Automatically start up the animation manager, regardless of whether or not

we're showing (the animated panel doesn't choke any more if it's asked to
render when not showing). Also leave the animation manager running until
it is explicitly shut down.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@833 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-12-18 09:46:07 +00:00
parent d75a1d956e
commit c6b7212e57
@@ -1,5 +1,5 @@
//
// $Id: AnimationManager.java,v 1.20 2001/12/16 08:05:06 mdb Exp $
// $Id: AnimationManager.java,v 1.21 2001/12/18 09:46:07 mdb Exp $
package com.threerings.media.sprite;
@@ -26,7 +26,10 @@ public class AnimationManager
{
/**
* Construct and initialize the animation manager with a sprite
* manager and the view in which the animations will take place.
* manager and the view in which the animations will take place. The
* animation manager will automatically start itself up, but must be
* explicitly shutdown when the animated view is no longer in
* operation via a call to {@link #stop}.
*/
public AnimationManager (SpriteManager spritemgr, AnimatedView view)
{
@@ -37,24 +40,8 @@ public class AnimationManager
// register to monitor the refresh action
PerformanceMonitor.register(this, "refresh", 1000);
// register the refresh interval immediately if the component is
// already showing on-screen
JComponent target = _view.getComponent();
if (target.isShowing()) {
start();
}
// listen to the view's ancestor events
target.addAncestorListener(new AncestorAdapter() {
public void ancestorAdded (AncestorEvent event) {
// start ourselves up when our animated view is added
start();
}
public void ancestorRemoved (AncestorEvent event) {
// automatically shutdown if our animated view is hidden
stop();
}
});
// start ourselves up
start();
}
/**