FloUI.Scrollable.PositionCap (FloUI v0.1.0-alpha.5) View Source

Module for applying limits to a position.

Link to this section Summary

Types

Data structure representing a minimum, or maximum cap which values will be compared against. The cap can be either a v2/0 or a t:Scenic.Scrollable.Direction.t/0. By using a t:Scenic.Scrollable.Direction/0 it is possible to cap a position only for either its x, or its y value.

The settings with which to initialize a t:Scenic.Scrollable.PositionCap.t. Both min and max caps are optional, and can be further limited to only the x, or y axes by passing in a t:Scenic.Scrollable.Direction/0 rather than a v2/0.

t()

A struct representing a position cap. Positions in the form of a v2/0 can be compared against, and increased or reduced to the capped values by using the cap/2 function.

A vector 2 in the form of {x, y}

Functions

Compare the upper and lower limits set in the t:Scenic.Scrollable.PositionCap.t/0 against the v2/0 provided, and adjusts the v2/0 according to those limits.

Initializes a t:Scenic.Scrollable.PositionCap.t/0 according to the provided t:Scenic.Scrollable.PositionCap.settings/0.

Link to this section Types

Specs

cap() :: v2() | {:horizontal, number()} | {:vertical, number()}

Data structure representing a minimum, or maximum cap which values will be compared against. The cap can be either a v2/0 or a t:Scenic.Scrollable.Direction.t/0. By using a t:Scenic.Scrollable.Direction/0 it is possible to cap a position only for either its x, or its y value.

Specs

settings() :: %{optional(:max) => cap(), optional(:min) => cap()}

The settings with which to initialize a t:Scenic.Scrollable.PositionCap.t. Both min and max caps are optional, and can be further limited to only the x, or y axes by passing in a t:Scenic.Scrollable.Direction/0 rather than a v2/0.

Specs

t() :: %FloUI.Scrollable.PositionCap{max: cap(), min: cap()}

A struct representing a position cap. Positions in the form of a v2/0 can be compared against, and increased or reduced to the capped values by using the cap/2 function.

Specs

v2() :: Scenic.Scrollable.v2()

A vector 2 in the form of {x, y}

Link to this section Functions

Specs

cap(t(), v2()) :: v2()

Compare the upper and lower limits set in the t:Scenic.Scrollable.PositionCap.t/0 against the v2/0 provided, and adjusts the v2/0 according to those limits.

Specs

init(settings()) :: t()

Initializes a t:Scenic.Scrollable.PositionCap.t/0 according to the provided t:Scenic.Scrollable.PositionCap.settings/0.