Class: UppKonvaArea
Defined in: upp-konva-area.ts:111
Live floor-plan area (model.area). Inside an UppKonvaModel the reference is never replaced.
To hydrate from the app, assign area.source = …. That and assigning shapes emit onSourceChanged$ on structural shape
changes, DTO data changes (same id/kind list), or room metadata changes.
doDestroy completes observables and destroys every shape in shapes.
Remarks
Integrator-facing surface (guide + public TypeDoc “model”): room dimensions and metadata, source / shapes,
onSourceChanged$, onShapeAdded$, onGrouped$, notifyPresentationDirty, removeShapes / removeShape,
selectShape, onClearSelection$, shapesStructuralFingerprint, findShapeById, doDestroy. Per-shape canvas attention: UppKonvaShape.attention.
Package-internal hooks (JSDoc internal tag: omitted from TypeDoc with excludeInternal, stripped from published .d.ts
with stripInternal, and not part of the integrator narrative): stage wiring (wireKonvaStage,
applyAdapterSnapshotFromStage, stage replay suppression, notifyGrouped,
requestRepaint). Konva host references: import('../stage/upp-konva-stage').UppKonvaStage,
uppKonvaAreaWire, tracing import('../internal/upp-konva-runtime-trace').uppKonvaRuntimeTrace.
Implements
UppKonvaDestroy
Constructors
Constructor
new UppKonvaArea(
source):UppKonvaArea
Defined in: upp-konva-area.ts:131
Initializes dimensions, metadata, and shapes from source.
Parameters
source
Initial DTO.
Returns
UppKonvaArea
Properties
onClearSelection$
readonlyonClearSelection$:Observable<void>
Defined in: upp-konva-area.ts:178
Emits once when the host selection goes from at least one element to none (same report the stage sends as
empty UUID list to upp-konva). Not emitted on initial empty state; idempotent across repeated empty reports.
onGrouped$
readonlyonGrouped$:Observable<UppKonvaGroup|null>
Defined in: upp-konva-area.ts:185
Multi-selection observable on the canvas; not part of the plan JSON.
After UppKonvaModel wiring, a homogeneous multi-selection emits an UppKonvaGroup with a stage delegate;
null when zero or one item is selected.
onShapeAdded$
readonlyonShapeAdded$:Observable<UppKonvaShape>
Defined in: upp-konva-area.ts:200
Emits once per new document row (id not present before the update): after source = …, shapes = …, or
applyAdapterSnapshotFromStage (via the host). Does not emit for the initial UppKonvaArea.from / new UppKonvaArea
load, nor when rows are only updated or reordered (same ids). Replacing a row under an existing id is not an “add”.
onSourceChanged$
readonlyonSourceChanged$:Observable<void>
Defined in: upp-konva-area.ts:193
Emits after source = … when the structural shapes fingerprint changes, any row’s serializable payload
(data / DTO geometry), or room metadata (orientation, draw mode, dimensions, etc.).
Does not emit on the constructor’s initial load. UppKonvaModel repaints the scene on every emission; onModelChanged
should only track structural list changes.
Accessors
height
Get Signature
get height():
number
Defined in: upp-konva-area.ts:208
Plan height in cm.
Returns
number
labelSize
Get Signature
get labelSize():
UppKonvaLabelFontSize
Defined in: upp-konva-area.ts:228
Label / sublabel badge text scale on the canvas.
Returns
mode
Get Signature
get mode():
UppKonvaDrawMode
Defined in: upp-konva-area.ts:223
Area draw mode (SHAPES / VERTEX); distinct from UppKonvaModel.mode VIEW/EDIT.
Returns
name
Get Signature
get name():
string|undefined
Defined in: upp-konva-area.ts:213
Optional plan name.
Returns
string | undefined
orientation
Get Signature
get orientation():
UppKonvaOrientation
Defined in: upp-konva-area.ts:218
Canvas fit (not shape rotation).
Returns
shapes
Get Signature
get shapes(): readonly
UppKonvaShape[]
Defined in: upp-konva-area.ts:233
Live model shapes (one instance per document row).
Returns
readonly UppKonvaShape[]
Set Signature
set shapes(
value):void
Defined in: upp-konva-area.ts:240
Replaces the shape list. Emits onSourceChanged$ when the structural fingerprint (id + kind order) changes.
Parameters
value
readonly UppKonvaShape[]
Returns
void
shapesStructuralFingerprint
Get Signature
get shapesStructuralFingerprint():
string
Defined in: upp-konva-area.ts:268
Ordered id + kind fingerprint; same notion of structural change as shapes / onSourceChanged$.
Returns
string
Structural fingerprint string.
source
Get Signature
get source():
UppKonvaAreaSource
Defined in: upp-konva-area.ts:273
DTO view of the current state (serializable; round-trips with source = …).
Returns
Set Signature
set source(
value):void
Defined in: upp-konva-area.ts:292
Applies an UppKonvaAreaSource in place. Emits onSourceChanged$ when the structural shapes fingerprint changes,
any row’s DTO payload (for example data.shape without id/kind changes), or room metadata.
Parameters
value
Full area DTO.
Returns
void
width
Get Signature
get width():
number
Defined in: upp-konva-area.ts:203
Plan width in cm.
Returns
number
Methods
doDestroy()
doDestroy():
void
Defined in: upp-konva-area.ts:145
Calls doDestroy on each shape, completes onGrouped$, onShapeAdded$, and onSourceChanged$, and clears shapes. Idempotent.
Returns
void
Implementation of
UppKonvaDestroy.doDestroy
findShapeById()
findShapeById(
id):UppKonvaShape|null
Defined in: upp-konva-area.ts:360
Resolves a live shape by public model id or by the canonical floor-plan element uuid (same rule as the host’s
selection ids when shape.id is not already a v4 string).
Parameters
id
string
UppKonvaShape.id (trimmed) or canonical element uuid from the canvas.
Returns
UppKonvaShape | null
Matching UppKonvaShape, or null.
notifyHostSelectionFromStage()
notifyHostSelectionFromStage(
selectedElementCount):void
Defined in: upp-konva-area.ts:342
Host selection sync: invoked by upp-konva with the number of ids the floor-plan stage reported for the current
selection (0 when cleared). Emits onClearSelection$ on the transition from non-zero to zero.
Parameters
selectedElementCount
number
elementUuids.length from the stage’s selection callback.
Returns
void
notifyPresentationDirty()
notifyPresentationDirty():
void
Defined in: upp-konva-area.ts:329
After mutating data or other live fields without assigning source, emits onSourceChanged$ so the model
repaints the scene.
Returns
void
removeShape()
removeShape(
shape):boolean
Defined in: upp-konva-area.ts:402
Same as removeShapes with a single shape.
Parameters
shape
Shape to remove.
Returns
boolean
true when the shape was removed.
removeShapes()
removeShapes(
shapes):boolean
Defined in: upp-konva-area.ts:371
Removes the given shapes from shapes, calls doDestroy on each, and emits onSourceChanged$ when the structural
fingerprint changes. When a stage is wired, clears the Konva host selection.
Parameters
shapes
readonly UppKonvaShape[]
Live shapes to remove (typically references from this.shapes).
Returns
boolean
true when at least one shape was removed.
selectShape()
selectShape(
shape):boolean
Defined in: upp-konva-area.ts:413
Selects a live public shape on the mounted canvas when a Konva stage is wired (UppKonvaModel does this for the host).
Parameters
shape
UppKonvaShape | null
Shape from this.shapes; pass null to clear host selection.
Returns
boolean
true when the operation was accepted (null clears best-effort when not destroyed). Returns false when
destroyed, the id is empty, the shape is not in this.shapes, or a non-null selection was requested without a wired stage.
from()
staticfrom(source):UppKonvaArea
Defined in: upp-konva-area.ts:122
Creates an area from a DTO (for example hydrated JSON).
Parameters
source
Initial UppKonvaAreaSource.
Returns
UppKonvaArea
A new UppKonvaArea instance.