Update scaling math to land on 100% consistently. #8043
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request updates the zooming functionality in the
CanvasStageModule
to improve user experience by refining the scale factor and introducing snapping to common zoom levels. The changes ensure smoother scaling and better precision when zooming in and out.Zooming Improvements:
SCALE_FACTOR
in theDEFAULT_CONFIG
from0.999
to0.9995
for finer zoom adjustments. (invokeai/frontend/web/src/features/controlLayers/konva/CanvasStageModule.ts
, invokeai/frontend/web/src/features/controlLayers/konva/CanvasStageModule.tsL34-R34)constrainScale
method to:1.0
(100%) with a tolerance of0.05
for a better user experience.0.25
,0.5
,0.75
,1.5
,2
, etc.) with a tolerance of0.03
. (invokeai/frontend/web/src/features/controlLayers/konva/CanvasStageModule.ts
, invokeai/frontend/web/src/features/controlLayers/konva/CanvasStageModule.tsL233-R250)Related Issues / Discussions
Some miscellaneous discord discussions.
QA Instructions
Scroll around on the canvas.
Merge Plan
Should be good to go on review.
Checklist
What's New
copy (if doing a release after this PR)