# Module `druid.scroll`

Component to handle scroll content.

Scroll consist from two nodes: scroll parent and scroll input Scroll input the user input zone, it's static Scroll parent the scroll moving part, it will change position. Setup initial scroll size by changing scroll parent size. If scroll parent size will be less than scroll_input size, no scroll is available. For scroll parent size should be more than input size

## Functions

init(scroll_parent, input_zone) | Component init function
scroll_to(vector3[, is_instant]) | Start scroll to target point
scroll_to_percent(vector3[, is_instant]) | Start scroll to target scroll percent
init(index[, skip_cb]) | Scroll to item in scroll by point index
set_points(points) | Set points of interest.
set_inert(state) | Enable or disable scroll inert.
on_point_move(callback) | Set the callback on scrolling to point (if exist)
set_border(border) | Set the scroll possibly area
get_scroll_percent() | Return current scroll progress

## Tables

Events | Component events
Fields | Component fields
Style | Component style params

## Functions

init(scroll_parent, input_zone)
  Component init function

  ### Parameters:

  - scroll_parent node Gui node where placed scroll content. This node will change position
  - input_zone node Gui node where input is catched
scroll_to(vector3[, is_instant])
  Start scroll to target point

  ### Parameters:

  - vector3 point target point
  - is_instant bool instant scroll flag (optional)

  ### Usage:

  -     scroll:scroll_to(vmath.vector3(0, 50, 0))

  -     scroll:scroll_to(vmath.vector3(0), true)

scroll_to_percent(vector3[, is_instant])
  Start scroll to target scroll percent

  ### Parameters:

  - vector3 point target percent
  - is_instant bool instant scroll flag (optional)

  ### Usage:

      scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))

init(index[, skip_cb])
  Scroll to item in scroll by point index

  ### Parameters:

  - index number Point index
  - skip_cb bool If true, skip the point callback (optional)
set_points(points)
  Set points of interest. Scroll will always centered on closer points

  ### Parameters:

  - points table Array of vector3 points
set_inert(state)
  Enable or disable scroll inert. If disabled, scroll through points (if exist) If no points, just simple drag without inertion

  ### Parameters:

  - state bool Inert scroll state
on_point_move(callback)
  Set the callback on scrolling to point (if exist)

  ### Parameters:

  - callback function Callback on scroll to point of interest
set_border(border)
  Set the scroll possibly area

  ### Parameters:

  - border vector3 Size of scrolling area
get_scroll_percent()
  Return current scroll progress

  ### Returns:

  vector3 Scroll progress

## Tables

Events
  Component events

  ### Fields:

  - on_scroll druid_event On scroll move callback
  - on_scroll_to druid_event On scroll_to function callback
  - on_point_scroll druid_event On scrolltoindex function callback
Fields
  Component fields

  ### Fields:

  - node node Scroll parent node
  - input_zone node Scroll input node
  - zone_size vector3 Current scroll content size
  - soft_size number Soft zone size from style table
  - center_offset vector3 Distance from node to node's center
  - is_inert bool Flag, if scroll now moving by inertion
  - inert vector3 Current inert speed
  - pos vector3 Current scroll posisition
  - target vector3 Current scroll target position
Style
  Component style params

  ### Fields:

  - FRICT_HOLD number Multiplier for inertion, while touching
  - FRICT number Multiplier for free inertion
  - INERT_THRESHOLD number Scroll speed to stop inertion
  - INERT_SPEED number Multiplier for inertion speed
  - DEADZONE number Deadzone for start scrol in pixels
  - SOFT_ZONE_SIZE number Size of outside zone in pixels (for scroll back moving)
  - BACK_SPEED number Scroll back returning lerp speed
  - ANIM_SPEED number Scroll gui.animation speed for scroll_to function

generated by LDoc 1.4.6 Last updated 2020-04-09 22:11:32