diff options
author | Sven Gothel <[email protected]> | 2023-03-19 08:07:45 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-19 08:07:45 +0100 |
commit | a9910af82c46b0ea918f65444c87d130a684a103 (patch) | |
tree | ea5a4556e553fe9f7b609ee6801950e2a0879459 /src/graphui/classes/com | |
parent | 32f7a476770d0a4ef853eab8f3c78a7ea801a180 (diff) |
Graph UI Shape: Fix setTransform(): Take back unscaled-center 1st, then add back later (scaled); TODO: Add alignment features
Diffstat (limited to 'src/graphui/classes/com')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java | 6 |
1 files changed, 4 insertions, 2 deletions
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 } /** |