mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(scrollView): stop polluting global.core
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
* rendering. This eases a lot of cases where it might be pretty complex to break down a state
|
||||
* based on the pure time difference.
|
||||
*/
|
||||
var zyngaCore = { effect: {} };
|
||||
(function(global) {
|
||||
var time = Date.now || function() {
|
||||
return +new Date();
|
||||
@@ -31,15 +32,7 @@
|
||||
var running = {};
|
||||
var counter = 1;
|
||||
|
||||
// Create namespaces
|
||||
if (!global.core) {
|
||||
var core = global.core = { effect : {} };
|
||||
|
||||
} else if (!core.effect) {
|
||||
core.effect = {};
|
||||
}
|
||||
|
||||
core.effect.Animate = {
|
||||
zyngaCore.effect.Animate = {
|
||||
|
||||
/**
|
||||
* A requestAnimationFrame wrapper / polyfill.
|
||||
@@ -221,7 +214,7 @@
|
||||
completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, percent === 1 || duration == null);
|
||||
} else if (render) {
|
||||
lastFrame = now;
|
||||
core.effect.Animate.requestAnimationFrame(step, root);
|
||||
zyngaCore.effect.Animate.requestAnimationFrame(step, root);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -229,7 +222,7 @@
|
||||
running[id] = true;
|
||||
|
||||
// Init first step
|
||||
core.effect.Animate.requestAnimationFrame(step, root);
|
||||
zyngaCore.effect.Animate.requestAnimationFrame(step, root);
|
||||
|
||||
// Return unique animation ID
|
||||
return id;
|
||||
@@ -1274,7 +1267,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
|
||||
// Stop deceleration
|
||||
if (self.__isDecelerating) {
|
||||
core.effect.Animate.stop(self.__isDecelerating);
|
||||
zyngaCore.effect.Animate.stop(self.__isDecelerating);
|
||||
self.__isDecelerating = false;
|
||||
}
|
||||
|
||||
@@ -1349,7 +1342,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
|
||||
// Stop deceleration
|
||||
if (self.__isDecelerating) {
|
||||
core.effect.Animate.stop(self.__isDecelerating);
|
||||
zyngaCore.effect.Animate.stop(self.__isDecelerating);
|
||||
self.__isDecelerating = false;
|
||||
}
|
||||
|
||||
@@ -1481,14 +1474,14 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
|
||||
// Stop deceleration
|
||||
if (self.__isDecelerating) {
|
||||
core.effect.Animate.stop(self.__isDecelerating);
|
||||
zyngaCore.effect.Animate.stop(self.__isDecelerating);
|
||||
self.__isDecelerating = false;
|
||||
self.__interruptedAnimation = true;
|
||||
}
|
||||
|
||||
// Stop animation
|
||||
if (self.__isAnimating) {
|
||||
core.effect.Animate.stop(self.__isAnimating);
|
||||
zyngaCore.effect.Animate.stop(self.__isAnimating);
|
||||
self.__isAnimating = false;
|
||||
self.__interruptedAnimation = true;
|
||||
}
|
||||
@@ -1871,7 +1864,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
// Remember whether we had an animation, then we try to continue based on the current "drive" of the animation
|
||||
var wasAnimating = self.__isAnimating;
|
||||
if (wasAnimating) {
|
||||
core.effect.Animate.stop(wasAnimating);
|
||||
zyngaCore.effect.Animate.stop(wasAnimating);
|
||||
self.__isAnimating = false;
|
||||
}
|
||||
|
||||
@@ -1924,7 +1917,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
};
|
||||
|
||||
// When continuing based on previous animation we choose an ease-out animation instead of ease-in-out
|
||||
self.__isAnimating = core.effect.Animate.start(step, verify, completed, self.options.animationDuration, wasAnimating ? easeOutCubic : easeInOutCubic);
|
||||
self.__isAnimating = zyngaCore.effect.Animate.start(step, verify, completed, self.options.animationDuration, wasAnimating ? easeOutCubic : easeInOutCubic);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -2056,7 +2049,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
};
|
||||
|
||||
// Start animation and switch on flag
|
||||
self.__isDecelerating = core.effect.Animate.start(step, verify, completed);
|
||||
self.__isDecelerating = zyngaCore.effect.Animate.start(step, verify, completed);
|
||||
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user