aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes/com/jogamp/graph/ui/Scene.java
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-07 13:05:42 +0100
committerSven Göthel <[email protected]>2024-01-07 13:05:42 +0100
commitd80762bdaf79a852cde2391479bb066968ae573c (patch)
treee4c0132b4d363ac1cfaa38ae82845d75ce5aeee7 /src/graphui/classes/com/jogamp/graph/ui/Scene.java
parentfa973b03fc1d6af5696cee27e1824c45da3150b4 (diff)
GraphUI Shape: Ease Tooltip managment via Scene: Only started Tooltip is required to tick(), drop List<Tooltip>
Diffstat (limited to 'src/graphui/classes/com/jogamp/graph/ui/Scene.java')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Scene.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
index c71060db4..e2dc96b8d 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
@@ -133,7 +133,7 @@ public final class Scene implements Container, GLEventListener {
private static final boolean DEBUG = false;
private final List<Shape> shapes = new CopyOnWriteArrayList<Shape>();
- /* pp */ final List<Tooltip> toolTips = new CopyOnWriteArrayList<Tooltip>();
+ private final AtomicReference<Tooltip> startedToolTip = new AtomicReference<Tooltip>();
private final AtomicReference<GraphShape> toolTipHUD = new AtomicReference<GraphShape>();
private boolean doFrustumCulling = false;
@@ -503,13 +503,12 @@ public final class Scene implements Container, GLEventListener {
displayedOnce = true;
syncDisplayedOnce.notifyAll();
}
- if( null == toolTipHUD.get() ) {
+ final Tooltip tt = startedToolTip.get();
+ if( null != tt && null == toolTipHUD.get() ) {
final GraphShape[] t = { null };
- for(final Tooltip tt : toolTips ) {
- if( tt.tick() && forOne(pmv, tt.tool, () -> { t[0] = tt.createTip(pmv); }) ) {
- toolTipHUD.set( t[0] );
- break; // done
- }
+ if( tt.tick() && forOne(pmv, tt.tool, () -> { t[0] = tt.createTip(pmv); }) ) {
+ toolTipHUD.set( t[0] );
+ startedToolTip.set(null);
}
}
}
@@ -1205,7 +1204,7 @@ public final class Scene implements Container, GLEventListener {
final Shape s = dispatchMouseEventPickShape(e, glWinX, glWinY);
if( null != s ) {
mouseOver = true;
- s.startToolTip();
+ startedToolTip.set( s.startToolTip() );
} else {
mouseOver = false;
}
@@ -1243,7 +1242,8 @@ public final class Scene implements Container, GLEventListener {
return true;
});
}
- for(final Tooltip tt : toolTips) {
+ final Tooltip tt = startedToolTip.getAndSet(null);
+ if( null != tt ) {
tt.stop();
}
}