Skip to content

Keep the canvas anchored beneath the pointer when zooming - #250

Open
stevebauman wants to merge 1 commit into
masterfrom
fix/canvas-zoom-anchor
Open

stevebauman wants to merge 1 commit into
masterfrom
fix/canvas-zoom-anchor

Conversation

@stevebauman

Copy link
Copy Markdown
Owner

Pinching over the canvas could still move the content away from your mouse. The zoom library measures the focal point from the surrounding area, but our canvas wrapper was a smaller element centered inside that area, which offset its calculations.

I've made the zoom wrapper fill the preview area while keeping the canvas centered at its configured size. The point beneath your mouse now stays in place as you zoom, including after panning and at the zoom limits.

Verified in Chromium with small and oversized canvases: the original layout drifted roughly 49px horizontally and 71px vertically from one pinch; the updated layout stayed within 0.001px across 12 zooms. All 160 tests pass.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying showcode with  Cloudflare Pages  Cloudflare Pages

Latest commit: d7945af
Status:🚫  Build failed.

View logs

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.

1 participant