diff --git a/core/modules/macros/scrollable.js b/core/modules/macros/scrollable.js index 84c4b464d..b19c3a388 100644 --- a/core/modules/macros/scrollable.js +++ b/core/modules/macros/scrollable.js @@ -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); diff --git a/core/modules/utils/dom/scroller.js b/core/modules/utils/dom/scroller.js index 03488a3e4..5f44b05e8 100644 --- a/core/modules/utils/dom/scroller.js +++ b/core/modules/utils/dom/scroller.js @@ -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); } diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index cf0ea9790..a529369c9 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -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));