Opened 14 years ago
Last modified 8 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
Attachments (1)
Change History (8)
Changed 14 years ago by
Attachment: | ui.droppable.js added |
---|
comment:1 Changed 14 years ago by
comment:2 Changed 13 years ago by
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.
comment:3 Changed 11 years ago by
Type: | enhancement → feature |
---|
comment:4 Changed 10 years ago by
Milestone: | 1.9.0 → 2.0.0 |
---|
comment:5 Changed 10 years ago by
Status: | new → open |
---|
comment:6 Changed 8 years ago by
Summary: | Make $.ui.intersect use a hash for each tolerance mode → Droppable: Expose hash for each tolerance mode |
---|
Note: See
TracTickets for help on using
tickets.
Changes in ui.droppable widget:
Changes in $.ui.ddmanager:
Demo - http://elsoft.tomsk.ru/jQuery/#intersect