From a5d00cb1cae3db55b8aba29c3f372e591bfbb22e Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 16 Oct 2002 01:55:22 +0000 Subject: [PATCH] - Added hook for adding additional objects to the scene other than those provided by the DisplayMisoScene. - If hover objects are SceneObjects, tell them when we start/stop hovering on them. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1806 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/miso/client/IsoSceneView.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/miso/client/IsoSceneView.java b/src/java/com/threerings/miso/client/IsoSceneView.java index e63cc6d2a..e79ee6f0e 100644 --- a/src/java/com/threerings/miso/client/IsoSceneView.java +++ b/src/java/com/threerings/miso/client/IsoSceneView.java @@ -1,5 +1,5 @@ // -// $Id: IsoSceneView.java,v 1.121 2002/09/24 05:33:51 mdb Exp $ +// $Id: IsoSceneView.java,v 1.122 2002/10/16 01:55:22 ray Exp $ package com.threerings.miso.scene; @@ -447,6 +447,7 @@ public class IsoSceneView implements SceneView Rectangle rect = new Rectangle(Short.MIN_VALUE, Short.MIN_VALUE, 2*Short.MAX_VALUE, 2*Short.MAX_VALUE); _scene.getSceneObjects(rect, _objects); + addAdditionalSceneObjects(_objects); // and fill in those objects' bounds int ocount = _objects.size(); @@ -456,6 +457,15 @@ public class IsoSceneView implements SceneView } } + /** + * A place for subclasses to add any additional scene objects they + * may have. + */ + protected void addAdditionalSceneObjects (ObjectSet set) + { + // nothing by default + } + // documentation inherited public Path getPath (MisoCharacterSprite sprite, int x, int y) { @@ -533,7 +543,25 @@ public class IsoSceneView implements SceneView // repainted unless we're not highlighting anything if (hobject != _hobject) { repaint |= (_hmode != HIGHLIGHT_NEVER); + + // unhover the old + if (_hobject instanceof SceneObject) { + SceneObject oldhov = (SceneObject) _hobject; + if (oldhov.setHovered(false)) { + _remgr.invalidateRegion(oldhov.bounds); + } + } + + // set the new _hobject = hobject; + + // hover the new + if (_hobject instanceof SceneObject) { + SceneObject newhov = (SceneObject) _hobject; + if (newhov.setHovered(true)) { + _remgr.invalidateRegion(newhov.bounds); + } + } // Log.info("New hover object [ho=" + _hobject + "]."); }