Opened 8 years ago
Last modified 4 years ago
#17273 assigned defect
[patch][cla] dojo/dnd/Target containing multiple drop targets unable to drop.
Reported by: | haysmark | Owned by: | dylan |
---|---|---|---|
Priority: | undecided | Milestone: | 1.15 |
Component: | DnD | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
See the attached test case. Drag the TIE Fighter from the left to the right outer target. The cursor turns green. With the mouse still held down, drag to one of the inner targets. The cursor goes red.
But if you try to drag back to the outer target, the cursor STAYS red. It should turn green.
Attachments (1)
Change History (6)
Changed 8 years ago by
Attachment: | test_dnd2.html added |
---|
comment:1 Changed 8 years ago by
nested targets aren't supported. i am very painfully aware of this because i'm in the middle of a couple of weeks on a customer project writing customized Container, Select and Source modules from scratch to enable this (amongst other things). the code is heavily customized to the customer's needs so unfortunately i won't be contributing anything from it. i looked at the dijit/Tree dnd as inspiration because it allows you to drag tree nodes in a hierarchical fashion which is sort of what nested targets would be trying to achieve.
comment:2 Changed 8 years ago by
Should this be closed as a dup of #5859? There's a patch there too, although I haven't looked at it.
comment:3 Changed 8 years ago by
the patch on #5859 could be improved - there's really no need for a flag for nested targets and it just looks messy.
the logic that needs to be applied is described like this:
- when the mouse is over the nested source/target, a
mouseover
event will bubble from the inner source to the outer source. the inner source will first callmanager.overSource(this)
(settingmanager.target
to the inner source). then themouseover
event will reach the outer source at which point it should ignore it if the node associated withmanager.target
is a descendant node otherwise it can callmanager.overSource(this)
- when the mouse leaves a source, the source should call
manager.outSource(this);
to unsetmanager.target
. if the mouse was leaving the inner target, then it will now be over the outer target which will then cause amouseover
event to apply the logic in the previous bullet point - there will be nomanager.target
so then the outer source can register itself as the target viamanager.overSource(this)
if you're lucky, this is all the relevant code that needs to be changed in dojo/dnd/Source:
onOverEvent: function () { Source.superclass.onOverEvent.call(this); var manager = Manager.manager(), target = manager.target || {}, node = target.node; // we might be nested, which means a child container may have got this enter event first // and set itself. only tell the manager that the mouse is over us if the current // target is not a descendant of ours if (!(node && dom.isDescendant(node, this.node))) { manager.overSource(this); if (this.isDragging && this.targetState !== 'Disabled') { this.onDraggingOver(); } } },
i haven't tested it but i *think* that's all that's relevant to this - i have lots of other features so my code barely looks like dojo/dnd anymore and i only have to support "modern" browsers so maybe i've relied on something that won't work cross-browser.
comment:4 Changed 5 years ago by
Milestone: | tbd → 1.12 |
---|---|
Owner: | set to dylan |
Status: | new → assigned |
Summary: | dojo/dnd/Target containing multiple drop targets unable to drop. → [patch][cla] dojo/dnd/Target containing multiple drop targets unable to drop. |
comment:5 Changed 4 years ago by
Milestone: | 1.13 → 1.15 |
---|
Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.
Test case.