PDA

View Full Version : Draggable, region & offset issue



Powderhound
1 Aug 2011, 11:32 AM
I have Panel with a Draggable and a Droppable Object placed in it. When I first move the Draggable, I successfully get a dropenter event from the Droppable when the Draggable intersects.

However, if I move the Draggable to a place on the Panel, and let go of the mouse button, any subsequent intersections do not occur in the correct location. They are offset by a vector representing the movement of the Draggable from it's initial position to where it was first moved.

In reading through the source code, it appears that Draggable.region and Droppable.region are used in determining when to fire the dropenter event. I have tracked Draggable.region.top and Draggable.region.left as the Draggable is moved. They appear fine while the Draggable is first being moved and when it is first relocated in the Panel. However, when the the Draggable is moved again, it's region.left and region.top values appear to be added to the Draggable.offset.x and Draggable.offest.y values as they were before the Draggable was moved for the second time. This makes the Draggable's intersection region offset in relation to the Droppable's, and explains why the intersection occurs in the wrong place.

My question is why are the offset values being added to the region values?

Powderhound
1 Aug 2011, 1:00 PM
OK, I'm thinking this is actually a bug.

If I take the dragdrop example code, and change revert to false for the Draggable, I get exactly the same behavior. Once the Draggable is relocated, it no longer intersects with the Droppable at the same location. Exactly the same issue is happening - the offset is getting added to the region co-ordinates.

Can anyone explain this?

Thanks

bk.dbe
19 Sep 2011, 6:54 AM
Hello Powderhound,

Is this bug related to this other one you had reported ? : http://www.sencha.com/forum/showthread.php?142369-Draggable-revert-false-prevents-intersections-working&p=650393

I (http://www.sencha.com/forum/showthread.php?142369-Draggable-revert-false-prevents-intersections-working&p=650393) re-bumped it, your fix works well. Thanks for this ! Hope Sencha Team will fix it too.

Powderhound
20 Sep 2011, 9:29 AM
Yes, it is. Thanks for the bump. Unfortunately Sencha doesn't seem to be listening to most of the bug reports, which is very frustrating...