mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-07 06:00:03 +00:00
fix: prevent node height shrinking on vueNodes/litegraph mode switch (#8697)
## Summary Three interacting bugs caused cumulative height loss (~66px per cycle): 1. useVueNodeLifecycle incorrectly subtracted NODE_TITLE_HEIGHT from LGraphNode.size[1] during layout init, but size[1] is already content-only (title excluded per LGraphNode.measure()). 2. ensureCorrectLayoutScale added/subtracted NODE_TITLE_HEIGHT in scale formulas, breaking the round-trip. Simplified to pure ratio scaling (size * scaleFactor). Also set LayoutSource.Canvas before batchUpdateNodeBounds to prevent stale DOM source from triggering incorrect height normalization. 3. initSizeStyles set --node-height (min-height of the full DOM element including title) to the content-only layout height. Added NODE_TITLE_HEIGHT so ResizeObserver captures the correct total height and normalization recovers the exact content height. ## Screenshots (if applicable) before https://github.com/user-attachments/assets/ae41124b-f9e3-4061-8127-eeacddc67a55 after https://github.com/user-attachments/assets/5ff288a6-73a3-481a-a750-150d9bdbc8fe ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8697-fix-prevent-node-height-shrinking-on-vueNodes-litegraph-mode-switch-2ff6d73d365081c7a2acdc7ec57e2e19) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -9,7 +9,6 @@ import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
||||
import { useLayoutMutations } from '@/renderer/core/layout/operations/layoutMutations'
|
||||
import { layoutStore } from '@/renderer/core/layout/store/layoutStore'
|
||||
import { useLayoutSync } from '@/renderer/core/layout/sync/useLayoutSync'
|
||||
import { removeNodeTitleHeight } from '@/renderer/core/layout/utils/nodeSizeUtil'
|
||||
import { ensureCorrectLayoutScale } from '@/renderer/extensions/vueNodes/layout/ensureCorrectLayoutScale'
|
||||
import { app as comfyApp } from '@/scripts/app'
|
||||
|
||||
@@ -33,10 +32,7 @@ function useVueNodeLifecycleIndividual() {
|
||||
const nodes = activeGraph._nodes.map((node: LGraphNode) => ({
|
||||
id: node.id.toString(),
|
||||
pos: [node.pos[0], node.pos[1]] as [number, number],
|
||||
size: [node.size[0], removeNodeTitleHeight(node.size[1])] as [
|
||||
number,
|
||||
number
|
||||
]
|
||||
size: [node.size[0], node.size[1]] as [number, number]
|
||||
}))
|
||||
layoutStore.initializeFromLiteGraph(nodes)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user