daybrush / moveable

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

Request draggable will not create elementGuidelines automatically #854

Open STO-2D opened 1 year ago

STO-2D commented 1 year ago

Environments

Description

I want to drag something into the scene and make the newly added "object" instantly draggable. Therefore I call the request method on draggable. Whenever I move my mouse I call the requester request function with the coordinates to move onto.

In the video you can see when i drag a container into the scene - no guidelines are available. When dragging a container which was already placed in the scene it works perfectly fine.

https://user-images.githubusercontent.com/71387364/220947862-574482be-e996-4968-bf3f-d5d53e66982b.mp4

daybrush commented 1 year ago

@STO-2D

Request is disabled with the Guideline function.

Perhaps the same example as you would be as follows:

AAA.addEventListener("mousedown", e => {

                         moveable.waitToChangeTarget().then(() => {
                             moveable. dragStart(inputEvent);
                         });
         // react
        setTarget(targets);
        // vanilla
         moveable. target = targets;
});

https://daybrush.com/moveable/storybook2/?path=/story/combination-with-other-components--use-selecto

STO-2D commented 1 year ago

@daybrush thanks MOVEABLE.dragStart(e); is working great. This is exactly what I expected. Awesome!

CarlMahnke1 commented 1 year ago

@STO-2D Can you give us a rough explanation how you implemented this panel with the available elements? As I can see, when you have a mouse down event on the container image, you create a new draggable element that goes directly into the "dragging" state and follows your mouse. But what exactly happens, when you move it into the main area? Thanks!