Line data Source code
1 : /**
2 : * Node Z-Index Management Composable
3 : *
4 : * Provides focused functionality for managing node layering through z-index.
5 : * Integrates with the layout system to ensure proper visual ordering.
6 : */
7 : import type { NodeId } from '@comfyorg/graph-model/nodeId'
8 : import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
9 : import { useLayoutMutations } from '@/renderer/core/layout/operations/layoutMutations'
10 : import { LayoutSource } from '@/renderer/core/layout/types'
11 :
12 16658 : export function useNodeZIndex() {
13 16658 : const layoutMutations = useLayoutMutations(LayoutSource.Vue)
14 16658 : const canvasStore = useCanvasStore()
15 :
16 954 : function bringNodeToFront(nodeId: NodeId) {
17 954 : const { currentGraph } = canvasStore
18 954 : if (!currentGraph) return
19 :
20 954 : layoutMutations.setNodeOrder(currentGraph, nodeId, 'front')
21 : }
22 :
23 16658 : return {
24 : bringNodeToFront
25 : }
26 : }
|