Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

stop/cancel work, and chaining function are properly called

  • Loading branch information...
commit 4067da1c0079810858a4388cd7ee1cad75795654 1 parent 5ff369f
@mcfedr authored
Showing with 23 additions and 11 deletions.
  1. +19 −8 Source/Fx/Fx.CSS3.js
  2. +4 −3 Source/Fx/Fx.Morph.CSS3.js
View
27 Source/Fx/Fx.CSS3.js
@@ -116,7 +116,7 @@ provides: [Fx.CSS3Funcs]
},
startCSS3: function(properties, from, to) {
- if(this.boundComplete) return this;
+ if(!this.check()) return this;
if(!Object.isEqual(from, to)) {
this.preTransStyles = this.element.getStyles(Fx.CSS3Funcs.css3Features.transitionProperty,
@@ -128,13 +128,16 @@ provides: [Fx.CSS3Funcs]
incomplete[p] = false;
});
+ this.animatingProperties = properties;
+
this.boundComplete = function(e) {
incomplete[e.getPropertyName()] = true;
if(Object.every(incomplete, function(v) { return v; })) {
this.element.removeEvent(Fx.CSS3Funcs.css3Features.transitionend, this.boundComplete);
this.element.setStyles(this.preTransStyles);
this.boundComplete = null;
- this.fireEvent('complete', this);
+ this.fireEvent('complete', this.subject);
+ if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
}
}.bind(this);
@@ -154,22 +157,23 @@ provides: [Fx.CSS3Funcs]
this.element.setStyle(Fx.CSS3Funcs.css3Features.transitionProperty, 'none');
this.set(this.compute(from, to, 0));
trans.delay(0.1);
- this.fireEvent('start', this);
+ this.fireEvent('start', this.subject);
}
else {
- this.fireEvent('start', this);
- this.fireEvent('complete', this);
+ this.fireEvent('start', this.subject);
+ this.fireEvent('complete', this.subject);
}
return this;
},
cancel: function(){
if (this.css3Supported){
- /*if(this.boundComplete) {
+ if(this.isRunning()) {
+ this.element.removeEvent(Fx.CSS3Funcs.css3Features.transitionend, this.boundComplete);
this.element.setStyles(this.preTransStyles);
- this.element.removeEvent(css3Features.transitionend, this.boundComplete);
this.boundComplete = null;
- }*/
+ this.fireEvent('cancel', this.subject).clearChain();
+ }
return this;
}
return this.parent();
@@ -177,6 +181,13 @@ provides: [Fx.CSS3Funcs]
stop: function() {
if (this.css3Supported){
+ if(this.isRunning()) {
+ this.element.removeEvent(Fx.CSS3Funcs.css3Features.transitionend, this.boundComplete);
+ this.element.setStyles(this.preTransStyles);
+ this.boundComplete = null;
+ this.fireEvent('complete', this.subject);
+ if (!this.callChain()) this.fireEvent('chainComplete', this.subject);
+ }
return this;
}
return this.parent();
View
7 Source/Fx/Fx.Morph.CSS3.js
@@ -24,19 +24,20 @@ provides: [Fx.Morph.CSS3]
checkCSS3: function(properties){
return (Fx.CSS3Funcs.css3Features && Fx.CSS3Funcs.animatable.containsArray(Object.keys(properties)));
},
-
+
start: function(properties){
if ((this.css3Supported = this.checkCSS3(properties))) {
if (typeof properties == 'string') properties = this.search(properties);
- var from = {}, to = {};
+ var from = {}, to = {}, usedProps = [];
for (var p in properties){
var parsed = this.prepare(this.element, p, properties[p]);
if(!Object.isEqual(parsed.from, parsed.to)) {
from[p] = parsed.from;
to[p] = parsed.to;
+ usedProps.push(p);
}
}
- return this.startCSS3(Object.keys(properties), from, to);
+ return this.startCSS3(usedProps, from, to);
}
return this.parent(properties);
}
Please sign in to comment.
Something went wrong with that request. Please try again.