From d6fbb827781a349892d215c6854202f6f24f78e5 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 28 Mar 2023 02:50:46 +0200 Subject: GraphUI: Label: Enforce bottom-left origin @ 0/0 for good drag-zoom experience (working sticky edge) --- src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/graphui/classes/com/jogamp/graph/ui') 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); } -- cgit v1.2.3