LanguageValues and typesStandard typesMedia and visual
Insets
On this page
Space inside each edge, written in CSS's order: 8 16 8 16.
Use it for padding in a layout. For a rectangle, use Rect.
Shape
| Field | Type | Required? |
|---|---|---|
top |
Decimal |
Yes |
right |
Decimal |
Yes |
bottom |
Decimal |
Yes |
left |
Decimal |
Yes |
Example
Insets { top: 8.0 right: 16.0 bottom: 8.0 left: 16.0 }text.parse(raw, as: Insets) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 8 16, 8 or -1 0 0 0.
Good to know
- None can be below zero, and text must give all four.
==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
An object of its parts, in a request, a response or json.write:
{"top":"8","right":"16","bottom":"8","left":"16"}{"top":"0","right":"0","bottom":"0","left":"0"}{"top":"0.5","right":"1","bottom":"1.5","left":"2"}
Details
Text form, storage, how it is shown, and operations
Insets is in the group Media and visual, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: 8 16 8 16, 0 0 0 0 and 0.5 1 1.5 2.
How it is stored
It is stored in 4 columns, each named for the field, _ and its suffix. This is 0 0 0 0:
| Column | Type | Holds |
|---|---|---|
<field>_top |
numeric |
0 |
<field>_right |
numeric |
0 |
<field>_bottom |
numeric |
0 |
<field>_left |
numeric |
0 |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
8 16 8 16 |
8 16 8 16 |
0 0 0 0 |
0 0 0 0 |
0.5 1 1.5 2 |
0.5 1 1.5 2 |
Operations
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-insets.md.Built from Jadpo main at aee2e8f.