Bug Tracker

Modify

Ticket #2057 (closed enhancement: fixed)

Opened 5 years ago

Last modified 14 months ago

Droppable tolerance for draggable that completely overlaps

Reported by: indirect Owned by: rworth
Priority: major Milestone: 1.2.2
Component: ui Version: 1.2.1
Keywords: Cc: website@…
Blocking: Blocked by:

Description

When a draggable item completely overlaps a droppable item, there is no tolerance that will register the draggable as "over". By adding a droppable tolerance, it is possible to make this happen.

For an example of why I would want this, see  http://arko.net/files/jquery_overlap/. The pieces should only be able to be dropped when they are on top of one of the marked hexes.

Here is the case which I added to the switch (toleranceMode) case statement:

case 'overlap':
	dao = $(oDrag.helper).offset();
	dpo = oDrop.offset;
	return ( dao.top == dpo.top && dao.left == dpo.left );

I have attached the case statement as a patch against ui.droppable.js, but since I am a jQuery newbie, there's probably a better way to do it. Thanks!

Attachments

overlap.diff Download (540 bytes) - added by indirect 5 years ago.

Change History

Changed 5 years ago by indirect

comment:1 Changed 5 years ago by rworth

  • Owner set to rworth
  • Status changed from new to assigned

comment:2 Changed 5 years ago by paul

  • Status changed from assigned to closed
  • Resolution set to fixed

check out the tolerance "fit": this should be exactly what you need!

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.