aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphui/classes')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Tooltip.java12
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/TooltipText.java22
2 files changed, 20 insertions, 14 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Tooltip.java b/src/graphui/classes/com/jogamp/graph/ui/Tooltip.java
index fd0bb6c2c..c8ab813aa 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Tooltip.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Tooltip.java
@@ -56,8 +56,8 @@ public abstract class Tooltip {
private Shape tool;
/** Graph's {@link Region} render modes, see {@link GLRegion#create(GLProfile, int, TextureSequence) create(..)}. */
protected final int renderModes;
- protected final Vec4f backColor = new Vec4f(1, 1, 0, 1);
- protected final Vec4f frontColor = new Vec4f(0.1f, 0.1f, 0.1f, 1);
+ protected final Vec4f backColor = new Vec4f(0.9f, 0.9f, 0.9f, 0.9f);
+ protected final Vec4f frontColor = new Vec4f(0.1f, 0.1f, 0.1f, 0.9f);
@Override
public String toString() {
@@ -65,8 +65,8 @@ public abstract class Tooltip {
}
/**
*
- * @param backColor optional HUD tip background color
- * @param frontColor optional HUD tip front color
+ * @param backColor optional HUD tip background color, if null a slightly transparent light-grey background is used
+ * @param frontColor optional HUD tip front color, if null an slightly transparent almost-black is used
* @param delayMS delay until HUD tip is visible after timer start (mouse moved), zero implies no time based alarm
* @param renderModes Graph's {@link Region} render modes, see {@link GLRegion#create(GLProfile, int, TextureSequence) create(..)}.
*/
@@ -159,8 +159,8 @@ public abstract class Tooltip {
} else {
pos.setX( sceneAABox.getLow().x() );
}
- if( toolMvBounds.getHigh().y() + tipHeight <= sceneAABox.getHigh().y() ) {
- pos.setY( toolMvBounds.getHigh().y() );
+ if( toolMvBounds.getCenter().y() + tipHeight <= sceneAABox.getHigh().y() ) {
+ pos.setY( toolMvBounds.getCenter().y() );
} else if( toolMvBounds.getHigh().y() >= tipHeight ) {
pos.setY( toolMvBounds.getHigh().y() - tipHeight );
} else {
diff --git a/src/graphui/classes/com/jogamp/graph/ui/TooltipText.java b/src/graphui/classes/com/jogamp/graph/ui/TooltipText.java
index 77386d224..b02c420cf 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/TooltipText.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/TooltipText.java
@@ -27,6 +27,7 @@
*/
package com.jogamp.graph.ui;
+import com.jogamp.common.util.StringUtil;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.font.Font;
@@ -39,7 +40,7 @@ import com.jogamp.math.util.PMVMatrix4f;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLProfile;
-/** A HUD text {@link Tooltip} for {@link Shape}, see {@link Shape#setToolTip(Tooltip)}. */
+/** A round {@link Button HUD text} {@link Tooltip} for {@link Shape}, see {@link Shape#setToolTip(Tooltip)}. */
public class TooltipText extends Tooltip {
/** Text of this tooltip */
private final CharSequence tipText;
@@ -67,7 +68,7 @@ public class TooltipText extends Tooltip {
}
/**
* Ctor of {@link TooltipText} using {@link Tooltip#DEFAULT_DELAY}, {@link Region#VBAA_RENDERING_BIT}
- * and a slightly transparent yellow background with an almost black opaque text color.
+ * and a slightly transparent light-grey background with an slightly transparent almost-black text color.
* @param tipText HUD tip text
* @param tipFont HUD tip font
* @param scaleY HUD tip vertical scale against tool height
@@ -86,9 +87,14 @@ public class TooltipText extends Tooltip {
final AffineTransform tempT1 = new AffineTransform();
final AffineTransform tempT2 = new AffineTransform();
final AABBox tipBox_em = tipFont.getGlyphBounds(tipText, tempT1, tempT2);
-
- float h = toolMvBounds.getHeight() * scaleY;
- float w = tipBox_em.getWidth() * h / tipBox_em.getHeight();
+ final float dys;
+ {
+ // lineHeight = tipBox_em.getHeight() / StringUtil.getLineCount(tipText);
+ final float totalH = tipBox_em.getHeight() * ( 1 + 0.5f/StringUtil.getLineCount(tipText) );
+ dys = totalH / tipBox_em.getHeight() - 1;
+ }
+ float h = toolMvBounds.getHeight() * scaleY * ( 1 + dys );
+ float w = ( tipBox_em.getWidth() * h / tipBox_em.getHeight() ) * ( 1 - dys );
if( w > sceneAABox.getWidth() * 0.9f) {
w = sceneAABox.getWidth() * 0.9f;
h = tipBox_em.getHeight() * w / tipBox_em.getWidth();
@@ -99,13 +105,13 @@ public class TooltipText extends Tooltip {
final Vec2f pos = getTipMvPosition(scene, toolMvBounds, w, h);
final Button ntip = (Button) new Button(renderModes, tipFont, tipText, w, h, zEps)
- .setPerp()
.moveTo(pos.x(), pos.y(), 100*zEps)
.setColor(backColor)
- // .setBorder(0.05f).setBorderColor(0, 0, 0, 1)
+ // .setBorder(0.05f).setBorderColor(0, 0, 0, 0.5f)
.setInteractive(false);
ntip.setLabelColor(frontColor);
- ntip.setSpacing(0.10f, 0.10f);
+ ntip.setSpacing(0.075f, dys);
+ ntip.setCorner(0.75f);
return ntip;
}
}