Altered animation manager to separate construction from the start of

actual animation so that animating components can call
AnimationManager.start() when they know they're fully laid out and
ready to be regularly re-painted.  Return desired dimensions based on
requested scene bounds in SceneViewPanel.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@186 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-08-06 18:57:39 +00:00
parent 17135945d1
commit c09986bab0
5 changed files with 53 additions and 12 deletions
@@ -1,5 +1,5 @@
//
// $Id: ViewerFrame.java,v 1.7 2001/08/04 01:41:02 shaper Exp $
// $Id: ViewerFrame.java,v 1.8 2001/08/06 18:57:39 shaper Exp $
package com.threerings.miso.viewer;
@@ -50,13 +50,15 @@ class ViewerFrame extends JFrame implements WindowListener
gl.setOffAxisPolicy(GroupLayout.STRETCH);
top.setLayout(gl);
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
// set up the scene view panel with a default scene
ViewerSceneViewPanel svpanel =
new ViewerSceneViewPanel(_ctx, spritemgr, sprite);
top.add(svpanel, GroupLayout.FIXED);
top.add(svpanel);
// add the scene view panel
getContentPane().add(svpanel, BorderLayout.CENTER);
getContentPane().add(top, BorderLayout.CENTER);
}
/** WindowListener interface methods */
@@ -1,5 +1,5 @@
//
// $Id: ViewerSceneViewPanel.java,v 1.1 2001/08/04 01:41:02 shaper Exp $
// $Id: ViewerSceneViewPanel.java,v 1.2 2001/08/06 18:57:39 shaper Exp $
package com.threerings.miso.viewer;
@@ -31,8 +31,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel
_sprite = sprite;
// create an animation manager for this panel
AnimationManager animmgr =
new AnimationManager(spritemgr, this, _view);
_animmgr = new AnimationManager(spritemgr, this, _view);
// listen to the desired events
addMouseListener(this);
@@ -40,8 +39,6 @@ public class ViewerSceneViewPanel extends SceneViewPanel
// load up the initial scene
prepareStartingScene();
PerformanceMonitor.register(this, "paint", 1000);
}
/**
@@ -71,6 +68,14 @@ public class ViewerSceneViewPanel extends SceneViewPanel
Log.info(name + " [ticks=" + ticks + "].");
}
public void doLayout ()
{
super.doLayout();
// now that we've been fully laid out, start animating
_animmgr.start();
}
/** MouseListener interface methods */
public void mousePressed (MouseEvent e)
@@ -104,6 +109,9 @@ public class ViewerSceneViewPanel extends SceneViewPanel
/** The default scene to load and display. */
protected static final String DEF_SCENE = "rsrc/scenes/default.xml";
/** The animation manager. */
AnimationManager _animmgr;
/** The sprite we're manipulating within the view. */
protected Sprite _sprite;