Skip to content

Commit

Permalink
Merge branch 'master' of github.com:metal/metal-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
jbalsas committed Apr 30, 2019
2 parents 0295521 + 961b25d commit ccd810a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/metal-drag-drop/src/helpers/DragAutoScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ class DragAutoScroll extends State {
continue;
}

let scrollHeight = scrollContainers[i].scrollHeight;
let scrollWidth = scrollContainers[i].scrollWidth;

if (scrollContainers[i] === document) {
scrollHeight = scrollContainers[i].documentElement.scrollHeight;
scrollWidth = scrollContainers[i].documentElement.scrollWidth;
} else if (scrollContainers[i] === window) {
scrollHeight =
scrollContainers[i].document.documentElement.scrollHeight;
scrollWidth =
scrollContainers[i].document.documentElement.scrollWidth;
}

let deltaX = 0;
let deltaY = 0;
let scrollTop = Position.getScrollTop(scrollContainers[i]);
Expand All @@ -104,6 +117,7 @@ class DragAutoScroll extends State {
deltaX -= this.speed;
// eslint-disable-next-line
} else if (
scrollWidth > scrollRegion.width &&
Math.abs(mouseX - scrollRegion.right) <= this.maxDistance
) {
deltaX += this.speed;
Expand All @@ -115,6 +129,7 @@ class DragAutoScroll extends State {
deltaY -= this.speed;
// eslint-disable-next-line
} else if (
scrollHeight > scrollRegion.height &&
Math.abs(mouseY - scrollRegion.bottom) <= this.maxDistance
) {
deltaY += this.speed;
Expand Down

0 comments on commit ccd810a

Please sign in to comment.