diff --git a/src/state/middleware/auto-scroll.js b/src/state/middleware/auto-scroll.js index c3be12394c..883bafb603 100644 --- a/src/state/middleware/auto-scroll.js +++ b/src/state/middleware/auto-scroll.js @@ -30,16 +30,14 @@ export default (getMarshal: () => DimensionMarshal) => scrollWindow, }); - return (action: Action): mixed => { + const shouldCancel = (action: Action) => // Need to cancel any pending auto scrolling when drag is ending - if (isDragEnding(action)) { - scroller.cancel(); - next(action); - return; - } - + isDragEnding(action) || // A new bulk collection is starting - cancel any pending auto scrolls - if (action.type === 'BULK_COLLECTION_STARTING') { + action.type === 'BULK_COLLECTION_STARTING'; + + return (action: Action): mixed => { + if (shouldCancel(action)) { scroller.cancel(); next(action); return; diff --git a/src/state/move-to-next-index/in-home-list.js b/src/state/move-to-next-index/in-home-list.js index 34f5d88a51..ad3bd16d3d 100644 --- a/src/state/move-to-next-index/in-home-list.js +++ b/src/state/move-to-next-index/in-home-list.js @@ -134,8 +134,6 @@ export default ({ const distance: Position = subtract(newPageBorderBoxCenter, previousPageBorderBoxCenter); const distanceWithScroll: Position = withDroppableDisplacement(droppable, distance); - console.log('request jump scroll', distanceWithScroll); - return { pageBorderBoxCenter: previousPageBorderBoxCenter, impact: newImpact, diff --git a/src/state/scroll-viewport.js b/src/state/scroll-viewport.js index 69f170d697..590ccfeb5f 100644 --- a/src/state/scroll-viewport.js +++ b/src/state/scroll-viewport.js @@ -2,7 +2,6 @@ import { getRect, type Rect } from 'css-box-model'; import type { Position } from 'css-box-model'; import { subtract, negate } from './position'; -import { offsetByPosition } from './spacing'; import type { Viewport } from '../types'; export default (viewport: Viewport, newScroll: Position): Viewport => { @@ -11,10 +10,12 @@ export default (viewport: Viewport, newScroll: Position): Viewport => { // We need to update the frame so that it is always a live value // The top / left of the frame should always match the newScroll position - const change: Position = subtract(diff, viewport.scroll.current); - const frame: Rect = getRect( - offsetByPosition(viewport.frame, change) - ); + const frame: Rect = getRect({ + top: newScroll.y, + bottom: newScroll.y + viewport.frame.height, + left: newScroll.x, + right: newScroll.x + viewport.frame.width, + }); const updated: Viewport = { frame, diff --git a/src/view/window/get-viewport.js b/src/view/window/get-viewport.js index 81992fda5c..65b29cd9d4 100644 --- a/src/view/window/get-viewport.js +++ b/src/view/window/get-viewport.js @@ -49,5 +49,7 @@ export default (): Viewport => { }, }; + console.log('viewport', viewport); + return viewport; };