aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2011-10-07 20:04:41 +0200
committerSven Gothel <sgothel@jausoft.com>2011-10-07 20:04:41 +0200
commit00a55caad191db3bda63779058fe49086d5c38cf (patch)
tree7c63ed41297f48d39322ef435e5e87c5bebd877c /src/test/com/jogamp/opengl
parente3441bccf296927549d41e6472cca8c03259f8f3 (diff)
parentfe8e357ac03d8dd5e244879647fcec7fca60dedc (diff)
Merge remote-tracking branch 'remotes/rsantina/master'
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
index 540aade38..5abc181a8 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
@@ -360,7 +360,8 @@ public class GPUUISceneGLListener0A implements GLEventListener {
}
private class MultiTouchListener extends MouseAdapter {
- int lv = 0;
+ int lx = 0;
+ int ly = 0;
boolean first = false;
@@ -378,30 +379,38 @@ public class GPUUISceneGLListener0A implements GLEventListener {
public void mouseDragged(MouseEvent e) {
System.err.println("demo:mousedragged "+e);
if(e.getPointerCount()==2) {
- // 2 finger zoom ..
+ // 2 pointers zoom ..
if(first) {
- lv = Math.abs(e.getY(0)-e.getY(1));
+ lx = Math.abs(e.getY(0)-e.getY(1));
first=false;
return;
}
int nv = Math.abs(e.getY(0)-e.getY(1));
- int dy = nv - lv;
+ int dy = nv - lx;
zoom += 2 * Math.signum(dy);
- lv = nv;
+ lx = nv;
} else {
- // 1 finger drag
+ // 1 pointer drag
if(first) {
- lv = e.getX();
+ lx = e.getX();
+ ly = e.getY();
first=false;
return;
}
- int nv = e.getX();
- int dx = nv - lv;
- xTran += Math.signum(dx);
-
- lv = nv;
+ int nx = e.getX();
+ int ny = e.getY();
+ int dx = nx - lx;
+ int dy = ny - ly;
+ if(Math.abs(dx) > Math.abs(dy)){
+ xTran += Math.signum(dx);
+ }
+ else {
+ yTran -= Math.signum(dy);
+ }
+ lx = nx;
+ ly = ny;
}
}
}