Draw

Vanduo Draw is a standalone SVG drawing tool from @vanduo-oss/vd3-cbun/draw. Its dependency-free brush engine turns freehand strokes into smooth, variable-width marks (pressure- and velocity-aware). Pick a brush (pen, pencil, marker, highlighter, calligraphy) and a color from the built-in palette, set size and opacity, and paint — or switch to the eraser, shapes, or sticky notes. Want room to think? Hit Full screen to sketch across the whole viewport (Esc to come back). The chrome themes with the active --vd-* palette and light / dark mode; your marks keep the color you pick.

Sketchpad
API Reference

Install

pnpm add @vanduo-oss/vd3-cbun

Usage

<script setup lang="ts">
import { VdDraw } from '@vanduo-oss/vd3-cbun/draw';
import '@vanduo-oss/vd3-cbun/draw/css';
</script>

<template>
  <!-- The toolbar (brushes, colors, size, eraser) is built in. -->
  <VdDraw tool="draw" @change="onChange" />
</template>

Component API

Prop / eventDescription
:dataDrawing document ({ shapes, viewport }); updates flow through load().
toolActive tool — 'draw', 'eraser', 'select', 'hand', shapes… (default 'draw').
:readonlyRender as a non-editable viewer (no toolbar).
:gridSize / :snapBackground grid size; snap-to-edges (default on).
:history / :historyLimitToggle undo history and cap the snapshot count.
@change / @select / @viewportForwarded editor events (pan/zoom is not undoable).
@readyEmitted once with the underlying VdDraw instance.

Tools

ToolAction
brushPaint variable-width strokes with the active brush + color.
eraserDrag to erase whole strokes / shapes you cross.
select / handSelect, move, resize (select); pan the canvas (hand).
rectangle / ellipse / arrowSecondary vector shapes in the current color.
text / stickyEditable text and sticky notes.

Brushes

PresetFeel
penCrisp, pressure-tapered ink.
pencilThin, slightly textured, softer opacity.
markerThick, flat, semi-opaque.
highlighterWide, translucent, multiply blend (overlaps darken).
calligraphyFixed-angle nib — width follows stroke direction.

Exposed methods (template ref)

MethodDescription
setColor / setBrushSet the current color / brush preset for the next mark.
setBrushSize / setOpacitySet the current brush size / opacity.
setGridSize / toggleGridResize the grid cells / show + hide the grid.
undo / redoStep through the whole-document history.
toSVG / toPNGExport the drawing (self-contained SVG string / PNG data URL).
getInstanceThe underlying VdDrawCore for imperative use.