Scenic Scrollable v0.1.0 Scenic.Scrollable.PositionCap 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 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 Scenic.Scrollable.PositionCap.t/0 against the v2/0 provided, and adjusts the v2/0 according to those limits

Link to this section Types

Link to this type

cap() View Source
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 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.

Link to this type

settings() View Source
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.

Link to this type

t() View Source
t() :: %Scenic.Scrollable.PositionCap{
  max: {:some, cap()} | :none,
  min: {:some, cap()} | :none
}

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}

Link to this section Functions

Link to this function

cap(map, coordinate) View Source
cap(t(), v2()) :: v2()

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

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