Skip to main content

sdk.appstateapi

Home > @kittl/sdk > AppStateAPI

AppStateAPI interface

API for managing application state including selection, viewport, active tool, and canvas mode.

Signature:

export interface AppStateAPI 

Methods

Method

Description

getActiveTool()

Gets the currently active tool (artboard, move, pen, comment, shape, etc.).

getAllSelectedObjectsIds()

Gets all selected object IDs including objects, artboards, and artboard objects.

getCanvasMode()

Gets the current canvas mode (erase, crop, reframe, or null).

getCoords()

Gets the viewport corner coordinates.

getHoveredObjectId()

Gets the ID of the currently hovered object.

getSelectedArtboardIds()

Gets the IDs of selected artboards.

getSelectedArtboardsObjectIds()

Gets the object IDs within selected artboards.

getSelectedLayersIds()

Gets the IDs of selected layers (all items are on the same level; may include group IDs).

getSelectedObjectsIds()

Gets the IDs of all selected objects (includes all selected objects regardless of group structure).

getTransform()

Gets the viewport transformation matrix.

getViewport()

Gets the current viewport state.

getZoom()

Gets the current zoom level.

setActiveTool(tool)

Sets the active tool.

setAllSelectedObjectsIds(ids)

Sets all selected object IDs.

setCanvasMode(mode)

Sets the canvas mode.

setCoords(coords)

Sets the viewport corner coordinates.

setHoveredObjectId(id)

Sets the hovered object ID.

setMany(fields)

Updates multiple app state fields at once.

setSelectedArtboardIds(ids)

Sets the selected artboard IDs.

setSelectedArtboardsObjectIds(ids)

Sets the object IDs within selected artboards.

setSelectedLayersIds(ids)

Sets the selected layer IDs.

setSelectedObjectsIds(ids)

Sets the selected object IDs.

setTransform(transform)

Sets the viewport transformation matrix.

setViewport(vp)

Sets the viewport state.

setZoom(zoom)

Sets the zoom level.