Skip to content

spatial-monorepo


spatial-monorepo / editor/src / UseEditorHook

Interface: UseEditorHook

Defined in: packages/editor/src/useEditor.ts:73

Properties

mode

mode: EditorMode

Defined in: packages/editor/src/useEditor.ts:74


selection

selection: Set<string>

Defined in: packages/editor/src/useEditor.ts:76


shortcuts

shortcuts: EditorShortcutsMap

Defined in: packages/editor/src/useEditor.ts:98

Named shortcut actions — useful for wiring custom UI controls.

Methods

copyToBuilding()

copyToBuilding(ids, targetBuildingId, targetFloorId, opts?): void

Defined in: packages/editor/src/useEditor.ts:87

Parameters

ids

string[]

targetBuildingId

string

targetFloorId

string

opts?

CopyOptions & object

Returns

void


copyToFloor()

copyToFloor(ids, targetLevelId, opts?): void

Defined in: packages/editor/src/useEditor.ts:86

Parameters

ids

string[]

targetLevelId

string

opts?

CopyOptions

Returns

void


copyToFloors()

copyToFloors(featureIds, targetFloorIds, opts?): Feature<Geometry, GeoJsonProperties>[]

Defined in: packages/editor/src/useEditor.ts:93

Copies the given features to each of the target floors, creating featureIds.length × targetFloorIds.length new features as a single undoable step. Returns the newly created feature copies.

Parameters

featureIds

string[]

targetFloorIds

string[]

opts?

CopyToFloorsOptions

Returns

Feature<Geometry, GeoJsonProperties>[]


exportIMDF()

exportIMDF(profile): Promise<Blob>

Defined in: packages/editor/src/useEditor.ts:96

Parameters

profile

"apple" | "microsoft"

Returns

Promise<Blob>


redo()

redo(): void

Defined in: packages/editor/src/useEditor.ts:95

Returns

void


setMode()

setMode(m): void

Defined in: packages/editor/src/useEditor.ts:75

Parameters

m

EditorMode

Returns

void


setSelection()

setSelection(ids): void

Defined in: packages/editor/src/useEditor.ts:85

Replaces the current selection. Accepts either a Set or an iterable of feature ids (e.g. an array) for caller convenience.

Issue #988 — this was missing from the public hook entirely, so shortcuts.delete()/shortcuts.copy() could never see a populated selection for any consumer built against this public API.

Parameters

ids

Iterable<string>

Returns

void


undo()

undo(): void

Defined in: packages/editor/src/useEditor.ts:94

Returns

void

Released under commercial licensing.