Permalink
Browse files

Merge pull request #1266 from SergioCrisostomo/fix1010-drag-offsetScroll

Count with offsetScroll when calculateLimit()
  • Loading branch information...
anutron committed May 31, 2014
2 parents 6be6e52 + 74d5b14 commit a586f51d264b07ca932e9f07d6a5de5e06a1920e
Showing with 6 additions and 5 deletions.
  1. +6 −5 Source/Drag/Drag.Move.js
View
@@ -92,7 +92,8 @@ Drag.Move = new Class({
elementBorder = {},
containerMargin = {},
containerBorder = {},
offsetParentPadding = {};
offsetParentPadding = {},
offsetScroll = offsetParent.getScroll();
['top', 'right', 'bottom', 'left'].each(function(pad){
elementMargin[pad] = element.getStyle('margin-' + pad).toInt();
@@ -104,10 +105,10 @@ Drag.Move = new Class({
var width = element.offsetWidth + elementMargin.left + elementMargin.right,
height = element.offsetHeight + elementMargin.top + elementMargin.bottom,
left = 0,
top = 0,
right = containerCoordinates.right - containerBorder.right - width,
bottom = containerCoordinates.bottom - containerBorder.bottom - height;
left = 0 + offsetScroll.x,
top = 0 + offsetScroll.y,
right = containerCoordinates.right - containerBorder.right - width + offsetScroll.x,
bottom = containerCoordinates.bottom - containerBorder.bottom - height + offsetScroll.y;
if (this.options.includeMargins){
left += elementMargin.left;

0 comments on commit a586f51

Please sign in to comment.