1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Use srcWindow in scrollable widget (#4677)

This commit is contained in:
Simon Huber 2020-06-11 12:49:32 +02:00 committed by GitHub
parent d31d4621a4
commit 5b9dbf7b95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,7 +68,8 @@ Scroll an element into view
ScrollableWidget.prototype.scrollIntoView = function(element) {
var duration = $tw.utils.getAnimationDuration();
this.cancelScroll();
this.startTime = Date.now();
this.startTime = Date.now(),
srcWindow = element ? element.ownerDocument.defaultView : window;
var scrollPosition = {
x: this.outerDomNode.scrollLeft,
y: this.outerDomNode.scrollTop
@ -122,7 +123,7 @@ ScrollableWidget.prototype.scrollIntoView = function(element) {
self.outerDomNode.scrollLeft = scrollPosition.x + (endX - scrollPosition.x) * t;
self.outerDomNode.scrollTop = scrollPosition.y + (endY - scrollPosition.y) * t;
if(t < 1) {
self.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame);
self.idRequestFrame = self.requestAnimationFrame.call(srcWindow,drawFrame);
}
};
drawFrame();