Set minimum cell size
This commit is contained in:
parent
c6638052a9
commit
e66f784344
1 changed files with 7 additions and 3 deletions
10
src/main.ts
10
src/main.ts
|
|
@ -12,7 +12,10 @@ const parsePattern = (pattern: string) => pattern.split('').map(x => Number.pars
|
||||||
|
|
||||||
const xs = reactive(xs_).map((pattern) => parsePattern(pattern))
|
const xs = reactive(xs_).map((pattern) => parsePattern(pattern))
|
||||||
const ys = reactive(ys_).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
|
// available size for a2: 420 * 594
|
||||||
const width = 420
|
const width = 420
|
||||||
|
|
@ -91,8 +94,9 @@ $compile(
|
||||||
["h2", {}, "Settings"],
|
["h2", {}, "Settings"],
|
||||||
["div", {}, ["label", {}, "Grid size: ",
|
["div", {}, ["label", {}, "Grid size: ",
|
||||||
["input", {
|
["input", {
|
||||||
type: "text",
|
type: "number",
|
||||||
value: cellSize_,
|
min: "5",
|
||||||
|
value: cellSize.deref()!,
|
||||||
oninput: $input(cellSize)
|
oninput: $input(cellSize)
|
||||||
}]]],
|
}]]],
|
||||||
["div", {}, ["label", {}, "X Pattern: ",
|
["div", {}, ["label", {}, "X Pattern: ",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue