vUX / SketchPad / v4.1.0
Shapes, curved connectors, freehand ink and text on a pan-and-zoom canvas, with undo, export and a scene you can save as JSON. Draw on the board below.
These act on the board above. Most settings take effect immediately; keyboardScope is read
once by initialize(), so changing it here destroys the pad and builds a new one around the same scene.
counterInvertImages is for pages that theme the surface with a CSS invert() filter,
as Sketchpad's dark mode does. Ticking it here also inverts the board: shapes flip, while placed images
like the sun are drawn pre-inverted and keep their real colours.
pad.elements is a plain array of JSON objects in scene coordinates. Save it however you like and
hand it back to load(). exportCanvas() renders the whole scene, cropped to its content.
The same component with the whiteboard switched off: tools: ["select", "rect"], a fixed view,
bounded so nothing leaves the card, and maxElements: 1. This is the configuration
an app uses to let someone mark the area on an uploaded design where a guest's name gets printed.
Try to draw past an edge, or drag the box off the card: bounded clamps it.
A second box is refused until this one is deleted.
createStamp(svgText) turns SVG source into something the stamp tool places with each click.
A stamp drawn only in black is mono: once placed, the fill colour re-tints it.
A coloured one keeps its own colours.
Arguments are checked at the call, and every error names the property or method and what it wanted. None of these buttons changes the pads above: each call throws before it touches anything.