1

I have several list items with their parent ul delegated as the node for Dragdrop, this works fine by itself - it drags, it drops.

In the Droptarget, I have a DOM's worth of nodes which subscribe to mouseenter/leave events (I've yet to delegate that behaviour to a container, if its possible/effective). This also works fine, mousenter/leave events fire when I enter and leave each element.

The problem though, is when I am in the middle of a drag operation, and I drag over the Droptarget - which is the correct place for me to be aiming at. What I want is the mousenter/leave targets to continue to fire (because the element hovered over adds a border and background - so you can see what you're hovered over).

The result is the ability to drag a node over the Droptargets' nodes and have those nodes 'highlight' (with border as above) via mousenter/leave, and then I can drop.

So again, both work fine separately, but in unison the mousenter/leave events don't fire while I'm dragging. Does this have something to do with bubbling?

The above code is spread across a few intricate files at the mo', right in the middle of an application, but if the above is not understandable - let me know and I will paste some code.

thanks, d


MAJOR EDIT:

Ooook. I was waaay off the mark. I do in fact have this working correctly - almost exactly the way I want. The problem is... the nodes being hovered while dragging are somehow positioned from top-left of the parent document. In a nutshell, I'm dealing with a dom's worth of Nodes in an iframe, they're now all set as Drop targets for the Drag objects in the parent DOM. When dragging over the iframe, the iframe Drop targets seem to be positioned very strangely.

Here's an example page now, too: http://codefinger.co.nz/projects/fpx/mod/project/dd_test_1.html

It fairly clearly outlines what is going on - there's two sets of nodes to drop the drags onto - one set (left) in an iframe, the other set (right) in a div in the parent DOM. The stuff in the parent DOM works fine, naturally, the stuff in the iframe exhibits the bizarre positioning. To see the positioning weirdness - drag one of the 'widget' list items over ... the list of widget list items :P You'll see the iframe nodes highlight, and when you drop the widget - the iframe node's contents are set, as intended.

Bizarre.

So this question should now be:

What have I done wrong here, to get these Nodes in the iframe positioned thusly? Is it that the Nodes are somehow cloned into the parent DOM as a proxy, or something else?

danjah
  • 2,939
  • 2
  • 30
  • 47
  • Same problem... both with YUI and jQuery UI, seems like the drop coordinates are wrong interpreted by the engine. I don't know if there is a way to check and change the drop coordinates (area), to avoid this issue... I read somewhere other people having the same problem had to modify the library functions to work correctly... hope this could be avoided! – Jose Faeti Jul 25 '11 at 09:58
  • Yeah, I was thinking that maybe I'd have to alter the lib to apply offsets on DropTargets where their container is a child document... but that seemed so freakish and unnecessary. Thanks for your repsonse, it has given me at least a glimmer of hope :D – danjah Jul 25 '11 at 21:54
  • I asked the same thing and with the help of a guy I was able to find where to add the offset in jQuery UI library, and it seems to be able to solve the issue, now I would be able to find the same for the YUI3. Here it's the link meanwhile http://stackoverflow.com/questions/6817758/drag-and-drop-elements-into-an-iframe-droppable-area-has-wrong-coordinates-and-c/6819100#6819100 – Jose Faeti Jul 25 '11 at 22:02
  • Awesome research, thanks, I will have a play with YUI now and get back to you. – danjah Jul 25 '11 at 22:17
  • Well, I had a good ferret around Y3 - got as far as the DOM's intersect() method, then on to the node module, saw references to DOM, window, etc, and decided it was thoroughly complicated to tamper with. I've posted on the YUI forum in hopes that it gets picked up there... – danjah Jul 28 '11 at 02:46
  • Found your post, subscribed and bookmarked... have searched for open tickets for this issue but seems like there's none. Don't give it up! – Jose Faeti Jul 28 '11 at 09:13
  • I won't give up - in fact this is great opportunity for me to get under the hood with YUI, its been so awesome so far that as a mid-level JS developer I haven't needed to burrow much - just adapt and extend examples and leverage the core library features. – danjah Jul 28 '11 at 22:12
  • Has an accepted ticket now: http://yuilibrary.com/projects/yui3/ticket/2530590 – danjah Aug 03 '11 at 03:31

0 Answers0