/** Applies a touch moved event to the stage and returns true if an actor in the scene {@link Event#handle() handled} the * event. Only {@link InputListener listeners} that returned true for touchDown will receive this event. */ public boolean touchDragged (int screenX, int screenY, int pointer) { pointerScreenX[pointer] = screenX; pointerScreenY[pointer] = screenY; mouseScreenX = screenX; mouseScreenY = screenY; if (touchFocuses.size == 0) return false; screenToStageCoordinates(tempCoords.set(screenX, screenY)); InputEvent event = Pools.obtain(InputEvent.class); event.setType(Type.touchDragged); event.setStage(this); event.setStageX(tempCoords.x); event.setStageY(tempCoords.y); event.setPointer(pointer); SnapshotArray<TouchFocus> touchFocuses = this.touchFocuses; TouchFocus[] focuses = touchFocuses.begin(); for (int i = 0, n = touchFocuses.size; i < n; i++) { TouchFocus focus = focuses[i]; if (focus.pointer != pointer) continue; if (!touchFocuses.contains(focus, true)) continue; // Touch focus already gone. event.setTarget(focus.target); event.setListenerActor(focus.listenerActor); if (focus.listener.handle(event)) event.handle(); } touchFocuses.end(); boolean handled = event.isHandled(); Pools.free(event); return handled; }
/** Applies a touch moved event to the stage and returns true if an actor in the scene {@link Event#handle() handled} the * event. Only {@link InputListener listeners} that returned true for touchDown will receive this event. */ public boolean touchDragged (int screenX, int screenY, int pointer) { pointerScreenX[pointer] = screenX; pointerScreenY[pointer] = screenY; mouseScreenX = screenX; mouseScreenY = screenY; if (touchFocuses.size == 0) return false; screenToStageCoordinates(tempCoords.set(screenX, screenY)); InputEvent event = Pools.obtain(InputEvent.class); event.setType(Type.touchDragged); event.setStage(this); event.setStageX(tempCoords.x); event.setStageY(tempCoords.y); event.setPointer(pointer); SnapshotArray<TouchFocus> touchFocuses = this.touchFocuses; TouchFocus[] focuses = touchFocuses.begin(); for (int i = 0, n = touchFocuses.size; i < n; i++) { TouchFocus focus = focuses[i]; if (focus.pointer != pointer) continue; if (!touchFocuses.contains(focus, true)) continue; // Touch focus already gone. event.setTarget(focus.target); event.setListenerActor(focus.listenerActor); if (focus.listener.handle(event)) event.handle(); } touchFocuses.end(); boolean handled = event.isHandled(); Pools.free(event); return handled; }
/** * Removes an actor from this group. If the actor will not be used again and has actions, they should be * {@link Actor#clearActions() cleared} so the actions will be returned to their * {@link Action#setPool(com.badlogic.gdx.utils.Pool) pool}, if any. This is not done automatically. * <p> * Note that the direct parent of {@link DragPane}'s children is the internal pane's group accessible through * {@link #getGroup()} - and since this removal method is overridden and extended, pane's children should be deleted with * {@code dragPane.removeActor(child, true)} rather than {@link Actor#remove()} method. * @param unfocus if true, {@link Stage#unfocus(Actor)} is called. * @param actor will be removed, if present in the internal {@link WidgetGroup}. * @return true if the actor was removed from this group. */ @Override public boolean removeActor (final Actor actor, final boolean unfocus) { if (getActor().getChildren().contains(actor, true)) { // Stage input focus causes problems, as touchUp is called in Draggable. Reproducing input unfocus after stage removed. Stage stage = actor.getStage(); getActor().removeActor(actor, false); // Stage is cleared. if (unfocus && stage != null) { stage.unfocus(actor); } return true; } return false; }
Gdx.app.postRunnable(() -> { if (!im.getProcessors().contains(inputController, true)) im.addProcessor(im.size(), inputController);
@Override public void render(float delta) { boolean bodySelectMode = input.getProcessors().contains(bodySelectInput, true); Gdx.gl.glEnable(GL20.GL_BLEND); if (bodySelectMode && null != data) {
/** Applies a touch moved event to the stage and returns true if an actor in the scene {@link Event#handle() handled} the * event. Only {@link InputListener listeners} that returned true for touchDown will receive this event. */ public boolean touchDragged (int screenX, int screenY, int pointer) { pointerScreenX[pointer] = screenX; pointerScreenY[pointer] = screenY; mouseScreenX = screenX; mouseScreenY = screenY; if (touchFocuses.size == 0) return false; screenToStageCoordinates(tempCoords.set(screenX, screenY)); InputEvent event = Pools.obtain(InputEvent.class); event.setType(Type.touchDragged); event.setStage(this); event.setStageX(tempCoords.x); event.setStageY(tempCoords.y); event.setPointer(pointer); SnapshotArray<TouchFocus> touchFocuses = this.touchFocuses; TouchFocus[] focuses = touchFocuses.begin(); for (int i = 0, n = touchFocuses.size; i < n; i++) { TouchFocus focus = focuses[i]; if (focus.pointer != pointer) continue; if (!touchFocuses.contains(focus, true)) continue; // Touch focus already gone. event.setTarget(focus.target); event.setListenerActor(focus.listenerActor); if (focus.listener.handle(event)) event.handle(); } touchFocuses.end(); boolean handled = event.isHandled(); Pools.free(event); return handled; }
Gdx.app.postRunnable(() -> { if (!im.getProcessors().contains(inputController, true)) im.addProcessor(im.size(), inputController);