I have several draggable container canvas elements, each contains a content element as a child. Both container and content child implement a drop handler (see example below). I'm not using dragReposition, as the application implements various custom logic during D'n'd.
The expected behavior is that the drop events are received on both child and parent (bubbled from the child).
However, the EventHandler.getDropTarget method produces following unwanted behavior:
1) moving the container element to another position (without dropping it on another element) produces drop events on both container and content element. As we move as target, the canDropOnSelf variable inside getDropTarget is initialized correctly, but evaluates only the dragged container element, not its children.
2) dragging t1 over t2 produces only drop events on t1 and c1. Dragging t2 over t1 produces correctly drop events on t1 and c1. The creation order of the elements (which is reflected in the list EH._dropRegistry) is causing this inconsistent behavior, as the order is significant to the algorithm who picks possible matching drop targets
This behavior has been tested against SmartClient LGPL 8.3d and 8.2p from 2012-10-30.
The expected behavior is that the drop events are received on both child and parent (bubbled from the child).
However, the EventHandler.getDropTarget method produces following unwanted behavior:
1) moving the container element to another position (without dropping it on another element) produces drop events on both container and content element. As we move as target, the canDropOnSelf variable inside getDropTarget is initialized correctly, but evaluates only the dragged container element, not its children.
2) dragging t1 over t2 produces only drop events on t1 and c1. Dragging t2 over t1 produces correctly drop events on t1 and c1. The creation order of the elements (which is reflected in the list EH._dropRegistry) is causing this inconsistent behavior, as the order is significant to the algorithm who picks possible matching drop targets
Code:
isc.defineClass("DragContainer", "Canvas").addProperties({ width:48, height:48, canDrag: true, canDrop: true, canAcceptDrop: true, dragAppearance: "target", drop: function() { console.log("drop " + this.getID()); } }); isc.defineClass("DragContent", "Label").addProperties({ width:48, height:48, backgroundColor: "#eecccc", canAcceptDrop: true, drop: function() { console.log("drop " + this.contents); } }); isc.DragContainer.create({ ID: "c1", left: 100, children: [ isc.DragContent.create({ contents: "t1" }) ] }); isc.DragContainer.create({ ID: "c2", left: 200, children: [ isc.DragContent.create({ contents: "t2" }) ] });
This behavior has been tested against SmartClient LGPL 8.3d and 8.2p from 2012-10-30.
Comment