From 79c5d9c925a81e5eaaa5b537bc782c14fb7736e5 Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Thu, 15 Jan 2009 00:49:23 +0000 Subject: [PATCH] Split out a little logic related to recentering and finishing up block resolution so it can be used reasonably by subclasses. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@753 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../threerings/media/VirtualMediaPanel.java | 4 ++++ .../miso/client/MisoScenePanel.java | 24 +++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/media/VirtualMediaPanel.java b/src/java/com/threerings/media/VirtualMediaPanel.java index 99c4c2d9..39bf9b11 100644 --- a/src/java/com/threerings/media/VirtualMediaPanel.java +++ b/src/java/com/threerings/media/VirtualMediaPanel.java @@ -236,7 +236,11 @@ public class VirtualMediaPanel extends MediaPanel protected void didTick (long tickStamp) { super.didTick(tickStamp); + adjustBoundsCenter(); + } + protected void adjustBoundsCenter () + { int width = getWidth(), height = getHeight(); // adjusts our view location to track any pathable we might be diff --git a/src/java/com/threerings/miso/client/MisoScenePanel.java b/src/java/com/threerings/miso/client/MisoScenePanel.java index c64924e0..1c8d7c4c 100644 --- a/src/java/com/threerings/miso/client/MisoScenePanel.java +++ b/src/java/com/threerings/miso/client/MisoScenePanel.java @@ -162,6 +162,7 @@ public class MisoScenePanel extends VirtualMediaPanel clearScene(); // Don't repaint immediately if we've gotten new penders from our rethink _delayRepaint = rethink() > 0; + System.err.println("MST REF SCENE: " + _delayRepaint); _remgr.invalidateRegion(_vbounds); } @@ -730,6 +731,7 @@ public class MisoScenePanel extends VirtualMediaPanel _ulpos.setLocation(_tcoords); if (rethink() > 0) { _delayRepaint = mightDelayPaint; + System.err.println("MST VIEW LOC DID CHANGE: " + _delayRepaint); // If this is a complete repaint, turn off visibility while we're resolving to // keep child components or media panels from drawing. if (_delayRepaint) { @@ -944,16 +946,24 @@ public class MisoScenePanel extends VirtualMediaPanel // once all the visible pending blocks have completed their // resolution, recompute our visible object set and show ourselves if (_visiBlocks.remove(block) && _visiBlocks.size() == 0) { - recomputeVisible(); - log.info("Restoring repaint... ", "left", _pendingBlocks, "view", - StringUtil.toString(_vbounds)); - _delayRepaint = false; - // Need to restore visibility as it may have been turned of as a result of the delay - setVisible(true); - _remgr.invalidateRegion(_vbounds); + allBlocksFinished(); } } + /** + * Called to handle the proceedings once our last resolving block has been finished. + */ + protected void allBlocksFinished () + { + recomputeVisible(); + log.info("Restoring repaint... ", "left", _pendingBlocks, "view", + StringUtil.toString(_vbounds)); + _delayRepaint = false; + // Need to restore visibility as it may have been turned of as a result of the delay + setVisible(true); + _remgr.invalidateRegion(_vbounds); + } + /** * Issues a warning to the error log that the specified block became visible prior to being * resolved. Derived classes may wish to augment or inhibit this warning.