From c1ad62f886d135932280270933f14fe4433b84a9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 13 Apr 2023 05:40:18 +0200 Subject: GraphUI Shape: Add onClicked(..) --- src/graphui/classes/com/jogamp/graph/ui/Shape.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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; -- cgit v1.2.3