Skip to content

Fix touch dragging by deferring re-renders until drag completion#16

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-dragging-issues-on-canvas
Draft

Fix touch dragging by deferring re-renders until drag completion#16
Copilot wants to merge 3 commits intomainfrom
copilot/fix-dragging-issues-on-canvas

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Touch-based element dragging was broken because each position update triggered a full canvas re-render, destroying and recreating DOM nodes mid-drag. This severed the touch event chain since touches are bound to specific DOM instances.

Changes

State management

  • Added updateElementSilent() to update state without triggering notifications
  • Modified selectElement() to skip notification when selection unchanged

Drag handling

  • handleMouseMove() and handleTouchMove() now use silent updates during drag
  • Manual DOM style updates via new helpers for immediate visual feedback
  • Single notify() call in handleMouseUp()/handleTouchEnd() after drag completes

Code structure

  • Extracted getElementDomNode(), updateElementPosition(), updateElementStyles() to eliminate duplication across mouse/touch handlers
// During drag: update state silently, update DOM manually
this.state.updateElementSilent(elementId, { x: newX, y: newY });
this.updateElementPosition(elementId, newX, newY);

// After drag: trigger single re-render
this.state.notify();

CSS

  • Added touch-action: auto to property panel inputs for proper touch scrolling
  • Added touch-action: none to canvas elements for custom drag handling

Screenshots

Before: Elements couldn't be dragged with touch
After: Smooth touch-based dragging on mobile viewport

Mobile viewport with draggable button element

Element successfully dragged to new position


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 17, 2026 06:54
Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix dragging elements on canvas for mobile touch events Fix touch dragging by deferring re-renders until drag completion Feb 17, 2026
Copilot AI requested a review from A1L13N February 17, 2026 07:02
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