jaswantdetec / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

Dragging over an inner target of (dom) nested drop targets does not generate any events #275

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create 2 drop targets, one of which will be inside the other in the dom
2. drag an item into the outer target and then into the inner target
3. there is no dragover event dispatched upon this action so the user has no 
way of detecting that we are within the inner target.

What is the expected output? What do you see instead?

* I would expect the active target to be the inner most possible target, if 
targets are nested
* I would expect the dragover/dragout event to fire when entering and leaving a 
target that is nested within another
* There may be some use for bubbling behaviour as well (to allow actions 
triggered on both the inner and outer targets when nested).

What version of the product are you using? On what operating system?

latest sources from approximately 1st Feb 2011
the existing code and behaviour is not browser/os specific

Please provide any additional information below.

I have made changes to fx/abstractdragdrop.js to implement the first two points 
above. The changes involve:

goog.fx.AbstractDragDrop.prototype.getTargetFromPosition: instead of returning 
the first target in this.targetList, it keeps track of the best (innermost) 
target and returns that. This locks the complexity at best/average/worst case 
O(n) compared to original average case O(n/2)

goog.fx.AbstractDragDrop.prototype.moveDrag_: originally assumes that if you 
are still in the bounds of the active object and havent moved to a different 
subtarget, nothing needs to be done. Now it also checks whether the result of 
getTargetFromPosition has changed. This is expensive because moveTrag_ is run 
every time the mouse is moved.

I havent implemented anything for bubbling or allowing events on both inner and 
outer targets.

If anyone is interested I'll generate a patch and submit it - though i've never 
done that before so any guidelines would be appreciated.

Original issue reported on code.google.com by thechee...@gmail.com on 5 Feb 2011 at 6:03

GoogleCodeExporter commented 8 years ago
It seems I didnt set the title propely - it should read:

Dragging over an inner target of (dom) nested drop targets does not generate 
any events.

Original comment by thechee...@gmail.com on 5 Feb 2011 at 6:09

GoogleCodeExporter commented 8 years ago

Original comment by pall...@google.com on 23 Feb 2011 at 1:11

GoogleCodeExporter commented 8 years ago
cc eae - thoughts?

Original comment by nn...@google.com on 27 Apr 2012 at 10:49