r2351 - filterCallback is called for each animated element now
Author: a.farkas.pm
Date: Sun Mar 22 06:45:29 2009
New Revision: 2351
Modified:
branches/dev/effects/dev-animateClass/index.html
branches/dev/effects/ui/effects.core.js
Log:
filterCallback is called for each animated element now
Modified: branches/dev/effects/dev-animateClass/index.html
==============================================================================
--- branches/dev/effects/dev-animateClass/index.html (original)
+++ branches/dev/effects/dev-animateClass/index.html Sun Mar 22 06:45:29
2009
@@ -171,8 +171,8 @@
duration: 500,
clearInlineStyles: true,
filterCallback: function(opts){
- $.extend(opts[0].animateStyles, dynCss);
- opts[0].resetStyle = 'top: '+ dynCss.top +'px; left: '+
dynCss.left+'px;';
+ $.extend(opts.animateStyles, dynCss);
+ opts.resetStyle = 'top: '+ dynCss.top +'px; left: '+
dynCss.left+'px;';
}
});
});
Modified: branches/dev/effects/ui/effects.core.js
==============================================================================
--- branches/dev/effects/ui/effects.core.js (original)
+++ branches/dev/effects/ui/effects.core.js Sun Mar 22 06:45:29 2009
@@ -98,7 +98,8 @@
padding: 'padding$site',
margin: 'margin$site',
borderColor: 'border$siteColor',
- borderWidth: 'border$siteWidth'
+ borderWidth: 'border$siteWidth',
+ borderRadius: 'border$siteRadius'
},
shortHandSites = ['Left', 'Right', 'Top', 'Bottom'];
@@ -127,22 +128,22 @@
filterCallback = filterCallback ||
function(){};
- cb = (typeof easing == "function" ? easing : (callback ? callback :
null));
- ea = (typeof easing == "string" ? easing : null);
+ cb = (typeof easing == 'function' ? easing : (callback ? callback :
null));
+ ea = (typeof easing == 'string' ? easing : null);
function getElementOptions(){
var elem = $(this),
newStyle,
- oldStyleAttr = elem.attr("style") || ' ';
+ oldStyleAttr = elem.attr('style') || ' ';
(clearInlineStyles &&
- elem.attr("style", ' '));
+ elem.attr('style', ' '));
newStyle = getElementStyles.call(this);
if(clearInlineStyles){
- elem.attr("style", oldStyleAttr);
- oldStyleAttr = " ";
+ elem.attr('style', oldStyleAttr);
+ oldStyleAttr = ' ';
}
return {element: elem, newStyle: newStyle, resetStyle: oldStyleAttr};
@@ -170,7 +171,7 @@
}
} else { //normal Browser + IE
for(key in style){
- if(!(/outline/.test(key)) && style[key]){ // no null properties +
IE8RC1 has some problems with outline*
+ if(style[key]){
newStyle[key] = style[key];
}
}
@@ -202,13 +203,9 @@
// The main function to form the object for animation
for (var n in opts[i].newStyle) {
if (typeof opts[i].newStyle[n] !== "function" /* No
functions */ &&
- n.indexOf("length") === -1 &&
+ n.indexOf('length') === -1 &&
opts[i].newStyle[n] !== oldStyle[i][n] /* Only values that have
changed are used for the animation */ &&
!n.match(/^pos|^pixel/) && !blacklist[n]) {
- /*
- if(n === 'backgroundPosition' && $.fx.step.backgroundPosition){
- opts[i].animateStyles[n] = '('+ opts[i].newStyle[n] +')';
//workaround for jQuery´s bug in animation-module
- } else */
if(dimStyles[n] && (opts[i].newStyle[n] === 'auto' ||
(opts[i].newStyle.display === 'none'))){ // handle height/width
opts[i].animateStyles[n] = opts[i].element[n]();
} else if(n == 'filter' &&
opts[i].newStyle[n].indexOf('opacity=') !== -1){ // handle filter opacity
@@ -271,7 +268,7 @@
childs = (animateChilds) ?
$(animateChilds, this) :
[],
- oldStyleAttr = that.attr("style") || ' ';
+ oldStyleAttr = that.attr('style') || ' ';
if (value.toggle) {
that.hasClass(value.toggle) ? value.remove = value.toggle :
value.add = value.toggle;
@@ -280,9 +277,6 @@
var options = createOptions(that, oldStyleAttr, childs);
- //last chance to manipulate the animateStyles-object, set starting
and/or reset-styles
- filterCallback.call(that[0], options);
-
var len = options.length,
i = len,
complete = function(){
@@ -292,7 +286,7 @@
that.removeClass(value.remove));
$.each(options, function(i, item){
- item.element.attr("style", item.resetStyle);
+ item.element.attr('style', item.resetStyle);
});
if(cb){
cb.apply(that[0], arguments);
@@ -302,6 +296,8 @@
//go reverse order main fx.Element is always last
while(i--){
var option = options[i];
+ //last chance to manipulate the animateStyles-object, set starting
and/or reset-styles
+ filterCallback.call(option.element[0], option);
option.element.animate(option.animateStyles, duration, ea, (!i) ?
complete : false);
}
});