diff options
author | Sven Gothel <[email protected]> | 2023-04-13 05:40:18 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-04-13 05:40:18 +0200 |
commit | c1ad62f886d135932280270933f14fe4433b84a9 (patch) | |
tree | 70d2fcdbbcecef7927c5a1aa81f730a6800f426e | |
parent | a832ea9863f4479085c46eb43f5c79c50b0dc518 (diff) |
GraphUI Shape: Add onClicked(..)
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/Shape.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java index 55dd5fa5c..9b32c0ee0 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java @@ -140,6 +140,7 @@ public abstract class Shape { private Listener onMoveListener = null; private Listener onToggleListener = null; + private Listener onClickedListener = null; public Shape() { this.box = new AABBox(); @@ -202,6 +203,7 @@ public abstract class Shape { public final void onMove(final Listener l) { onMoveListener = l; } public final void onToggle(final Listener l) { onToggleListener = l; } + public final void onClicked(final Listener l) { onClickedListener = l; } /** Move to scaled position. Position ends up in PMVMatrix unmodified. */ public final Shape moveTo(final float tx, final float ty, final float tz) { @@ -1072,6 +1074,9 @@ public abstract class Shape { switch( eventType ) { case MouseEvent.EVENT_MOUSE_CLICKED: toggle(); + if( null != onClickedListener ) { + onClickedListener.run(this); + } break; case MouseEvent.EVENT_MOUSE_PRESSED: dragFirst = true; |