mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-02 16:43:00 +00:00
Use Date.now() instead of new Date()
Just for when what we actually want is a millisecond counter. Interesting video about this: https://www.youtube.com/watch?v=Vo72W1HWeFI
This commit is contained in:
@@ -68,7 +68,7 @@ Scroll an element into view
|
||||
ScrollableWidget.prototype.scrollIntoView = function(element) {
|
||||
var duration = $tw.utils.getAnimationDuration();
|
||||
this.cancelScroll();
|
||||
this.startTime = new Date();
|
||||
this.startTime = Date.now();
|
||||
var scrollPosition = {
|
||||
x: this.outerDomNode.scrollLeft,
|
||||
y: this.outerDomNode.scrollTop
|
||||
@@ -112,7 +112,7 @@ ScrollableWidget.prototype.scrollIntoView = function(element) {
|
||||
if(duration <= 0) {
|
||||
t = 1;
|
||||
} else {
|
||||
t = ((new Date()) - self.startTime) / duration;
|
||||
t = ((Date.now()) - self.startTime) / duration;
|
||||
}
|
||||
if(t >= 1) {
|
||||
self.cancelScroll();
|
||||
|
||||
Reference in New Issue
Block a user