From 6f30ddc41a71343220c7b1d14c31cdad6fbea907 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 28 Sep 2011 17:20:06 +0200 Subject: 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 --- .../classes/com/jogamp/newt/event/MouseEvent.java | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/newt/classes/com') 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; i0) { + 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) { -- cgit v1.2.3