import { FreeLayoutPluginContext, inject, injectable, FlowNodeEntity, FlowNodeTransformData, FlowNodeFormData } from '@flowgram.ai/free-layout-editor'
@injectable()
export class MyLayer extends Layer {
@inject(FreeLayoutPluginContext) ctx: FreeLayoutPluginContext
// Can monitor node width, height, and position changes
@observeEntityDatas(FlowNodeEntity, FlowNodeTransformData) transformDatas: FlowNodeTransformData[];
// Can monitor form data changes, connection data can be stored in forms
@observeEntityDatas(FlowNodeEntity, FlowNodeFormData) formDatas: FlowNodeFormData[];
onReady() {
// Can also add styles
// zIndex controls whether to overlay nodes, nodes default to 10, greater than 10 will be above nodes
this.node.style.zIndex = 11;
}
onZoom(scale) {
// Scale with canvas
this.node.style.transform = `scale(${scale})`;
}
render() {
return <div>{...}</div>
}
}