Example usage for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setCancelTouchFocus

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setCancelTouchFocus

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setCancelTouchFocus.

Prototype

public void setCancelTouchFocus(boolean cancelTouchFocus) 

Source Link

Document

When true (default), the Stage#cancelTouchFocus() touch focus} is cancelled when flick scrolling begins.

Usage

From source file:com.vlaaad.dice.ui.windows.DiceWindow.java

License:Open Source License

@Override
protected void doShow(final UserData userData) {
    final Table items = new Table();
    final ScrollPane pane = new ScrollPane(items, new ScrollPane.ScrollPaneStyle()) {

        @Override/*www . j a v a  2 s .  co m*/
        public void layout() {
            float w = items.getPrefWidth();
            float h = Math.min(getParent().getHeight(), items.getPrefHeight());
            if (w != getWidth() || h != getHeight()) {
                setSize(w, h);
                invalidateHierarchy();
            }
            super.layout();
        }
    };
    pane.setTouchable(Touchable.childrenOnly);
    pane.setOverscroll(false, false);
    pane.setCancelTouchFocus(false);
    pane.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            pane.layout();
            pane.layout();
            items.layout();
            if (actor instanceof Layout)
                ((Layout) actor).layout();
            pane.layout();
            pane.layout();
            pane.scrollTo(actor.getX(), actor.getY(), actor.getWidth(), actor.getHeight() + 100);
        }
    });

    Iterable<Die> dice = userData.dice();
    int i = 1;
    int count = userData.diceCount();
    for (Die die : dice) {
        DiePane diePane = new DiePane(die, userData, diceWindowGroup);
        table.add(diePane);
        diePane.setWidth(0);
        diePane.pack();
        diePane.setWidth(ViewController.CELL_SIZE * 6.6f);
        Cell cell = items.add(diePane).fillX().maxWidth(ViewController.CELL_SIZE * 6.6f);
        if (i != count) {
            cell.padBottom(-1);
        }
        cell.row();
        map.put(die, diePane);
        diePane.info.addListener(createMinimizeListener(die, dice));
        i++;
    }
    items.pack();
    table.add(pane).width(items.getPrefWidth());//.size(items.getPrefWidth(), 200);
}

From source file:de.bitbrain.craft.screens.IngameScreen.java

License:Open Source License

private ScrollPane generateScrollPane(Actor actor) {
    ScrollPane pane = new ScrollPane(actor);
    pane.setCancelTouchFocus(false);
    pane.setScrollingDisabled(true, false);
    return pane;//from   w w  w . j a va  2  s.co m
}

From source file:io.piotrjastrzebski.sfg.screen.CustomDifficultyScreen.java

License:Open Source License

private Table createTabs() {
    buttons = new Table();
    buttonGroup = new ButtonGroup();
    stack = new Stack();
    tabs = new ArrayMap<String, Tab>();

    addTab(TAB_1, Config.Difficulty.CUSTOM_1);
    addTab(TAB_2, Config.Difficulty.CUSTOM_2);
    addTab(TAB_3, Config.Difficulty.CUSTOM_3);
    showTab(TAB_1);/* w w w . j a v a 2  s.c om*/

    final Table table = new Table();
    table.add(buttons).pad(0, 10, 10, 10);
    table.row();
    final ScrollPane scrollPane = new ScrollPane(stack);
    // so sliders sort of work
    scrollPane.setCancelTouchFocus(false);
    scrollPane.setScrollingDisabled(true, false);
    table.add(scrollPane).expand().fill();
    //        table.debug();
    return table;
}