diff options
author | Sven Göthel <[email protected]> | 2024-01-20 05:11:28 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-20 05:11:28 +0100 |
commit | 018f2633ba8f7106439ec70829d2444abf0c389b (patch) | |
tree | 1be2e6b9090cfd25600d147ae819982b8053f926 /src/graphui/classes/com/jogamp/graph/ui/TooltipShape.java | |
parent | 5a24e0bbaaa0cdb61292e264b4919295fff40a2a (diff) |
GraphUI Tooltip*: Allow user to trigger display via now(); Ensure TooltipShape.DestroyCallback gets passed the user provided Shape only
Diffstat (limited to 'src/graphui/classes/com/jogamp/graph/ui/TooltipShape.java')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/TooltipShape.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/TooltipShape.java b/src/graphui/classes/com/jogamp/graph/ui/TooltipShape.java index ec3dbf45f..40cc8c66d 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/TooltipShape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/TooltipShape.java @@ -30,7 +30,6 @@ package com.jogamp.graph.ui; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.ui.layout.Alignment; import com.jogamp.graph.ui.layout.BoxLayout; -import com.jogamp.graph.ui.layout.GridLayout; import com.jogamp.graph.ui.shapes.Rectangle; import com.jogamp.math.Vec2f; import com.jogamp.math.Vec4f; @@ -50,7 +49,7 @@ public class TooltipShape extends Tooltip { * </p> * @param gl * @param renderer - * @param tip + * @param tip the user provided {@link Shape} as passed via {@link TooltipShape#TooltipShape(Vec4f, Vec4f, float, Vec2f, long, int, Shape, DestroyCallback)}. * @see TooltipShape#TooltipShape(Vec2f, long, Shape, DestroyCallback) * @see TooltipShape#createTip(GLAutoDrawable, Scene, PMVMatrix4f, AABBox) */ @@ -106,8 +105,9 @@ public class TooltipShape extends Tooltip { final float h = toolMvBounds.getHeight()*scale.y(); final Group g = new Group(new BoxLayout(w, h, Alignment.FillCenter)); - g.addShape(new Rectangle(renderModes, 1*w/h, 1, 0).setColor(backColor).setBorder(borderThickness).setBorderColor(frontColor)); - g.addShape(tip.move(0, 0, zEps)); // above back + g.addShape(new Rectangle(renderModes, 1*w/h, 1, 0).setColor(backColor).setBorder(borderThickness).setBorderColor(frontColor).move(0, 0, -zEps)); + g.setName("TooltipShapeGroup"); + g.addShape(tip); g.setInteractive(false); final Vec2f pos = getTipMvPosition(scene, toolMvBounds, w, h); @@ -115,11 +115,15 @@ public class TooltipShape extends Tooltip { return g; } @Override - public void destroyTip(final GL2ES2 gl, final RegionRenderer renderer, final Shape tip) { + public void destroyTip(final GL2ES2 gl, final RegionRenderer renderer, final Shape tipGroup) { if( null != dtorCallback ) { + // Remove user tip from our layout group first and dtor our group + // This allows the user to receive its own passed tip + ((Group)tipGroup).removeShape(tip); + tipGroup.destroy(gl, renderer); dtorCallback.destroyTip(gl, renderer, tip); } else { - super.destroyTip(gl, renderer, tip); + super.destroyTip(gl, renderer, tipGroup); } } } |