Bug Tracker

Opened 11 years ago

Closed 11 years ago

#3121 closed enhancement (invalid)

Need an option for an "exclusive" draggable

Reported by: jeffkretz Owned by: stefan
Priority: critical Milestone: 1.3
Component: interface Version: 1.2.6
Keywords: draggable Cc:
Blocked by: Blocking:

Description

I'm building a page manager for a CMS using 1.2.6 and the latest UI draggable/droppable.

I have a problem whereby the draggable element sometimes overlaps two drop zones at the same time, thus firing the drop event twice.

My thought was to have a property on the draggable called "exclusive". If the draggable was found to be validly over one drop zone, then it would return false for intersecting any other drop zones.

I've spent the last day trying modifications to the droppable script so I could propose a complete solution but as yet I haven't been able to come up with anything workable.

Any help on this would be greatly appreciated.

JK

Attachments (1)

ui.droppable.js.patch (2.5 KB) - added by jeffkretz 11 years ago.
Possible patch for "exclusive" draggable.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by jeffkretz

Attachment: ui.droppable.js.patch added

Possible patch for "exclusive" draggable.

comment:1 Changed 11 years ago by jeffkretz

I just found a possible solution. When the draggable fires the "over" event, record which draggable it is over in the draggable.options.isover property (and remove it on the "out" event).

When testing for intersection both for the drag and the drop event, check to see if it is a non-exclusive, the isover is null, or if the isover matches the current droppable. Otherwise return false for intersection.

I've uploaded a patch for review.

JK

comment:2 Changed 11 years ago by jeffkretz

For what it's worth, this problem is only with the "touch" tolerance. Exclusivity is already built into the pointer and intersection tolerances.

I'd still like to solve the problem for exclusive on the "touch" tolerance, but perhaps this isn't the best way to do it.

What do you think?

JK

comment:3 Changed 11 years ago by flesler

Resolution: invalid
Status: newclosed

This belongs to jQuery UI. Please repost this to the UI Bug Tracker. Thanks.

Note: See TracTickets for help on using tickets.