Skip to content

Commit

Permalink
Merge pull request #1903 from bryan-m-hughes/timob-8483
Browse files Browse the repository at this point in the history
Timob 8483 Animation fallback
  • Loading branch information
cb1kenobi committed Apr 14, 2012
2 parents 2d47f50 + 6650b3d commit 2e0ac28
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
17 changes: 13 additions & 4 deletions mobileweb/titanium/Ti/_/UI/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,16 +993,25 @@ define(
anim.start && anim.start();

if (anim.duration > 0) {
// Create the transition, must be set before setting the other properties
setStyle(this.domNode, "transition", "all " + anim.duration + "ms " + curve + (anim.delay ? " " + anim.delay + "ms" : ""));
on.once(window, transitionEnd, lang.hitch(this, function(e) {

function completeAnimation(){
if (!this._destroyed) {
// Clear the transform so future modifications in these areas are not animated
setStyle(this.domNode, "transition", "");
is(anim.complete, "Function") && anim.complete();
is(callback, "Function") && callback();
}
}));
}

// Create the transition, must be set before setting the other properties
if (style.supports("transition", this.domNode)) {
setStyle(this.domNode, "transition", "all " + anim.duration + "ms " + curve + (anim.delay ? " " + anim.delay + "ms" : ""));
on.once(window, transitionEnd, lang.hitch(this, function(e) {
completeAnimation();
}));
} else {
setTimeout(completeAnimation,anim.duration);
}
setTimeout(fn, 0);
} else {
fn();
Expand Down
16 changes: 15 additions & 1 deletion mobileweb/titanium/Ti/_/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ define(["Ti/_", "Ti/_/string", "Ti/Filesystem"], function(_, string, Filesystem)
return node.style[name];
},

set: set
set: set,

supports: function(name, node) {
var i = 0,
x,
uc;

while (i < vp.length) {
x = vp[i++];
x += x ? uc || (uc = string.capitalize(name)) : name;
if (x in node.style) {
return true;
}
}
}
};
});

0 comments on commit 2e0ac28

Please sign in to comment.