pastello-app

0004. Vector document model

Context

Children want to write text on their drawings, add stickers and shapes, and move them around afterwards. They also need a reliable undo. A plain bitmap cannot offer any of this, and it ties the drawing to one screen resolution.

Decision

A drawing is an ordered list of elements; list order is the z-order. Bitmaps are only produced for display and export.

Drawing
├── id, title, createdAt, updatedAt, schemaVersion
├── sheet: { width, height, background }     # fixed logical size
└── elements: [Element]                       # order = z-order
    │   (every element has: id, transform { translation, scale, rotation })
    ├── StrokeElement   { tool, color, width, points[x, y, pressure], erasures[] }
    ├── TextElement     { text, font, size, color }
    ├── StickerElement  { packId, elementId }
    ├── ShapeElement    { kind, size, stroke, fill }
    └── FillElement     { mask PNG, color }   # bucket fill, after v1

Consequences

Alternatives considered