Search and Top Navigation
#4737 open feature ()
Opened August 01, 2009 03:51AM UTC
Last modified February 25, 2015 03:16PM UTC
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
Attachments (1)
Change History (7)
Changed August 01, 2009 04:11AM UTC by comment:1
Changed October 06, 2009 01:05PM UTC by comment:2
milestone: | TBD → 1.8 |
---|---|
summary: | $.ui.intersect - position of draggable object over droppable object → Make $.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.
Changed June 26, 2012 01:22AM UTC by comment:3
type: | enhancement → feature |
---|
Changed October 11, 2012 02:49PM UTC by comment:4
milestone: | 1.9.0 → 2.0.0 |
---|
Changed October 29, 2012 04:50AM UTC by comment:5
status: | new → open |
---|
Changed February 25, 2015 03:13PM UTC by comment:6
summary: | Make $.ui.intersect use a hash for each tolerance mode → Droppable: Expose hash for each tolerance mode |
---|
Changes in ui.droppable widget:
Changes in $.ui.ddmanager:
Demo - http://elsoft.tomsk.ru/jQuery/#intersect