layout docs: try something

This commit is contained in:
🪞👃🪞 2025-01-03 23:08:25 +01:00
parent f81a04dd44
commit fc82d6ff9b

View file

@ -6,20 +6,36 @@ and are generic over `tek_engine::Engine`
and `tek_engine::Content`. chiefly, they
are not dependent on rendering framework.
* `Fill` is to make the content's dimension equal to the container's.
* `Fixed` is to assign a fixed dimension to its content.
* `Shrink`/`Expand` are to change the dimension of the content
* `Min`/`Max` are to constrain the dimension of the content
* `Push`/`Pull` are to move the content along the axis
* `Margin`/`Padding` are to change the dimension proportionally
* `Align` is to pin the content along the axis of the container
* `When` is to render content conditionally
* `Either` is to alternates between contents
* `Map` is to transform each content
* `Reduce` is to transform all contents into one
* and, finally, `Bsp` is to put 2 where there was 1.
|operator|description|
|-|-|
|**`When(x, a)`**|render `a` only when `x == true`|
|**`Either(x, a, b)`**|render `a` when `x == true`, otherwise render `b`|
|**`Map(get_iterator, callback)`**|transform items in uniform way|
|**`Bsp`**|concatenative layout|
|...|...|
|**`Align`**|pin content along axis|
|...|...|
|**`Fill`**|**make content's dimension equal to container's:**|
|`Fill::x(a)`|use container's width for content|
|`Fill::y(a)`|use container's height for content|
|`Fill::xy(a)`|use container's width and height for content|
|**`Fixed`**|**assign fixed dimension to content:**|
|`Fixed::x(w, a)`|use width `w` for content|
|`Fixed::y(w, a)`|use height `w` for content|
|`Fixed::xy(w, h, a)`|use width `w` and height `h` for content|
|**`Expand`/`Shrink`**|**change dimension of content:**|
|`Expand::x(n, a)`/`Shrink::x(n, a)`|increment/decrement width of content area by `n`|
|`Expand::y(n, a)`/`Shrink::y(n, a)`|increment/decrement height of content area by `m`|
|`Expand::xy(n, m, a)`/`Shrink::xy(n, m, a)`|increment/decrement width of content area by `n`, height by `m`|
|**`Min`/`Max`**|**constrain dimension of content:**|
|`Min::x(w, a)`/`Max::x(w, a)`|enforce minimum/maximum width `w` for content|
|`Min::y(h, a)`/`Max::y(h, a)`|enforce minimum/maximum height `h` for content|
|`Min::xy(w, h, a)`/`Max::xy(w, h, a)`|enforce minimum/maximum width `w` and height `h` for content|
|**`Push`/`Pull`**|**move content along axis:**|
|`Push::x(n, a)`/`Pull::x(n, a)`|increment/decrement `x` of content area|
|`Push::y(n, a)`/`Pull::y(n, a)`|increment/decrement `y` of content area|
|`Push::xy(n, m, a)`/`Pull::xy(n, m, a)`|increment/decrement `x` and `y` of content area|
**todo.** and then you're like,
"but why are they generic over E in the first place
and not, say, over E::Unit? that might even free up
some space to implement for non-uint cosmologies...
**todo:**
* sensible `Margin`/`Padding`
* `Reduce`