mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-02 20:29:10 +00:00
Move the slowInSlowOut easing function into utils
This commit is contained in:
parent
e0d2985ec3
commit
d3e6a0cdf0
@ -65,10 +65,6 @@ exports.postRenderInDom = function() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var slowInSlowOut = function(t) {
|
|
||||||
return (1 - ((Math.cos(t * Math.PI) + 1) / 2));
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.scrollTo = function(bounds) {
|
exports.scrollTo = function(bounds) {
|
||||||
this.cancelScroll();
|
this.cancelScroll();
|
||||||
this.startTime = new Date();
|
this.startTime = new Date();
|
||||||
@ -84,7 +80,7 @@ exports.scrollTo = function(bounds) {
|
|||||||
self.cancelScroll();
|
self.cancelScroll();
|
||||||
t = 1;
|
t = 1;
|
||||||
}
|
}
|
||||||
t = slowInSlowOut(t);
|
t = $tw.utils.slowInSlowOut(t);
|
||||||
self.child.domNode.scrollLeft = self.startX + (self.endX - self.startX) * t;
|
self.child.domNode.scrollLeft = self.startX + (self.endX - self.startX) * t;
|
||||||
self.child.domNode.scrollTop = self.startY + (self.endY - self.startY) * t;
|
self.child.domNode.scrollTop = self.startY + (self.endY - self.startY) * t;
|
||||||
}, 10);
|
}, 10);
|
||||||
|
@ -12,10 +12,6 @@ Module that creates a $tw.utils.Scroller object prototype that manages scrolling
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var slowInSlowOut = function(t) {
|
|
||||||
return (1 - ((Math.cos(t * Math.PI) + 1) / 2));
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Creates a Scroller object
|
Creates a Scroller object
|
||||||
*/
|
*/
|
||||||
@ -67,7 +63,7 @@ Scroller.prototype.scrollIntoView = function(domNode) {
|
|||||||
self.cancel();
|
self.cancel();
|
||||||
t = 1;
|
t = 1;
|
||||||
}
|
}
|
||||||
t = slowInSlowOut(t);
|
t = $tw.utils.slowInSlowOut(t);
|
||||||
window.scrollTo(self.startX + (self.endX - self.startX) * t,self.startY + (self.endY - self.startY) * t);
|
window.scrollTo(self.startX + (self.endX - self.startX) * t,self.startY + (self.endY - self.startY) * t);
|
||||||
}, 10);
|
}, 10);
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,10 @@ exports.extendDeepCopy = function(object,extendedProperties) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.slowInSlowOut = function(t) {
|
||||||
|
return (1 - ((Math.cos(t * Math.PI) + 1) / 2));
|
||||||
|
};
|
||||||
|
|
||||||
exports.formatDateString = function (date,template) {
|
exports.formatDateString = function (date,template) {
|
||||||
var t = template.replace(/0hh12/g,$tw.utils.pad($tw.utils.getHours12(date)));
|
var t = template.replace(/0hh12/g,$tw.utils.pad($tw.utils.getHours12(date)));
|
||||||
t = t.replace(/hh12/g,$tw.utils.getHours12(date));
|
t = t.replace(/hh12/g,$tw.utils.getHours12(date));
|
||||||
|
Loading…
Reference in New Issue
Block a user