/** * Gets the layer underneath the given screen coordinates, ignoring hit testers. This is * useful for inspecting the scene graph for debugging purposes, and is not intended for use * is shipped code. The layer returned is the one that has a size and is the deepest within * the graph and contains the coordinate. */ public static Layer.HasSize layerUnderPoint (float x, float y) { GroupLayer root = PlayN.graphics().rootLayer(); Point p = new Point(x, y); root.transform().inverseTransform(p, p); p.x += root.originX(); p.y += root.originY(); return layerUnderPoint(root, p); }
public void onTouchStart(Event.Impl[] touches) { if (!enabled) return; if (listener != null) listener.onTouchStart(touches); GroupLayer root = PlayN.graphics().rootLayer(); if (root.interactive()) { for (Event.Impl event : touches) { Point p = new Point(event.x(), event.y()); root.transform().inverseTransform(p, p); p.x += root.originX(); p.y += root.originY(); AbstractLayer hitLayer = (AbstractLayer)root.hitTest(p); if (hitLayer != null) { activeLayers.put(event.id(), hitLayer); dispatcher.dispatch(hitLayer, LayerListener.class, event, START); } } } }
protected boolean onMouseDown(ButtonEvent.Impl event) { if (!enabled) return false; event.flags().setPreventDefault(false); if (listener != null) { listener.onMouseDown(event); } GroupLayer root = PlayN.graphics().rootLayer(); if (root.interactive()) { Point p = new Point(event.x(), event.y()); root.transform().inverseTransform(p, p); p.x += root.originX(); p.y += root.originY(); activeLayer = (AbstractLayer)root.hitTest(p); if (activeLayer != null) { dispatcher.dispatch(activeLayer, LayerListener.class, event, DOWN); } } return event.flags().getPreventDefault(); }
protected boolean onPointerStart(Event.Impl event, boolean preventDefault) { if (!enabled) return preventDefault; event.flags().setPreventDefault(preventDefault); if (listener != null) { listener.onPointerStart(event); } GroupLayer root = PlayN.graphics().rootLayer(); if (root.interactive()) { Point p = new Point(event.x(), event.y()); root.transform().inverseTransform(p, p); p.x += root.originX(); p.y += root.originY(); active.layer = (AbstractLayer)root.hitTest(p); if (active.layer != null) { event.captureState = active; dispatcher.dispatch(Listener.class, event, START, CANCEL); } } return event.flags().getPreventDefault(); }
if (root.interactive()) { Point p = new Point(event.x(), event.y()); root.transform().inverseTransform(p, p); p.x += root.originX(); p.y += root.originY();