moveable icon indicating copy to clipboard operation
moveable copied to clipboard

Add element to group when pointer down and drag at the same time

Open ccpu opened this issue 2 years ago • 0 comments

Environments

  • Framework name: react-moveable
  • Framework version: 3.2.1
  • Moveable Component version: 3.2.1
  • Testable Address(optional): codesandbox

Description

In Figma, when you hold down the Shift key, you can add an element to a group and drag it simultaneously:

figma

I'm attempting to replicate this functionality using Moveable.js, but I've encountered an issue. The dragStart event doesn't start drag when a new element is selected and added to a group. You can see the problem in this example on CodeSandbox (No need to press Shift, just click on another element, and drag):

codesandbox

I've discovered that one potential solution is to unmount the Moveable component and then recreate it. However, this approach may cause problems with touch devices.

I'm wondering if there's a way to add an element to a group when the pointer is down and drag it at the same time without the need to recreate the Moveable component.

ccpu avatar Nov 04 '23 17:11 ccpu