Skip to main content

Search and Top Navigation

#3831 closed feature (duplicate)

Opened January 15, 2009 10:55AM UTC

Closed October 12, 2010 02:54AM UTC

Add new tolerance options for small droppables

Reported by: kquinn Owned by: paul
Priority: trivial Milestone: 1.9.0
Component: ui.droppable Version: 1.6rc4
Keywords: Cc:
Blocked by: Blocking:
Description

The current tolerance options for droppables seem to assume the droppable is smaller than the draggable, and aren't very useful if the draggable is larger. I propose two additional tolerance options: 'enclose', which triggers if the droppable is fully inside the draggable, and 'overlap', which triggers if the draggable overlaps the center of the droppable. I have found 'overlap' in particular to be very useful for my application.

Sample implementations are provided below. They are simple enough that I do not claim any copyright over them. They can be inserted into the case statement in $.ui.intersect that begins "switch (toleranceMode) {":

		case 'enclose':		//test if draggable completely encloses droppable
			return (x1 <= l && x2 >= r &&
				y1 <= t && y2 >= b);
			break;
		case 'overlap':		//test if draggable overlaps center of droppable
			return (x2 > l + (droppable.proportions.width / 2)	
				&& x1 < l + (droppable.proportions.width / 2)	
				&& y1 < t + (droppable.proportions.height / 2)	
				&& y2 > t + (droppable.proportions.height / 2));	
			break;

I would like to see these or similar options added to future UI releases.

Attachments (0)
Change History (3)

Changed May 07, 2009 12:43PM UTC by jzaefferer comment:1

milestone: TBD1.8

Looks very useful to me, just needs some testing.

Changed May 27, 2009 09:49AM UTC by Cloudream comment:2

owner: → paul
status: newassigned

Changed October 12, 2010 02:54AM UTC by scottgonzalez comment:3

resolution: → duplicate
status: assignedclosed

Closing as duplicate of #4737 since that will allow you to implement any intersection mode you want.