mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-05 21:20:12 +00:00
Fix/vue nodes auto scale (#6664)
## Summary **Problem:** ensureCorrectLayoutScale scales up LG -> Vue. But doesn't scale down from Vue -> LG. **Solution:** Bi directional scaling. **Bonus:** fix edge cases such as subgraphs, groups, and reroutes. Also, set auto scale: true now that we 'preserve' LG scale. **IMPORTANT:** useVueNodeResizeTracking.ts sets vue node height - Litegraph.NODE_TITLE_HEIGHT on workflow load using a resize observer. Reloading the page (loading a workflow) in Vue mode, will subtract height each time. This can look like a problem caused by ensureCorrectLayoutScale. It is not. Need to fix. Here was an attempt by [removing the Litegraph.NODE_TITLE_HEIGHT entirely](https://github.com/Comfy-Org/ComfyUI_frontend/pull/6643). ## Review Focus Full lifecycle of loading workflows and switching between vue and lg. Race conditions could be present. For example switching the mode using keybind very fast. ## Screenshots (if applicable) https://github.com/user-attachments/assets/5576b760-13a8-45b9-b8f7-64e1caf443c1 https://github.com/user-attachments/assets/46d6f870-df76-4084-968a-53cb629fc123 --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { createSharedComposable } from '@vueuse/core'
|
||||
import { createSharedComposable, whenever } from '@vueuse/core'
|
||||
import { shallowRef, watch } from 'vue'
|
||||
|
||||
import { useGraphNodeManager } from '@/composables/graph/useGraphNodeManager'
|
||||
@@ -82,8 +82,9 @@ function useVueNodeLifecycleIndividual() {
|
||||
(enabled, wasEnabled) => {
|
||||
if (enabled) {
|
||||
initializeNodeManager()
|
||||
ensureCorrectLayoutScale()
|
||||
|
||||
ensureCorrectLayoutScale(
|
||||
comfyApp.canvas?.graph?.extra.workflowRendererVersion
|
||||
)
|
||||
if (!wasEnabled && !isVueNodeToastDismissed.value) {
|
||||
useToastStore().add({
|
||||
group: 'vue-nodes-migration',
|
||||
@@ -91,14 +92,22 @@ function useVueNodeLifecycleIndividual() {
|
||||
life: 0
|
||||
})
|
||||
}
|
||||
} else {
|
||||
comfyApp.canvas?.setDirty(true, true)
|
||||
disposeNodeManagerAndSyncs()
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
whenever(
|
||||
() => !shouldRenderVueNodes.value,
|
||||
() => {
|
||||
ensureCorrectLayoutScale(
|
||||
comfyApp.canvas?.graph?.extra.workflowRendererVersion
|
||||
)
|
||||
disposeNodeManagerAndSyncs()
|
||||
comfyApp.canvas?.setDirty(true, true)
|
||||
}
|
||||
)
|
||||
|
||||
// Consolidated watch for slot layout sync management
|
||||
watch(
|
||||
() => shouldRenderVueNodes.value,
|
||||
|
||||
Reference in New Issue
Block a user