My change didn't properly "unhover" the old hover sprite when an overlapping
but higher priority hover sprite was entered. Noted a refinement that would make getHit() more correct in the overlapping case. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3718 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -703,18 +703,17 @@ public class MediaPanel extends JComponent
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void mouseMoved (MouseEvent me)
|
public void mouseMoved (MouseEvent me)
|
||||||
{
|
{
|
||||||
if (_activeSprite instanceof HoverSprite) {
|
|
||||||
if (!_activeSprite.hitTest(me.getX(), me.getY())) {
|
|
||||||
((HoverSprite) _activeSprite).setHovered(false);
|
|
||||||
_activeSprite = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Sprite s = getHit(me);
|
Sprite s = getHit(me);
|
||||||
if (s instanceof HoverSprite) {
|
if (_activeSprite == s) {
|
||||||
((HoverSprite) s).setHovered(true);
|
return;
|
||||||
|
}
|
||||||
|
if (_activeSprite instanceof HoverSprite) {
|
||||||
|
((HoverSprite) _activeSprite).setHovered(false);
|
||||||
}
|
}
|
||||||
_activeSprite = s;
|
_activeSprite = s;
|
||||||
|
if (_activeSprite instanceof HoverSprite) {
|
||||||
|
((HoverSprite) _activeSprite).setHovered(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -723,6 +722,8 @@ public class MediaPanel extends JComponent
|
|||||||
*/
|
*/
|
||||||
protected Sprite getHit (MouseEvent me)
|
protected Sprite getHit (MouseEvent me)
|
||||||
{
|
{
|
||||||
|
// TODO: this should get all hit sprites, sort them by render
|
||||||
|
// priority and then return the first non-disabled sprite
|
||||||
Sprite s = _spritemgr.getHighestHitSprite(me.getX(), me.getY());
|
Sprite s = _spritemgr.getHighestHitSprite(me.getX(), me.getY());
|
||||||
if (!(s instanceof DisableableSprite) ||
|
if (!(s instanceof DisableableSprite) ||
|
||||||
((DisableableSprite) s).isEnabled()) {
|
((DisableableSprite) s).isEnabled()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user