Skip to main content

Type Alias: GetInstanceScreenRect

GetInstanceScreenRect = (instanceId) => Promise<Nullable<{ height: number; width: number; x: number; y: number; }>>

Projects a placed item into a rectangle measured in CSS pixels from the active canvas’s top-left corner. Use for an overlay anchored to a modular item. Null means projection is unavailable, including when bounds cross the camera plane. The rectangle can extend beyond the canvas. For world dimensions use observers.scene.instanceBounds.

Parameters​

instanceId​

string

Returns​

Promise<Nullable<{ height: number; width: number; x: number; y: number; }>>

Example​

const { actions, observers } = window.mimeeqApp;
const [item] = Object.values(observers.modular.sceneItems.getValue() ?? {});
if (item) {
const rect = await actions.getInstanceScreenRect(item.instanceId);
if (rect) console.log(rect.x, rect.y, rect.width, rect.height);
}