From a9910af82c46b0ea918f65444c87d130a684a103 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 19 Mar 2023 08:07:45 +0100 Subject: Graph UI Shape: Fix setTransform(): Take back unscaled-center 1st, then add back later (scaled); TODO: Add alignment features --- src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/graphui/classes/com/jogamp/graph/ui/gl') diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java index 626e25beb..a42453b5a 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java @@ -392,8 +392,8 @@ public abstract class Shape { */ public void setTransform(final PMVMatrix pmv) { final float[] uiTranslate = getPosition(); - pmv.glTranslatef(uiTranslate[0], uiTranslate[1], uiTranslate[2]); - + final float[] ctr = box.getCenter(); + pmv.glTranslatef(uiTranslate[0]-ctr[0], uiTranslate[1]-ctr[1], uiTranslate[2]-ctr[2]); // translate less unscaled-center final Quaternion quat = getRotation(); final boolean rotate = !quat.isIdentity(); final float[] uiScale = getScale(); @@ -414,6 +414,8 @@ public abstract class Shape { pmv.glTranslatef(-rotOrigin[0], -rotOrigin[1], -rotOrigin[2]); } } + // TODO: Add alignment features + pmv.glTranslatef(ctr[0], ctr[1], ctr[2]); // add-back center, scaled } /** -- cgit v1.2.3