Skip to content

feat(paint-editor): allow zoom while drawing - #857

Open
saif-ellafi wants to merge 4 commits into
hm21:stablefrom
saif-ellafi:draw-with-pan
Open

feat(paint-editor): allow zoom while drawing#857
saif-ellafi wants to merge 4 commits into
hm21:stablefrom
saif-ellafi:draw-with-pan

Conversation

@saif-ellafi

Copy link
Copy Markdown
Contributor

Description

Hello,

This PR is to allow navigating the paint editor while a drawing tool is active. This has been AI-assisted, but I tested myself.

Pinch, trackpad, and mouse-wheel still move the view; primary click-drag still draws. Secondary and middle mouse buttons pan, matching the main editor. An in-progress stroke is discarded if the view moves so path coordinates stay in one transform space.

Disable with PaintEditorConfigs.enableZoomWhileDrawing: false (also restores every mouse button drawing).

By default, the library behaves like it was before this PR. Flag needs to be set to true to benefit from this.

Implementation:

  • Drawing already used a Listener on the canvas (that was upstream, for stylus latency). We only skip secondary/middle there when zoom-while-drawing is on.
  • Right/middle pan is a Listener on the viewer (onPointerDown / Move / Up), because GestureDetector pan is tied to left-drag (panEnabled).
  • Pinch, trackpad, wheel still go through the viewer’s existing GestureDetector / pointer-signal path, with scale enabled independently of pan.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

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