com.badlogic.gdx.scenes.scene2d.Stage.cancelTouchFocus()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.badlogic.gdx.scenes.scene2d.Stage.cancelTouchFocus()方法的一些代码示例,展示了Stage.cancelTouchFocus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stage.cancelTouchFocus()方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Stage
类名称:Stage
方法名:cancelTouchFocus

Stage.cancelTouchFocus介绍

[英]Removes all touch focus listeners, sending a touchUp event to each listener. Listeners typically expect to receive a touchUp event when they have touch focus. The location of the touchUp is Integer#MIN_VALUE. Listeners can use InputEvent#isTouchFocusCancel() to ignore this event if needed.
[中]删除所有触控焦点侦听器,并向每个侦听器发送触控事件。当听众有触控焦点时,他们通常希望收到触控事件。修补的位置是整数#MIN_值。如果需要,侦听器可以使用InputEvent#isTouchFocusCancel()忽略此事件。

代码示例

代码示例来源:origin: libgdx/libgdx

/** Removes the touch, keyboard, and scroll focused actors. */
public void unfocusAll () {
  setScrollFocus(null);
  setKeyboardFocus(null);
  cancelTouchFocus();
}

代码示例来源:origin: libgdx/libgdx

/** Removes the touch, keyboard, and scroll focused actors. */
public void unfocusAll () {
  setScrollFocus(null);
  setKeyboardFocus(null);
  cancelTouchFocus();
}

代码示例来源:origin: libgdx/libgdx

/** Removes the touch, keyboard, and scroll focus for the specified actor and any descendants. */
public void unfocus (Actor actor) {
  cancelTouchFocus(actor);
  if (scrollFocus != null && scrollFocus.isDescendantOf(actor)) setScrollFocus(null);
  if (keyboardFocus != null && keyboardFocus.isDescendantOf(actor)) setKeyboardFocus(null);
}

代码示例来源:origin: libgdx/libgdx

/** Removes the touch, keyboard, and scroll focus for the specified actor and any descendants. */
public void unfocus (Actor actor) {
  cancelTouchFocus(actor);
  if (scrollFocus != null && scrollFocus.isDescendantOf(actor)) setScrollFocus(null);
  if (keyboardFocus != null && keyboardFocus.isDescendantOf(actor)) setKeyboardFocus(null);
}

代码示例来源:origin: libgdx/libgdx

/** {@link #pack() Packs} the dialog (but doesn't set the position), adds it to the stage, sets it as the keyboard and scroll
 * focus, clears any actions on the dialog, and adds the specified action to it. The previous keyboard and scroll focus are
 * remembered so they can be restored when the dialog is hidden.
 * @param action May be null. */
public Dialog show (Stage stage, Action action) {
  clearActions();
  removeCaptureListener(ignoreTouchDown);
  previousKeyboardFocus = null;
  Actor actor = stage.getKeyboardFocus();
  if (actor != null && !actor.isDescendantOf(this)) previousKeyboardFocus = actor;
  previousScrollFocus = null;
  actor = stage.getScrollFocus();
  if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
  pack();
  stage.addActor(this);
  stage.cancelTouchFocus();
  stage.setKeyboardFocus(this);
  stage.setScrollFocus(this);
  if (action != null) addAction(action);
  return this;
}

代码示例来源:origin: libgdx/libgdx

/** {@link #pack() Packs} the dialog (but doesn't set the position), adds it to the stage, sets it as the keyboard and scroll
 * focus, clears any actions on the dialog, and adds the specified action to it. The previous keyboard and scroll focus are
 * remembered so they can be restored when the dialog is hidden.
 * @param action May be null. */
public Dialog show (Stage stage, Action action) {
  clearActions();
  removeCaptureListener(ignoreTouchDown);
  previousKeyboardFocus = null;
  Actor actor = stage.getKeyboardFocus();
  if (actor != null && !actor.isDescendantOf(this)) previousKeyboardFocus = actor;
  previousScrollFocus = null;
  actor = stage.getScrollFocus();
  if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
  pack();
  stage.addActor(this);
  stage.cancelTouchFocus();
  stage.setKeyboardFocus(this);
  stage.setScrollFocus(this);
  if (action != null) addAction(action);
  return this;
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** Removes the touch, keyboard, and scroll focused actors. */
public void unfocusAll () {
  setScrollFocus(null);
  setKeyboardFocus(null);
  cancelTouchFocus();
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** Removes the touch, keyboard, and scroll focus for the specified actor and any descendants. */
public void unfocus (Actor actor) {
  cancelTouchFocus(actor);
  if (scrollFocus != null && scrollFocus.isDescendantOf(actor)) setScrollFocus(null);
  if (keyboardFocus != null && keyboardFocus.isDescendantOf(actor)) setKeyboardFocus(null);
}

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

private void updateViewport() {
    viewport.setUnitsPerPixel(scale);

    ViewController currentController = interfaceService.getCurrentController();
    if (currentController != null) {
      currentController.getStage().cancelTouchFocus();
    }

    Gdx.app.postRunnable(new Runnable() {
      @Override
      public void run() {
        app.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      }
    });
  }
}

代码示例来源:origin: peakgames/libgdx-stagebuilder

private void cancelChildTouchFocusOf(Group group) {
  SnapshotArray<Actor> children = group.getChildren();
  children.begin();
  int size = children.size;
  for (int i = 0; i < size; i++) {
    Actor child = children.get(i);
    if (getStage() == null) {
      break;
    }
    getStage().cancelTouchFocus(child);
    if (child instanceof Group) {
      cancelChildTouchFocusOf((Group) child);
    }
  }
  children.end();
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

/** {@link #pack() Packs} the dialog (but doesn't set the position), adds it to the stage, sets it as the keyboard and scroll
 * focus, clears any actions on the dialog, and adds the specified action to it. The previous keyboard and scroll focus are
 * remembered so they can be restored when the dialog is hidden.
 * @param action May be null. */
public Dialog show (Stage stage, Action action) {
  clearActions();
  removeCaptureListener(ignoreTouchDown);
  previousKeyboardFocus = null;
  Actor actor = stage.getKeyboardFocus();
  if (actor != null && !actor.isDescendantOf(this)) previousKeyboardFocus = actor;
  previousScrollFocus = null;
  actor = stage.getScrollFocus();
  if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
  pack();
  stage.addActor(this);
  stage.cancelTouchFocus();
  stage.setKeyboardFocus(this);
  stage.setScrollFocus(this);
  if (action != null) addAction(action);
  return this;
}

相关文章