From 2a9382b4e5d0387bfd939fdbdf281b730b67ee9b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 26 Sep 2023 04:16:20 +0200 Subject: GraphUI GraphShape: Factor out static addRectangle(..) to be reused for debugging purposes --- src/graphui/classes/com/jogamp/graph/ui/GraphShape.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java index 971136ec8..333b1c150 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java @@ -37,6 +37,7 @@ import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.ui.layout.Padding; import com.jogamp.math.Vec3f; import com.jogamp.math.Vec4f; +import com.jogamp.math.geom.AABBox; import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.texture.TextureSequence; @@ -238,7 +239,8 @@ public abstract class GraphShape extends Shape { addShapeToRegion(glp, gl); // calls updateGLRegion(..) if( hasBorder() ) { // Also takes padding into account - addBorderOutline(); + addRectangle(region, oshapeSharpness, box, getPadding(), getBorderThickness(), getBorderColor()); + setRotationPivot( box.getCenter() ); } else if( hasPadding() ) { final Padding p = getPadding(); final Vec3f l = box.getLow(); @@ -253,9 +255,9 @@ public abstract class GraphShape extends Shape { } } - protected void addBorderOutline() { + static protected void addRectangle(final Region region, final float sharpness, final AABBox box, final Padding padding, final float borderThickness, final Vec4f color) { final OutlineShape shape = new OutlineShape(); - final Padding p = null != getPadding() ? getPadding() : new Padding(); + final Padding p = null != padding ? padding : new Padding(); final float x1 = box.getMinX() - p.left; final float x2 = box.getMaxX() + p.right; final float y1 = box.getMinY() - p.bottom; @@ -273,7 +275,7 @@ public abstract class GraphShape extends Shape { } { // Inner OutlineShape as Winding.CW. - final float dxy = getBorderThickness(); + final float dxy = borderThickness; shape.moveTo(x1+dxy, y1+dxy, z); shape.lineTo(x1+dxy, y2-dxy, z); shape.lineTo(x2-dxy, y2-dxy, z); @@ -282,10 +284,9 @@ public abstract class GraphShape extends Shape { shape.closeLastOutline(true); } shape.setIsQuadraticNurbs(); - shape.setSharpness(oshapeSharpness); - region.addOutlineShape(shape, null, getBorderColor()); + shape.setSharpness(sharpness); + region.addOutlineShape(shape, null, color); box.resize(shape.getBounds()); // border <-> shape = padding, and part of shape size - setRotationPivot( box.getCenter() ); } protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { } -- cgit v1.2.3