aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorZbigniew Motyka <zbigniew.motyka@gmail.com>2012-10-29 09:55:54 +0100
committerMike Sherov <mike.sherov@gmail.com>2013-03-16 11:51:51 -0400
commitbd126a9c1cfcbc9d0fd370af25cfa0eab294fc4e (patch)
treee666172d54d690d971fd2c846c6287659d9a19ac /ui
parentebd5f13027b30be1cdd9e8782e81ce468dcdff5e (diff)
downloadjquery-ui-bd126a9c1cfcbc9d0fd370af25cfa0eab294fc4e.tar.gz
jquery-ui-bd126a9c1cfcbc9d0fd370af25cfa0eab294fc4e.zip
Draggable: modified snapping algorithm to use edges and corners. Fixed #8165 - Draggable: Snapping doesn't take top/left into account properly
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.draggable.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index a75f9e9f3..4c8a9d5d5 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -850,8 +850,7 @@ $.ui.plugin.add("draggable", "snap", {
t = inst.snapElements[i].top;
b = t + inst.snapElements[i].height;
- //Yes, I know, this is insane ;)
- if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
+ if(x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d) {
if(inst.snapElements[i].snapping) {
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}