Skip to content

Conversation

Myestery
Copy link
Collaborator

@Myestery Myestery commented Oct 2, 2025

This pull request improves the selection and movement logic for groups and nodes on the LiteGraph canvas, especially when using Vue-based node rendering. The most notable changes are the addition of proper bounding box handling for groups and a new coordinated movement mechanism that updates both LiteGraph internals and the Vue layout store when dragging nodes and groups.

Selection and bounding box calculation:

  • Added support for including LGraphGroup bounding rectangles when calculating the selection toolbox position, so groups are now properly considered in selection overlays. [1] [2]

Node and group movement synchronization (Vue nodes mode):

  • Introduced a new movement logic in LGraphCanvas for Vue nodes mode: when dragging, groups and their child nodes are moved together, and all affected node positions are batch-updated in both LiteGraph and the Vue layout store via moveNode. This ensures canvas and UI stay in sync.
  • Added imports for layout mutation operations and types to support the above synchronization.

These changes make group selection and movement more robust and ensure that UI and internal state remain consistent when using the Vue-based node system.

Screen.Recording.2025-10-02.at.01.13.02.mov

┆Issue is synchronized with this Notion page by Unito

Copy link

github-actions bot commented Oct 2, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 10/02/2025, 12:16:38 AM UTC

🔗 Links


🎉 Your Storybook is ready for review!

Copy link

github-actions bot commented Oct 2, 2025

🎭 Playwright Test Results

⚠️ Tests passed with flaky tests

⏰ Completed at: 10/02/2025, 12:26:50 AM UTC

📈 Summary

  • Total Tests: 486
  • Passed: 455 ✅
  • Failed: 0
  • Flaky: 2 ⚠️
  • Skipped: 29 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 447 / ❌ 0 / ⚠️ 2 / ⏭️ 29
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 5 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@Myestery Myestery marked this pull request as ready for review October 2, 2025 00:25
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 2, 2025
const bounds = item.getBounding()
allBounds.push([bounds[0], bounds[1], bounds[2], bounds[3]] as const)
} else if (item instanceof LGraphGroup) {
const bounds = item.boundingRect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Node and Group both exposed the same method to get the bounds, you could eliminate the instanceof check, right?

for (const item of allItems) {
item.move(deltaX, deltaY, true)

if (LiteGraph.vueNodesMode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty big conditional, could you break it up or flip it to a guard clause?

Comment on lines +3440 to +3444
const nodesInMovingGroups = new Set<LGraphNode>()
const nodesToMove: Array<{
node: LGraphNode
newPos: { x: number; y: number }
}> = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, could you either extract a method with a name or use functional chaining here?

These seem like operations that could be useful otherwise later, but I'm more concerned with readability.

Comment on lines +3458 to +3470
const isNode = item instanceof LGraphNode
if (isNode) {
const node = item as LGraphNode
if (nodesInMovingGroups.has(node)) {
continue
}
nodesToMove.push({
node,
newPos: {
x: node.pos[0] + deltaX,
y: node.pos[1] + deltaY
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checks here with the very similar contents make me think there's a worthwhile abstraction to be had in LGraphNode and LGraphGroup.

@comfyui-wiki comfyui-wiki linked an issue Oct 2, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vue nodes can't move with group
2 participants