View Full Version : something wrong with animation code

6 Feb 2007, 8:46 PM
take, for example, blindShow function

blindShow=function(anchor,newSize,duration,easing){var size=newSize||this.getSize();this.clip();this.setVisible(true);anchor=anchor.toLowerCase();switch(anchor){case't':case'top':this.setHeight(1);this.setHeight(newSize,true,duration||.5,null,easing||YAHOO.util.Easing.easeOut);break;case'l':case'left':this.setWidth(1);this.setWidth(newSize,true,duration||.5,null,easing||YAHOO.util.Easing.easeOut);break;}
this.unclip();return size;};

First of all, getSize() results are discarded so it doesn't work if newSize isn't specified (that's what led me to the investigation)
Then, if we add alert(this.getSize) to the func bidy we find out that this.getSize is actually a completely irrelevant, it's a func that returns some flavour of screen size and requires a parameter :)
And then I guess it could use beginMeasure and endMeasure given that the element size of which is required is hiddent when we launch getSize ;)

6 Feb 2007, 8:57 PM
Err, I did a bit of digging, getSize ma be not as irrelevant as it seemed but I dunno what sdhould be passed to it and it's not "this".
Sorry no time to dig more :(

6 Feb 2007, 9:08 PM
It's worked for me before. Maybe a description of what the problem actually is, or some sample calling code would help demonstrate what you're seeing.

7 Feb 2007, 1:59 PM
headerClick: function(headerId)
if (this.panels[headerId])
var panel = this.panels[headerId];
var actor = new YAHOO.ext.Actor(panel.id, null, true);
if (panel.isVisible())



On the first run the function successfully hides the panel; on the second however the panel is only resized to one pixel high (or maybe it's some side effect and it's not resized at all).
I injected alerts in YUI ext code and they fire so it's that function that is executed and it's clear from its code that size variable is set and never used; newSize is used and I sure do not pass it explicitly, it was probably your case (you passed newSize in?)
Moreover, if you alert this.getSize that should set for default size value it is not correct which is also understandable if you find the func in the code and inject some debugging alerts or logging into it.
It returns (and logs) correct values when YUI ext Layout uses it but in blindShow is returns the height of one for my case.

24 Feb 2007, 12:03 AM
Umm... so what's up? ;)
Is there any way to submit biugs or are they picked up riught from here?
Or what is wrong w/ my code

24 Feb 2007, 12:18 AM
I can tell you that in the .33 codebase, there were some problems related to element size not being persisted correctly across multiple animations in some cases, and so I'm pretty sure that what you are seeing is a bug.

The animation code has been completely refactored in 1.0, and in fact, Actor has been deprecated in favor of the new Ext.fx class. The new effects take chaining and sequencing into account correctly, including caching and auto-resetting element properties like size, opacity, etc., and should allow you to do what you're trying without any problems.

One thing to note: the methods are now slideIn and slideOut, and the API has changed to support 8-way anchoring and an optional animation cofig object. Unfortunately, this stuff is not yet documented, but will be before final release. Hope you can wait -- trying to patch .33 at this point for this particular bug is not likely to happen.