aboutsummaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-02-07 03:25:27 +0100
committerSven Göthel <[email protected]>2024-02-07 03:25:27 +0100
commit29697eaac78bdc0c1a6cfb8547516c614dc1db8e (patch)
treec3fc6ca20df251aa150022c7b519d6a12f0053dc /src/demos
parent5bacb8e6887b55ab2053dc5ed76bebcc0743a45e (diff)
GraphUI Shape: Add MouseEvent to MoveListener; RangeSlider: Add rel obj position + NEWT MouseEvent to listener, renamed {Slider->Change}Listener and add PeekListener for mouse-over events
Diffstat (limited to 'src/demos')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java32
4 files changed, 15 insertions, 23 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
index 4839f6a83..dd10bc822 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
@@ -291,7 +291,7 @@ public class FontView01 {
new SliderParam( new Vec2f(glyphGridCellSize/4f, glyphGridSize.y()), glyphGridCellSize/10f, true ) );
glyphView.getVertSlider().setColor(0.3f, 0.3f, 0.3f, 0.7f).setName("GlyphView");
if( VERBOSE_UI ) {
- glyphView.getVertSlider().addSliderListener((final RangeSlider w, final float old_val, final float val, final float old_val_pct, final float val_pct) -> {
+ glyphView.getVertSlider().addChangeListener((final RangeSlider w, final float old_val, final float val, final float old_val_pct, final float val_pct, Vec3f pos, MouseEvent e) -> {
final Vec2f minmax = w.getMinMax();
final float row_f = val / glyphGridCellSize;
System.err.println("VertSlider: row["+row_f+".."+(row_f+gridDim.rowsPerPage-1)+"]/"+gridDim.rows+
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java
index f9949e70c..ad9e6c93c 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java
@@ -287,7 +287,7 @@ public class UIMediaGrid01 {
mediaView.getVertSlider().setColor(0.3f, 0.3f, 0.3f, 0.7f).setName("MediaView");
// mediaView.setRelayoutOnDirtyShapes(false); // avoid group re-validate to ease load in Group.isShapeDirty() w/ thousands of glyphs
if( VERBOSE_UI ) {
- mediaView.getVertSlider().addSliderListener((final RangeSlider w, final float old_val, final float val, final float old_val_pct, final float val_pct) -> {
+ mediaView.getVertSlider().addChangeListener((final RangeSlider w, final float old_val, final float val, final float old_val_pct, final float val_pct, Vec3f pos, MouseEvent e) -> {
final Vec2f minmax = w.getMinMax();
final float row_f = val / mediaCellHeight;
System.err.println("VertSlider: row "+row_f+", val["+old_val+" -> "+val+"], pct["+(100*old_val_pct)+"% -> "+(100*val_pct)+"%], minmax "+minmax);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java
index ce81d360f..8fe4a04dd 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java
@@ -118,7 +118,7 @@ public class UISceneDemo10 {
scene.setPMVMatrixSetup(new MyPMVMatrixSetup());
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- shape.onMove((final Shape s, final Vec3f origin, final Vec3f dest) -> {
+ shape.onMove((final Shape s, final Vec3f origin, final Vec3f dest, MouseEvent e) -> {
final Vec3f p = shape.getPosition();
System.err.println("Shape moved: "+origin+" -> "+p);
} );
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
index 8e466dbe5..27dca8358 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -727,7 +727,7 @@ public class UISceneDemo20 implements GLEventListener {
}
});
- button.onMove((final Shape shape, final Vec3f origin, final Vec3f dest) -> {
+ button.onMove((final Shape shape, final Vec3f origin, final Vec3f dest, final MouseEvent e) -> {
final ALAudioSink aSink = alAudioSink[0];
if( null != aSink && aSink.getContext().isValid() ) {
setSoundPosition(shape, aSink.getContext(), aSink.getSource());
@@ -804,26 +804,18 @@ public class UISceneDemo20 implements GLEventListener {
System.err.println("Sine "+sineSound);
} } );
- final Shape.MoveListener setAudioPosition = new Shape.MoveListener() {
- @Override
- public void run(final Shape shape, final Vec3f origin, final Vec3f dest) {
- setSoundPosition(shape, aSink.getContext(), aSource);
- }
- };
- final Shape.ListenerBool initAudio = new Shape.ListenerBool() {
- @Override
- public boolean run(final Shape shape) {
- if( null != aSink && aSink.getContext().isValid() ) {
- initSound(shape, aSink.getContext(), aSource);
- System.err.println("Sine Audio: "+aSink);
- return true;
- } else {
- return false;
- }
+ button.onInit( (final Shape shape) -> {
+ if( null != aSink && aSink.getContext().isValid() ) {
+ initSound(shape, aSink.getContext(), aSource);
+ System.err.println("Sine Audio: "+aSink);
+ return true;
+ } else {
+ return false;
}
- };
- button.onInit( initAudio );
- button.onMove( setAudioPosition );
+ } );
+ button.onMove( (final Shape shape, final Vec3f origin, final Vec3f dest, final MouseEvent e) -> {
+ setSoundPosition(shape, aSink.getContext(), aSource);
+ } );
buttonsRight.addShape(button);
}
if( true ) {