From ded080fd890c21b54ba1f96d84f9e355711dc88a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 24 Mar 2013 07:08:42 +0100 Subject: 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). --- .../opengl/test/junit/jogl/demos/es2/GearsES2.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/test/com') 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 } } -- cgit v1.2.3