Skip to content

Fit: scale

A container with a fixed size. Its content becomes smaller to fit, and the labels become smaller too.

Edit it

Fit: scalePlayground →
Fit: scale: the layoutframesmall-windowbig-windoww1w2w3w4w5w6w7w8w9w10w11w12g1g2g3g4

19 boxes, 0 edges. The audit finds no defect.

The input

The same layout in TypeScript. The input is plain data, so it can come from JSON.

fit-scale.ts
import { layout } from "ireko";
const input = {
"root": {
"id": "frame",
"mode": "nested",
"layout": {
"type": "grid",
"columns": 2
},
"children": [
{
"id": "small-window",
"mode": "nested",
"fit": "scale",
"size": {
"width": 240,
"height": 160
},
"children": [
{
"id": "w1"
},
{
"id": "w2"
},
{
"id": "w3"
},
{
"id": "w4"
},
{
"id": "w5"
},
{
"id": "w6"
},
{
"id": "w7"
},
{
"id": "w8"
},
{
"id": "w9"
},
{
"id": "w10"
},
{
"id": "w11"
},
{
"id": "w12"
}
]
},
{
"id": "big-window",
"mode": "nested",
"fit": "grow",
"children": [
{
"id": "g1"
},
{
"id": "g2"
},
{
"id": "g3"
},
{
"id": "g4"
}
]
}
]
}
};
const result = layout(input);