Repository navigation
feat: add Nodes 2.0 drag snapping - #9894
benceruleanlu wants to merge 8 commits into
Conversation
🎭 Playwright: ✅ 627 passed, 0 failed · 9 flaky📊 Browser Reports
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds node-alignment snapping for Vue nodes: new setting and schema, snapping resolution and guide generation, integration into drag workflows, canvas rendering of guides, unit and UI tests, and test/mocks updates. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DragHandler as useNodeDrag
participant SnapLogic as nodeAlignmentSnap
participant LayoutStore as layoutStore
participant Canvas as LGraphCanvas
participant UI
User->>DragHandler: start drag(selection)
DragHandler->>DragHandler: compute selectionBounds & candidateBounds
DragHandler->>LayoutStore: reset vueDragSnapGuides
loop while dragging
User->>DragHandler: mouse move (delta)
DragHandler->>SnapLogic: resolveNodeAlignmentSnap(candidates, delta, selection, zoom)
SnapLogic-->>DragHandler: snappedDelta + guides
DragHandler->>LayoutStore: update vueDragSnapGuides(guides)
DragHandler->>Canvas: apply snappedDelta to nodes
Canvas->>UI: render nodes + draw alignment guides (dashed red)
end
User->>DragHandler: end drag
DragHandler->>LayoutStore: clear vueDragSnapGuides
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎨 Storybook: ✅ Built — View Storybook |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
browser_tests/tests/vueNodes/interactions/node/dragSnapping.spec.ts (1)
26-26: Prefer centralized test selectors over raw CSS class selectors.
Using.lg-node-headermakes this E2E test fragile to presentational refactors. Please switch this lookup to the shared selector constants inbrowser_tests/fixtures/selectors.ts.As per coding guidelines:
browser_tests/**/*.spec.ts: "Use the centralized TestIds frombrowser_tests/fixtures/selectors.tsfor test element selection".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@browser_tests/tests/vueNodes/interactions/node/dragSnapping.spec.ts` at line 26, Replace the raw CSS selector usage when building ksamplerHeader with the centralized test selector constant: import the shared selector constants (e.g. TestIds) from the centralized selectors module and change ksamplerNode.locator('.lg-node-header') to use the corresponding constant (for example ksamplerNode.locator(TestIds.NODE_HEADER)); update the ksamplerHeader declaration to reference that constant so the test uses the canonical selector instead of the hard-coded class.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/litegraph/src/LGraphCanvas.ts`:
- Line 5010: The call to _drawVueDragAlignmentGuides(ctx) is being executed
unconditionally and can leak Vue-specific guides into classic rendering; update
the draw path in LGraphCanvas to only call this._drawVueDragAlignmentGuides(ctx)
when Vue mode and the overlay are available (e.g. guard with
LiteGraph.vueNodesMode && this.overlay) so the Vue-only rendering runs
exclusively in Vue mode and when overlay exists.
---
Nitpick comments:
In `@browser_tests/tests/vueNodes/interactions/node/dragSnapping.spec.ts`:
- Line 26: Replace the raw CSS selector usage when building ksamplerHeader with
the centralized test selector constant: import the shared selector constants
(e.g. TestIds) from the centralized selectors module and change
ksamplerNode.locator('.lg-node-header') to use the corresponding constant (for
example ksamplerNode.locator(TestIds.NODE_HEADER)); update the ksamplerHeader
declaration to reference that constant so the test uses the canonical selector
instead of the hard-coded class.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 705a2046-ff75-40d9-9c0a-c1b6d86b4b79
📒 Files selected for processing (12)
browser_tests/tests/vueNodes/interactions/node/dragSnapping.spec.tssrc/components/rightSidePanel/settings/TabGlobalSettings.vuesrc/lib/litegraph/src/LGraphCanvas.tssrc/locales/en/settings.jsonsrc/platform/settings/constants/coreSettings.tssrc/renderer/core/layout/store/layoutStore.tssrc/renderer/extensions/vueNodes/composables/useNodePointerInteractions.tssrc/renderer/extensions/vueNodes/layout/nodeAlignmentSnap.test.tssrc/renderer/extensions/vueNodes/layout/nodeAlignmentSnap.tssrc/renderer/extensions/vueNodes/layout/useNodeDrag.test.tssrc/renderer/extensions/vueNodes/layout/useNodeDrag.tssrc/schemas/apiSchema.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.ts (1)
96-104: Consider adding type annotation forvueDragSnapGuidesto match production code.The production
layoutStoredeclaresvueDragSnapGuidesasref<NodeAlignmentGuide[]>([]). Using the same type in the mock would improve type safety and catch any accidental misuse in tests.♻️ Proposed fix
Add the import alongside the existing
NodeLayoutimport:-import type { NodeLayout } from '@/renderer/core/layout/types' +import type { NodeAlignmentGuide, NodeLayout } from '@/renderer/core/layout/types'Then apply the type to the mock:
- const vueDragSnapGuides = ref([]) + const vueDragSnapGuides = ref<NodeAlignmentGuide[]>([])Based on learnings: "In TypeScript test files, avoid duplicating interface/type definitions. Import real type definitions from the component modules under test and reference them directly, so there is a single source of truth and to prevent type drift."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.ts` around lines 96 - 104, The test's mock defines vueDragSnapGuides as ref([]) without types; import the real NodeAlignmentGuide type (alongside the existing NodeLayout import) and change the mock's vueDragSnapGuides to be typed as ref<NodeAlignmentGuide[]>([]) so the mock layoutStore.vueDragSnapGuides matches production and provides compile-time safety; update the import and the vueDragSnapGuides declaration in the test file accordingly, keeping references to layoutStore, vueDragSnapGuides, and fakeNodeLayoutRef intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.ts`:
- Around line 96-104: The test's mock defines vueDragSnapGuides as ref([])
without types; import the real NodeAlignmentGuide type (alongside the existing
NodeLayout import) and change the mock's vueDragSnapGuides to be typed as
ref<NodeAlignmentGuide[]>([]) so the mock layoutStore.vueDragSnapGuides matches
production and provides compile-time safety; update the import and the
vueDragSnapGuides declaration in the test file accordingly, keeping references
to layoutStore, vueDragSnapGuides, and fakeNodeLayoutRef intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a700e57c-9bf0-4ff8-9181-47f944f168b8
📒 Files selected for processing (1)
src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/extensions/vueNodes/layout/useNodeDrag.ts (1)
333-345: Consider using nullish coalescing for NODE_TITLE_HEIGHT.The
||operator would treat a hypothetical0value as falsy, thoughNODE_TITLE_HEIGHTis currently30. Using??is more semantically precise for "fallback if undefined/null."🔧 Optional: Use nullish coalescing
function getRenderedNodeBounds(layout: { position: Point size: { width: number; height: number } }): Bounds { - const titleHeight = LiteGraph.NODE_TITLE_HEIGHT || 0 + const titleHeight = LiteGraph.NODE_TITLE_HEIGHT ?? 0 return { x: layout.position.x, y: layout.position.y - titleHeight, width: layout.size.width, height: layout.size.height + titleHeight } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/extensions/vueNodes/layout/useNodeDrag.ts` around lines 333 - 345, In getRenderedNodeBounds, replace the fallback expression using || for LiteGraph.NODE_TITLE_HEIGHT with nullish coalescing (use ??) so a legitimate 0 value is not treated as falsy; update the expression inside getRenderedNodeBounds that currently reads LiteGraph.NODE_TITLE_HEIGHT || 0 to use LiteGraph.NODE_TITLE_HEIGHT ?? 0 so titleHeight correctly falls back only when NODE_TITLE_HEIGHT is null or undefined.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/renderer/extensions/vueNodes/layout/useNodeDrag.ts`:
- Around line 333-345: In getRenderedNodeBounds, replace the fallback expression
using || for LiteGraph.NODE_TITLE_HEIGHT with nullish coalescing (use ??) so a
legitimate 0 value is not treated as falsy; update the expression inside
getRenderedNodeBounds that currently reads LiteGraph.NODE_TITLE_HEIGHT || 0 to
use LiteGraph.NODE_TITLE_HEIGHT ?? 0 so titleHeight correctly falls back only
when NODE_TITLE_HEIGHT is null or undefined.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1b1aa874-7f87-45bd-9abb-df3f92b2d138
📒 Files selected for processing (1)
src/renderer/extensions/vueNodes/layout/useNodeDrag.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45f8ec337a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| draggedSelectionNodeIds = new Set(selectedNodes) | ||
| draggedSelectionNodeIds.add(nodeId) | ||
| draggedSelectionBounds = getDraggedSelectionBounds(draggedSelectionNodeIds) |
There was a problem hiding this comment.
Restrict snap selection bounds to nodes that will move
startDrag always seeds draggedSelectionNodeIds from the pre-drag selectedNodeIds, even when the dragged node was not selected. In that case, otherSelectedNodesStartPositions stays null (so only the dragged node actually moves), but draggedSelectionBounds still includes unrelated selected nodes; maybeResolveAlignmentSnap then computes corrections from the wrong bounding box. This causes missed or incorrect snapping when stale selection nodes sit away from the dragged node (for example, selection on both sides of the dragged node), because none of the oversized-bounds anchors are within threshold even though the dragged node itself is close enough to snap.
Useful? React with 👍 / 👎.
| y: canvasWithDelta.y - canvasOrigin.y | ||
| } | ||
| const snappedCanvasDelta = maybeResolveAlignmentSnap(event, canvasDelta) | ||
|
|
There was a problem hiding this comment.
question (non-blocking): handleDrag returns early when a rAF is already pending (line 117), which means subsequent pointermove events are dropped and the RAF callback closes over the first event's clientX/clientY rather than the latest. During fast mouse movement this can cause positional lag.
This is a pre-existing pattern not introduced by this PR -- is there a reason the latest event isn't stored and read inside the RAF callback? e.g. capturing latestEvent = event and reading from that inside requestAnimationFrame.
There was a problem hiding this comment.
good point that was just the old shape I made it use the latest event now
| import type { ComputedRef, Ref } from 'vue' | ||
| import * as Y from 'yjs' | ||
|
|
||
| import type { NodeAlignmentGuide } from '@/renderer/extensions/vueNodes/layout/nodeAlignmentSnap' |
There was a problem hiding this comment.
issue: renderer/core imports a type from renderer/extensions:
import type { NodeAlignmentGuide } from '@/renderer/extensions/vueNodes/layout/nodeAlignmentSnap'This creates an upward dependency from the core layer into an extension. Consider moving the NodeAlignmentGuide interface to renderer/core/layout/types.ts (where Bounds, Point, etc. already live) so the dependency arrow stays extensions -> core.
There was a problem hiding this comment.
true! merged it into types
There was a problem hiding this comment.
Noting this here for coordination: the same core->extensions layering issue also shows up in #10224. The concrete spots are useSubgraphDragBridge.ts lines 19-21, where renderer/core imports runtime helpers from renderer/extensions/vueNodes/*, plus the runtime hookup in GraphCanvas.vue line 166 and GraphCanvas.vue line 468.
That PR is a separate feature, but it looks like the same structural cleanup. If we want to restore snapping/handoff from the canvas side into Vue Nodes 2.0, I am happy to use the #10224 bridge as the source for that path rather than duplicate the same canvas->Vue bridge work in both PRs.
| } | ||
| } | ||
|
|
||
| function translateBounds(bounds: Bounds, delta: Point): Bounds { |
There was a problem hiding this comment.
suggestion: translateBounds is duplicated identically here and in nodeAlignmentSnap.ts:219. Extract it to a shared utility (e.g. alongside expandBounds/mergeBounds or into a geometry utils file) to keep a single source of truth.
There was a problem hiding this comment.
done, moved to geometry.ts in utils folder
| } | ||
|
|
||
| if ( | ||
| shouldSnap(event) || |
There was a problem hiding this comment.
nitpick (non-blocking): Inside maybeResolveAlignmentSnap, shouldSnap(event) reads as "should do snapping" but it actually checks for grid snap -- so true here disables alignment snapping. A brief inline comment (e.g. // Grid snap active -- skip alignment snapping) would clarify the intent for future readers.
There was a problem hiding this comment.
Renamed to shouldSnapToGrid
| @@ -102,6 +102,7 @@ export function useNodePointerInteractions( | |||
|
|
|||
| function cleanupDragState() { | |||
| layoutStore.isDraggingVueNodes.value = false | |||
There was a problem hiding this comment.
question (non-blocking): onContextmenu (line 166) calls cleanupDragState() instead of endDrag(), which means stopShiftSync listeners are never torn down. This is a pre-existing pattern, but this PR adds vueDragSnapGuides cleanup here without the corresponding endDrag call -- so the snap guides are cleared but shift listeners still leak. Would it make sense to call safeDragEnd here (similar to onPointercancel) to clean up everything?
There was a problem hiding this comment.
agree, added safeDragCancel there that wraps cancelDrag and cleanupDragState
| return candidates | ||
| } | ||
|
|
||
| function updateDragSnapGuides(guides: NodeAlignmentGuide[]) { |
There was a problem hiding this comment.
suggestion (non-blocking): updateDragSnapGuides([]) unconditionally calls setDirty(true) even when guides are already empty. Consider guarding with a length check to avoid redundant canvas repaints:
function updateDragSnapGuides(guides: NodeAlignmentGuide[]) {
if (guides.length === 0 && layoutStore.vueDragSnapGuides.value.length === 0) return
layoutStore.vueDragSnapGuides.value = guides
canvasStore.canvas?.setDirty(true)
}There was a problem hiding this comment.
K, guarded with !guides.length && !layoutStore.vueDragSnapGuides.value.length
📦 Bundle: 5.01 MB gzip 🔴 +2.41 kBDetailsSummary
Category Glance App Entry Points — 22.7 kB (baseline 22.7 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.11 MB (baseline 1.1 MB) • 🔴 +8.72 kBGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 75.9 kB (baseline 75.9 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 9 added / 9 removed / 2 unchanged Panels & Settings — 461 kB (baseline 461 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 10 added / 10 removed / 12 unchanged User & Accounts — 16.9 kB (baseline 16.9 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 5 added / 5 removed / 2 unchanged Editors & Dialogs — 82 kB (baseline 82 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 2 added / 2 removed UI Components — 59.4 kB (baseline 59.4 kB) • ⚪ 0 BReusable component library chunks
Status: 5 added / 5 removed / 8 unchanged Data & Services — 2.92 MB (baseline 2.92 MB) • 🔴 +1.06 kBStores, services, APIs, and repositories
Status: 14 added / 14 removed / 3 unchanged Utilities & Hooks — 322 kB (baseline 322 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 15 added / 15 removed / 7 unchanged Vendor & Third-Party — 9.79 MB (baseline 9.79 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 16 unchanged Other — 8.24 MB (baseline 8.24 MB) • 🔴 +258 BBundles that do not match a named category
Status: 57 added / 57 removed / 75 unchanged ⚡ Performance Report
All metrics
Historical variance (last 10 runs)
Trend (last 10 commits on main)
Raw data{
"timestamp": "2026-03-19T03:17:17.008Z",
"gitSha": "f0eaa6ab686492927b1047341e3122d7a8047e0c",
"branch": "bl/nodes-2-drag-snapping",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2027.1419999999694,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.5539999999999985,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 371.958,
"heapDeltaBytes": 812980,
"domNodes": 18,
"jsHeapTotalBytes": 17825792,
"scriptDurationMs": 14.587000000000003,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "canvas-idle",
"durationMs": 2049.0299999999593,
"styleRecalcs": 11,
"styleRecalcDurationMs": 11.599000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 499.4460000000001,
"heapDeltaBytes": 2404228,
"domNodes": 22,
"jsHeapTotalBytes": 15990784,
"scriptDurationMs": 30.244,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "canvas-idle",
"durationMs": 2040.7350000000406,
"styleRecalcs": 11,
"styleRecalcDurationMs": 9.772,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 340.62199999999996,
"heapDeltaBytes": 1057740,
"domNodes": 21,
"jsHeapTotalBytes": 17301504,
"scriptDurationMs": 20.351000000000003,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1999.908000000005,
"styleRecalcs": 76,
"styleRecalcDurationMs": 53.116,
"layouts": 12,
"layoutDurationMs": 4.265000000000001,
"taskDurationMs": 979.4659999999999,
"heapDeltaBytes": 18171004,
"domNodes": 58,
"jsHeapTotalBytes": 24903680,
"scriptDurationMs": 168.721,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1761.6649999999936,
"styleRecalcs": 74,
"styleRecalcDurationMs": 35.03,
"layouts": 12,
"layoutDurationMs": 3.282,
"taskDurationMs": 745.97,
"heapDeltaBytes": -3259248,
"domNodes": 57,
"jsHeapTotalBytes": 18087936,
"scriptDurationMs": 131.225,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "canvas-mouse-sweep",
"durationMs": 2009.9440000000186,
"styleRecalcs": 83,
"styleRecalcDurationMs": 49.487,
"layouts": 12,
"layoutDurationMs": 3.7630000000000003,
"taskDurationMs": 968.386,
"heapDeltaBytes": 17463516,
"domNodes": 67,
"jsHeapTotalBytes": 24641536,
"scriptDurationMs": 137.81199999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1761.5020000000072,
"styleRecalcs": 29,
"styleRecalcDurationMs": 22.309999999999995,
"layouts": 6,
"layoutDurationMs": 0.7850000000000001,
"taskDurationMs": 389.997,
"heapDeltaBytes": 5756064,
"domNodes": 78,
"jsHeapTotalBytes": 17301504,
"scriptDurationMs": 33.429,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000073
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1847.9939999999715,
"styleRecalcs": 30,
"styleRecalcDurationMs": 23.419999999999998,
"layouts": 6,
"layoutDurationMs": 0.7709999999999998,
"taskDurationMs": 507.53700000000003,
"heapDeltaBytes": 5653344,
"domNodes": 80,
"jsHeapTotalBytes": 17039360,
"scriptDurationMs": 42.449,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1752.020000000016,
"styleRecalcs": 32,
"styleRecalcDurationMs": 20.696,
"layouts": 6,
"layoutDurationMs": 0.6330000000000001,
"taskDurationMs": 307.955,
"heapDeltaBytes": 6006528,
"domNodes": 82,
"jsHeapTotalBytes": 17563648,
"scriptDurationMs": 25.816000000000006,
"eventListeners": 45,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "dom-widget-clipping",
"durationMs": 601.4860000000226,
"styleRecalcs": 12,
"styleRecalcDurationMs": 8.238999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 376.53700000000003,
"heapDeltaBytes": 11545740,
"domNodes": 20,
"jsHeapTotalBytes": 17039360,
"scriptDurationMs": 68.775,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.65999999999999
},
{
"name": "dom-widget-clipping",
"durationMs": 595.8790000000249,
"styleRecalcs": 13,
"styleRecalcDurationMs": 9.350999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 374.71299999999997,
"heapDeltaBytes": 13444472,
"domNodes": 22,
"jsHeapTotalBytes": 15204352,
"scriptDurationMs": 67.97299999999998,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.65999999999999
},
{
"name": "dom-widget-clipping",
"durationMs": 545.7409999999072,
"styleRecalcs": 14,
"styleRecalcDurationMs": 10.225,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 326.004,
"heapDeltaBytes": 6916984,
"domNodes": 25,
"jsHeapTotalBytes": 14155776,
"scriptDurationMs": 61.23700000000001,
"eventListeners": 26,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "large-graph-idle",
"durationMs": 2016.4209999999798,
"styleRecalcs": 13,
"styleRecalcDurationMs": 14.99,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 716.8240000000002,
"heapDeltaBytes": 14213580,
"domNodes": 29,
"jsHeapTotalBytes": 17096704,
"scriptDurationMs": 127.18800000000002,
"eventListeners": 28,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "large-graph-idle",
"durationMs": 2034.1429999999718,
"styleRecalcs": 11,
"styleRecalcDurationMs": 13.175999999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 677.2900000000001,
"heapDeltaBytes": -10070764,
"domNodes": 23,
"jsHeapTotalBytes": 9318400,
"scriptDurationMs": 120.422,
"eventListeners": 28,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "large-graph-idle",
"durationMs": 2034.138999999982,
"styleRecalcs": 13,
"styleRecalcDurationMs": 12.74,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 515.28,
"heapDeltaBytes": -9914512,
"domNodes": 27,
"jsHeapTotalBytes": 8769536,
"scriptDurationMs": 101.192,
"eventListeners": 30,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000073
},
{
"name": "large-graph-pan",
"durationMs": 2100.441999999987,
"styleRecalcs": 68,
"styleRecalcDurationMs": 16.726000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1114.381,
"heapDeltaBytes": -12076,
"domNodes": 16,
"jsHeapTotalBytes": 9756672,
"scriptDurationMs": 405.167,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "large-graph-pan",
"durationMs": 2126.96799999992,
"styleRecalcs": 69,
"styleRecalcDurationMs": 17.683000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1222.786,
"heapDeltaBytes": 382572,
"domNodes": 16,
"jsHeapTotalBytes": 15990784,
"scriptDurationMs": 454.54299999999995,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.659999999999947
},
{
"name": "large-graph-pan",
"durationMs": 2110.1620000000594,
"styleRecalcs": 70,
"styleRecalcDurationMs": 16.508999999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1039.092,
"heapDeltaBytes": 2297076,
"domNodes": 18,
"jsHeapTotalBytes": 10285056,
"scriptDurationMs": 398.859,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "minimap-idle",
"durationMs": 2016.5230000000065,
"styleRecalcs": 6,
"styleRecalcDurationMs": 7.313000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 619.291,
"heapDeltaBytes": -12334108,
"domNodes": 12,
"jsHeapTotalBytes": 9056256,
"scriptDurationMs": 105.00999999999999,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.680000000000017
},
{
"name": "minimap-idle",
"durationMs": 2021.2020000000166,
"styleRecalcs": 10,
"styleRecalcDurationMs": 9.256,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 470.65500000000003,
"heapDeltaBytes": -10480540,
"domNodes": 20,
"jsHeapTotalBytes": 8794112,
"scriptDurationMs": 87.934,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "minimap-idle",
"durationMs": 2026.0490000000573,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.562,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 461.545,
"heapDeltaBytes": -11040616,
"domNodes": 20,
"jsHeapTotalBytes": 9056256,
"scriptDurationMs": 88.26199999999999,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.659999999999947
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 594.3450000000325,
"styleRecalcs": 49,
"styleRecalcDurationMs": 14.381,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 394.925,
"heapDeltaBytes": 13912356,
"domNodes": 25,
"jsHeapTotalBytes": 13107200,
"scriptDurationMs": 126.521,
"eventListeners": 32,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 657.7800000000025,
"styleRecalcs": 48,
"styleRecalcDurationMs": 15.328999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 441.41200000000003,
"heapDeltaBytes": 13438368,
"domNodes": 22,
"jsHeapTotalBytes": 13631488,
"scriptDurationMs": 146.91299999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.65999999999999
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 589.9110000000292,
"styleRecalcs": 50,
"styleRecalcDurationMs": 13.746,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 373.2679999999999,
"heapDeltaBytes": 13596172,
"domNodes": 26,
"jsHeapTotalBytes": 13893632,
"scriptDurationMs": 126.304,
"eventListeners": 32,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "subgraph-idle",
"durationMs": 2019.0269999999941,
"styleRecalcs": 13,
"styleRecalcDurationMs": 14.475999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 491.019,
"heapDeltaBytes": 1670376,
"domNodes": 28,
"jsHeapTotalBytes": 17825792,
"scriptDurationMs": 30.401000000000003,
"eventListeners": 28,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "subgraph-idle",
"durationMs": 2021.4620000000423,
"styleRecalcs": 11,
"styleRecalcDurationMs": 12.809,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 472.8760000000001,
"heapDeltaBytes": 1981292,
"domNodes": 25,
"jsHeapTotalBytes": 13893632,
"scriptDurationMs": 26.980999999999998,
"eventListeners": 30,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "subgraph-idle",
"durationMs": 2002.6810000000523,
"styleRecalcs": 11,
"styleRecalcDurationMs": 11.806000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 343.987,
"heapDeltaBytes": 1557520,
"domNodes": 22,
"jsHeapTotalBytes": 17301504,
"scriptDurationMs": 16.816,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1773.6549999999625,
"styleRecalcs": 78,
"styleRecalcDurationMs": 57.986000000000004,
"layouts": 16,
"layoutDurationMs": 5.337000000000001,
"taskDurationMs": 848.381,
"heapDeltaBytes": -6788864,
"domNodes": 68,
"jsHeapTotalBytes": 15990784,
"scriptDurationMs": 115.619,
"eventListeners": 28,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1697.306000000026,
"styleRecalcs": 76,
"styleRecalcDurationMs": 39.191,
"layouts": 16,
"layoutDurationMs": 4.814,
"taskDurationMs": 757.754,
"heapDeltaBytes": -7101080,
"domNodes": 62,
"jsHeapTotalBytes": 17825792,
"scriptDurationMs": 112.131,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1963.6809999999514,
"styleRecalcs": 83,
"styleRecalcDurationMs": 45.003,
"layouts": 16,
"layoutDurationMs": 4.235,
"taskDurationMs": 868.1000000000001,
"heapDeltaBytes": -6540152,
"domNodes": 72,
"jsHeapTotalBytes": 14155776,
"scriptDurationMs": 95.59399999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
},
{
"name": "vue-large-graph-idle",
"durationMs": 13983.258999999976,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 13963.600000000002,
"heapDeltaBytes": -35323984,
"domNodes": -3338,
"jsHeapTotalBytes": 21757952,
"scriptDurationMs": 751.7439999999999,
"eventListeners": -16488,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.329999999999927
},
{
"name": "vue-large-graph-idle",
"durationMs": 12680.169999999976,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12668.164,
"heapDeltaBytes": -26571216,
"domNodes": -3338,
"jsHeapTotalBytes": 24903680,
"scriptDurationMs": 615.186,
"eventListeners": -16486,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.340000000000146
},
{
"name": "vue-large-graph-idle",
"durationMs": 12879.649999999969,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12865.402999999998,
"heapDeltaBytes": -27647296,
"domNodes": -3338,
"jsHeapTotalBytes": 24379392,
"scriptDurationMs": 654.386,
"eventListeners": -16486,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.339999999999783
},
{
"name": "vue-large-graph-pan",
"durationMs": 16023.869999999988,
"styleRecalcs": 86,
"styleRecalcDurationMs": 18.039999999999946,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15986.391,
"heapDeltaBytes": -15478876,
"domNodes": -3328,
"jsHeapTotalBytes": 19574784,
"scriptDurationMs": 943.433,
"eventListeners": -16482,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.329999999999927
},
{
"name": "vue-large-graph-pan",
"durationMs": 15072.176999999898,
"styleRecalcs": 77,
"styleRecalcDurationMs": 15.058000000000016,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15050.776000000002,
"heapDeltaBytes": -10142836,
"domNodes": -3340,
"jsHeapTotalBytes": 18788352,
"scriptDurationMs": 886.8450000000001,
"eventListeners": -16484,
"totalBlockingTimeMs": 0,
"frameDurationMs": 19.990000000000144
},
{
"name": "vue-large-graph-pan",
"durationMs": 15089.017000000013,
"styleRecalcs": 74,
"styleRecalcDurationMs": 15.089999999999993,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15067.571999999998,
"heapDeltaBytes": -14877092,
"domNodes": -3328,
"jsHeapTotalBytes": 18526208,
"scriptDurationMs": 873.949,
"eventListeners": -16486,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.329999999999927
},
{
"name": "workflow-execution",
"durationMs": 460.64900000004627,
"styleRecalcs": 20,
"styleRecalcDurationMs": 30.810000000000002,
"layouts": 4,
"layoutDurationMs": 1.3760000000000001,
"taskDurationMs": 143.58999999999997,
"heapDeltaBytes": 4620544,
"domNodes": 168,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 28.738000000000003,
"eventListeners": 69,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.67999999999997
},
{
"name": "workflow-execution",
"durationMs": 438.36799999996856,
"styleRecalcs": 17,
"styleRecalcDurationMs": 21.373000000000005,
"layouts": 4,
"layoutDurationMs": 0.9629999999999999,
"taskDurationMs": 109.38000000000001,
"heapDeltaBytes": 4361448,
"domNodes": 155,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 24.606,
"eventListeners": 71,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.660000000000036
},
{
"name": "workflow-execution",
"durationMs": 458.03300000000036,
"styleRecalcs": 17,
"styleRecalcDurationMs": 25.467000000000002,
"layouts": 5,
"layoutDurationMs": 1.3579999999999999,
"taskDurationMs": 135.71700000000004,
"heapDeltaBytes": 4553768,
"domNodes": 156,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 32.281,
"eventListeners": 71,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998
}
]
} |
|
Removed assignment -- can you find someone else? |
We can push this until after the test overhaul is done |
|
@christian-byrne @benceruleanlu i can take this over, it's related to other work I'm doing |
|
@christian-byrne can you assign to me, that way it's easier for me to track, will need fork and open a new PR but at least it lets others know I'm working on it |
|
Thank you for building and iterating on Nodes 2.0 drag snapping, including addressing the review feedback. The work was deferred with a plan for a new takeover PR, and the layout and geometry architecture has since been substantially centralized in #14110, leaving this branch conflicted and several key target files obsolete. If drag snapping is still desired, please open a focused implementation against current main so it can use the present layout APIs and test structure. |
Summary
Comfy.Canvas.AlignNodesWhileDraggingsetting for Nodes 2.0Scope
This PR is intentionally limited to drag snapping. It does not include the broader alignment/distribution context-menu work from the earlier draft.
Supersedes #9750 for review purposes.
Implementation Notes
8px / zoom)Verification
pnpm installpnpm typecheckpnpm typecheck:browserpnpm vitest run src/renderer/extensions/vueNodes/layout/nodeAlignmentSnap.test.ts src/renderer/extensions/vueNodes/layout/useNodeDrag.test.ts src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.tspnpm exec eslint src/components/rightSidePanel/settings/TabGlobalSettings.vue src/lib/litegraph/src/LGraphCanvas.ts src/platform/settings/constants/coreSettings.ts src/renderer/core/layout/store/layoutStore.ts src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.ts src/renderer/extensions/vueNodes/layout/nodeAlignmentSnap.ts src/renderer/extensions/vueNodes/layout/nodeAlignmentSnap.test.ts src/renderer/extensions/vueNodes/layout/useNodeDrag.ts src/renderer/extensions/vueNodes/layout/useNodeDrag.test.ts src/schemas/apiSchema.ts browser_tests/tests/vueNodes/interactions/node/dragSnapping.spec.ts --no-cachepnpm exec oxfmt --check src/components/rightSidePanel/settings/TabGlobalSettings.vue src/lib/litegraph/src/LGraphCanvas.ts src/platform/settings/constants/coreSettings.ts src/renderer/core/layout/store/layoutStore.ts src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.ts src/renderer/extensions/vueNodes/layout/nodeAlignmentSnap.ts src/renderer/extensions/vueNodes/layout/nodeAlignmentSnap.test.ts src/renderer/extensions/vueNodes/layout/useNodeDrag.ts src/renderer/extensions/vueNodes/layout/useNodeDrag.test.ts src/schemas/apiSchema.ts browser_tests/tests/vueNodes/interactions/node/dragSnapping.spec.ts src/locales/en/settings.jsonNotes
┆Issue is synchronized with this Notion page by Unito