-
Couldn't load subscription status.
- Fork 391
Make Vue nodes read-only when in panning mode #5574
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
Make Vue nodes read-only when in panning mode #5574
Conversation
🎭 Playwright Test Results✅ All tests passed! ⏰ Completed at: 09/18/2025, 10:28:34 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
2c35c25 to
3c48f03
Compare
🔧 Auto-fixes AppliedThis PR has been automatically updated to fix linting and formatting issues.
Changes made:
|
| * Whether Vue components can capture pointer events. | ||
| * Returns false when canvas is in read-only/panning mode. | ||
| */ | ||
| const canCapturePointerEvents = computed( |
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.
Just a minor naming concern, it's unclear from just the name and the fact that this is in useCanvasInteractions which elements can capture pointer events and whether that means they will capture pointer events
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.
Renamed to shouldHandleNodePointerEvents for better clarity in 690f6d2
| } | ||
| // Don't capture pointer events when canvas is in panning mode - forward to canvas instead | ||
| if (!canCapturePointerEvents.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.
So it's more do capture than can capture?
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.
Exactly! Renamed to shouldHandleNodePointerEvents in 690f6d2
| <div v-else class="lg-node-widgets flex flex-col gap-2 pr-4"> | ||
| <div | ||
| v-else | ||
| :class="[ |
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.
| :class="[ | |
| :class="cn( | |
| 'lg-node-widgets flex flex-col gap-2 pr-4', | |
| canCapturePointerEvents ? 'pointer-events-auto' : 'pointer-events-none' | |
| )" |
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.
Updated to use cn() utility in 690f6d2
| nodeData: VueNodeData, | ||
| wasDragging: boolean | ||
| ) => { | ||
| if (!canCapturePointerEvents.value) return |
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.
Normally when a boolean value is only ever used negated, I think it's !(backwards setting a expressing)
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.
Maybe disableNodePointerEvents?
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.
Good point! Renamed to shouldHandleNodePointerEvents to better reflect the intent in 690f6d2
Vue nodes now respect canvas panning mode and disable interactions during: - Hand tool activation (Comfy.Canvas.Lock command) - Space key temporary panning - Canvas read-only state This ensures Vue nodes behave consistently with native LiteGraph nodes by: - Disabling pointer event capture via CSS pointer-events - Forwarding events to canvas for proper panning functionality - Preventing widget interactions (SelectWidget, InputNumber, InputText, etc.) - Disabling hover effects during panning mode - Blocking node selection, collapse, title editing, and slot connections Implementation centralizes panning state logic in useCanvasInteractions composable and applies event masking at both node and widget container levels.
Add mock for useCanvasInteractions dependency that was introduced in the panning mode integration. The test now properly mocks canCapturePointerEvents to allow testing of existing functionality.
Move useCanvasInteractions from src/composables/graph/ to src/renderer/core/canvas/ to follow Domain-Driven Design principles. Canvas interactions are specifically about canvas behavior and should be grouped with other canvas-related functionality. Also move the corresponding test file to maintain the same directory structure. Updated all import paths across: - Vue components (GraphCanvas, GraphCanvasMenu, SelectionToolbox, etc.) - Vue node components (LGraphNode, NodeWidgets) - Composables (useNodeEventHandlers, useNodeImage) - Test files and mocks
690f6d2 to
5444718
Compare
🔧 Auto-fixes AppliedThis PR has been automatically updated to fix linting and formatting issues.
Changes made:
|
Summary
Integrated Vue node components with canvas panning mode to prevent UI interference during navigation.
Changes
useCanvasInteractionscomposable that checks canvas read-only stateReview Focus
Event forwarding logic in panning mode and pointer event capture state management across Vue node hierarchy.
graph TD A[User Interaction] --> B{Canvas in Panning Mode?} B -->|Yes| C[Forward to Canvas] B -->|No| D[Handle in Vue Component] C --> E[Canvas Navigation] D --> F[Node Selection/Widget Interaction] G[canCapturePointerEvents] --> H{read_only === false} H -->|Yes| I[Allow Vue Events] H -->|No| J[Block Vue Events] style A fill:#f9f9f9,stroke:#333,color:#000 style E fill:#f9f9f9,stroke:#333,color:#000 style F fill:#f9f9f9,stroke:#333,color:#000 style I fill:#e1f5fe,stroke:#01579b,color:#000 style J fill:#ffebee,stroke:#c62828,color:#000Screenshots
2025-09-14.20-27-33_processed_20250914_202818.mp4
┆Issue is synchronized with this Notion page by Unito