package toffee

Build not yet checked
  1. Overview
  2. Docs
CSS layout engine for OCaml (Flexbox, Grid, Block)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.3.0.tbz
sha256=a92cbbcbe016fb19fb0a749222da0e459a9567aef3f4c7340d9bd6b71c53ed6f
sha512=6a7ab054605538bb31a2b73a1a6d093981a2704c9f0af5852221c05735290d74aca7c7282298c4d0f91e86a800e2ccd94b4918af883cd963449c758eb6b272b3

doc/toffee.geometry/Toffee_geometry/Pointf/index.html

Module Toffee_geometry.PointfSource

Points of floats.

A t holds two coordinates in floats, flat, as Sizef.t holds a size: layout computes its locations as ts. Point remains for points of other values.

Sourcetype t = {
  1. x : float;
  2. y : float;
}

Two coordinates.

Constants and creation

Sourceval zero : t

zero is the origin.

Sourceval make : float -> float -> t

make x y is { x; y }.

Arithmetic

Sourceval add : t -> t -> t

add a b adds a and b coordinate by coordinate.

Sourceval sub : t -> t -> t

sub a b subtracts b from a coordinate by coordinate.

Sourceval (+) : t -> t -> t

a + b is add a b.

Sourceval (-) : t -> t -> t

a - b is sub a b.

Sourceval mul_scalar : t -> float -> t

mul_scalar point scalar multiplies both coordinates by scalar.

Sourceval div_scalar : t -> float -> t

div_scalar point scalar divides both coordinates by scalar.

Sourceval (*) : t -> float -> t

point * scalar is mul_scalar point scalar.

Sourceval (/) : t -> float -> t

point / scalar is div_scalar point scalar.

Axis accessors

Sourceval get : Abstract_axis.t -> t -> float

get axis point is x for Inline and y for Block.

Conversions

Sourceval of_point : float Point.t -> t

of_point point has the coordinates of point.

Sourceval to_point : t -> float Point.t

to_point point has the coordinates of point.

Comparison and formatting

Sourceval equal : t -> t -> bool

equal a b is true iff both coordinates are equal floats.

Sourceval compare : t -> t -> int

compare a b orders by x, then y, as Float.compare.

Sourceval to_string : t -> string

to_string point is a readable representation of point.

Sourceval pp : Format.formatter -> t -> unit

pp formats a point as to_string.