aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2009-01-19 15:22:56 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2009-01-19 15:22:56 +0000
commit1a631ae2846c40ea37dd5e086ad7db130b88b529 (patch)
treef4c4c129a3f15b0768de05b0c3b2a6edd426ddf0 /ui
parent14e32a2b9fcb8aa6940264912373f7569766b915 (diff)
downloadjquery-ui-1a631ae2846c40ea37dd5e086ad7db130b88b529.tar.gz
jquery-ui-1a631ae2846c40ea37dd5e086ad7db130b88b529.zip
draggable: fixed margin inclusion in snap option (fixes #3853)
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.draggable.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js
index b70435e77..469949199 100644
--- a/ui/ui.draggable.js
+++ b/ui/ui.draggable.js
@@ -678,10 +678,10 @@ $.ui.plugin.add("draggable", "snap", {
var bs = Math.abs(b - y1) <= d;
var ls = Math.abs(l - x2) <= d;
var rs = Math.abs(r - x1) <= d;
- if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
- if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
- if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
- if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
}
var first = (ts || bs || ls || rs);
@@ -691,10 +691,10 @@ $.ui.plugin.add("draggable", "snap", {
var bs = Math.abs(b - y2) <= d;
var ls = Math.abs(l - x1) <= d;
var rs = Math.abs(r - x2) <= d;
- if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
- if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
- if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
- if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
}
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))