fix: allow nodes to collapse by skipping resize constraints#19
Merged
CodeWithBehnam merged 2 commits intomainfrom Dec 25, 2025
Merged
fix: allow nodes to collapse by skipping resize constraints#19CodeWithBehnam merged 2 commits intomainfrom
CodeWithBehnam merged 2 commits intomainfrom
Conversation
added 2 commits
December 25, 2025 17:44
When a node is collapsed, the onResize handler was enforcing minimum height constraints, preventing LiteGraph from shrinking the node to its collapsed state. This caused the image preview area to remain visible even when collapsed. Added collapsed state check at the start of both onResize handlers to skip constraint enforcement when the node is collapsed. Co-Authored-By: Behnam & Claude Code
Extended the collapse fix to all custom nodes that don't use createNodeClass(): - PromptNode: Added onResize handler and collapsed check in onDrawForeground - NegativePromptNode: Added onResize handler and collapsed check - SeedNode: Added onResize handler and collapsed check - ImageSourceNode: Added onResize handler and collapsed check All nodes now properly collapse when clicking the collapse button. Co-Authored-By: Behnam & Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed bug where nodes wouldn't collapse properly when clicking the collapse button.
Changes:
collapsedstate check to bothonResizehandlers (for image preview and regular resizable nodes)onResizehandler with collapsed check + collapsed check inonDrawForegroundonResizehandler with collapsed check + collapsed check inonDrawForegroundonResizehandler with collapsed check + collapsed check inonDrawForegroundonResizehandler with collapsed check + collapsed check inonDrawForegroundRoot Cause
When clicking the collapse button, LiteGraph tries to shrink the node size. However, the
onResizehandlers were enforcing minimum height constraints, immediately re-expanding the node and preventing it from collapsing. Additionally,onDrawForegroundwas drawing content even when collapsed.Test Plan
Behnam Ebrahimi