protected int[] getCoordinates(GwtEvent<? extends EventHandler> event) { if (event instanceof TouchEvent) { return getPositionInTouch((TouchEvent<? extends EventHandler>) event); } else if (event instanceof MouseEvent) { MouseEvent<? extends EventHandler> me = (MouseEvent<? extends EventHandler>) event; return new int[] {me.getRelativeX(canvas.getElement()), me.getRelativeY(canvas.getElement())}; } return null; }
private Point getMousePosition(MouseEvent event) { int x = event.getRelativeX(this.canvas.getElement()); int y = event.getRelativeY(this.canvas.getElement()); return new Point(x, y); }