OpenFini

Docs / Guides

Whiteboard (Office Suite app "board")

The Whiteboard is the Office Suite's infinite canvas for sketches, sticky notes, diagrams and handwritten notebooks, in the spirit of Excalidraw, tldraw and GoodNotes. It plugs into the suite through the contract of office-suite.md; this page is the user guide and the engineering reference. Wiki: wiki/Whiteboard.md.

Using it#

  • New: Office Home ▸ Whiteboard, or a template: Blank whiteboard, Brainstorm, Kanban board, Flowchart, Notebook (three pages with lined and squared paper).
  • Open: File ▸ Open…, drag and drop or the OS Open with for .excalidraw and .tldraw. File ▸ Save writes the original format again (with a note about what it cannot keep); the .ofini keeps everything.
  • Export (Board ▸ Export As, office.export): Excalidraw, tldraw, PNG and SVG (current page), PDF (every page).

Tools and keys (while the canvas has focus)#

KeyToolKeyTool
VSelectR O DRectangle, ellipse, diamond
H / Space-drag / middle buttonPanL ALine, arrow (connector)
PPen (pressure-aware)TText (also double-click on empty canvas)
MHighlighterNSticky note
EEraser (whole strokes and shapes)IImage (also paste or drop files)
KLaser pointer (fading trail, not saved)FFrame
CComment (click the board or an element)Mod+\Show or hide the sidebar

Delete removes, Mod+D duplicates (Alt-drag too), Mod+G / Mod+Shift+G group and ungroup, Mod+] / Mod+[ (with Shift: to front / back), Mod+A selects the page, arrows nudge (Shift: 10 px), Enter edits the text of the selection, Shift+1 zooms to fit, Mod+0 / Mod+= / Mod+- zoom, Mod+wheel or pinch zooms, PageUp / PageDown change pages. Shift keeps proportions while resizing, snaps rotation to 15° and lines to 15° steps.

  • Selection: click, Shift-click, marquee; eight resize handles and a rotation handle; lines and arrows show their end points instead (drag an end onto a shape to connect it).
  • Connectors: an arrow or line started or ended on a shape binds to it and follows when the shape moves, resizes or rotates. The end point sits on the shape's outline (rectangle, ellipse or diamond).
  • Style: stroke and fill colors, hatched / cross-hatched / solid fill, width, solid / dashed / dotted, font, and the Hand-drawn style toggle (rough, Excalidraw-like strokes from toolkit/rough.js, seeded so they never "boil") versus clean geometry. Changing a control restyles the selection and becomes the default for new elements.
  • Arrange: z-order, group, lock, align, distribute, Arrange in a Grid, Arrange as Flowchart (layers along the connectors).
  • Pages (notebook style): the bar below the canvas lists pages; add, rename (double-click), delete, and choose the paper: plain, dotted, squared or lined. View ▸ Show Grid and Snap to Grid work on every page.
  • Touch and stylus: pen pressure and coalesced pointer samples give smooth ink; once a stylus is seen, fingers only pan and pinch-zoom (palm rejection, best effort).
  • Comments and the sidebar: see the next two sections.

Comments#

Comments are the document's comment threads (doc.comments, the same threads as in every studio): they work without a collaboration room, are saved in the .ofini and, in a room, travel as end-to-end encrypted comment ops (authorship checks, idempotent; the Collaboration window lists them too). They are not part of the board's undo history, like in the other apps.

  • Add: the Comment tool (C) and a click on an element or on empty board; right-click ▸ Add comment… (on an element) or Add comment here… (on the board); Edit ▸ Add Comment (the selection, else the view's center); Comment Mode (Shift+C) works on the board as well. The composer opens at the pin.
  • Anchors (office/board/comments.js): on an element { kind: "item", item: "el:<id>", page, pin, off, quote }: off is the clicked spot relative to the element's unrotated box, so the pin follows when the element moves, resizes or rotates. When the element is deleted the pin stays where it was last seen (dashed outline) and the list says "Deleted element"; undo brings the element back with the same id and the pin re-attaches. On the board: { kind: "item", item: "pt:<pageId>", page, pin }. Comments from before 1.1.2 (el:<id> without a pin) sit at the element's top right corner.
  • Pins: numbered (creation order), in the author's color, positioned with the camera on every frame, so they keep their size at any zoom. Pins that would overlap on screen merge into a cluster with a count; clicking it zooms in. Drag a pin to move the comment (its author or the room host): onto an element or to a point. A red dot marks threads with new messages from others (per device). Show or Hide All Comments hides every pin.
  • Threads: click a pin (or a row of the sidebar) to open the thread popover at the pin: reply, edit and delete your messages, resolve and reopen, delete the thread, Resolve with AI, @mentions of room members, [ / ] step between pins, Escape closes and returns focus to the pin.
  • Export: pins are interface, not content: PNG, SVG, PDF, Excalidraw and tldraw never contain them.

View ▸ Sidebar (Mod+\, or the sidebar button in the Review group of the toolbar) docks a panel on the right of the board (office/board/sidebar.js). It is resizable (drag its edge or use the arrow keys on it) and remembers whether it is open, its width and its tab (preferences boardSidebar, boardSidebarWidth, boardSidebarTab). On boards narrower than 760 px it opens as an overlay drawer (Escape or a click beside it closes it). With the glass surface style the docked panel uses the panel fill; the drawer blurs on its own box.

  • Comments: every thread of the board with filters (Open / Resolved / All, Mine, This page), search (text, author, element), the unread count, and per row the author, time, target, first message, replies and a resolve button. A row opens its thread at the pin (switching page and scrolling the pin into view).
  • Outline: the pages (click to switch) and the elements of the current page, top-most first, with frame contents indented under their frame. Click selects (Shift/Ctrl adds), double-click or F2 renames (frames change their title, other elements get a name), eye and lock buttons hide and lock, the magnifier zooms to the element, drag rows to change the stacking order (Alt+Up / Alt+Down from the keyboard), and a search field filters. Hidden elements are not drawn, hit or exported (hidden: true, synced like every other property).
  • Properties: position, size and angle of one element; stroke, fill (or none), fill style, width, line style, drawing style and opacity; font, size and alignment for text; start and end arrowheads for connectors; locked and hidden. Changes apply to the whole selection where it makes sense; locked elements are read-only. The style controls of the toolbar stay for quick changes.
  • Library: shapes, text, frame and sticky notes in every paper color; click to add one at the view's center or drag it onto the board.

Model#

doc.office = OfficeProject(model, "board"); the model is plain JSON (office/board/model.js header):

{ version: 1, title, background: "#ffffff",
  pages: [{ id, name, z, paper }],                  // z: fractional order key (collab/fractional.js)
  elements: { [id]: { id, type, page, x, y, w, h, angle, z, stroke, fill, fillStyle, width, dash, rough, opacity,
                      seed, group?, frame?, locked?, text?, font?, fontSize?, align?, points?, start?, end?, heads?,
                      media?, name? } },
  media: { [id]: { id, mime, name, w, h, bytes } } } // bytes in .ofini as office/board/media/<id>.<ext>

Types: rect ellipse diamond line arrow pen highlighter text sticky image frame plus the rich objects table chart plot math portal (below). Points of lines and ink are relative to (x, y); ink points carry pressure as a third value. Connectors store start / end as { id }; layoutConnectors() re-routes them after every operation that moves something.

Rich objects#

Native objects that render as vector display lists like everything else (screen, SVG, PDF, PNG), so they stay sharp and editable instead of being drawn stroke by stroke (office/board/objects.js, pure). Insert ▸ Table… / Chart… / Graph (Coordinate System)… / Formula… / Sub-board… opens a small dialog; double-click (or Edit… in the context menu) edits an object, double-click on a sub-board card opens its page.

TypeFieldsNotes
tablerows (strings), header, fontSize, fill (header color), stroke, merges (A1 ranges such as "A1:C1"), styles ({ "B2": { bold, fill } })up to 200 × 30 cells; numbers right-aligned; long cells end with …; a merge shows the text of its top-left cell centered, overlapping merges are dropped
chartchart (engine/layout/chart-data.js definition with data)the chart renderer of the spreadsheet and the Layout studio; data typed in or read from an open spreadsheet range (a snapshot)
plotxMin xMax yMin yMax, grid, axisLabels, functions [{ expr, color, label? }], points [{ x, y, label?, color? }], segments [{ from, to, color? }]a coordinate system in math coordinates (y up) inside the element box; nice ticks, arrows on the axes, curves clipped to the box; an expr is a graph y = f(x) (split at asymptotes), a parametric curve or an implicit curve (see below)
mathtex, fontSize, stroke (color)a small TeX subset: \frac, \sqrt, ^{ }, _{ }, Greek letters, relations, arrows, \sum, \int, \infty, \text{ }, stretched \left( … \right) delimiters (`( ) [ ] { }
portaltarget (page id), namea sub-board: a card that opens another page, with a scaled preview of that page's content (previews inside a preview are not drawn)

Function expressions (compileExpr) are parsed by a small recursive-descent compiler, never eval: + - * / ^, parentheses, implicit multiplication (2x, 3(x+1)), sin cos tan asin acos atan sinh cosh tanh sqrt cbrt abs exp ln log log2 floor ceil round sign min max pow, pi e tau; a leading y = or f(x) = is ignored. parseCurve classifies a plot expression: (x(t), y(t)) with an optional t = a..b (default 0 to 2π) is a parametric curve (sampled at 800 points, split where it jumps); an equation in x and y or an expression containing y (x^2 + y^2 = 4, x = 3, x*y - 1) is an implicit curve F(x, y) = 0, traced by marching squares on a grid of about one cell per 4 px (saddles resolved with the cell center, sign changes across poles skipped); anything else is y = f(x). Write x*y, not xy. diagrams.js ▸ buildDiagram turns structured items into a laid-out mind map, tree, timeline, cycle or 2 × 2 matrix of shapes, stickies and bound connectors.

Code map#

PartFile
Manifest (formats, templates, AI note)app/src/office/board/manifest.js
Contract implementation (create, open, save, adapters)app/src/office/board/app.js
Pure model and operations (geometry, hit tests, connectors, z-order, align, arrange, pages, records, templates)app/src/office/board/model.js
Renderer: elements → engine display lists (screen, SVG, PDF, PNG), ink outlinesapp/src/office/board/render.js
PNG / SVG / PDF exportapp/src/office/board/export.js
Rich objects (tables, charts, coordinate systems, formulas, sub-boards): normalizers, expression compiler, curve classification and tracing, formula layout with environments and delimiters, display listsapp/src/office/board/objects.js
Diagram generators (mind map, tree, timeline, cycle, matrix)app/src/office/board/diagrams.js
Insert and edit dialogs for rich objects (lazy)app/src/office/board/object-dialogs.js
Excalidraw / tldraw codecsapp/src/office/board/formats.js
Canvas UI (gestures, editing, pages, comment pins)app/src/office/board/view.js
Comment anchors, pins, clusters, filters, unread (pure)app/src/office/board/comments.js
Sidebar (Comments, Outline, Properties, Library)app/src/office/board/sidebar.js
Outline rows and z-order drag and drop (pure)app/src/office/board/outline.js
Commands and context menu (registered when the first board mounts)app/src/commands/office-board.js
Menusapp/src/studios/office.js ▸ OFFICE_MENUS (officeKinds: ["board"])
Vibe toolsapp/src/vibe/tools/office-board.js (group Whiteboard)
Stylesapp/styles/office-board.css
Teststests/office/board.test.js, tests/office/board-objects.test.js, tests/office/board-depth.test.js, tests/office/board-comments.test.js, tests/office/board-outline.test.js

Rendering uses the engine's display lists (docs/engine-contracts.md): the screen draws them with engine/backends/canvas.js on a scene canvas (redrawn on model or camera changes) under an overlay canvas (selection, ink in progress, laser). Display-list items are cached per element object, which works because models are immutable (sub-board cards are re-drawn when the board's elements change, and every item when the language changes). Text the board draws itself (frame names, the sub-board card, template contents, default page names) is translated.

Undo and collaboration#

Every finished gesture, menu command or Vibe call is one commitOffice step (nudges coalesce). The collabAdapter flattens the board into records: el:<id> per element (last writer wins per element, so two people moving different shapes never conflict), page:<id>, media:<id> (images up to about 46 KiB travel inline; larger ones travel as chunk records and show as placeholders only until every chunk has arrived) and meta:board. Orders are fractional keys inside the records. An element that arrives before its page is kept and shown when the page arrives. Undo and Redo revert only your own step, also after other people edited the board. Comments are not records: they are the document's comment threads and sync as comment ops (see Comments). Remote cursors are not shown. A single element larger than 64 KiB as JSON (a very long freehand stroke) is not sent live; the others get it with Resync.

Vibe#

board_describe (ids, positions, texts, connections), board_add_shape, board_add_sticky, board_add_text, board_add_connector (bound to element ids), board_update, board_delete, board_arrange (grid, row, column, flow, align, distribute, group, z-order), board_page, board_import (Excalidraw / tldraw JSON into the current page) and board_export (Excalidraw, tldraw or SVG text). Rich content: board_add_table and board_edit_table (with merges and bold), board_add_chart (data or an open spreadsheet range), board_add_plot (coordinate system with function graphs, points, segments, parametric and implicit curves), board_add_math (TeX formula with matrices and stretched delimiters), board_add_subboard (new page plus a card that opens it; pass its page id to the other tools), board_add_diagram (mindmap, tree, timeline, cycle, matrix in one call) and board_draw (free polylines and polygons). Comments: board_list_comments (each thread with the element or board point it points at) and board_add_comment (on an element id, optionally at a point on it, or at a point of a page); the general reply_comment, resolve_comment, list_comments and get_comment_context work on the same threads and resolve board anchors to the element. Skills: whiteboard-math-lesson, whiteboard-data-story, whiteboard-diagram, whiteboard-visual-explainer, brainstorm-to-board. office_describe, office_new and office_export work too. office_board_to_document writes a board up as a new text document (boardToMarkdown in model.js: the title, one heading per page and frame, stickies, text boxes and labeled shapes as bullets in reading order, connectors as "A → B" lines).

Import and export fidelity#

FormatKeptSimplified or lost
Excalidraw readrectangles, ellipses, diamonds, lines, arrows with bindings and arrowheads, freedraw with pressure, text, bound labels, images (embedded files), frames, groups, colors, fills, stroke style, roughness, opacity, angle, links, locksnested groups become one group; zigzag/dots fills become hatching; elbow arrows become straight segments; embeddables, iframes and other unknown types are dropped (listed in the import report)
Excalidraw writeall of the abovesticky notes become filled rectangles with text; highlighter strokes become semi-transparent freehand; several pages become frames side by side; tables, charts, graphs, formulas and sub-board cards become rectangles with their text
tldraw read (2.x and 3.x records, plain or rich text)pages, geo shapes (rectangle, ellipse, diamond), notes, text, draw and highlight (pressure), arrows with bindings (binding records and the older inline form), lines, frames, groups, images (embedded data URLs), rotation, opacity, locksother geo shapes become rectangles; curved arrows become straight; images stored outside the file and embeds, bookmarks and videos are dropped
tldraw write (schema of tldraw 2.x; newer versions migrate it)pages, shapes, notes, text, ink, arrows with bindings, lines, frames, imagescolors snap to tldraw's palette; widths and font sizes snap to s/m/l/xl; fills follow the stroke color; groups are not written; bent arrows become straight; notes have tldraw's fixed size
PNG / SVGthe current page, cropped to its content with a marginfonts are the system's (the handwritten font maps to Comic Sans MS with fallbacks)
PDFevery pagestandard PDF fonts

The tldraw writer was checked by round trips through our own reader, not against tldraw itself.

Limits#

  • No elbow / curved connector routing, no arrow labels positioned by the user; the Library holds the built-in shapes and sticky notes only (no user libraries or templates).
  • No remote cursors or live laser for collaborators; a single element larger than 64 KiB (a very long freehand stroke) is not sent through live editing (Resync brings it).
  • Text inside rotated shapes is edited unrotated; the editor is a plain textarea (no rich text).
  • Palm rejection is heuristic: it activates after the first stylus contact in the session.
  • Formulas cover a TeX subset (no \over, accents such as \hat or \vec, or user macros); implicit curves are traced on a grid, so details smaller than a grid cell can be missed; table cells hold one line each. tldraw and Excalidraw export write rich objects as rectangles with their text.

Edit on GitHub → docs/office-board.md