Created changeHoverObject() to consolidate setting a new hover object and

do the required changes.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1816 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-10-18 19:44:00 +00:00
parent c69bfc2ca3
commit dda1039dc0
@@ -1,5 +1,5 @@
//
// $Id: IsoSceneView.java,v 1.123 2002/10/17 02:12:42 ray Exp $
// $Id: IsoSceneView.java,v 1.124 2002/10/18 19:44:00 ray Exp $
package com.threerings.miso.scene;
@@ -466,15 +466,6 @@ public class IsoSceneView implements SceneView
// nothing by default
}
/**
* A place for subclasses to react to the hover object changing.
* One of the supplied arguments may be null.
*/
protected void hoverObjectChanged (Object oldHover, Object newHover)
{
// nothing by default
}
// documentation inherited
public Path getPath (MisoCharacterSprite sprite, int x, int y)
{
@@ -548,10 +539,25 @@ public class IsoSceneView implements SceneView
hobject = item.obj;
}
// if this hover object is different than before, we'll need to be
// repainted unless we're not highlighting anything
if (hobject != _hobject) {
repaint |= (_hmode != HIGHLIGHT_NEVER);
repaint |= changeHoverObject(hobject);
// clear out the hitlists
_hitList.clear();
_hitSprites.clear();
return repaint;
}
/**
* Change the hover object to the new object.
*
* @return true if we need to repaint the entire scene. Bah!
*/
protected boolean changeHoverObject (Object newHover)
{
if (newHover == _hobject) {
return false; // no change, no repaint
}
// unhover the old
if (_hobject instanceof SceneObject) {
@@ -561,9 +567,9 @@ public class IsoSceneView implements SceneView
}
}
hoverObjectChanged(_hobject, hobject);
hoverObjectChanged(_hobject, newHover);
// set the new
_hobject = hobject;
_hobject = newHover;
// hover the new
if (_hobject instanceof SceneObject) {
@@ -572,14 +578,17 @@ public class IsoSceneView implements SceneView
_remgr.invalidateRegion(newhov.bounds);
}
}
// Log.info("New hover object [ho=" + _hobject + "].");
return (_hmode != HIGHLIGHT_NEVER);
}
// clear out the hitlists
_hitList.clear();
_hitSprites.clear();
return repaint;
/**
* A place for subclasses to react to the hover object changing.
* One of the supplied arguments may be null.
*/
protected void hoverObjectChanged (Object oldHover, Object newHover)
{
// nothing by default
}
/**
@@ -615,7 +624,7 @@ public class IsoSceneView implements SceneView
{
// clear the highlight tracking data
_hcoords.setLocation(-1, -1);
_hobject = null;
changeHoverObject(null);
}
// documentation inherited