mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-24 22:33:16 +00:00
Use srcWindow in scrollable widget (#4677)
This commit is contained in:
parent
d31d4621a4
commit
5b9dbf7b95
|
@ -68,7 +68,8 @@ Scroll an element into view
|
||||||
ScrollableWidget.prototype.scrollIntoView = function(element) {
|
ScrollableWidget.prototype.scrollIntoView = function(element) {
|
||||||
var duration = $tw.utils.getAnimationDuration();
|
var duration = $tw.utils.getAnimationDuration();
|
||||||
this.cancelScroll();
|
this.cancelScroll();
|
||||||
this.startTime = Date.now();
|
this.startTime = Date.now(),
|
||||||
|
srcWindow = element ? element.ownerDocument.defaultView : window;
|
||||||
var scrollPosition = {
|
var scrollPosition = {
|
||||||
x: this.outerDomNode.scrollLeft,
|
x: this.outerDomNode.scrollLeft,
|
||||||
y: this.outerDomNode.scrollTop
|
y: this.outerDomNode.scrollTop
|
||||||
|
@ -122,7 +123,7 @@ ScrollableWidget.prototype.scrollIntoView = function(element) {
|
||||||
self.outerDomNode.scrollLeft = scrollPosition.x + (endX - scrollPosition.x) * t;
|
self.outerDomNode.scrollLeft = scrollPosition.x + (endX - scrollPosition.x) * t;
|
||||||
self.outerDomNode.scrollTop = scrollPosition.y + (endY - scrollPosition.y) * t;
|
self.outerDomNode.scrollTop = scrollPosition.y + (endY - scrollPosition.y) * t;
|
||||||
if(t < 1) {
|
if(t < 1) {
|
||||||
self.idRequestFrame = self.requestAnimationFrame.call(window,drawFrame);
|
self.idRequestFrame = self.requestAnimationFrame.call(srcWindow,drawFrame);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
drawFrame();
|
drawFrame();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user