I am trying to create a drag and drop program but running into some odd
behavior. I created an object that allows itself to be moved to another
location via drag & drop. What I am seeing is that when I try and set the
new location of the object via setTop and setLeft, it is setting it as a
relative position to it's original position, not relative to the upper left
of the object it's being dropped on. If the object started out at 0,0 then
there is no issue moving it around, it goes where I want it to. But if the
object started out at 50,100 and I try to move it to location 10,10 on the
page via setTop(10), setLeft(10), it moves to location 60, 110.
Does anyone have any idea why this is so? The code I am using to move the
object is below. Perhaps there is another/better way to do it that I have
not found?

function handleDragEnd(e)
{
 var newY = e.getMouseEvent().getClientY();
 var newX = e.getMouseEvent().getClientX();
 d.info("X:" + newX + "  Y:" + newY); // this is how I know I am trying to
move it to the correct location
 e.getRelatedTarget().setLeft(newX);
 e.getRelatedTarget().setTop(newY);
};

Thanks,
Jim
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to