-
Notifications
You must be signed in to change notification settings - Fork 8
Length
Christopher Nikkel edited this page Dec 22, 2018
·
12 revisions
type Length =
| UserSpace of float
| Pixels of int
| Em of float
| Percent of float
Length
is used to described a distance in coordinate space often from the origin. It is the foundation to other base types such as Point and Area.
Constant | Type | Description |
---|---|---|
Length.empty |
Length | zero length |
Length.half |
Length | 50% length |
Length.full |
Length | 100% length |
Function | Signature | Description |
---|---|---|
Length.ofUserSpace |
float -> Length |
creates a length specified with a distance in user space |
Length.ofPixels |
int -> Length |
creates a length specified with a distance in pixels |
Length.ofFloat |
float -> Length |
creates a length specified with a distance in user space (alias for ofUserSpace ) |
Length.ofInt |
int -> Length |
creates a length specified with an integer distance in user space |
Length.ofEm |
float -> Length |
creates a length specified with a distance in Ems |
Length.ofPercent |
float -> Length |
creates a length specified with percentage based distance |
Length.toString |
Length -> string |
converts a length to a string |
Length.toFloat |
Length -> float |
unboxes a length value |
let length1 = Length.ofFloat 10.0
let length2 = Length.full
printfn "length1 = %s" <| Length.toString length1
printfn "length1 = %s" <| Length.toString length2
length1 = "10"
length1 = "100%"