added hoverObjectWillChange()

fixed bug that happened when HIGHLIGHT_WITH_ACTION was on.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1555 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-06-29 01:32:28 +00:00
parent 7982e21fc1
commit a31730278b
@@ -1,5 +1,5 @@
//
// $Id: IsoSceneView.java,v 1.115 2002/06/25 01:20:07 mdb Exp $
// $Id: IsoSceneView.java,v 1.116 2002/06/29 01:32:28 ray Exp $
package com.threerings.miso.scene;
@@ -537,16 +537,8 @@ public class IsoSceneView implements SceneView
// if this hover object is different than before, we'll need to be
// repainted
if (hobject != _hobject) {
repaint = hoverObjectWillChange(hobject) || repaint;
_hobject = hobject;
// we need to repaint if we're highlighting objects, but if
// we're only highlighting objects with actions, we only need
// to repaint if the object has an action
if (_hmode != HIGHLIGHT_NEVER) {
repaint = (_hmode == HIGHLIGHT_WITH_ACTION) ?
(_scene.getObjectAction((ObjectTile)_hobject) != null) :
true;
}
}
// clear out the hitlists
@@ -556,6 +548,24 @@ public class IsoSceneView implements SceneView
return repaint;
}
/**
* Called to inform that the hover object, _hobject, has changed.
* When overriding this method, be sure not to short-circuit any
* calls to super() unless you mean to.
*
* @return true if we need to repaint.
*/
protected boolean hoverObjectWillChange (Object newhobject)
{
// we need to repaint if we're highlighting objects, but if
// we're only highlighting objects with actions, we only need
// to repaint if the object has an action
return (_hmode == HIGHLIGHT_WITH_ACTION)
? ((newhobject instanceof ObjectTile) &&
(_scene.getObjectAction((ObjectTile)newhobject) != null))
: (_hmode != HIGHLIGHT_NEVER);
}
/**
* Adds to the supplied dirty item list, all of the object tiles that
* are hit by the specified point (meaning the point is contained