List of usage examples for com.google.gwt.event.dom.client TouchEvent getTargetTouches
public JsArray<Touch> getTargetTouches()
From source file:nl.mpi.tg.eg.experiment.client.view.ColourPickerCanvasView.java
License:Open Source License
private void setColour(TouchEvent event, Canvas targetCanvas, VerticalPanel targetPanel) { if (event.getTouches().length() > 0) { final JsArray<Touch> touches = event.getTargetTouches(); if (touches.length() > 0) { Touch touch = touches.get(0); setColour(touch.getRelativeX(targetCanvas.getElement()), touch.getRelativeY(targetCanvas.getElement()), targetCanvas, targetPanel); }/*from w w w.j ava 2 s .c o m*/ } }
From source file:nl.mpi.tg.eg.experiment.client.view.ColourPickerCanvasView.java
License:Open Source License
private void setHue(TouchEvent event, Canvas targetCanvas) { if (event.getTouches().length() > 0) { final JsArray<Touch> touches = event.getTargetTouches(); if (touches.length() > 0) { Touch touch = touches.get(0); setHue(touch.getRelativeX(targetCanvas.getElement()), touch.getRelativeY(targetCanvas.getElement()), targetCanvas);// w w w . java 2 s. c o m } } }
From source file:org.geomajas.gwt2.client.controller.TouchNavigationController.java
License:Open Source License
/** * Method used to calculate exact middle point between multiple touches of a touch events. * * @param event a touch event// w w w .j a va2s. co m * @return middle point */ protected Coordinate getMidPoint(TouchEvent<?> event) { Coordinate[] coords = new Coordinate[event.getTouches().length()]; for (int i = 0; i < event.getTargetTouches().length(); i++) { coords[i] = new Coordinate(event.getTouches().get(i).getClientX(), event.getTouches().get(i).getClientY()); } double x = 0; double y = 0; for (Coordinate coord : coords) { x += coord.getX(); y += coord.getY(); } x /= coords.length; y /= coords.length; return new Coordinate(x, y); }
From source file:org.geomajas.puregwt.client.controller.TouchNavigationController.java
License:Open Source License
/** * Method used to calculate exact middle point between multiple touches of a touch events. * /* ww w . jav a 2 s . com*/ * @param event a touch event * @return middle point */ private Coordinate getMidPoint(TouchEvent<?> event) { Coordinate[] coords = new Coordinate[event.getTouches().length()]; for (int i = 0; i < event.getTargetTouches().length(); i++) { coords[i] = new Coordinate(event.getTouches().get(i).getClientX(), event.getTouches().get(i).getClientY()); } double x = 0; double y = 0; for (Coordinate coord : coords) { x += coord.getX(); y += coord.getY(); } x /= coords.length; y /= coords.length; return new Coordinate(x, y); }