Skip to content

Commit 497bafc

Browse files
DrJKLsimula-rgithub-actions
authored
Fix: Widget sizing with multiple expanding items (#7118)
## Summary Textarea/Markdown/3D pieces grow, other widget rows size to their contents. ## Screenshots (if applicable) <img width="564" height="420" alt="image" src="https://github.com/user-attachments/assets/35aeb9bf-a44d-4e3f-b2cd-a9f3604a7778" /> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7118-Fix-Widget-sizing-with-multiple-expanding-items-2be6d73d3650816c8153ff3f1e49176d) by [Unito](https://www.unito.io) --------- Co-authored-by: Simula_r <18093452+simula-r@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com>
1 parent c698838 commit 497bafc

File tree

5 files changed

+49
-28
lines changed

5 files changed

+49
-28
lines changed
-97 Bytes
Loading

src/components/load3d/Load3D.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div
3-
class="widget-expands relative h-full w-full"
3+
class="relative size-full"
44
@mouseenter="handleMouseEnter"
55
@mouseleave="handleMouseLeave"
66
@pointerdown.stop
@@ -17,7 +17,7 @@
1717
:on-model-drop="isPreview ? undefined : handleModelDrop"
1818
:is-preview="isPreview"
1919
/>
20-
<div class="pointer-events-none absolute top-0 left-0 h-full w-full">
20+
<div class="pointer-events-none absolute top-0 left-0 size-full">
2121
<Load3DControls
2222
v-model:scene-config="sceneConfig"
2323
v-model:model-config="modelConfig"

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

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
v-else
77
:class="
88
cn(
9-
'lg-node-widgets grid grid-cols-[min-content_minmax(80px,max-content)_minmax(125px,auto)] has-[.widget-expands]:flex-1 gap-y-1 pr-3',
9+
'lg-node-widgets grid grid-cols-[min-content_minmax(80px,max-content)_minmax(125px,auto)] flex-1 gap-y-1 pr-3',
1010
shouldHandleNodePointerEvents
1111
? 'pointer-events-auto'
1212
: 'pointer-events-none'
1313
)
1414
"
15+
:style="{
16+
'grid-template-rows': gridTemplateRows
17+
}"
1518
@pointerdown="handleWidgetPointerEvent"
1619
@pointermove="handleWidgetPointerEvent"
1720
@pointerup="handleWidgetPointerEvent"
@@ -22,11 +25,9 @@
2225
>
2326
<div
2427
v-if="!widget.simplified.options?.hidden"
25-
:data-is-hidden="`hidden: ${widget.simplified.options?.hidden}`"
26-
class="lg-node-widget group col-span-full grid grid-cols-subgrid items-stretch has-[.widget-expands]:flex-1"
28+
class="lg-node-widget group col-span-full grid grid-cols-subgrid items-stretch"
2729
>
2830
<!-- Widget Input Slot Dot -->
29-
3031
<div
3132
:class="
3233
cn(
@@ -66,7 +67,7 @@
6667

6768
<script setup lang="ts">
6869
import type { TooltipOptions } from 'primevue'
69-
import { computed, onErrorCaptured, ref } from 'vue'
70+
import { computed, onErrorCaptured, ref, toValue } from 'vue'
7071
import type { Component } from 'vue'
7172
7273
import type {
@@ -190,4 +191,29 @@ const processedWidgets = computed((): ProcessedWidget[] => {
190191
191192
return result
192193
})
194+
195+
// TODO: Derive from types in widgetRegistry
196+
const EXPANDING_TYPES = [
197+
'textarea',
198+
'TEXTAREA',
199+
'multiline',
200+
'customtext',
201+
'markdown',
202+
'MARKDOWN',
203+
'progressText',
204+
'load3D',
205+
'LOAD_3D'
206+
] as const
207+
208+
const gridTemplateRows = computed((): string => {
209+
const widgets = toValue(processedWidgets)
210+
return widgets
211+
.filter((w) => !w.simplified.options?.hidden)
212+
.map((w) =>
213+
EXPANDING_TYPES.includes(w.type as (typeof EXPANDING_TYPES)[number])
214+
? 'auto'
215+
: 'min-content'
216+
)
217+
.join(' ')
218+
})
193219
</script>

src/renderer/extensions/vueNodes/widgets/components/WidgetMarkdown.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<template>
2-
<div
3-
class="widget-expands widget-markdown relative w-full"
4-
@dblclick="startEditing"
5-
>
2+
<div class="widget-markdown relative w-full" @dblclick="startEditing">
63
<!-- Display mode: Rendered markdown -->
74
<div
85
class="comfy-markdown-content size-full min-h-[60px] overflow-y-auto rounded-lg text-sm"

src/renderer/extensions/vueNodes/widgets/components/WidgetTextarea.vue

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<template>
2-
<div class="widget-expands relative">
3-
<Textarea
4-
v-model="modelValue"
5-
v-bind="filteredProps"
6-
:class="cn(WidgetInputBaseClass, 'size-full text-xs resize-none')"
7-
:placeholder="placeholder || widget.name || ''"
8-
:aria-label="widget.name"
9-
:readonly="widget.options?.read_only"
10-
:disabled="widget.options?.read_only"
11-
fluid
12-
data-capture-wheel="true"
13-
@pointerdown.capture.stop
14-
@pointermove.capture.stop
15-
@pointerup.capture.stop
16-
@contextmenu.capture.stop
17-
/>
18-
</div>
2+
<Textarea
3+
v-model="modelValue"
4+
v-bind="filteredProps"
5+
:class="cn(WidgetInputBaseClass, 'relative size-full text-xs resize-none')"
6+
:placeholder="placeholder || widget.name || ''"
7+
:aria-label="widget.name"
8+
:readonly="widget.options?.read_only"
9+
:disabled="widget.options?.read_only"
10+
fluid
11+
data-capture-wheel="true"
12+
@pointerdown.capture.stop
13+
@pointermove.capture.stop
14+
@pointerup.capture.stop
15+
@contextmenu.capture.stop
16+
/>
1917
</template>
2018

2119
<script setup lang="ts">

0 commit comments

Comments
 (0)