From 4d1127ed5bec2f7fa34acea508c41cddf9806ea8 Mon Sep 17 00:00:00 2001 From: BurningTreeC Date: Tue, 6 Nov 2018 17:23:46 +0100 Subject: [PATCH] Fix tc-adjust-top-of-scroll (#3475) * correct scrolling with tc-adjust-top-of-scroll not multiplying `offset` with t causes jumps at the first animation steps, where the offset value is bigger than `endY - scrollPosition.y` * correct scroll offset --- core/modules/utils/dom/scroller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/utils/dom/scroller.js b/core/modules/utils/dom/scroller.js index f7f5c0c3f..417bc1b33 100644 --- a/core/modules/utils/dom/scroller.js +++ b/core/modules/utils/dom/scroller.js @@ -71,7 +71,7 @@ PageScroller.prototype.scrollIntoView = function(element) { scrollPosition = $tw.utils.getScrollPosition(); return { left: clientBounds.left + scrollPosition.x, - top: clientBounds.top + scrollPosition.y, + top: clientBounds.top + scrollPosition.y - offset, width: clientBounds.width, height: clientBounds.height }; @@ -104,7 +104,7 @@ PageScroller.prototype.scrollIntoView = function(element) { bounds = getBounds(), endX = getEndPos(bounds.left,bounds.width,scrollPosition.x,window.innerWidth), endY = getEndPos(bounds.top,bounds.height,scrollPosition.y,window.innerHeight); - window.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y - offset) * t); + window.scrollTo(scrollPosition.x + (endX - scrollPosition.x) * t,scrollPosition.y + (endY - scrollPosition.y) * t); if(t < 1) { self.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame); }