Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix,feat: canvas followups 11 #6878

Merged
merged 13 commits into from
Sep 18, 2024
Merged

Conversation

psychedelicious
Copy link
Collaborator

Summary

  • Fix: Hide the scaled bbox from HUD when scaling is disabled
  • Fix: Tiny artifacts related to scaling in canvas (does not affect generation, but its ugly)
  • Fix: Duplicate alt+a hotkey
  • Fix: Disallow creating new layers while staging
  • Fix: Handle deleting control layers when deleting image
  • Fix: Delete hotkey not working as expected
  • Feat: Only show raster layers while staging (configurable in settings)
  • Feat: Updated hotkey list & internal hotkey usage (see commit for details)
  • Internal: Use zod schema to model canvas state, so that if we load full state from an external source we can be confident it is in the right format

Related Issues / Discussions

Discord & offline discussion

QA Instructions

Review the hotkeys descriptions.

Merge Plan

Due for an alpha

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

@github-actions github-actions bot added the frontend PRs that change frontend files label Sep 18, 2024
This is expose as a setting int he settings popover. On by default for distraction-free staging.
This was caused by allowing the stage to be set to fractional coordinates. For example, the stage might be positioned at `x: 142.22255, y: 488.79`.

When positioned like this, the canvas will be slightly misaligned with its native pixel grid. The browser does its best, but this causes tiny scaling artifacts throughout the image. It's most noticeable where there is a sharp contrast.

This behaviour was introduced while troubleshooting an issue with degraded quality when saving canvas to gallery. Turned out the stage position was unrelated to that issue, but I didn't realize that the change would cause this other type of problem.

The fix is super simple - ensure we floor stage coords when setting the manually. Konva never sets the position to fractional coordinates itself. For example, while dragging the stage, Konva sets the stage coordiantes itself, and they are always integers.
By modeling canvas state as a zod schema vs a Typescript type, we get a runtime validator that can be used for metadata recall.
Had to shuffle around the canvas right panel tabs state.
- Rework hotkey data to include the keys for each hotkey action.
- Add wrapper for `useHotkeys` that accepts a hotkey category and id. Automatically selects the key from the hotkey data.
- Add handling for macOS (cmd vs ctrl, option vs alt).
- Redo all hotkey descriptions, deleting nonexistant ones.
- Some `esc` hotkeys that just close whatever you are currently in are omitted due to their relative simplicity and intuitiveness.
@hipsterusername hipsterusername enabled auto-merge (rebase) September 18, 2024 18:06
@hipsterusername hipsterusername merged commit 91d77b5 into main Sep 18, 2024
14 checks passed
@hipsterusername hipsterusername deleted the psyche/canvas-followups-11 branch September 18, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants