27 lines
611 B
TypeScript
27 lines
611 B
TypeScript
export class FlowManager {
|
|
stateManager: any
|
|
vueFlow: any
|
|
constructor(options) {
|
|
this.stateManager = options.stateManager;
|
|
this.vueFlow = options.vueFlow
|
|
}
|
|
setZoom(zoom: number) {
|
|
this.stateManager.zoom.value = zoom
|
|
this.vueFlow.value.zoomTo(zoom)
|
|
}
|
|
getNodeById(id: string) {
|
|
return this.vueFlow.value.getNode(id)
|
|
}
|
|
getLastNode() {
|
|
const lastNode = this.stateManager.getLastNode()
|
|
if (lastNode?.id) {
|
|
return this.vueFlow.value.getNode(lastNode.id)
|
|
}
|
|
return null;
|
|
}
|
|
getSubordNodeByID(id: string) {
|
|
return this.vueFlow.value.getNodes?.find((v) => v.data.superiorID === id)
|
|
}
|
|
|
|
}
|