Set minimum cell size

This commit is contained in:
arne 2024-07-19 00:31:33 +02:00
commit e66f784344

View file

@ -12,7 +12,10 @@ const parsePattern = (pattern: string) => pattern.split('').map(x => Number.pars
const xs = reactive(xs_).map((pattern) => parsePattern(pattern))
const ys = reactive(ys_).map((pattern) => parsePattern(pattern))
const cellSize = reactive(cellSize_).map(num => Number.parseInt(num, 10))
const cellSize = reactive(cellSize_).map(num => {
const next = Number.parseInt(num, 10)
return Number.isNaN(next)|| next < 5 ? 5 : next
})
// available size for a2: 420 * 594
const width = 420
@ -91,8 +94,9 @@ $compile(
["h2", {}, "Settings"],
["div", {}, ["label", {}, "Grid size: ",
["input", {
type: "text",
value: cellSize_,
type: "number",
min: "5",
value: cellSize.deref()!,
oninput: $input(cellSize)
}]]],
["div", {}, ["label", {}, "X Pattern: ",