diff options
author | Sven Gothel <[email protected]> | 2011-09-28 17:20:06 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-28 17:20:06 +0200 |
commit | 6f30ddc41a71343220c7b1d14c31cdad6fbea907 (patch) | |
tree | 453d17583714ed3598dd2a1a11b68f1e3b110fe9 /src/newt/classes/com | |
parent | 7fe2ec7b57d76f5b0e45a2382cb374073758cecc (diff) |
NEWT/Android: Send MouseClicked event, MouseEvent enhancement, Demo: real 2 finger zoom
MouseEvent: Check array sizes at cstr. Enhance 'toString()', pointer arrays added.
GPUUISceneGLListener0A now uses 2 finger distance for zoom
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/event/MouseEvent.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index 62a8941d7..2c12049c4 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java @@ -69,6 +69,11 @@ public class MouseEvent extends InputEvent super(eventType, source, when, modifiers); this.x = x; this.y = y; + if(pointerids.length != pressure.length || + pointerids.length != x.length || + pointerids.length != y.length) { + throw new IllegalArgumentException("All multiple pointer arrays must be of same size"); + } this.pressure = pressure; this.pointerids = pointerids; this.clickCount=clickCount; @@ -138,10 +143,25 @@ public class MouseEvent extends InputEvent } public String toString() { - return "MouseEvent["+getEventTypeString(getEventType())+ - ", "+x+"/"+y+", button "+button+", count "+clickCount+ - ", wheel rotation "+wheelRotation+ - ", "+super.toString()+"]"; + StringBuffer sb = new StringBuffer(); + sb.append("MouseEvent[").append(getEventTypeString(getEventType())) + .append(", ").append(x).append("/").append(y) + .append(", button ").append(button).append(", count ") + .append(clickCount).append(", wheel rotation ").append(wheelRotation); + if(pointerids.length>0) { + sb.append(", pointer<").append(pointerids.length).append(">["); + for(int i=0; i<pointerids.length; i++) { + if(i>0) { + sb.append(", "); + } + sb.append(pointerids[i]).append(": ") + .append(x[i]).append(" / ").append(y[i]).append(" ") + .append(pressure[i]).append("p"); + } + sb.append("]"); + } + sb.append(", ").append(super.toString()).append("]"); + return sb.toString(); } public static String getEventTypeString(int type) { |