workflow底层UI库整合至项目,优化构建逻辑
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import {store} from '#store/stores.svelte';
|
||||
|
||||
export const useGetNodeRelativePosition = () => {
|
||||
const getNodeRelativePosition = (parentNodeId: string) => {
|
||||
let node = store.getNode(parentNodeId);
|
||||
const position = { x: 0, y: 0 };
|
||||
while (node) {
|
||||
position.x += node.position.x;
|
||||
position.y += node.position.y;
|
||||
|
||||
if (node.parentId) {
|
||||
node = store.getNode(node.parentId);
|
||||
} else {
|
||||
node = undefined;
|
||||
}
|
||||
}
|
||||
return position;
|
||||
};
|
||||
return {
|
||||
getNodeRelativePosition
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user