Skip to content

Fix zoom jump by anchoring magnification to viewport center#84

Merged
vade merged 1 commit intoFabric-Project:mainfrom
JustinMeans:fix/zoom-jump
Nov 16, 2025
Merged

Fix zoom jump by anchoring magnification to viewport center#84
vade merged 1 commit intoFabric-Project:mainfrom
JustinMeans:fix/zoom-jump

Conversation

@JustinMeans
Copy link
Copy Markdown
Contributor

@JustinMeans JustinMeans commented Nov 16, 2025

Addresses feedback from #83 regarding zoom stutter caused by @Environment observation cascades.

Changes:

  • Calculates zoom anchor from current scroll position instead of gesture location to eliminate jumps between magnification gestures

Result: Smooth zoom to viewport center wherever scrolled, no jump on gesture initiation/termination.

Screen.Recording.2025-11-15.at.10.14.32.PM.mov

Related: #83, #66

@JustinMeans JustinMeans force-pushed the fix/zoom-jump branch 2 times, most recently from 2b6a9f4 to 72f0f46 Compare November 16, 2025 05:24
Addresses feedback from Fabric-Project#83 regarding zoom stutter caused by @Environment
observation cascades. Marks Graph drag preview properties as @ObservationIgnored
to prevent view recalculation during gestures. Calculates zoom anchor from
current scroll position instead of gesture location to eliminate jumps between
magnification gestures.

Related: Fabric-Project#83, Fabric-Project#66
@vade
Copy link
Copy Markdown
Contributor

vade commented Nov 16, 2025

Thanks! Post merge of the last PR I caught the old deprecated magnify gesture - I was working on similar changes but you beat me to it :)

At a glance this looks good. Will review later tonight! Again thank you!

@vade
Copy link
Copy Markdown
Contributor

vade commented Nov 16, 2025

So this method seems to cause Modifying state during view update, this will cause undefined behavior. due to view change callbacks in onScrollGeometryChange updating state in the view itself

Also this PR introduces visual glitches when scrolling with certain zoom levels, likely due to incoherent values due to state updates during view callbacks.

ill poke around, because overall the zoom anchor behaviour def feels right, but the overall resulting behaviour could use some work.

Thank you again for the PRs!

@vade vade merged commit 479c769 into Fabric-Project:main Nov 16, 2025
@vade
Copy link
Copy Markdown
Contributor

vade commented Nov 16, 2025

Did a smidge of cleanup on my own branch of this - Thanks again, these PRs are awesome! Keep em coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants