FloUI.Scrollable.Drag (FloUI v0.1.0-alpha.6) View Source
Module for handling the drag controllability for Scenic.Scrollable
components.
Link to this section Summary
Types
Atom representing what state the drag functionality is currently in. The drag state can be 'idle' or 'dragging'.
Atom representing a mouse button.
Data structure with settings that dictate the behaviour of the drag controllability.
It consists of a list with t:Scenic.Scrollable.Drag.mouse_button/0
s which specify the buttons with which the user can drag the Scenic.Scrollable
component.
By default, drag functionality is disabled.
The state containing the necessary information to enable the drag functionality.
Shorthand for Scenic.Math.vector_2/0
.
Consists of a tuple containing the x and y numeric values.
Functions
Increases the current scroll speed, intended to be called when the user stops dragging. The increase in speed is intended to make the drag experience more smooth.
Find out if the user is currently dragging the Scenic.Scrollable
component.
Update the t:Scenic.Scrollable.Drag.t/0
based on the pressed mouse button, mouse position, and the position of the scrollable content.
Update the t:Scenic.Scrollable.Drag.t/0
based on the new cursor position the user has moved to.
Update the t:Scenic.Scrollable.Drag.t/0
based on the released mouse button and mouse position.
Initialize the t:Scenic.Scrollable.Drag.t/0
state by passing in the t:Scenic.Scrollable.Drag.settings/0
settings object.
When nil is passed, the default settings will be used.
Get the position of the users cursor during the previous update. Returns an the coordinate.
Calculate the new scroll position based on the current drag state. The result will be wrapped in an.
Link to this section Types
Specs
drag_state() :: :idle | :dragging
Atom representing what state the drag functionality is currently in. The drag state can be 'idle' or 'dragging'.
Specs
mouse_button() :: 0 | 1 | 2
Atom representing a mouse button.
Specs
settings() :: %{mouse_buttons: [mouse_button()]}
Data structure with settings that dictate the behaviour of the drag controllability.
It consists of a list with t:Scenic.Scrollable.Drag.mouse_button/0
s which specify the buttons with which the user can drag the Scenic.Scrollable
component.
By default, drag functionality is disabled.
Specs
t() :: %FloUI.Scrollable.Drag{ current: v2(), drag_start: v2(), drag_start_content_position: v2(), drag_state: drag_state(), enabled_buttons: [mouse_button()] }
The state containing the necessary information to enable the drag functionality.
Specs
v2() :: Scenic.Math.vector_2()
Shorthand for Scenic.Math.vector_2/0
.
Consists of a tuple containing the x and y numeric values.
Link to this section Functions
Specs
Increases the current scroll speed, intended to be called when the user stops dragging. The increase in speed is intended to make the drag experience more smooth.
Specs
Find out if the user is currently dragging the Scenic.Scrollable
component.
Specs
handle_mouse_click(t(), mouse_button(), v2(), v2()) :: t()
Update the t:Scenic.Scrollable.Drag.t/0
based on the pressed mouse button, mouse position, and the position of the scrollable content.
Specs
Update the t:Scenic.Scrollable.Drag.t/0
based on the new cursor position the user has moved to.
Specs
handle_mouse_release(t(), mouse_button(), v2()) :: t()
Update the t:Scenic.Scrollable.Drag.t/0
based on the released mouse button and mouse position.
Specs
Initialize the t:Scenic.Scrollable.Drag.t/0
state by passing in the t:Scenic.Scrollable.Drag.settings/0
settings object.
When nil is passed, the default settings will be used.
Specs
Get the position of the users cursor during the previous update. Returns an the coordinate.
Specs
Calculate the new scroll position based on the current drag state. The result will be wrapped in an.