mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-05 13:41:59 +00:00
* [refactor] move workflow domain to its own folder * [refactor] Fix workflow platform architecture organization - Move workflow rendering functionality to renderer/thumbnail domain - Rename ui folder to management for better semantic clarity - Update all import paths to reflect proper domain boundaries - Fix test imports to use new structure Architecture improvements: - rendering → renderer/thumbnail (belongs with other rendering logic) - ui → management (better name for state management and UI integration) This ensures proper separation of concerns and domain boundaries. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [fix] Resolve circular dependency between nodeDefStore and subgraphStore * [fix] Update browser test imports to use new workflow platform paths --------- Co-authored-by: Claude <noreply@anthropic.com>
69 lines
2.0 KiB
TypeScript
69 lines
2.0 KiB
TypeScript
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
|
|
import { LGraphEventMode } from '@/lib/litegraph/src/litegraph'
|
|
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
|
|
import { app } from '@/scripts/app'
|
|
import { useCommandStore } from '@/stores/commandStore'
|
|
import { filterOutputNodes } from '@/utils/nodeFilterUtil'
|
|
|
|
/**
|
|
* Composable for handling node information and utility operations
|
|
*/
|
|
export function useSelectedNodeActions() {
|
|
const { getSelectedNodes, toggleSelectedNodesMode } =
|
|
useSelectedLiteGraphItems()
|
|
const commandStore = useCommandStore()
|
|
const workflowStore = useWorkflowStore()
|
|
|
|
const adjustNodeSize = () => {
|
|
const selectedNodes = getSelectedNodes()
|
|
|
|
selectedNodes.forEach((node) => {
|
|
const optimalSize = node.computeSize()
|
|
node.setSize([optimalSize[0], optimalSize[1]])
|
|
})
|
|
|
|
app.canvas.setDirty(true, true)
|
|
workflowStore.activeWorkflow?.changeTracker?.checkState()
|
|
}
|
|
|
|
const toggleNodeCollapse = () => {
|
|
const selectedNodes = getSelectedNodes()
|
|
selectedNodes.forEach((node) => {
|
|
node.collapse()
|
|
})
|
|
|
|
app.canvas.setDirty(true, true)
|
|
workflowStore.activeWorkflow?.changeTracker?.checkState()
|
|
}
|
|
|
|
const toggleNodePin = () => {
|
|
const selectedNodes = getSelectedNodes()
|
|
selectedNodes.forEach((node) => {
|
|
node.pin(!node.pinned)
|
|
})
|
|
|
|
app.canvas.setDirty(true, true)
|
|
workflowStore.activeWorkflow?.changeTracker?.checkState()
|
|
}
|
|
|
|
const toggleNodeBypass = () => {
|
|
toggleSelectedNodesMode(LGraphEventMode.BYPASS)
|
|
app.canvas.setDirty(true, true)
|
|
}
|
|
|
|
const runBranch = async () => {
|
|
const selectedNodes = getSelectedNodes()
|
|
const selectedOutputNodes = filterOutputNodes(selectedNodes)
|
|
if (selectedOutputNodes.length === 0) return
|
|
await commandStore.execute('Comfy.QueueSelectedOutputNodes')
|
|
}
|
|
|
|
return {
|
|
adjustNodeSize,
|
|
toggleNodeCollapse,
|
|
toggleNodePin,
|
|
toggleNodeBypass,
|
|
runBranch
|
|
}
|
|
}
|