aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-28 02:50:46 +0200
committerSven Gothel <[email protected]>2023-03-28 02:50:46 +0200
commitd6fbb827781a349892d215c6854202f6f24f78e5 (patch)
tree26e97fbf0b29a700d58a3d1d3df966465b14f8eb /src/graphui
parent5b86483177ec97b30cb82c337483be376e0a1a8e (diff)
GraphUI: Label: Enforce bottom-left origin @ 0/0 for good drag-zoom experience (working sticky edge)
Diffstat (limited to 'src/graphui')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java
index 5d45ffb9c..90094c361 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java
@@ -182,10 +182,11 @@ public class Label extends Shape {
@Override
protected void addShapeToRegion() {
+ AABBox fbox = font.getGlyphBounds(text, tempT2, tempT3);
tempT1.setToScale(fontScale, fontScale);
- final AABBox fbox = font.processString(glyphVisitor, tempT1, text, tempT2, tempT3);
- final float[] ctr = fbox.getCenter();
- setRotationOrigin( ctr[0], ctr[1], ctr[2]);
+ tempT1.translate(-fbox.getMinX(), -fbox.getMinY(), tempT2); // enforce bottom-left origin @ 0/0 for good drag-zoom experience
+ fbox = font.processString(glyphVisitor, tempT1, text, tempT2, tempT3);
+ setRotationPivot( fbox.getCenter() );
box.copy(fbox);
}