Skip to content

Add Space + drag canvas panning#875

Open
panudetjt wants to merge 2 commits intodrawdb-io:mainfrom
panudetjt:main
Open

Add Space + drag canvas panning#875
panudetjt wants to merge 2 commits intodrawdb-io:mainfrom
panudetjt:main

Conversation

@panudetjt
Copy link
Copy Markdown

Summary

Adds support for Space + drag canvas panning, a standard interaction pattern used in professional design tools (Figma, Miro,
Adobe products).

Changes

  • Added spacePressed state to track Space key
  • Added keydown/keyup event listeners to detect Space key with page scroll prevention
  • Modified handlePointerDown to initiate panning when Space is held during left-click
  • Updated cursor feedback: "grab" when Space is held, "grabbing" during active pan

Behavior

Action Result
Hold Space Cursor changes to "grab"
Space + left-click drag Canvas pans with "grabbing" cursor
Release mouse (Space still held) Cursor returns to "grab"
Release Space Cursor returns to "default"
Space + click on element Pans canvas (does not select element)

Compatibility

  • Existing middle-mouse panning still works
  • Normal left-click selection/dragging unchanged
  • Mouse wheel panning unchanged

Test plan

  • Hold Space key shows "grab" cursor
  • Space + left-click drag pans the canvas
  • Normal left-click still selects/drags elements
  • Middle-mouse button still works for panning
  • Space doesn't scroll the page when canvas is focused

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 20, 2026

@panudetjt is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

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