Skip to content

Commit 6e4471a

Browse files
AustinMrozgithub-actions
andauthored
Fix node sizing in vue mode (#6289)
Before ![broken-resize](https://github.com/user-attachments/assets/1d3651f7-8589-439c-99d1-fa67c5970945) After ![vue-resize](https://github.com/user-attachments/assets/ef97ea8f-b601-4a5c-9c6a-34d3f4b776d2) Also add ~~content~~ [contain](https://developer.mozilla.org/en-US/docs/Web/CSS/contain) styling for improved render performance. Future: - Update size scaling for WidgetLayoutField widgets. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6289-Fix-node-sizing-in-vue-mode-2986d73d365081ac8fa0da35a635b226) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <[email protected]>
1 parent b03cf7e commit 6e4471a

File tree

17 files changed

+15
-291
lines changed

17 files changed

+15
-291
lines changed
452 Bytes
Loading
543 Bytes
Loading
Loading
509 Bytes
Loading
Loading
412 Bytes
Loading
667 Bytes
Loading
642 Bytes
Loading
44 Bytes
Loading

src/renderer/extensions/vueNodes/components/LGraphNode.vue

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
:data-node-id="nodeData.id"
99
:class="
1010
cn(
11-
'bg-node-component-surface',
12-
'lg-node absolute rounded-2xl touch-none flex flex-col',
11+
'bg-node-component-surface lg-node absolute',
12+
'min-h-min min-w-min contain-style contain-layout',
13+
'rounded-2xl touch-none flex flex-col',
1314
'border-1 border-solid border-node-component-border',
1415
// hover (only when node should handle events)
1516
shouldHandleNodePointerEvents &&
@@ -83,7 +84,7 @@
8384

8485
<!-- Node Body - rendered based on LOD level and collapsed state -->
8586
<div
86-
class="flex min-h-0 flex-1 flex-col gap-4 pb-4"
87+
class="flex min-h-min min-w-min flex-1 flex-col gap-4 pb-4"
8788
:data-testid="`node-body-${nodeData.id}`"
8889
>
8990
<!-- Slots only rendered at full detail -->
@@ -150,7 +151,6 @@ import { cn } from '@/utils/tailwindUtil'
150151
151152
import type { ResizeHandleDirection } from '../interactions/resize/resizeMath'
152153
import { useNodeResize } from '../interactions/resize/useNodeResize'
153-
import { calculateIntrinsicSize } from '../utils/calculateIntrinsicSize'
154154
import LivePreview from './LivePreview.vue'
155155
import NodeContent from './NodeContent.vue'
156156
import NodeHeader from './NodeHeader.vue'
@@ -269,18 +269,9 @@ const handleContextMenu = (event: MouseEvent) => {
269269
270270
onMounted(() => {
271271
// Set initial DOM size from layout store, but respect intrinsic content minimum
272-
if (size.value && nodeContainerRef.value && transformState) {
273-
const intrinsicMin = calculateIntrinsicSize(
274-
nodeContainerRef.value,
275-
transformState.camera.z
276-
)
277-
278-
// Use the larger of stored size or intrinsic minimum
279-
const finalWidth = Math.max(size.value.width, intrinsicMin.width)
280-
const finalHeight = Math.max(size.value.height, intrinsicMin.height)
281-
282-
nodeContainerRef.value.style.width = `${finalWidth}px`
283-
nodeContainerRef.value.style.height = `${finalHeight}px`
272+
if (size.value && nodeContainerRef.value) {
273+
nodeContainerRef.value.style.width = `${size.value.width}px`
274+
nodeContainerRef.value.style.height = `${size.value.height}px`
284275
}
285276
})
286277

0 commit comments

Comments
 (0)