Skip to content

fix(editor): preserve canvas position on zoom reset - #537

Open
MelmacAlpha wants to merge 2 commits into
CoreBunch:mainfrom
MelmacAlpha:fix/canvas-zoom-preserve-position
Open

MelmacAlpha wants to merge 2 commits into
CoreBunch:mainfrom
MelmacAlpha:fix/canvas-zoom-preserve-position

Conversation

@MelmacAlpha

@MelmacAlpha MelmacAlpha commented Sep 16, 2026 •

Copy link
Copy Markdown

Summary

Keeps the canvas work area in place when resetting the editor zoom to 100% with Cmd/Ctrl+0 or the toolbar percentage control.

  • Replaces the old reset behavior that set the canvas pan to (0, 0).
  • Uses the visible canvas center as the zoom origin, preserving the content under the current work area.
  • Routes the toolbar reset through the canvas hook, so it uses the live transform and cancels a pending debounced gesture commit.
  • Applies the same behavior to the keyboard shortcuts and toolbar control.
  • Adds focused regression coverage for keyboard and toolbar resets and updates the editor documentation.

Verification

  • bun run build — passes.
  • bun test — 7,039 passed, 14 failed; the failures are unrelated environment issues in server-artifact path isolation and collab relay port allocation.
  • bun run lint — passes.
  • Focused regression tests:
    bun test src/__tests__/canvas/canvasSlice.test.ts src/__tests__/canvas/canvasMath.test.ts src/__tests__/canvas/useCanvasWheelSync.test.tsx src/__tests__/toolbar/toolbar.test.ts
  • TypeScript project check: bun node_modules/typescript/bin/tsc -b --pretty false

Checklist

  • Tests cover behavior changes.
  • Docs were updated when behavior changed.
  • No compatibility shim was added for old pre-release behavior.
  • No secrets, local databases, uploads, or generated artifacts are included.

Assisted-by: OpenAI Codex

@MelmacAlpha
MelmacAlpha force-pushed the fix/canvas-zoom-preserve-position branch from 2dfcbc3 to 46f7442 Compare September 16, 2026 16:48
@MelmacAlpha MelmacAlpha changed the title fix(editor): preserve canvas position on zoom reset fix(editor): preserve canvas position on zoom reset with Cmd+0/Ctrl+0 Sep 16, 2026
@MelmacAlpha MelmacAlpha changed the title fix(editor): preserve canvas position on zoom reset with Cmd+0/Ctrl+0 fix(editor): preserve canvas position on zoom reset Sep 16, 2026
@MelmacAlpha
MelmacAlpha marked this pull request as ready for review September 16, 2026 17:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46f7442cdf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/admin/pages/site/toolbar/ZoomControls.tsx Outdated
@MelmacAlpha
MelmacAlpha marked this pull request as draft September 17, 2026 21:17
@MelmacAlpha
MelmacAlpha marked this pull request as ready for review September 18, 2026 10:24

This branch has not been deployed

No deployments
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