A canvas workspace for freehand sketches, shapes and diagrams, powered by Konva.js.
The NgStarter Angular Whiteboard component is a Konva.js canvas for sketches, diagrams and idea boards. Draw with mouse, touch or pen; add shapes, arrows, text and notes; select, move, resize and rotate objects. Change stroke, fill, line style and opacity, then save the editable JSON document or export a PNG. New objects are selected as soon as you finish drawing or save their text. The lock button keeps the drawing tool active. Set pressureSensitive to vary pencil stroke width with pen pressure.
Use [(value)] to own the portable document in your application. Coordinates stay independent of pan and zoom. Replacing the document resets undo history. Use the menu to save or open JSON. Click the canvas with the Text or Note tool to type directly on the board. With the Select tool active, double-click a rectangle to add or edit its label, or double-click a text object or note to edit it. Click outside or press Ctrl/Cmd+Enter to save, or press Escape to cancel.
Drag a line or arrow between blocks to attach its ends. A ring marks each attachment point as you draw. Drag the middle handle of a selected line or arrow to bend it. Drag either end to reconnect it or release it on the canvas. Hold Ctrl/Cmd while drawing or dragging an end to keep it free. Straight connectors switch sides when their path would cross an attached block. If overlapping blocks leave no clear segment, the connector reappears when they separate. Connections are saved in the board's JSON.
With the canvas or drawing toolbar focused, use V (select), H (hand), R (rectangle), D (diamond), O (ellipse), A (arrow), L (line), P (pencil), T (text), N (note), E (eraser), or Q (tool lock). Hold Shift while drawing to constrain proportions or snap a line or arrow angle. Shift-click or drag a box around objects to select several at once. Use the arrow keys on the canvas to move the selection by 1 pixel, or by 10 with Shift. Hold Space on the canvas or drag with the middle mouse button to pan. Scroll without modifiers to pan, use Ctrl/Cmd + wheel or +/− to zoom, and press 0 to fit the content. Delete removes the selection, Ctrl/Cmd+D duplicates it, Ctrl/Cmd+Z undoes an edit, and Ctrl/Cmd+Shift+Z or Ctrl/Cmd+Y redoes it.
Import Whiteboard and WhiteboardDocument from @ngstarter-ui/components/whiteboard. Set readonly for a board that allows only pan, zoom and export. Set showToolbar to false to provide your own controls through the public methods. The canvas initializes only in the browser and resizes with its container.
Line and arrow elements accept optional startBinding and endBinding values. Each binding contains the target's elementId and an anchor pair in local coordinates from 0 to 1. For example, [1, 0.5] is the midpoint of a rectangle's right edge.
The component stores local canvas objects; application code owns persistence and collaboration. It does not provide realtime synchronization or rich text editing. For image composition use ImageDesigner; for a signature field use SignaturePad.