-
Notifications
You must be signed in to change notification settings - Fork 377
Select Vue Nodes After Drag #5863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🎭 Playwright Test Results⏰ Completed at: 10/07/2025, 10:12:09 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 10/07/2025, 10:00:57 PM UTC 🔗 Links🎉 Your Storybook is ready for review! |
// If it wasn't a drag: single-select the node | ||
if (!wasDragging) { | ||
const selectedMultipleNodes = | ||
canvasStore.selectedItems.filter((n) => isLGraphNode(n)).length > 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a little weird to me. Can we change the selection logic in useNodePointerInteractions instead? I think we'll have to change the interface there anyway since that's where the dragging logic lives.
I would expect the selection to be apparent as I click and drag, not after I release the click.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree - I think we should try to match litegraph behavior exactly (unless it's extremely difficult to do).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be fairly comfortable to add a test case here, following the existing patterns:
ComfyUI_frontend/browser_tests/tests/vueNodes/interactions/node/select.spec.ts
Lines 23 to 38 in 35ddb19
test(`should allow selecting multiple nodes with ${name}+click`, async ({ | |
comfyPage | |
}) => { | |
await comfyPage.page.getByText('Load Checkpoint').click() | |
expect(await comfyPage.vueNodes.getSelectedNodeCount()).toBe(1) | |
await comfyPage.page.getByText('Empty Latent Image').click({ | |
modifiers: [modifier] | |
}) | |
expect(await comfyPage.vueNodes.getSelectedNodeCount()).toBe(2) | |
await comfyPage.page.getByText('KSampler').click({ | |
modifiers: [modifier] | |
}) | |
expect(await comfyPage.vueNodes.getSelectedNodeCount()).toBe(3) | |
}) |
src/renderer/extensions/vueNodes/composables/useNodeEventHandlers.ts
Outdated
Show resolved
Hide resolved
…nter down and update tests accordingly
The tests might need to be updated |
Screen.Recording.2025-10-03.at.06.43.01.mov |
Added support for dragging with ctrl and selecting nodes at the same time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these tests, we should avoid using litegraph test utils/fixtures (since we are manipulating Vue nodes) and also try to accomplish changes by emulating user behaviors rather than calling methods on code objects. For testing code, we can rely moreso on unit tests; for e2e tests we should test the system using more of a black-box approach - which provides a different breadth of coverage and ensures things work from the most important perspective (user), among other reasons. This means:
- Not using
NodeReference
to get nodes but rather just finding the nodes by using locators that query for visible title text (as a user would do) - Not calling
LGraphNode.pin
to pin but rather just selecting the node and pressing the pin hotkey (as a user would do).
To see an example of both, check here.
} else { | ||
// If it wasn't a drag: single-select the node | ||
if (!wasDragging) { | ||
const selectedMultipleNodes = hasMultipleNodesSelected( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[architecture] medium Priority
Issue: The new selection logic changes behavior - previously wasDragging prevented single selection after drag, now multiple selection status is checked instead
Context: This could cause unintended single-selection when clicking on a node with multiple nodes already selected, breaking existing UX patterns
Suggestion: Consider if this behavioral change is intentional or if the original drag-based logic should be preserved
// Record position for drag threshold calculation | ||
startPosition.value = { x: event.clientX, y: event.clientY } | ||
|
||
onNodeSelect(event, nodeData.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[architecture] medium Priority
Issue: Removed drag threshold logic and moved selection to pointer down event
Context: This changes when selection occurs - now on pointer down instead of pointer up, which may affect drag behavior and user expectations
Suggestion: Verify this change doesn't interfere with drag operations or create unintended selections during drags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comprehensive PR Review
This review is generated by Claude. It may not always be accurate, as with human reviewers. If you believe that any of the comments are invalid or incorrect, please state why for each. For others, please implement the changes in one way or another.
Review Summary
PR: Select Vue Nodes After Drag (#5863)
Impact: 189 additions, 121 deletions across 8 files
Issue Distribution
- Critical: 0
- High: 0
- Medium: 2
- Low: 2
Category Breakdown
- Architecture: 2 issues
- Security: 0 issues
- Performance: 1 issue
- Code Quality: 1 issue
Key Findings
Architecture & Design
This refactoring simplifies the node selection API by removing the wasDragging
parameter from handleNodeSelect
. However, this introduces two important behavioral changes:
- Selection timing change: Selection now occurs on pointer down instead of pointer up, which may affect user experience during drag operations
- Selection logic change: The new logic checks for multiple existing selections rather than drag state, which could cause unintended single-selection behavior when clicking on nodes with existing multi-selections
Security Considerations
No security issues identified in this refactoring. The changes maintain the same security boundaries and do not introduce new attack vectors.
Performance Impact
The new hasMultipleNodesSelected
function introduces O(n) complexity on every non-multi-select click. While the function includes early termination optimization, it could impact performance with large selection counts.
Integration Points
The changes maintain backward compatibility with existing components and tests. All test files have been properly updated to match the new function signature.
Positive Observations
- Well-structured refactoring with clear intent
- Comprehensive test coverage updates across all affected files
- Good documentation and comments explaining the changes
- Proper use of TypeScript types and Vue 3 Composition API patterns
- Clean separation of concerns between selection logic and pointer interactions
Next Steps
- Verify the behavioral changes are intentional and align with UX expectations
- Consider performance optimizations for the selection checking logic
- Validate that drag operations work as expected with the new selection timing
- Consider grouping import statements for better code organization
This is a comprehensive automated review. For architectural decisions requiring human judgment, please request additional manual review.
This pull request refactors the node selection logic in the Vue nodes event handler composable to simplify the function signature and improve single vs. multi-selection behavior. The main change is the removal of the
wasDragging
parameter from thehandleNodeSelect
function, with selection logic now determined by the current selection state. Related test code is updated to match the new function signature.Node selection logic improvements:
handleNodeSelect
function inuseNodeEventHandlersIndividual
to remove thewasDragging
parameter, making the function signature simpler and relying on selection state to handle single vs. multi-selection.isLGraphNode
, and only perform single selection if not.Code and test updates:
handleNodeSelect
in the composable to remove thewasDragging
argument, ensuring consistent usage throughout the codebase. [1] [2] [3]handleNodeSelect
signature without the third parameter. [1] [2] [3] [4] [5] [6]Utility import:
isLGraphNode
from@/utils/litegraphUtil
to support the updated selection logic.## SummaryScreenshots (if applicable)
Screen.Recording.2025-09-30.at.17.47.18.mov