Interface ScrollBar.Model

Enclosing class:
ScrollBar

public static interface ScrollBar.Model
The scroll state the bar reflects and drives.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
     
    float
     
    default void
    scrollBy(float delta)
    Scrolls by delta from where the content is, as the wheel does (the host clamps).
    void
    setOffset(float offset)
    Scrolls to offset (the host clamps).
    float
     
  • Method Details

    • contentLength

      float contentLength()
      Returns:
      total content extent along the bar's axis
    • viewportLength

      float viewportLength()
      Returns:
      visible extent along the bar's axis
    • offset

      float offset()
      Returns:
      current scroll offset along the bar's axis
    • setOffset

      void setOffset(float offset)
      Scrolls to offset (the host clamps).
    • scrollBy

      default void scrollBy(float delta)
      Scrolls by delta from where the content is, as the wheel does (the host clamps). A drag that rests near the host's edge scrolls through this, a few points a frame.

      The default is setOffset(offset() + delta), which is exact where the offset is. A host whose offset is an estimate, as a list whose rows of different heights are measured only as they are built, overrides it with a move that walks the content from where it is: through setOffset each small step would land by the estimate, and the rows would stand still and then leap.

      Parameters:
      delta - how far: positive toward the end of the content