mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 02:32:18 +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>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { whenever } from '@vueuse/core'
|
|
||||||
import { storeToRefs } from 'pinia'
|
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 { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
|
import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
|
||||||
@@ -373,11 +372,17 @@ const handleResizePointerDown = (direction: ResizeHandleDirection) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
whenever(isCollapsed, () => {
|
watch(isCollapsed, (collapsed) => {
|
||||||
const element = nodeContainerRef.value
|
const element = nodeContainerRef.value
|
||||||
if (!element) return
|
if (!element) return
|
||||||
element.style.setProperty('--node-width', '')
|
const [from, to] = collapsed ? ['', '-x'] : ['-x', '']
|
||||||
element.style.setProperty('--node-height', '')
|
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)
|
// Check if node has custom content (like image/video outputs)
|
||||||
|
|||||||
Reference in New Issue
Block a user