From 7f712e9e1516547a9472d424ff8f47b726066358 Mon Sep 17 00:00:00 2001 From: Joshua Slack Date: Sat, 6 Jan 2018 11:45:57 -0600 Subject: Fixed a highlight bug when mouseover moves between multiple rings without mousedepart. Changed RotateWidget mouseover blend effect to be more subtle. --- .../interact/widget/AbstractInteractWidget.java | 9 +++++++-- .../ardor3d/extension/interact/widget/RotateWidget.java | 16 ++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'ardor3d-extras/src') diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java index df23f4b..9d1797d 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java @@ -113,8 +113,13 @@ public abstract class AbstractInteractWidget { mouseDeparted(manager); return; } - } else if (!_mouseOver) { - mouseEntered(manager); + } else { + if (!_mouseOver) { + mouseEntered(manager); + } else if (_results.getPickData(0).getTarget() != _lastMouseOverSpatial) { + mouseDeparted(manager); + mouseEntered(manager); + } } } diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java index 0348887..3ddd7ac 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java @@ -32,6 +32,7 @@ import com.ardor3d.renderer.Camera; import com.ardor3d.renderer.Renderer; import com.ardor3d.renderer.queue.RenderBucketType; import com.ardor3d.renderer.state.BlendState; +import com.ardor3d.renderer.state.BlendState.SourceFunction; import com.ardor3d.renderer.state.RenderState.StateType; import com.ardor3d.renderer.state.ZBufferState; import com.ardor3d.renderer.state.ZBufferState.TestFunction; @@ -84,32 +85,27 @@ public class RotateWidget extends AbstractInteractWidget { public void mouseEntered(final InteractManager manager) { super.mouseEntered(manager); if (_lastMouseOverSpatial != null) { - cleanupBlendStates(); - final BlendState bs = (BlendState) _lastMouseOverSpatial.getLocalRenderState(StateType.Blend); - if (bs != null) { - bs.setBlendEnabled(false); - } - _handle.updateGeometricState(0); + updateBlendStates(_lastMouseOverSpatial); } } @Override public void mouseDeparted(final InteractManager manager) { super.mouseDeparted(manager); - cleanupBlendStates(); - _handle.updateGeometricState(0); + updateBlendStates(null); } - protected void cleanupBlendStates() { + protected void updateBlendStates(final Spatial highlight) { _handle.acceptVisitor(new Visitor() { @Override public void visit(final Spatial spatial) { final BlendState bs = (BlendState) spatial.getLocalRenderState(StateType.Blend); if (bs != null) { - bs.setBlendEnabled(true); + bs.setSourceFunction(spatial == highlight ? SourceFunction.One : SourceFunction.SourceAlpha); } } }, true); + _handle.updateGeometricState(0); } public RotateWidget withXAxis() { -- cgit v1.2.3