diff options
author | Sven Gothel <[email protected]> | 2023-12-18 02:34:17 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-12-18 02:34:17 +0100 |
commit | 8b30ea9859fb1a1e9d1a373a0e355748b9a7c8ef (patch) | |
tree | 58b42d390c25c384cf9ad57565ede90723fb5f5d /src/graphui/classes/com/jogamp | |
parent | b7f8a70674e36a8c324f91d0f73f89667c3c8300 (diff) |
GraphUI Shape: Rename [set|is]{Enabled -> Visible}(..) for clarity
Note that invisible shapes are still considered for picking/activation.
To completely mute the shape, issue {@link #setInteractive(boolean)} as well.
Diffstat (limited to 'src/graphui/classes/com/jogamp')
5 files changed, 20 insertions, 14 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java b/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java index b17399a01..f28c8984e 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java +++ b/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java @@ -737,9 +737,9 @@ public class AnimGroup extends Group { pos.add( p_t.normalize().scale( dxy ) ); } if( clip.intersects2DRegion(pos.x(), pos.y(), sd.shape.getScaledWidth(), sd.shape.getScaledHeight()) ) { - sd.shape.setEnabled(true); + sd.shape.setVisible(true); } else { - sd.shape.setEnabled(false); + sd.shape.setVisible(false); } sd.shape.moveTo(pos); return true; diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java index aa5079b02..e5f98d164 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Group.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java @@ -219,7 +219,7 @@ public class Group extends Shape implements Container { final int shapeCount = shapesS.length; for(int i=0; i<shapeCount; i++) { final Shape shape = (Shape) shapesS[i]; - if( shape.isEnabled() ) { + if( shape.isVisible() ) { pmv.pushMv(); shape.setTransformMv(pmv); @@ -319,12 +319,12 @@ public class Group extends Shape implements Container { final int myRMs = Region.isVBAA(firstRMs) ? Region.VBAA_RENDERING_BIT : 0; border = new Rectangle(myRMs, box, getBorderThickness()); } else { - border.setEnabled(true); + border.setVisible(true); border.setBounds(box, getBorderThickness()); } border.setColor(getBorderColor()); } else if( null != border ) { - border.setEnabled(false); + border.setVisible(false); } } } diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java index e35ce5c31..ea5e98b84 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java @@ -489,7 +489,7 @@ public final class Scene implements Container, GLEventListener { // final Shape shape = shapes.get(i); final Shape shape = (Shape)shapes[i]; // System.err.println("Id "+i+": "+uiShape); - if( shape.isEnabled() ) { + if( shape.isVisible() ) { pmv.pushMv(); shape.setTransformMv(pmv); diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java index a80f07403..7f218fcbe 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java @@ -165,7 +165,7 @@ public abstract class Shape { private int id = -1; private String name = "noname"; - private static final int IO_ENABLED = 1 << 0; + private static final int IO_VISIBLE = 1 << 0; private static final int IO_INTERACTIVE = 1 << 1; private static final int IO_ACTIVABLE = 1 << 2; private static final int IO_TOGGLEABLE = 1 << 3; @@ -179,7 +179,7 @@ public abstract class Shape { private static final int IO_IN_MOVE = 1 << 11; private static final int IO_IN_RESIZE_BR = 1 << 12; private static final int IO_IN_RESIZE_BL = 1 << 13; - private volatile int ioState = IO_DRAGGABLE | IO_RESIZABLE | IO_INTERACTIVE | IO_ACTIVABLE | IO_ENABLED; + private volatile int ioState = IO_DRAGGABLE | IO_RESIZABLE | IO_INTERACTIVE | IO_ACTIVABLE | IO_VISIBLE; private final boolean isIO(final int mask) { return mask == ( ioState & mask ); } private final Shape setIO(final int mask, final boolean v) { if( v ) { ioState |= mask; } else { ioState &= ~mask; } return this; } @@ -219,10 +219,16 @@ public abstract class Shape { /** Returns true if this shape denotes a container, e.g. {@link Group}, otherwise false. */ public boolean isContainer() { return false; } - /** Returns true if this shape is enabled and hence visible, otherwise false. */ - public final boolean isEnabled() { return isIO(IO_ENABLED); } - /** Enable or disable this shape, i.e. its visibility. */ - public final Shape setEnabled(final boolean v) { return setIO(IO_ENABLED, v); } + /** Returns true if this shape is visible, otherwise false. */ + public final boolean isVisible() { return isIO(IO_VISIBLE); } + /** + * Enable or disable this shape's visibility. + * <p> + * Note that invisible shapes are still considered for picking/activation. + * To completely mute the shape, issue {@link #setInteractive(boolean)} as well. + * </p> + */ + public final Shape setVisible(final boolean v) { return setIO(IO_VISIBLE, v); } /** * Sets the padding for this shape, which is included in {@link #getBounds()B} and also includes the border. Default is zero. @@ -1170,7 +1176,7 @@ public abstract class Shape { final String bs = hasBorder() ? "border[l "+getBorderThickness()+", c "+getBorderColor()+"], " : ""; final String idS = -1 != id ? ", id "+id : ""; final String nameS = "noname" != name ? ", '"+name+"'" : ""; - return getDirtyString()+idS+nameS+", enabled "+isIO(IO_ENABLED)+activeS+", toggle "+isIO(IO_TOGGLE)+ + return getDirtyString()+idS+nameS+", visible "+isIO(IO_VISIBLE)+activeS+", toggle "+isIO(IO_TOGGLE)+ ", able[toggle "+isIO(IO_TOGGLEABLE)+", iactive "+isInteractive()+", resize "+isResizable()+", move "+this.isDraggable()+ "], pos["+position+"], "+pivotS+scaleS+rotateS+ ps+bs+"box"+box; diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java index f55bd927f..493135a14 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java @@ -69,7 +69,7 @@ public class GlyphShape extends GraphShape { this.glyph = glyph; this.origPos = new Vec3f(x, y, 0f); if( glyph.isNonContour() ) { - setEnabled(false); + setVisible(false); } final int[/*2*/] vertIndexCount = Region.countOutlineShape(glyph.getShape(), new int[2]); regionVertCount = vertIndexCount[0]; |