feat: Add sticky notes support to the new canvas (no-changelog) (#10031)

This commit is contained in:
Alex Grozav
2024-07-15 13:00:52 +03:00
committed by GitHub
parent 9302e33d55
commit cd24c71a9e
32 changed files with 653 additions and 147 deletions

View File

@@ -19,6 +19,7 @@ const emit = defineEmits<{
'update:node:active': [id: string];
'update:node:enabled': [id: string];
'update:node:selected': [id?: string];
'update:node:parameters': [id: string, parameters: Record<string, unknown>];
'run:node': [id: string];
'delete:node': [id: string];
'delete:connection': [connection: Connection];
@@ -57,10 +58,14 @@ const { getSelectedEdges, getSelectedNodes, viewportRef, fitView, project } = us
function onNodeDragStop(e: NodeDragEvent) {
e.nodes.forEach((node) => {
emit('update:node:position', node.id, node.position);
onUpdateNodePosition(node.id, node.position);
});
}
function onUpdateNodePosition(id: string, position: XYPosition) {
emit('update:node:position', id, position);
}
function onSelectionDragStop(e: NodeDragEvent) {
onNodeDragStop(e);
}
@@ -82,6 +87,10 @@ function onDeleteNode(id: string) {
emit('delete:node', id);
}
function onUpdateNodeParameters(id: string, parameters: Record<string, unknown>) {
emit('update:node:parameters', id, parameters);
}
/**
* Connections
*/
@@ -222,6 +231,8 @@ onUnmounted(() => {
@select="onSelectNode"
@toggle="onToggleNodeEnabled"
@activate="onSetNodeActive"
@update="onUpdateNodeParameters"
@move="onUpdateNodePosition"
/>
</template>