Hi all,
I'm working to introduce the Mochikit.Visual effects on existing
UI4Web <http://ui4w.sf.net> widgets.
The natural candidate for testing the effects was the Accordion, with
blind{Up, Down}. So, I changed the showElement and hideElement calls
when the accordion elements are expanding/collapsing to blindDown and
blindUp.
On first look, it worked on the current examples, but it behaved
strange on the test suite. More manual testing revealed that blindDown
and blindUp were 'conflicting' when called on the same element before
the other effect finished.
By 'conflicting' I mean that if blindUp was called in the middle of a
blindDown, it took a non-original height, and set that height to the
element when the blindUp finish and the display is set to 'none'.
Later, blindDown only expand the element to that non-original height,
showing only a fraction of the accordion element.
Now, my question: How those conditions should be managed?. Is there
any intention to solve them on MochiKit itself? (That is, Scale effect
would detect if another Scale effect is running on the same element
and finish it before running the new scaling) Or is it a resposability
of the MochiKit user?
On the meantime, I've implemented a quick and dirty wrapper to
workaround this, but AFAIK it leaks on IE, because I'm making circular
dependencies between the effect and the DOM element:
function safeEffect(effect) {
return function(element, effectOptions) {
if (element._currentEffect) {
element._currentEffect.render(1.0);
element._currentEffect.cancel();
element._currentEffect.event('beforeFinish');
element._currentEffect.finish();
element._currentEffect.event('afterFinish');
}
element._currentEffect = effect(element, update({
'afterFinish': function() {
element._currentEffect = null
}
}, effectOptions));
}
}
BTW, shouldn't be a finalize() function on effects that does this?:
this.render(1.0);
this.cancel();
this.event('beforeFinish');
this.finish();
this.event('afterFinish');
I see it twice on Visual.js, and was forced to repeat it on
safeEffect(), as element._currentEffect.finish();
alone didn't work as expected.
--
Leonardo Soto M.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---