From 06b9e84c635cffc4a51beb6a38b5f5c111edcb7f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 17 Sep 2023 01:38:51 +0200 Subject: GraphUI Layout: Remove unused leftover var and complete GridLayout ctor --- .../classes/com/jogamp/graph/ui/layout/BoxLayout.java | 1 - .../classes/com/jogamp/graph/ui/layout/GridLayout.java | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/graphui/classes/com') 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 340060e02..67f3ff445 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java +++ b/src/graphui/classes/com/jogamp/graph/ui/layout/BoxLayout.java @@ -172,7 +172,6 @@ public class BoxLayout implements Group.Layout { @Override public void layout(final Group g, final AABBox box, final PMVMatrix pmv) { - final Vec3f zeroVec3 = new Vec3f(); final boolean hasCellWidth = !FloatUtil.isZero(cellSize.x()); final boolean hasCellHeight = !FloatUtil.isZero(cellSize.y()); final boolean isCenteredHoriz = hasCellWidth && alignment.isSet(Alignment.Bit.CenterHoriz); 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 50f847df4..e4fd2d6c7 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java +++ b/src/graphui/classes/com/jogamp/graph/ui/layout/GridLayout.java @@ -108,6 +108,17 @@ public class GridLayout implements Group.Layout { this(alignment, Math.max(1, column_limit), -1, cellWidth, cellHeight, gap, padding); } + /** + * Default layout order of {@link Group#getShapes()}} is {@link Order#ROW}. + * @param cellWidth + * @param cellHeight + * @param alignment TODO + * @param row_limit [1..inf) + */ + public GridLayout(final float cellWidth, final float cellHeight, final Alignment alignment, final int row_limit) { + this(alignment, -1, Math.max(1, row_limit), cellWidth, cellHeight, new Gap(), null); + } + /** * Default layout order of {@link Group#getShapes()}} is {@link Order#ROW}. * @param cellWidth @@ -170,7 +181,6 @@ public class GridLayout implements Group.Layout { @Override public void layout(final Group g, final AABBox box, final PMVMatrix pmv) { - final Vec3f zeroVec3 = new Vec3f(); final boolean hasCellWidth = !FloatUtil.isZero(cellSize.x()); final boolean hasCellHeight = !FloatUtil.isZero(cellSize.y()); final boolean isCenteredHoriz = hasCellWidth && alignment.isSet(Alignment.Bit.CenterHoriz); @@ -185,7 +195,7 @@ public class GridLayout implements Group.Layout { col_count = (int) Math.ceil( (double)shapes.size() / (double)row_limit ); } if( TRACE_LAYOUT ) { - System.err.println("gl.00: "+order+", "+col_count+" x "+row_count+", a "+alignment+", shapes "+shapes.size()+", "+gap); + System.err.println("gl.00: "+order+", "+col_count+" x "+row_count+", a "+alignment+", shapes "+shapes.size()+", "+gap+", "+box); } int col_i = 0, row_i = 0; float x=0, y=0; -- cgit v1.2.3