Generic Object Operations
Often you need to make changes that apply generally to any object regardless of whether it's a shape, text, or image. The kittl.design.object API handles operations that are universally applicable.
Getting Objects
You can retrieve the normalized state of any object if you have its ID.
const getResult = await kittl.design.object.getObject({
id: 'my-object-id'
});
if (getResult.isOk) {
console.log('Object details:', getResult.result);
}
Modifying Generic Properties
You can hide, lock, rename, or rotate elements uniformly.
// Lock an object so users can't modify it with the mouse
await kittl.design.object.setLockedState({
id: 'background-shape-id',
locked: true
});
// Hide an object visually from the board
await kittl.design.object.setHiddenState({
id: 'secret-layer',
hidden: true
});
// Programmatically rotate an object 45 degrees
await kittl.design.object.rotateObject({
id: 'my-icon',
angle: 45
});