Skip to content

Implement Ability To Drag Selection Actions Bar#414

Open
PauloMFJ wants to merge 3 commits into
datacommonsorg:mainfrom
madebypxlp:paulo/ability-to-drag-selection
Open

Implement Ability To Drag Selection Actions Bar#414
PauloMFJ wants to merge 3 commits into
datacommonsorg:mainfrom
madebypxlp:paulo/ability-to-drag-selection

Conversation

@PauloMFJ

@PauloMFJ PauloMFJ commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Overview

  • Enable dragging the whole multi-selection by pressing its blue actions bar, mirroring how a single card's actions bar drags the card.
  • Extract the shared drag mechanics (pointer capture, screen→page delta, updateShapes, history markers) into a reusable useShapeDragHandle hook, and reduce useCardDragHandle to a thin wrapper over it so the two paths no longer duplicate logic.
  • Move Selection into its own selection/ folder and split it into useSelectionPosition (presence + box placement) and useSelectionDragHandle hooks, matching the card base's hook-per-concern structure.
  • Updated use of cursor: grabbing to use cursor: all-scroll to closer match tldraw behaviour.

Ticket

image

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the drag-handling logic by extracting the core dragging functionality into a reusable useShapeDragHandle hook, which is now utilized by both card and multi-selection drag handles. Additionally, selection positioning logic has been separated into its own hook. The review feedback highlights a TypeScript compilation issue under strict null checks when filtering shapes, recommending flatMap as a type-safe alternative. It also suggests using optional chaining for pointer capture methods to prevent potential runtime errors in testing environments like jsdom.

Comment thread dataweaver/apps/web/src/hooks/use_shape_drag_handle.ts Outdated
Comment thread dataweaver/apps/web/src/hooks/use_shape_drag_handle.ts
Comment thread dataweaver/apps/web/src/hooks/use_shape_drag_handle.ts
@PauloMFJ PauloMFJ self-assigned this Jul 21, 2026

@beets beets left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice changes!

I've noticed that drag doesn't update the z-index of the card which seems counterintuitive to me. Here's an example (it also appears with a single card drag). Something we can discuss separately and doesn't block this PR.

Image

@beets

beets commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

/cc @miss-o-soup for your thoughts on the z-index issue above.

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