platform.touch().onTouchStart(touches); platform.pointer().onPointerStart( new Pointer.Event.Impl(flags, time, pointerEvent.x(), pointerEvent.y(), true)); break; case MotionEvent.ACTION_UP: platform.touch().onTouchEnd(touches); platform.pointer().onPointerEnd( new Pointer.Event.Impl(flags, time, pointerEvent.x(), pointerEvent.y(), true)); break; case MotionEvent.ACTION_POINTER_DOWN: platform.touch().onTouchMove(touches); platform.pointer().onPointerDrag( new Pointer.Event.Impl(flags, time, pointerEvent.x(), pointerEvent.y(), true)); break; case MotionEvent.ACTION_CANCEL: platform.touch().onTouchCancel(touches); platform.pointer().onPointerCancel( new Pointer.Event.Impl(flags, time, pointerEvent.x(), pointerEvent.y(), true)); break;
platform.touch().onTouchStart(touches); platform.pointer().onPointerStart( new Pointer.Event.Impl(flags, time, pointerEvent.x(), pointerEvent.y(), true)); break; case MotionEvent.ACTION_UP: platform.touch().onTouchEnd(touches); platform.pointer().onPointerEnd( new Pointer.Event.Impl(flags, time, pointerEvent.x(), pointerEvent.y(), true)); break; case MotionEvent.ACTION_POINTER_DOWN: platform.touch().onTouchMove(touches); platform.pointer().onPointerDrag( new Pointer.Event.Impl(flags, time, pointerEvent.x(), pointerEvent.y(), true)); break; case MotionEvent.ACTION_CANCEL: platform.touch().onTouchCancel(touches); platform.pointer().onPointerCancel( new Pointer.Event.Impl(flags, time, pointerEvent.x(), pointerEvent.y(), true)); break;
private Event.Impl toPointerEvent(NSSet<UITouch> touches, UIEvent event) { for (UITouch touch : touches) { long handle = touch.getHandle(); // if we have an active touch, we only care about that touch if (_active == 0 || handle == _active) { _active = handle; CGPoint loc = touch.getLocationInView(touch.getView()); // transform the point based on our current scale IPoint xloc = platform.graphics().transformTouch((float)loc.getX(), (float)loc.getY()); return new Event.Impl( new Events.Flags.Impl(), touch.getTimestamp() * 1000, xloc.x(), xloc.y(), true); } } return null; }
void onMouseDown(double time, float x, float y) { onPointerStart(new Event.Impl(new Events.Flags.Impl(), time, x, y, false), false); mouseDown = true; }
void onMouseDown(double time, float x, float y) { onPointerStart(new Event.Impl(new Events.Flags.Impl(), time, x, y, false), false); mouseDown = true; }
void onMouseUp(double time, float x, float y) { onPointerEnd(new Event.Impl(new Events.Flags.Impl(), time, x, y, false), false); mouseDown = false; }
void onMouseUp(double time, float x, float y) { onPointerEnd(new Event.Impl(new Events.Flags.Impl(), time, x, y, false), false); mouseDown = false; }
private Event.Impl eventFromTouch(final Element rootElement, Touch touch) { float x = touch.getRelativeX(rootElement), y = touch.getRelativeY(rootElement); Point xy = platform.graphics().transformMouse(x, y); return new Event.Impl(new Events.Flags.Impl(), PlayN.currentTime(), xy.x, xy.y, true); } }
@Override public void cancelLayerDrags() { if (active.layer != null) { Event.Impl event = new Event.Impl(new Events.Flags.Impl(), PlayN.currentTime(), 0, 0, false); event.captureState = active; dispatcher.dispatch(Listener.class, event, CANCEL, null); active.clear(); } }
void onMouseMove(double time, float x, float y) { if (mouseDown) { onPointerDrag(new Event.Impl(new Events.Flags.Impl(), time, x, y, false), false); } }
private Event.Impl eventFromMouse(final Element rootElement, NativeEvent nativeEvent) { float x = HtmlInput.getRelativeX(nativeEvent, rootElement); float y = HtmlInput.getRelativeY(nativeEvent, rootElement); Point xy = platform.graphics().transformMouse(x, y); return new Event.Impl(new Events.Flags.Impl(), PlayN.currentTime(), xy.x, xy.y, false); }
@Override public Event.Impl localize(Layer hit) { Event.Impl impl = new Event.Impl(hit, flags(), time(), x(), y(), isTouch()); impl.captureState = captureState; return impl; }
void onMouseMove(double time, float x, float y) { if (mouseDown) { onPointerDrag(new Event.Impl(new Events.Flags.Impl(), time, x, y, false), false); } }