daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
10.08k stars 618 forks source link

`moveable.dragStart(event)` is not working with `individualGroupable: true` #967

Closed ivadenis closed 1 year ago

ivadenis commented 1 year ago

Environments

"dependencies": {
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-moveable": "0.52.1",
}

Description

I'm trying to make item drag on mouseDown event. When individualGroupable: true, moveable.dragStart() is not working. Toggle it off, and everything works.

const onMouseDown = (e) => {
    const moveable = moveableRef.current;
    const { nativeEvent } = e;
    moveable.waitToChangeTargets().then(() => {
      moveable.dragStart(nativeEvent);
    });

    setTarget(nativeEvent.target);
  };

See: https://codesandbox.io/p/sandbox/serene-fire-zynp6k?file=%2Fsrc%2FApp.js%3A77%2C3-85%2C5

daybrush commented 1 year ago

@ivadenis

moveable's new version is released. Check it again.

ivadenis commented 1 year ago

@daybrush it works! thanks!

UreMySunshine commented 5 months ago

it happends again in react18,sad