Move the slowInSlowOut easing function into utils

print-window-tiddler
Jeremy Ruston 2012-11-08 18:34:04 +00:00
rodzic e0d2985ec3
commit d3e6a0cdf0
3 zmienionych plików z 6 dodań i 10 usunięć

Wyświetl plik

@ -65,10 +65,6 @@ exports.postRenderInDom = function() {
};
};
var slowInSlowOut = function(t) {
return (1 - ((Math.cos(t * Math.PI) + 1) / 2));
};
exports.scrollTo = function(bounds) {
this.cancelScroll();
this.startTime = new Date();
@ -84,7 +80,7 @@ exports.scrollTo = function(bounds) {
self.cancelScroll();
t = 1;
}
t = slowInSlowOut(t);
t = $tw.utils.slowInSlowOut(t);
self.child.domNode.scrollLeft = self.startX + (self.endX - self.startX) * t;
self.child.domNode.scrollTop = self.startY + (self.endY - self.startY) * t;
}, 10);

Wyświetl plik

@ -12,10 +12,6 @@ Module that creates a $tw.utils.Scroller object prototype that manages scrolling
/*global $tw: false */
"use strict";
var slowInSlowOut = function(t) {
return (1 - ((Math.cos(t * Math.PI) + 1) / 2));
};
/*
Creates a Scroller object
*/
@ -67,7 +63,7 @@ Scroller.prototype.scrollIntoView = function(domNode) {
self.cancel();
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);
}, 10);
}

Wyświetl plik

@ -88,6 +88,10 @@ exports.extendDeepCopy = function(object,extendedProperties) {
return result;
};
exports.slowInSlowOut = function(t) {
return (1 - ((Math.cos(t * Math.PI) + 1) / 2));
};
exports.formatDateString = function (date,template) {
var t = template.replace(/0hh12/g,$tw.utils.pad($tw.utils.getHours12(date)));
t = t.replace(/hh12/g,$tw.utils.getHours12(date));