Opened 10 years ago

Last modified 4 years ago

#4737 open feature

Droppable: Expose hash for each tolerance mode

Reported by: TitAn Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.droppable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

change: $.ui.intersect is object with methods for each tolerance mode:

$.ui.intersect = function(draggable, droppable, toleranceMode) {

	if (!droppable.offset) return false;

	var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
		y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
	var l = droppable.offset.left, r = l + droppable.proportions.width,
		t = droppable.offset.top, b = t + droppable.proportions.height;

	if ($.ui.intersect[toleranceMode]) {
		return $.ui.intersect[toleranceMode].call($.ui.intersect, draggable, droppable, x1, x2, y1, y2, l, r, t, b);
	} else return false;

};

$.extend($.ui.intersect, {

	fit : function(draggable, droppable, x1, x2, y1, y2, l, r, t, b) {
		return (l < x1 && x2 < r && t < y1 && y2 < b);
	},
......
}

You can add your tolerance mode:

$.extend($.ui.intersect, {
	yourToleranceModeFunction : function(draggable, droppable, x1, x2, y1, y2, l, r, t, b) {
		state = true;// or false or 'state'. if return string $.ui.ddmanager triggered event for that state: over+'state' and out+'state'
		return state;
	}
}

Changes in ui.droppable widget:

  • overState property is added instead of private properties isover and isout
  • _over and _out methods for generation of overstate events are changed
  • _changeOverState method is added
  • overState property added to ui object for possibility to check up an draggable object overstate on drop event

Changes in $.ui.ddmanager:

  • reset overState for droppable objects in drop method
  • inspect overState changes in drag method

http://elsoft.tomsk.ru/jQuery/#intersect

Attachments (1)

ui.droppable.js (12.4 KB) - added by TitAn 10 years ago.

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by TitAn

Attachment: ui.droppable.js added

comment:1 Changed 10 years ago by TitAn

Changes in ui.droppable widget:

  • overState property is added instead of private properties isover and isout
  • _over and _out methods for generation of overstate events are changed
  • _changeOverState method is added
  • overState property added to ui object for possibility to check up an draggable object overstate on drop event

Changes in $.ui.ddmanager:

  • reset overState for droppable objects in drop method
  • inspect overState changes in drag method

Demo - http://elsoft.tomsk.ru/jQuery/#intersect

comment:2 Changed 10 years ago by Scott González

Milestone: TBD1.8
Summary: $.ui.intersect - position of draggable object over droppable objectMake $.ui.intersect use a hash for each tolerance mode

This should be done in stages. We should first clean up the internal logic of droppable, then define the tolerance modes in a hash. Once that is done, we can consider the other changes proposed in this ticket.

comment:3 Changed 7 years ago by Scott González

Type: enhancementfeature

comment:4 Changed 7 years ago by Scott González

Milestone: 1.9.02.0.0

comment:5 Changed 6 years ago by mikesherov

Status: newopen

comment:6 Changed 4 years ago by Scott González

Summary: Make $.ui.intersect use a hash for each tolerance modeDroppable: Expose hash for each tolerance mode

comment:7 Changed 4 years ago by Scott González

#11226 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.