Example usage for com.badlogic.gdx.scenes.scene2d InputListener touchUp

List of usage examples for com.badlogic.gdx.scenes.scene2d InputListener touchUp

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d InputListener touchUp.

Prototype

public void touchUp(InputEvent event, float x, float y, int pointer, int button) 

Source Link

Document

Called when a mouse button or a finger touch goes up anywhere, but only if touchDown previously returned true for the mouse button or touch.

Usage

From source file:es.eucm.ead.editor.view.widgets.Slider.java

License:Open Source License

public Slider(float min, float max, float stepSize, boolean vertical, SliderStyle style) {
    super(min, max, stepSize, vertical, style);
    final InputListener inputListener = (InputListener) getListeners().get(0);
    clearListeners();/*w w  w  .ja v a 2s .c  o m*/
    addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return inputListener.touchDown(event, x, y, pointer, button);
        }

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            inputListener.touchUp(event, x, y, pointer, button);
        }

        @Override
        public void touchDragged(InputEvent event, float x, float y, int pointer) {
            getStage().cancelTouchFocusExcept(Slider.this.getListeners().first(), Slider.this);
            inputListener.touchDragged(event, x, y, pointer);
        }
    });
}

From source file:es.eucm.ead.editor.view.widgets.Slider.java

License:Open Source License

public boolean addInputListener(final InputListener listener) {
    final InputListener inputListener = (InputListener) getListeners().get(0);
    clearListeners();/*from w w w. ja  v  a2 s . co m*/
    return addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            inputListener.touchDown(event, x, y, pointer, button);
            listener.touchDown(event, x, y, pointer, button);
            return true;
        }

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            inputListener.touchUp(event, x, y, pointer, button);
            listener.touchUp(event, x, y, pointer, button);
        }

        @Override
        public void touchDragged(InputEvent event, float x, float y, int pointer) {
            inputListener.touchDragged(event, x, y, pointer);
            listener.touchDragged(event, x, y, pointer);
        }
    });
}