mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-09 23:20:04 +00:00
[fix] Fix viewport sync in minimap and subgraphs navigation (#4644)
This commit is contained in:
@@ -33,6 +33,17 @@ export const useSubgraphNavigationStore = defineStore(
|
||||
maxSize: 32
|
||||
})
|
||||
|
||||
/**
|
||||
* Get the ID of the root graph for the currently active workflow.
|
||||
* @returns The ID of the root graph for the currently active workflow.
|
||||
*/
|
||||
const getCurrentRootGraphId = () => {
|
||||
const canvas = canvasStore.getCanvas()
|
||||
if (!canvas) return 'root'
|
||||
|
||||
return canvas.graph?.rootGraph?.id ?? 'root'
|
||||
}
|
||||
|
||||
/**
|
||||
* A stack representing subgraph navigation history from the root graph to
|
||||
* the current opened subgraph.
|
||||
@@ -117,13 +128,13 @@ export const useSubgraphNavigationStore = defineStore(
|
||||
saveViewport(prevSubgraph.id)
|
||||
} else if (!prevSubgraph && subgraph) {
|
||||
// Leaving root graph to enter a subgraph
|
||||
saveViewport('root')
|
||||
saveViewport(getCurrentRootGraphId())
|
||||
}
|
||||
|
||||
const isInRootGraph = !subgraph
|
||||
if (isInRootGraph) {
|
||||
idStack.value.length = 0
|
||||
restoreViewport('root')
|
||||
restoreViewport(getCurrentRootGraphId())
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user