diff options
author | Sven Gothel <[email protected]> | 2013-03-24 07:08:42 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-03-24 07:08:42 +0100 |
commit | ded080fd890c21b54ba1f96d84f9e355711dc88a (patch) | |
tree | ba90a80580cf26b17731690d37ffae68da0b32e1 /src/test/com/jogamp | |
parent | 654a678bd7171e81ec947cafa854dad366f5041e (diff) |
Newt/MouseEvent: Add 'float[3] getRotation()', getWheelScale() -> getRotationScale(), refinement of commit 18cb57246372eda72c25a5cd9a69a873bdf09489
Turns out the 'wheel' semantics are not generic enough and confining rotation values
to one axis only satisfies the traditional mouse wheel.
Widen the definition of 'rotation' and delivering 3-axis if supported.
On NEWT/Android, we deliver the 2-axis for example, allowing to rotate around both
or scrolling using both directions (-> GearsES2).
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index c239a949b..06635f2d5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -420,23 +420,16 @@ public class GearsES2 implements GLEventListener { @Override public void mouseWheelMoved(MouseEvent e) { - float r = e.getWheelRotation() * 0.5f; + float[] rot = e.getRotation(); if( e.isControlDown() ) { // alternative zoom - panZ += r; - if( e.isShiftDown() ) { - panZ += r; - } - System.err.println("panZ.2: incr "+r+", dblZoom "+e.isShiftDown()+" -> "+panZ); + final float incr = e.isShiftDown() ? rot[0] : rot[1] * 0.5f ; + panZ += incr; + System.err.println("panZ.2: incr "+incr+", dblZoom "+e.isShiftDown()+" -> "+panZ); } else { // panning - if( e.isShiftDown() ) { - // horizontal - panX -= r; // positive -> left - } else { - // vertical - panY += r; // positive -> up - } + panX -= rot[0]; // positive -> left + panY += rot[1]; // positive -> up } } |