[ 3 posts ]

Christopher Bargren

  • Username: chrisb
  • Joined: Fri Mar 11, 2011 11:31 am
  • Posts: 13
  • Offline
  • Profile

Drag and Drop Bleed Through

Post Posted: Tue Oct 04, 2011 12:38 pm
+0-
Hey all. I'm having a small problem with Drag and Drop that I'm hoping there is a simple solution for. I have multiple containers on a certain page that each contain drop nodes. The drop nodes overflow outside of the visible area of the containers and some of them may overflow under another drop node container. The problem that I'm having is that when I'm dragging a node over a drop target, any drop targets that are invisible on the screen (hidden because they are outside of the visible area of its container) are still acting as usable drop targets. Here is a fiddle demonstrating the problem I'm having. Try dragging a drag node from container3 over a drop target in container2 and you'll notice that even though your pointer isn't over container 1, it's still firing enter events from items inside it. Any pointers would be appreciated. Thanks!

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Drag and Drop Bleed Through

Post Posted: Tue Oct 04, 2011 12:55 pm
+0-
DragDrop doesn't have a real way of knowing if the item is visible or not. You are going to have to determine those rules from inside your `drop:over` event. In your case, you would check the top,bottom,left and right (along with scrollbars) of the parent and see if the drop is outside of that region, then determine if you are to exit that operation or not.

Christopher Bargren

  • Username: chrisb
  • Joined: Fri Mar 11, 2011 11:31 am
  • Posts: 13
  • Offline
  • Profile
Tags:

Re: Drag and Drop Bleed Through

Post Posted: Thu Oct 06, 2011 9:01 am
+0-
Hey Dav, thanks for your response. I've implemented what you said but I'm still not quite getting the desired behavior. I'm still having an issue with the drop targets picking up a drop:hit that's desired if an undesired drop:hit is picked up (and prevented) first. See my updated fiddle here. Notice that if you drop on a target that is over another target, it will only pick up the drop on the underneath target. I know that it is related to when the drop targets are plugged in (so if you reverse the order that you create the targets, you'll have the issue the other way), but is there a way to handle it without changing the order in which the drops are plugged in? Thanks!
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum