1

I am doing a drag and drop function in javascript.
I already have the drag and drop working, but I have a question about the cursor's position. When I click on the object, instead of staying in the center of the object, the cursor automatically flies to the left corner of the object. I can still drag it, but I'm dragging it from the corner, not the middle.

The thing is, I don't know how to use Jquery, I'm learning basic javascript. I've tried googling, but things are all for more advanced projects.

This is how I am doing the drag and drop:

    thing.on("pressmove", function (evt) {
            console.log("mouse down");
            evt.currentTarget.x = evt.stageX;
            evt.currentTarget.y = evt.stageY;
                stage.update();
        });

    thing.on("pressup", function (evt) {
            console.log("mouse up");
        }); 

Thank you for your time.

  • I think is not possible in javascript as described here: http://stackoverflow.com/questions/13320727/jquery-set-mouse-position-inside-a-div-graphic-area – jhyap Jun 09 '14 at 05:07

0 Answers0