Code
import {rasterize, serialize} from "@mbostock/saving-svg"
function get_paper_dimension(format, orientation) {
if (orientation == "Portrait") {
return {x: format.width, y: format.height}
else {
} return {x: format.height, y: format.width}
}
}
= Inputs.select(new Map([
viewof format "Letter", {width: 215.9, height: 279.4}],
["A4", {width: 210, height: 297}],
[, {label: "Paper Format"})
])
= Inputs.radio(["Landscape", "Portrait"], {value: "Landscape"})
viewof orientation
= get_paper_dimension(format, orientation)
paper_dimension
= Inputs.form({
viewof paper x: Inputs.range([1, 1000], {value: paper_dimension.x, step: .01, label: "Width (mm)"}),
y: Inputs.range([1, 1000], {value: paper_dimension.y, step: .01, label: "Height (mm)"}),
colour: Inputs.color({value: "#ffffff", label: "Colour"}),
})