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
logging-improvements
BurningTreeC 2018-11-06 17:23:46 +01:00 zatwierdzone przez Jeremy Ruston
rodzic 16eb5e1e32
commit 4d1127ed5b
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -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);
}