mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
Fix: Persist Size across Collapsing Vue Nodes (#6726)
## Summary When restoring a collapsed node, return to the uncollapsed size. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6726-Fix-Persist-Size-across-Collapsing-Vue-Nodes-2ae6d73d365081e28628d5640bc35ab3) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -135,9 +135,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { whenever } from '@vueuse/core'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { computed, inject, onErrorCaptured, onMounted, ref } from 'vue'
|
||||
import { computed, inject, onErrorCaptured, onMounted, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
|
||||
@@ -373,11 +372,17 @@ const handleResizePointerDown = (direction: ResizeHandleDirection) => {
|
||||
}
|
||||
}
|
||||
|
||||
whenever(isCollapsed, () => {
|
||||
watch(isCollapsed, (collapsed) => {
|
||||
const element = nodeContainerRef.value
|
||||
if (!element) return
|
||||
element.style.setProperty('--node-width', '')
|
||||
element.style.setProperty('--node-height', '')
|
||||
const [from, to] = collapsed ? ['', '-x'] : ['-x', '']
|
||||
const currentWidth = element.style.getPropertyValue(`--node-width${from}`)
|
||||
element.style.setProperty(`--node-width${to}`, currentWidth)
|
||||
element.style.setProperty(`--node-width${from}`, '')
|
||||
|
||||
const currentHeight = element.style.getPropertyValue(`--node-height${from}`)
|
||||
element.style.setProperty(`--node-height${to}`, currentHeight)
|
||||
element.style.setProperty(`--node-height${from}`, '')
|
||||
})
|
||||
|
||||
// Check if node has custom content (like image/video outputs)
|
||||
|
||||
Reference in New Issue
Block a user