Skip to content

Commit

Permalink
Merge pull request #120 from Cinetik/master
Browse files Browse the repository at this point in the history
Fixing getBoundingClientRect in hitTest doesn't account for scrolled page #112
  • Loading branch information
fatlinesofcode committed Mar 31, 2015
2 parents ccabdaf + cd7bce1 commit d757428
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ngDraggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,10 @@ angular.module("ngDraggable", [])

var hitTest = function(x, y) {
var bounds = element[0].getBoundingClientRect();// ngDraggable.getPrivOffset(element);
bounds.right = bounds.left + element[0].offsetWidth;
bounds.bottom = bounds.top + element[0].offsetHeight;
bounds.right = bounds.left + element[0].offsetWidth - $window.pageXOffset;
bounds.bottom = bounds.top + element[0].offsetHeight - $window.pageYOffset;
x -= $window.pageXOffset;
y -= $window.pageYOffset;
return x >= bounds.left
&& x <= bounds.right
&& y <= bounds.bottom
Expand Down

0 comments on commit d757428

Please sign in to comment.