Skip to content

feat(ui): canvas stage, zoom, and fit improvements #8085

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

Merged
merged 7 commits into from
Jun 6, 2025

Conversation

psychedelicious
Copy link
Collaborator

Summary

  • Fix issue where creating a new canvas from an image using one of the pictured buttons can result in the new layer being offset from the bbox, if the bbox had previously been moved.

image

  • Fix issue where canvas isn't always centered and zoomed correctly when creating new canvas from an image
  • Add a spinner that renders when the canvas is busy rasterizing, compositing (the pause between clicking Invoke and the graph getting queued) or calculating the bbox rect. Just a subtle hint that "we are doing something right now, don't be alarmed that nothing is happening"
  • Add quick animation when fitting canvas view to make it less jarring

Related Issues / Discussions

Reported somewhere in discord. I think the two issues have existed for a long time and are not new.

QA Instructions

Demo of new behaviours:

Screen.Recording.2025-06-06.at.2.01.06.pm.mov

Note:

  • Spinner in bottom right corner while we are calculating the bbox (same spinner shows during other operatiosn as described above)
  • Things are centered and zoomed correctly when creating new layer
  • Tweened position and scale when fitting

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

This ensures that _both_ bbox and layers are visible
…r to stage when creating new canvas from an image

When a layer is initialized, we do not yet know its bbox, so we cannot fit the stage view to the layer. We have to wait for the bbox calculation to finish. Previously, we had no way to wait unti lthat bbox calculation was complete to take an action.

For example, this means we could not fit the layers to the stage immediately after creating a new layer, bc we don't know the dimensions of the layer yet.

This callback lets us do that. When creating a new canvas from an image, we now...
- Register a bbox update callback to fit the layers to stage
- Layer is created
- Canvas initializes the layer's entity adapter module (layer's width and height are set to zero at this point)
- Canvas calculates the bbox
- Bbox is updated (width and height are now correct)
- Callback is ran, fitting layer to stage
@github-actions github-actions bot added the frontend PRs that change frontend files label Jun 6, 2025
@psychedelicious psychedelicious merged commit 31584da into main Jun 6, 2025
12 checks passed
@psychedelicious psychedelicious deleted the psyche/fix/ui/new-canvas-placement branch June 6, 2025 10:50
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