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

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

Introduction

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

Prototype

public void setScrollPercentX(float percentX) 

Source Link

Usage

From source file:com.kotcrab.vis.ui.widget.ScrollableTextArea.java

License:Apache License

private void updateScrollPosition() {
    if (cullingArea == null || getParent() instanceof ScrollPane == false)
        return;//w w  w . j  a  v  a 2  s  .  co  m
    ScrollPane scrollPane = (ScrollPane) getParent();

    if (cullingArea.contains(getCursorX(), cullingArea.y) == false) {
        scrollPane.setScrollPercentX(getCursorX() / getWidth());
    }

    if (cullingArea.contains(cullingArea.x, (getHeight() - getCursorY())) == false) {
        scrollPane.setScrollPercentY(getCursorY() / getHeight());
    }
}