Toggle switches on and off the second grid

rc-1.0.0
Mike Lynch 2025-01-05 17:17:52 +11:00
parent 3b8afdc41a
commit d1bff0adf7
1 changed files with 13 additions and 4 deletions

View File

@ -18,10 +18,19 @@ const m1 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"m1"}));
const n1 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"n1"})); const n1 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"n1"}));
const fg2 = view(Inputs.color({label: "fg2", value: d3.color("blue").formatHex()})) const v2 = view(Inputs.toggle({label: "Second grid", value:true}));
const m2 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"m2"})); ```
const n2 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"n2"}));
```js
const fg2 = view(Inputs.color({
label: "fg2", value: d3.color("blue").formatHex(),
disabled: !v2
}))
const m2 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"m2", disabled: !v2}));
const n2 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"n2", disabled: !v2}));
``` ```
@ -29,7 +38,7 @@ const n2 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"n2"}));
```js ```js
const dots1 = make_dots(1 / m1, n1, CELL, WIDTH) const dots1 = make_dots(1 / m1, n1, CELL, WIDTH)
const dots2 = make_dots(1 / m2, n2, CELL, WIDTH) const dots2 = v2 ? make_dots(1 / m2, n2, CELL, WIDTH) : []
``` ```