本文整理了Java中com.badlogic.gdx.scenes.scene2d.Stage.setScrollFocus()
方法的一些代码示例,展示了Stage.setScrollFocus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stage.setScrollFocus()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Stage
类名称:Stage
方法名:setScrollFocus
[英]Sets the actor that will receive scroll events.
[中]设置将接收滚动事件的参与者。
代码示例来源: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
public void collapse () {
if (collapsed) return;
expandHeight = getHeight();
setHeight(collapseHeight);
setY(getY() + expandHeight - collapseHeight);
collapsed = true;
if (getStage() != null) getStage().setScrollFocus(null);
}
代码示例来源:origin: libgdx/libgdx
public void hide () {
if (!list.isTouchable() || !hasParent()) return;
list.setTouchable(Touchable.disabled);
Stage stage = getStage();
if (stage != null) {
stage.removeCaptureListener(hideListener);
stage.removeListener(list.getKeyListener());
if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
Actor actor = stage.getScrollFocus();
if (actor == null || isAscendantOf(actor)) stage.setScrollFocus(previousScrollFocus);
}
clearActions();
selectBox.onHide(this);
}
代码示例来源:origin: libgdx/libgdx
public void hide () {
if (!list.isTouchable() || !hasParent()) return;
list.setTouchable(Touchable.disabled);
Stage stage = getStage();
if (stage != null) {
stage.removeCaptureListener(hideListener);
stage.removeListener(list.getKeyListener());
if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
Actor actor = stage.getScrollFocus();
if (actor == null || isAscendantOf(actor)) stage.setScrollFocus(previousScrollFocus);
}
clearActions();
selectBox.onHide(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: 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
/** Removes the dialog from the stage, restoring the previous keyboard and scroll focus, and adds the specified action to the
* dialog.
* @param action If null, the dialog is removed immediately. Otherwise, the dialog is removed when the action completes. The
* dialog will not respond to touch down events during the action. */
public void hide (Action action) {
Stage stage = getStage();
if (stage != null) {
removeListener(focusListener);
if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null;
Actor actor = stage.getKeyboardFocus();
if (actor == null || actor.isDescendantOf(this)) stage.setKeyboardFocus(previousKeyboardFocus);
if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
actor = stage.getScrollFocus();
if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus);
}
if (action != null) {
addCaptureListener(ignoreTouchDown);
addAction(sequence(action, Actions.removeListener(ignoreTouchDown, true), Actions.removeActor()));
} else
remove();
}
代码示例来源:origin: libgdx/libgdx
/** Removes the dialog from the stage, restoring the previous keyboard and scroll focus, and adds the specified action to the
* dialog.
* @param action If null, the dialog is removed immediately. Otherwise, the dialog is removed when the action completes. The
* dialog will not respond to touch down events during the action. */
public void hide (Action action) {
Stage stage = getStage();
if (stage != null) {
removeListener(focusListener);
if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null;
Actor actor = stage.getKeyboardFocus();
if (actor == null || actor.isDescendantOf(this)) stage.setKeyboardFocus(previousKeyboardFocus);
if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
actor = stage.getScrollFocus();
if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus);
}
if (action != null) {
addCaptureListener(ignoreTouchDown);
addAction(sequence(action, Actions.removeListener(ignoreTouchDown, true), Actions.removeActor()));
} else
remove();
}
代码示例来源:origin: libgdx/libgdx
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (draggingPointer != -1) return false;
if (pointer == 0 && button != 0) return false;
getStage().setScrollFocus(ScrollPane.this);
代码示例来源:origin: libgdx/libgdx
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (draggingPointer != -1) return false;
if (pointer == 0 && button != 0) return false;
getStage().setScrollFocus(ScrollPane.this);
代码示例来源:origin: libgdx/libgdx
Actor actor = stage.getScrollFocus();
if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
stage.setScrollFocus(this);
代码示例来源:origin: libgdx/libgdx
Actor actor = stage.getScrollFocus();
if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
stage.setScrollFocus(this);
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
@Override
public void enter(InputEvent event, float x, float y, int pointer, com.badlogic.gdx.scenes.scene2d.Actor fromActor) {
// EditorLogger.debug("ENTER - X: " + x + " Y: " + y);
getStage().setScrollFocus(centerPanel);
}
});
代码示例来源:origin: com.badlogicgames.gdx/gdx
/** Removes the touch, keyboard, and scroll focused actors. */
public void unfocusAll () {
setScrollFocus(null);
setKeyboardFocus(null);
cancelTouchFocus();
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
@Override
public void enter(InputEvent event, float x, float y, int pointer,
com.badlogic.gdx.scenes.scene2d.Actor fromActor) {
super.enter(event, x, y, pointer, fromActor);
// EditorLogger.debug("ENTER - X: " + x + " Y: " + y);
scnWidget.getStage().setScrollFocus(scnWidget);
}
代码示例来源:origin: kotcrab/vis-ui
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
getStage().setScrollFocus(getTextField());
return true;
}
代码示例来源:origin: kotcrab/vis-ui
@Override
public void changed (ChangeEvent event, Actor actor) {
event.stop();
getStage().setScrollFocus(getTextField());
decrement(true);
}
});
内容来源于网络,如有侵权,请联系作者删除!