Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

problems

  • Loading branch information...
commit 5ff369fe248bfc9b541f87adc65a7800e0242f33 1 parent 02c602d
@mcfedr authored
View
29 Source/Fx/Fx.CSS3.js
@@ -108,24 +108,31 @@ provides: [Fx.CSS3Funcs]
if(!options.transition || !transitionTimings[options.transition]) {
options.transition = 'sine:in:out';
}
+ if(this.initializeCSS3) {
+ this.initializeCSS3(element, options);
+ }
}
this.parent(element, options);
},
- startCSS3: function(properties, from, to, complete) {
+ startCSS3: function(properties, from, to) {
if(this.boundComplete) return this;
if(!Object.isEqual(from, to)) {
- var preTransStyles = this.element.getStyles(Fx.CSS3Funcs.css3Features.transitionProperty,
+ this.preTransStyles = this.element.getStyles(Fx.CSS3Funcs.css3Features.transitionProperty,
Fx.CSS3Funcs.css3Features.transitionDuration,
Fx.CSS3Funcs.css3Features.transitionTimingFunction);
- complete = complete || function() { return true; };
+ var incomplete = {};
+ properties.each(function(p) {
+ incomplete[p] = false;
+ });
this.boundComplete = function(e) {
- if(complete(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(preTransStyles);
+ this.element.setStyles(this.preTransStyles);
this.boundComplete = null;
this.fireEvent('complete', this);
}
@@ -158,12 +165,14 @@ provides: [Fx.CSS3Funcs]
cancel: function(){
if (this.css3Supported){
- this.element.setStyle(css3Features.transition, 'none');
- this.element.removeEvent(css3Features.transitionend, this.boundComplete);
- this.boundComplete = null;
+ /*if(this.boundComplete) {
+ this.element.setStyles(this.preTransStyles);
+ this.element.removeEvent(css3Features.transitionend, this.boundComplete);
+ this.boundComplete = null;
+ }*/
+ return this;
}
- this.parent();
- return this;
+ return this.parent();
},
stop: function() {
View
23 Source/Fx/Fx.Elements.CSS3.js
@@ -19,6 +19,20 @@ provides: [Fx.Elements.CSS3]
Fx.Elements = new Class({
Extends: elementsCSS2,
+
+ initializeCSS3: function(elements, options){
+ this.morphers = elements.map(function(element) {
+ return new Fx.Morph(element, Object.merge({}, options, {
+ onComplete: this.complete.bind(this)
+ }));
+ }.bind(this));
+ },
+
+ complete: function() {
+ if(this.count-- == 0) {
+ this.fireEvent('complete', this);
+ }
+ },
checkCSS3: function(obj){
return (Fx.CSS3Funcs.css3Features && Object.every(obj, function(properties, key) {
@@ -35,18 +49,11 @@ provides: [Fx.Elements.CSS3]
if ((this.css3Supported = this.checkCSS3(obj))) {
if(this.count != 0) return this;
this.count = 0;
- var complete = function() {
- if(this.count-- == 0) {
- this.fireEvent('complete', this);
- }
- }.bind(this);
Object.each(obj, function(properties, key) {
if(properties && this.elements[key]) {
this.count++;
- new Fx.Morph(this.elements[key], Object.merge({}, this.options, {
- onComplete: complete
- })).start(properties);
+ this.morphers[key].start(properties);
}
}, this);
View
16 Source/Fx/Fx.Morph.CSS3.js
@@ -31,18 +31,12 @@ provides: [Fx.Morph.CSS3]
var from = {}, to = {};
for (var p in properties){
var parsed = this.prepare(this.element, p, properties[p]);
- from[p] = parsed.from;
- to[p] = parsed.to;
+ if(!Object.isEqual(parsed.from, parsed.to)) {
+ from[p] = parsed.from;
+ to[p] = parsed.to;
+ }
}
-
- var incomplete = Object.map(properties, function() { return false; });
-
- var complete = function(event){
- incomplete[event.getPropertyName()] = true;
- return Object.every(incomplete, function(v) { return v; });
- };
-
- return this.startCSS3(Object.keys(properties), from, to, complete);
+ return this.startCSS3(Object.keys(properties), from, to);
}
return this.parent(properties);
}
Please sign in to comment.
Something went wrong with that request. Please try again.