Object Tool

Object tool allows listing and interacting with all objects that are currently on canvas. Objects include shapes, text, stickers, drawings, overlay images etc.

const pixie = await Pixie.init();
console.log(pixie.tools.objects.getAll());

Methods

getAll

Get all objects that are currently on canvas.

getAll(): Object[]

get

Get object with specified name from canvas.

get(name: string): undefined | Object

getById

Get object with specified id from canvas.

getById(id: string): undefined | Object

isActive

Check whether specified object is currently selected.

isActive(objectOrId: string | Object): boolean

getActive

Get currently active object.

getActive(): null | Object

has

Check if object with specified name exists on canvas.

has(name: string): boolean

select

Select specified object.

select(objOrId: string | Object): void

deselectActive

Deselect currently active object.

deselectActive(): void

setValues

Apply values to specified or currently active object.

setValues(values: ObjectOptions, obj?: null | Object): void

move

Move specified or currently active object in given direction.

move(direction: "up" | "right" | "down" | "left", amount?: number, obj?: null | Object): void

bringToFront

Bring specified or currently active object to front of canvas.

bringToFront(obj?: null | Object): void

sendToBack

Send specified or currently active object to back of canvas.

sendToBack(obj?: null | Object): void

flipHorizontally

Flip specified or currently active object horizontally.

flipHorizontally(obj?: null | Object): void

duplicate

Duplicate specified or currently active object.

duplicate(obj?: null | Object): void

delete

Delete specified or currently active object.

delete(obj?: null | Object): void