diff options
Diffstat (limited to 'src/graphui/classes/com/jogamp')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java | 25 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java | 25 |
2 files changed, 44 insertions, 6 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java index c45fc3bb1..05e3189ae 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java +++ b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java @@ -250,14 +250,33 @@ public class BoxLayout implements Group.Layout { final float aY = y + dyh; s.moveTo( aX, aY, s.getPosition().z() ); - // Remove the bottom-left delta + // Remove the negative or positive delta on centered axis. + // Only remove negative offset of non-centered axis (i.e. underline) final Vec3f diffBL = new Vec3f(s.getBounds().getLow()); diffBL.setZ(0); - diffBL.scale(s.getScale()).scale(-1f); + if( isCenteredHoriz || isCenteredVert ) { + if( !isCenteredVert && diffBL.y() > 0 ) { + diffBL.setY(0); // only adjust negative if !center-vert + } else if( !isCenteredHoriz && diffBL.x() > 0 ) { + diffBL.setX(0); // only adjust negative if !center-horiz + } + diffBL.scale(s.getScale()).scale(-1f); + s.move( diffBL.scale(sxy) ); + } else if( diffBL.x() < 0 || diffBL.y() < 0 ) { + if( diffBL.x() > 0 ) { + diffBL.setX(0); + } + if( diffBL.y() > 0 ) { + diffBL.setY(0); + } + diffBL.scale(s.getScale()).scale(-1f); + s.move( diffBL.scale(sxy) ); + } else { + diffBL.set(0, 0, 0); + } if( TRACE_LAYOUT ) { System.err.println("bl("+i+").bl: sbox0 "+s.getBounds()+", diffBL_ "+diffBL); } - s.move( diffBL.scale(sxy) ); // resize bounds box.resize( x, y, sbox.getMinZ()); diff --git a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java index b6a7baf12..3afe093f3 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java +++ b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java @@ -324,14 +324,33 @@ public class GridLayout implements Group.Layout { final float aY = y + dyh; s.moveTo( aX, aY, s.getPosition().z() ); - // Remove the bottom-left delta + // Remove the negative or positive delta on centered axis. + // Only remove negative offset of non-centered axis (i.e. underline) final Vec3f diffBL = new Vec3f(s.getBounds().getLow()); diffBL.setZ(0); - diffBL.scale(s.getScale()).scale(-1f); + if( isCenteredHoriz || isCenteredVert ) { + if( !isCenteredVert && diffBL.y() > 0 ) { + diffBL.setY(0); // only adjust negative if !center-vert + } else if( !isCenteredHoriz && diffBL.x() > 0 ) { + diffBL.setX(0); // only adjust negative if !center-horiz + } + diffBL.scale(s.getScale()).scale(-1f); + s.move( diffBL.scale(sxy) ); + } else if( diffBL.x() < 0 || diffBL.y() < 0 ) { + if( diffBL.x() > 0 ) { + diffBL.setX(0); + } + if( diffBL.y() > 0 ) { + diffBL.setY(0); + } + diffBL.scale(s.getScale()).scale(-1f); + s.move( diffBL.scale(sxy) ); + } else { + diffBL.set(0, 0, 0); + } if( TRACE_LAYOUT ) { System.err.println("gl("+i+")["+col_i+"]["+row_i+"].bl: sbox0 "+s.getBounds()+", diffBL_ "+diffBL); } - s.move( diffBL.scale(sxy) ); // resize bounds box.resize( x, y, sbox.getMinZ()); |