mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-21 00:48:49 +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:
@@ -57,7 +57,7 @@ PageScroller.prototype.scrollIntoView = function(element) {
|
||||
var duration = $tw.utils.getAnimationDuration();
|
||||
// Now get ready to scroll the body
|
||||
this.cancelScroll();
|
||||
this.startTime = new Date();
|
||||
this.startTime = Date.now();
|
||||
var scrollPosition = $tw.utils.getScrollPosition();
|
||||
// Get the client bounds of the element and adjust by the scroll position
|
||||
var clientBounds = element.getBoundingClientRect(),
|
||||
@@ -94,7 +94,7 @@ PageScroller.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