Repository navigation
feat(camera-info): 3D viewport widget for CreateCameraInfo node - #13741
Conversation
🎭 Playwright: ✅ 1985 passed, 0 failed📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle: 9.14 MB gzip 🔴 +25.2 kBDetailsSummary
Category Glance App Entry Points — 3.71 kB (baseline 3.71 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.38 MB (baseline 1.38 MB) • 🔴 +30 BGraph editor runtime, canvas, workflow orchestration
Status: 2 added / 2 removed / 1 unchanged Views & Navigation — 124 kB (baseline 124 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 15 added / 15 removed / 2 unchanged Panels & Settings — 591 kB (baseline 591 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 11 added / 11 removed / 16 unchanged User & Accounts — 27.5 kB (baseline 27.5 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 6 added / 6 removed / 5 unchanged Editors & Dialogs — 125 kB (baseline 125 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 8 added / 8 removed UI Components — 67.1 kB (baseline 67.1 kB) • ⚪ 0 BReusable component library chunks
Status: 13 added / 13 removed / 1 unchanged Data & Services — 3.49 MB (baseline 3.53 MB) • 🟢 -43.7 kBStores, services, APIs, and repositories
Status: 15 added / 15 removed / 2 unchanged Utilities & Hooks — 549 kB (baseline 549 kB) • 🔴 +411 BHelpers, composables, and utility bundles
Status: 22 added / 22 removed / 15 unchanged Vendor & Third-Party — 18.1 MB (baseline 18.1 MB) • 🔴 +49 kBExternal libraries and shared vendor chunks
Status: 2 added / 2 removed / 16 unchanged Other — 14.3 MB (baseline 14.1 MB) • 🔴 +119 kBBundles that do not match a named category
Status: 110 added / 105 removed / 180 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-08-24T04:02:41.632Z",
"gitSha": "2c58d226260c8d6ba372d34f961e7f9f2c089fc5",
"branch": "feat/create-camera-info-preview",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2039.0729999999735,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.160999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 540.1750000000001,
"heapDeltaBytes": 3600852,
"heapUsedBytes": 65140912,
"domNodes": -281,
"jsHeapTotalBytes": 3923968,
"scriptDurationMs": 8.528999999999998,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-idle",
"durationMs": 2031.4429999999675,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.022,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 552.41,
"heapDeltaBytes": -7139116,
"heapUsedBytes": 55427360,
"domNodes": -283,
"jsHeapTotalBytes": 4186112,
"scriptDurationMs": 9.591000000000001,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1996.910000000014,
"styleRecalcs": 80,
"styleRecalcDurationMs": 49.308,
"layouts": 12,
"layoutDurationMs": 4.3709999999999996,
"taskDurationMs": 1002.116,
"heapDeltaBytes": 6365928,
"heapUsedBytes": 68895524,
"domNodes": -280,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 114.282,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1861.5469999999732,
"styleRecalcs": 72,
"styleRecalcDurationMs": 38.225,
"layouts": 12,
"layoutDurationMs": 3.416000000000001,
"taskDurationMs": 926.091,
"heapDeltaBytes": -5701424,
"heapUsedBytes": 55772760,
"domNodes": -283,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 108.018,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1711.4880000000312,
"styleRecalcs": 30,
"styleRecalcDurationMs": 17.171,
"layouts": 6,
"layoutDurationMs": 0.7280000000000001,
"taskDurationMs": 372.42599999999993,
"heapDeltaBytes": 3355520,
"heapUsedBytes": 65321756,
"domNodes": 76,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 10.550999999999998,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1706.7329999999856,
"styleRecalcs": 31,
"styleRecalcDurationMs": 17.713,
"layouts": 6,
"layoutDurationMs": 0.761,
"taskDurationMs": 367.036,
"heapDeltaBytes": 3348412,
"heapUsedBytes": 65578056,
"domNodes": 77,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 9.376000000000001,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 636.7239999999583,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.617,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 413.44699999999995,
"heapDeltaBytes": 10599732,
"heapUsedBytes": 73501968,
"domNodes": 18,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 54.221000000000004,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 563.1070000000591,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.6770000000000005,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 367.584,
"heapDeltaBytes": 10085028,
"heapUsedBytes": 72233708,
"domNodes": 14,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 51.594,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2087.3080000000073,
"styleRecalcs": 8,
"styleRecalcDurationMs": 8.128000000000004,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 668.077,
"heapDeltaBytes": -5333796,
"heapUsedBytes": 71791596,
"domNodes": -281,
"jsHeapTotalBytes": -1052672,
"scriptDurationMs": 15.040999999999999,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2072.799000000032,
"styleRecalcs": 7,
"styleRecalcDurationMs": 10.189,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 669.246,
"heapDeltaBytes": 347324,
"heapUsedBytes": 77276872,
"domNodes": -272,
"jsHeapTotalBytes": -1314816,
"scriptDurationMs": 15.237999999999998,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2182.8219999999874,
"styleRecalcs": 70,
"styleRecalcDurationMs": 15.158999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1290.4900000000002,
"heapDeltaBytes": -8254308,
"heapUsedBytes": 69727476,
"domNodes": -279,
"jsHeapTotalBytes": -303104,
"scriptDurationMs": 336.30199999999996,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-pan",
"durationMs": 2118.345999999974,
"styleRecalcs": 67,
"styleRecalcDurationMs": 12.448,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1242.3690000000001,
"heapDeltaBytes": -6200312,
"heapUsedBytes": 71986728,
"domNodes": -282,
"jsHeapTotalBytes": -1089536,
"scriptDurationMs": 332.39599999999996,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3197.532000000024,
"styleRecalcs": 63,
"styleRecalcDurationMs": 13.776000000000003,
"layouts": 60,
"layoutDurationMs": 7.979,
"taskDurationMs": 1438.5330000000001,
"heapDeltaBytes": -11613140,
"heapUsedBytes": 67779112,
"domNodes": -289,
"jsHeapTotalBytes": 4714496,
"scriptDurationMs": 381.235,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3250.656999999933,
"styleRecalcs": 66,
"styleRecalcDurationMs": 15.756999999999996,
"layouts": 60,
"layoutDurationMs": 8.188,
"taskDurationMs": 1478.4039999999998,
"heapDeltaBytes": -7938916,
"heapUsedBytes": 70868360,
"domNodes": -284,
"jsHeapTotalBytes": 5763072,
"scriptDurationMs": 401.995,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 2420.35199999998,
"styleRecalcs": 45,
"styleRecalcDurationMs": 9.539,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1472.938,
"heapDeltaBytes": 10404828,
"heapUsedBytes": 90511696,
"domNodes": 10,
"jsHeapTotalBytes": 6221824,
"scriptDurationMs": 460.503,
"eventListeners": 186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 2253.7569999999505,
"styleRecalcs": 44,
"styleRecalcDurationMs": 8.591000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1443.3899999999999,
"heapDeltaBytes": 11258500,
"heapUsedBytes": 91233272,
"domNodes": 8,
"jsHeapTotalBytes": 6746112,
"scriptDurationMs": 440.56,
"eventListeners": 186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "minimap-idle",
"durationMs": 2048.1680000000324,
"styleRecalcs": 6,
"styleRecalcDurationMs": 8.653,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 668.1379999999999,
"heapDeltaBytes": -8144080,
"heapUsedBytes": 74998800,
"domNodes": -278,
"jsHeapTotalBytes": 6549504,
"scriptDurationMs": 13.241000000000003,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2057.617999999934,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.577,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 642.574,
"heapDeltaBytes": -11211584,
"heapUsedBytes": 73923960,
"domNodes": -272,
"jsHeapTotalBytes": 3141632,
"scriptDurationMs": 13.464,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 597.2819999999501,
"styleRecalcs": 46,
"styleRecalcDurationMs": 9.830999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 408.513,
"heapDeltaBytes": 11379800,
"heapUsedBytes": 74314208,
"domNodes": 18,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 125.98800000000001,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 608.7560000000849,
"styleRecalcs": 46,
"styleRecalcDurationMs": 9.338,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 396.14200000000005,
"heapDeltaBytes": 11714436,
"heapUsedBytes": 74702284,
"domNodes": 18,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 122.599,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-idle",
"durationMs": 2035.209000000009,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.249999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 536.789,
"heapDeltaBytes": 6780008,
"heapUsedBytes": 69703516,
"domNodes": -284,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 8.698,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2008.350000000064,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.969000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 532.99,
"heapDeltaBytes": 17984112,
"heapUsedBytes": 80865228,
"domNodes": -280,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 8.234999999999998,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1742.0699999999556,
"styleRecalcs": 77,
"styleRecalcDurationMs": 40.542,
"layouts": 16,
"layoutDurationMs": 4.845999999999999,
"taskDurationMs": 893.328,
"heapDeltaBytes": 4964844,
"heapUsedBytes": 67903168,
"domNodes": -282,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 85.293,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1724.0920000000415,
"styleRecalcs": 76,
"styleRecalcDurationMs": 37.513,
"layouts": 16,
"layoutDurationMs": 4.6499999999999995,
"taskDurationMs": 880.0229999999999,
"heapDeltaBytes": 4426796,
"heapUsedBytes": 67206664,
"domNodes": -281,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 84.054,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 1400.8460000000014,
"styleRecalcs": 19,
"styleRecalcDurationMs": 29.296999999999997,
"layouts": 14,
"layoutDurationMs": 12.658,
"taskDurationMs": 936.0809999999997,
"heapDeltaBytes": 1504344,
"heapUsedBytes": 100046696,
"domNodes": 13673,
"jsHeapTotalBytes": 11534336,
"scriptDurationMs": 16.879999999999992,
"eventListeners": 2375,
"totalBlockingTimeMs": 125,
"frameDurationMs": 16.666666666666696,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "viewport-pan-sweep",
"durationMs": 8211.692999999968,
"styleRecalcs": 251,
"styleRecalcDurationMs": 39.452,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4293.7609999999995,
"heapDeltaBytes": -10977672,
"heapUsedBytes": 65116036,
"domNodes": -281,
"jsHeapTotalBytes": 4452352,
"scriptDurationMs": 1010.573,
"eventListeners": -163,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "viewport-pan-sweep",
"durationMs": 8229.080999999951,
"styleRecalcs": 250,
"styleRecalcDurationMs": 36.928000000000004,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4275.082,
"heapDeltaBytes": -10621464,
"heapUsedBytes": 65394660,
"domNodes": -281,
"jsHeapTotalBytes": 4714496,
"scriptDurationMs": 1032.6090000000002,
"eventListeners": -163,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 16074.644999999975,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15047.282,
"heapDeltaBytes": -31717764,
"heapUsedBytes": 180819096,
"domNodes": -8316,
"jsHeapTotalBytes": -16293888,
"scriptDurationMs": 96.96600000000001,
"eventListeners": -16393,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 16479.54499999992,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15381.041999999998,
"heapDeltaBytes": -44340220,
"heapUsedBytes": 181069156,
"domNodes": -8312,
"jsHeapTotalBytes": -13672448,
"scriptDurationMs": 110.18500000000002,
"eventListeners": -16389,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.779999999999927,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 18592.10200000001,
"styleRecalcs": 149,
"styleRecalcDurationMs": 17.145999999999994,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 18092.938,
"heapDeltaBytes": -29780188,
"heapUsedBytes": 186513872,
"domNodes": -8312,
"jsHeapTotalBytes": -19492864,
"scriptDurationMs": 403.201,
"eventListeners": -16387,
"totalBlockingTimeMs": 10,
"frameDurationMs": 18.333333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 18811.94400000004,
"styleRecalcs": 159,
"styleRecalcDurationMs": 18.41999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 18330.482,
"heapDeltaBytes": -33671248,
"heapUsedBytes": 193057420,
"domNodes": -8312,
"jsHeapTotalBytes": -16601088,
"scriptDurationMs": 449.527,
"eventListeners": -16387,
"totalBlockingTimeMs": 63,
"frameDurationMs": 17.220000000000073,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "workflow-execution",
"durationMs": 480.32100000000355,
"styleRecalcs": 18,
"styleRecalcDurationMs": 23.870999999999995,
"layouts": 3,
"layoutDurationMs": 1.7309999999999999,
"taskDurationMs": 120.206,
"heapDeltaBytes": 5098432,
"heapUsedBytes": 67765892,
"domNodes": 150,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 7.542,
"eventListeners": 99,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 115.28900000007525,
"styleRecalcs": 7,
"styleRecalcDurationMs": 14.652999999999999,
"layouts": 3,
"layoutDurationMs": 0.818,
"taskDurationMs": 88.2,
"heapDeltaBytes": 3135476,
"heapUsedBytes": 65739544,
"domNodes": 107,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 7.291,
"eventListeners": 51,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
}
]
} |
🎨 Storybook: 🚧 Building... |
|
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:
📝 WalkthroughWalkthroughThe pull request adds a camera-info widget with interactive Three.js overlays, orbit and transform gizmos, look-through editing, widget synchronization, viewport render callbacks, and custom camera-up controls. ChangesCamera info and camera controls
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant CameraInfoVue
participant useCameraInfo
participant CameraInfoViewport
participant CameraInfoOverlay
participant LiteGraphWidgets
CameraInfoVue->>useCameraInfo: initialize(container)
useCameraInfo->>LiteGraphWidgets: read camera state
useCameraInfo->>CameraInfoViewport: create viewport
CameraInfoViewport->>CameraInfoOverlay: apply subject camera state
CameraInfoVue->>useCameraInfo: setLookThrough / setGizmosVisible
useCameraInfo->>CameraInfoViewport: update interaction state
CameraInfoViewport->>useCameraInfo: emit field updates
useCameraInfo->>LiteGraphWidgets: write changed values
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 inconclusive)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Note: there's a known bug where the node height resets to its default value after a refresh. This comes from dynamicInput, isn't specific to this PR, and try to fix in another PR #13456 . |
There was a problem hiding this comment.
Actionable comments posted: 14
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/cameraInfo/CameraInfo.vue`:
- Around line 165-190: Update the mode-change handling near
transformGizmoOptions so transformGizmoMode is reset to the supported fallback
when the current selection becomes disabled, such as switching from
quaternion/camera-rotate to orbit. Reconcile the selection against the computed
enabled options and preserve valid selections; ensure the viewport receives the
fallback rather than retaining an invalid gizmo mode.
In `@src/composables/useCameraInfo.ts`:
- Around line 69-72: Update the initialization error handling in useCameraInfo
to obtain the user-facing alert text through vue-i18n instead of hardcoding it.
Add the corresponding translation entry to src/locales/en/main.json and pass the
translated message to useToastStore().addAlert, while leaving the console error
unchanged.
- Around line 53-79: Update cleanup and initialization around wrappedSet,
unwireWidgets, and wireNodeMouseStatus to fully unwind prior hooks before
reinitializing. Remove each unwired widget from wrappedSet, retain the original
node mouse handlers so cleanup restores them, and clean any existing or
partially initialized viewport before creating a new one in initialize.
In `@src/extensions/core/cameraInfo/CameraInfoOverlay.test.ts`:
- Around line 90-109: Update the “camera type swap” test to assert that the
rebuilt CameraHelper references the newly active camera returned by
getSubjectCamera(), rather than only checking that its object identity differs
from the initial helper. Keep the behavior-focused assertions and avoid
change-detector or implementation-identity checks.
In `@src/extensions/core/cameraInfo/CameraInfoViewport.ts`:
- Around line 3-31: Separate type-only imports in CameraInfoViewport.ts: import
Viewport3d, CameraHandle, OrbitHandles, and other runtime values normally, while
importing Load3DOptions, CameraHandleMode, CameraHandleTransform,
OrbitHandleType, and camera-info types through dedicated import type
declarations. In CameraHandle.test.ts, keep the CameraHandle value import
separate from dedicated type imports for CameraHandleMode and
CameraHandleTransform.
- Around line 481-484: Update CameraInfoViewport.onPostRender so it never
synchronously calls viewport.forceRender from the post-render hook. Move
fitSubjectAspect synchronization before the main render, or defer the required
follow-up render until the current frame completes, while preserving
aspect-change handling and avoiding re-entry into Viewport3d.renderView.
In `@src/extensions/core/cameraInfo/cameraTransform.test.ts`:
- Around line 129-143: The roll test should verify the actual rotation behavior
rather than only checking that the quaternion changed. Update the “rotates
around the view axis without moving the camera position” test to assert that the
forward direction remains unchanged and that the up direction rotates by exactly
45 degrees around that forward axis, using deterministic vector comparisons.
In `@src/extensions/core/cameraInfo/handles/handlePicking.test.ts`:
- Around line 67-78: Adjust the test for pickHandleAtPointer so the ray does not
intersect either handle directly, forcing the screen-space fallback
nearest-candidate branch while keeping both handles within tolerance. Preserve
the assertion that the closer projected handle, “yaw”, is selected.
In `@src/extensions/core/cameraInfo/handles/rollDragMath.ts`:
- Around line 15-24: Update the roll orientation setup around the backward
vector normalization to detect coincident cameraPos and target positions and
choose a stable nonzero fallback direction before computing right and up.
Preserve the existing orientation behavior for distinct positions, and add a
regression test covering coincident inputs to verify the roll drag math remains
nondegenerate.
In `@src/extensions/core/cameraInfo/lookThroughDragMath.ts`:
- Around line 199-204: Update the look-at dolly calculation in the visible
drag-math flow to clamp nextDistance to both MIN_DISTANCE and the shared
maximum-distance constant used by orbit dolly and handle dragging. Preserve the
existing exponential factor and ensure the clamped distance is used when
computing the next position.
- Around line 131-139: Update the quaternion rotation logic near yawQ and pitchQ
so yaw uses the camera’s quaternion-derived local up axis rather than global Y,
and apply both rotations in local space instead of premultiplying yawQ. Preserve
normalization and add a regression covering horizontal movement from a rolled
starting quaternion.
In `@src/extensions/core/cameraInfo/widgetBridge.ts`:
- Around line 34-36: Update num in widgetBridge.ts to apply camera-specific
domain bounds when reading zoom, FOV, distance, and pitch, matching the limits
enforced by the drag controls. Keep finite numeric values only when they fall
within each field’s supported range; otherwise return the provided fallback
before values reach Three.js calculations.
- Around line 1-6: Separate type-only imports from value imports across the
camera info files: update src/extensions/core/cameraInfo/widgetBridge.ts lines
1-6 and src/extensions/core/cameraInfo/CameraInfoOverlay.ts lines 5-10 to use
dedicated import type statements, and update
src/extensions/core/cameraInfo/cameraTransform.test.ts lines 3-4,
src/extensions/core/cameraInfo/lookThroughDragMath.test.ts lines 4-5,
src/extensions/core/cameraInfo/widgetBridge.test.ts lines 3-8, and
src/extensions/core/cameraInfo/CameraInfoOverlay.test.ts lines 4-5 so
CameraInfoState or NodeWithWidgets is imported separately from value symbols.
In `@src/extensions/core/load3d/Viewport3d.ts`:
- Around line 198-210: Update runPostRenderCallbacks to iterate over a stable
snapshot of postRenderCallbacks rather than the live array, so disposals during
dispatch do not skip callbacks and newly registered callbacks wait until the
next render.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6c3d8342-c4a2-4b59-a099-69711fb2fb37
📒 Files selected for processing (42)
src/components/cameraInfo/CameraInfo.vuesrc/components/load3d/Load3DControls.vuesrc/components/load3d/controls/CameraControls.vuesrc/composables/useCameraInfo.test.tssrc/composables/useCameraInfo.tssrc/composables/useLoad3d.tssrc/extensions/core/cameraInfo.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.test.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.tssrc/extensions/core/cameraInfo/CameraInfoViewport.test.tssrc/extensions/core/cameraInfo/CameraInfoViewport.tssrc/extensions/core/cameraInfo/cameraTransform.test.tssrc/extensions/core/cameraInfo/cameraTransform.tssrc/extensions/core/cameraInfo/handles/CameraHandle.test.tssrc/extensions/core/cameraInfo/handles/CameraHandle.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.test.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.tssrc/extensions/core/cameraInfo/handles/RollHandle.test.tssrc/extensions/core/cameraInfo/handles/RollHandle.tssrc/extensions/core/cameraInfo/handles/TargetHandle.tssrc/extensions/core/cameraInfo/handles/handlePicking.test.tssrc/extensions/core/cameraInfo/handles/handlePicking.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.test.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.tssrc/extensions/core/cameraInfo/handles/rollDragMath.test.tssrc/extensions/core/cameraInfo/handles/rollDragMath.tssrc/extensions/core/cameraInfo/handles/types.tssrc/extensions/core/cameraInfo/lookThroughDragMath.test.tssrc/extensions/core/cameraInfo/lookThroughDragMath.tssrc/extensions/core/cameraInfo/types.tssrc/extensions/core/cameraInfo/widgetBridge.test.tssrc/extensions/core/cameraInfo/widgetBridge.tssrc/extensions/core/load3d/CameraManager.tssrc/extensions/core/load3d/Load3d.test.tssrc/extensions/core/load3d/Viewport3d.test.tssrc/extensions/core/load3d/Viewport3d.tssrc/extensions/core/load3d/createViewport3d.tssrc/extensions/core/load3d/interfaces.tssrc/extensions/core/load3d/nodeTypes.tssrc/extensions/core/load3dLazy.tssrc/locales/en/main.jsonsrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts
💤 Files with no reviewable changes (1)
- src/extensions/core/load3d/Viewport3d.test.ts
e893bf0 to
32b51dc
Compare
There was a problem hiding this comment.
Actionable comments posted: 8
♻️ Duplicate comments (1)
src/composables/useCameraInfo.ts (1)
59-63: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winClean up before returning for a missing node.
If
nodeRefbecomes null after initialization, Line 61 returns before removing the existing viewport or restoring the old node’s callbacks. Move cleanup before the guard and add a null-transition regression test.Proposed fix
const initialize = (container: HTMLElement): void => { + if (viewport) cleanup() const raw = toRaw(node.value) if (!raw || !container) return - if (viewport) cleanup()As per coding guidelines, implement proper cleanup and error handling.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/composables/useCameraInfo.ts` around lines 59 - 63, Update initialize in useCameraInfo so cleanup runs before the missing-node guard, ensuring an existing viewport and the previous node’s callbacks are released when nodeRef becomes null. Preserve the early return after cleanup, and add a regression test covering the transition from an initialized node to a null node.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/load3d/controls/CameraControls.vue`:
- Around line 32-41: Update the icon class composition in the CameraControls
template to replace the font-size utility text-lg with the appropriate size-*
utility, while preserving the existing icon selection and text-base-foreground
classes.
In `@src/extensions/core/cameraInfo/CameraInfoViewport.test.ts`:
- Around line 343-362: Extend the camera handle change tests around
CameraInfoViewport to cover quaternion rotation mode: select the camera-rotate
mode, dispatch objectChange on controlsOf(viewport.cameraHandle), and verify
onHandleDrag is called for mode.quat_x, mode.quat_y, mode.quat_z, and
mode.quat_w with numeric values. Preserve the existing translation-mode
coverage.
In `@src/extensions/core/cameraInfo/CameraInfoViewport.ts`:
- Around line 175-185: Update setLookThrough in CameraInfoViewport to save the
controls’ prior enabled state and disable standard controls when look-through is
activated. Restore that saved state when look-through is deactivated, ensuring
custom mouse-look input cannot simultaneously move the existing orbit controls.
- Around line 214-226: Update the handle visibility logic around wantTarget and
wantCamera so both targetHandle and cameraHandle are also gated by gizmosOn.
Preserve the existing transform mode applicability checks, but ensure selecting
“Hide gizmos” makes these handles invisible.
In `@src/extensions/core/cameraInfo/handles/CameraHandle.test.ts`:
- Around line 46-72: Extend the CameraHandle tests to cover emitted drag
behavior by dispatching objectChange and dragging-changed events on the handle’s
controlled object. Assert that the resulting callback emits the updated
transform, current mode, and dragging boolean, while preserving the existing
state and proxy tests.
In `@src/extensions/core/load3d/CameraManager.ts`:
- Around line 177-179: Update the toggleCamera method to copy the current
camera’s up vector to the newly created camera alongside position and rotation,
preserving custom-up orientation and allowing subsequent setUseCustomUp behavior
to remain consistent.
In `@src/extensions/core/load3d/Viewport3d.test.ts`:
- Around line 480-518: Extend the “render callback dispatch” tests to exercise
the real render pipeline through renderView(), recording events from a
pre-render callback, the main scene-render step, and a post-render callback.
Assert the ordering is exactly pre → main scene → post, without directly
invoking runPreRenderCallbacks or runPostRenderCallbacks and without adding
change-detector coverage.
In `@src/locales/en/main.json`:
- Line 2270: Update the failedToInitializeCameraInfoViewer locale message to
include the recovery step “Try refreshing the node,” while preserving the
existing initialization failure context.
---
Duplicate comments:
In `@src/composables/useCameraInfo.ts`:
- Around line 59-63: Update initialize in useCameraInfo so cleanup runs before
the missing-node guard, ensuring an existing viewport and the previous node’s
callbacks are released when nodeRef becomes null. Preserve the early return
after cleanup, and add a regression test covering the transition from an
initialized node to a null node.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8c572bbe-8769-4a93-a4a1-0e077d6f9930
📒 Files selected for processing (45)
src/components/cameraInfo/CameraInfo.test.tssrc/components/cameraInfo/CameraInfo.vuesrc/components/load3d/Load3DControls.vuesrc/components/load3d/controls/CameraControls.vuesrc/composables/useCameraInfo.test.tssrc/composables/useCameraInfo.tssrc/composables/useLoad3d.tssrc/extensions/core/cameraInfo.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.test.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.tssrc/extensions/core/cameraInfo/CameraInfoViewport.test.tssrc/extensions/core/cameraInfo/CameraInfoViewport.tssrc/extensions/core/cameraInfo/cameraTransform.test.tssrc/extensions/core/cameraInfo/cameraTransform.tssrc/extensions/core/cameraInfo/handles/CameraHandle.test.tssrc/extensions/core/cameraInfo/handles/CameraHandle.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.test.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.tssrc/extensions/core/cameraInfo/handles/RollHandle.test.tssrc/extensions/core/cameraInfo/handles/RollHandle.tssrc/extensions/core/cameraInfo/handles/TargetHandle.test.tssrc/extensions/core/cameraInfo/handles/TargetHandle.tssrc/extensions/core/cameraInfo/handles/handlePicking.test.tssrc/extensions/core/cameraInfo/handles/handlePicking.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.test.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.tssrc/extensions/core/cameraInfo/handles/rollDragMath.test.tssrc/extensions/core/cameraInfo/handles/rollDragMath.tssrc/extensions/core/cameraInfo/handles/types.tssrc/extensions/core/cameraInfo/lookThroughDragMath.test.tssrc/extensions/core/cameraInfo/lookThroughDragMath.tssrc/extensions/core/cameraInfo/types.tssrc/extensions/core/cameraInfo/widgetBridge.test.tssrc/extensions/core/cameraInfo/widgetBridge.tssrc/extensions/core/load3d/CameraManager.test.tssrc/extensions/core/load3d/CameraManager.tssrc/extensions/core/load3d/Load3d.test.tssrc/extensions/core/load3d/Viewport3d.test.tssrc/extensions/core/load3d/Viewport3d.tssrc/extensions/core/load3d/createViewport3d.tssrc/extensions/core/load3d/interfaces.tssrc/extensions/core/load3d/nodeTypes.tssrc/extensions/core/load3dLazy.tssrc/locales/en/main.jsonsrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts
32b51dc to
2162a93
Compare
There was a problem hiding this comment.
Actionable comments posted: 12
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/composables/useCameraInfo.test.ts`:
- Around line 140-145: Remove the “ignores toolbar actions before
initialization” test from the useCameraInfo test suite, including its
optional-chaining no-throw assertion; retain tests that verify observable camera
behavior instead.
In `@src/extensions/core/cameraInfo/CameraInfoOverlay.ts`:
- Around line 110-119: Update CameraInfoOverlay.dispose() to detach
referenceGroup, subjectPerspective, and subjectOrthographic from the scene
before disposing their resources. Preserve the existing idempotency guard and
cleanup behavior, ensuring a reused scene cannot traverse these disposed
objects.
In `@src/extensions/core/cameraInfo/CameraInfoViewport.test.ts`:
- Around line 351-370: Update the camera-handle change tests around
CameraInfoViewport to assert the complete callback contract: verify position_x,
position_y, and position_z, plus target_x, target_y, and target_z, with numeric
values for each emitted coordinate. Cover both the position and target callback
cases so missing y/z widget writes fail the tests.
In `@src/extensions/core/cameraInfo/CameraInfoViewport.ts`:
- Around line 307-310: Update CameraInfoViewport.updatePointer to convert
pointer coordinates through viewport.clientPointToNdc() instead of calculating
NDC from the full canvas bounds. When fitting the subject/look-through camera,
use Viewport3d’s effective letterboxed render-viewport aspect rather than the
canvas aspect, ensuring both picking and projection calculations match the
rendered sub-viewport.
In `@src/extensions/core/cameraInfo/cameraTransform.test.ts`:
- Around line 70-79: Extend the “uses explicit position” test around
computeSubjectTransform to verify orientation as well as position. Use a
non-axis-aligned lookAt target, transform the camera’s local -Z direction by the
returned quaternion, and assert the resulting direction numerically points
toward the target while preserving the existing position assertion.
In `@src/extensions/core/cameraInfo/handles/OrbitHandles.test.ts`:
- Around line 33-63: Add a nonzero-pitch test case for OrbitHandles.update() and
validate the world-space positions of both the pitch and distance handles
against the expected camera direction, including deterministic edge/permutation
coverage for the pitch branch. Keep assertions focused on resulting geometry
rather than implementation details.
- Around line 84-89: Remove the child mesh visibility assertion from the test
“isVisible reflects the root group, not individual handle meshes” in
OrbitHandles.test.ts. Keep the handles.update setup and the handles.isVisible()
expectation, which validates the observable OrbitHandles behavior without
asserting Three.js child-visibility internals.
In `@src/extensions/core/cameraInfo/handles/rollDragMath.test.ts`:
- Around line 18-21: Expand the rollBasis tests in rollDragMath.test.ts to fully
validate the straight-down fallback by asserting its complete orthonormal basis,
not just right.x. Add a corresponding straight-up camera case and assert the
complete expected basis there as well, covering both vertical-pole fallback
directions and their numerical geometry.
In `@src/extensions/core/cameraInfo/handles/RollHandle.test.ts`:
- Around line 54-77: Add a deterministic test in the roll-handle positioning
suite that sets roll to 90 degrees and verifies the pickable handle’s world
position relative to the target and camera basis. Exercise the handle-position
calculation used by the roll handle, such as through the existing handle.update
flow, and assert the resulting coordinates numerically rather than only checking
the default target placement.
In `@src/extensions/core/cameraInfo/lookThroughDragMath.test.ts`:
- Around line 82-105: Strengthen the quaternion coverage in the
rotateSubjectByDrag tests around rotateSubjectByDrag by adding deterministic
yaw-only and pitch-only cases that assert the resulting transformed forward and
up vectors. Include a rolled starting quaternion to verify yaw rotates around
world Y, and cover the relevant axis/sign permutations so incorrect axis
selection or multiplication order fails while preserving the existing
unit-quaternion assertions.
In `@src/extensions/core/cameraInfo/widgetBridge.test.ts`:
- Around line 20-43: Update the test for readStateFromWidgets to set camera_type
to 'orthographic' and assert that state.cameraType is 'orthographic'. Keep the
existing widget values and assertions unchanged so the test exercises the
non-default camera-type behavior.
In `@src/extensions/core/load3d/Viewport3d.ts`:
- Around line 202-216: Update addPreRenderCallback and addPostRenderCallback to
store a unique registration wrapper rather than the raw callback, and have each
returned disposer remove only that wrapper. Ensure repeated disposer calls are
idempotent and do not remove another registration of the same callback.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8a1cbf2f-7497-4b51-8bdd-39aa8182c66f
📒 Files selected for processing (45)
src/components/cameraInfo/CameraInfo.test.tssrc/components/cameraInfo/CameraInfo.vuesrc/components/load3d/Load3DControls.vuesrc/components/load3d/controls/CameraControls.vuesrc/composables/useCameraInfo.test.tssrc/composables/useCameraInfo.tssrc/composables/useLoad3d.tssrc/extensions/core/cameraInfo.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.test.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.tssrc/extensions/core/cameraInfo/CameraInfoViewport.test.tssrc/extensions/core/cameraInfo/CameraInfoViewport.tssrc/extensions/core/cameraInfo/cameraTransform.test.tssrc/extensions/core/cameraInfo/cameraTransform.tssrc/extensions/core/cameraInfo/handles/CameraHandle.test.tssrc/extensions/core/cameraInfo/handles/CameraHandle.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.test.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.tssrc/extensions/core/cameraInfo/handles/RollHandle.test.tssrc/extensions/core/cameraInfo/handles/RollHandle.tssrc/extensions/core/cameraInfo/handles/TargetHandle.test.tssrc/extensions/core/cameraInfo/handles/TargetHandle.tssrc/extensions/core/cameraInfo/handles/handlePicking.test.tssrc/extensions/core/cameraInfo/handles/handlePicking.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.test.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.tssrc/extensions/core/cameraInfo/handles/rollDragMath.test.tssrc/extensions/core/cameraInfo/handles/rollDragMath.tssrc/extensions/core/cameraInfo/handles/types.tssrc/extensions/core/cameraInfo/lookThroughDragMath.test.tssrc/extensions/core/cameraInfo/lookThroughDragMath.tssrc/extensions/core/cameraInfo/types.tssrc/extensions/core/cameraInfo/widgetBridge.test.tssrc/extensions/core/cameraInfo/widgetBridge.tssrc/extensions/core/load3d/CameraManager.test.tssrc/extensions/core/load3d/CameraManager.tssrc/extensions/core/load3d/Load3d.test.tssrc/extensions/core/load3d/Viewport3d.test.tssrc/extensions/core/load3d/Viewport3d.tssrc/extensions/core/load3d/createViewport3d.tssrc/extensions/core/load3d/interfaces.tssrc/extensions/core/load3d/nodeTypes.tssrc/extensions/core/load3dLazy.tssrc/locales/en/main.jsonsrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts
2162a93 to
f64c8fb
Compare
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/extensions/core/load3d/Viewport3d.test.ts (1)
442-517: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider exporting
LetterboxDimmerfor test reuse instead of re-declaring its shape.
DimmerInternals.letterboxDimmerduplicates the privateLetterboxDimmertype fromViewport3d.ts. Exporting it would let the test import the real type and avoid type drift if the shape changes.♻️ Proposed fix
-type LetterboxDimmer = { +export type LetterboxDimmer = { scene: THREE.Scene camera: THREE.OrthographicCamera geometry: THREE.PlaneGeometry material: THREE.MeshBasicMaterial }Then in the test:
import type { LetterboxDimmer } from '@/extensions/core/load3d/Viewport3d'and use it directly inDimmerInternals.Based on learnings: "avoid duplicating interface/type definitions... Import real type definitions from the component modules under test."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/extensions/core/load3d/Viewport3d.test.ts` around lines 442 - 517, Export the existing LetterboxDimmer type from Viewport3d.ts, then update the test to import it and use it for DimmerInternals.letterboxDimmer instead of redeclaring the scene, camera, geometry, and material shape; leave the other test-only internals unchanged.Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/composables/useCameraInfo.ts`:
- Around line 59-80: Update the catch block in initialize so any
CameraInfoViewport constructed before wireWidgetsToOverlay or
wireNodeMouseStatus fails is disposed via cleanup(). Preserve the existing error
logging and toast behavior while ensuring partial initialization cannot leave
viewport resources active.
In `@src/extensions/core/cameraInfo/CameraInfoOverlay.test.ts`:
- Around line 106-121: Update the camera-type swap test around applyState and
the newHelper lookup to assert that the scene contains exactly one
THREE.CameraHelper after switching to orthographic mode, while preserving the
existing active-camera and helper-target assertions.
In `@src/extensions/core/cameraInfo/handles/CameraHandle.test.ts`:
- Around line 53-55: Update the tests for CameraHandle visibility, including the
cases around “starts hidden with controls disabled” and “controls.enabled
together,” to assert controls().enabled alongside isVisible(). Use the existing
controls() helper so both visibility and control-enabled state are verified.
In `@src/extensions/core/cameraInfo/handles/OrbitHandles.test.ts`:
- Around line 33-45: Strengthen the yaw-handle assertion in the test around
handles.update by verifying yawHandle.position.z is close to the expected
RING_RADIUS at yaw=0, while retaining the x-position assertion. Replace the
sign-only z check with a magnitude check that directly validates the ring
placement.
In `@src/extensions/core/cameraInfo/handles/OrbitHandles.ts`:
- Around line 35-61: Extract the shared handle/glow mesh builders and constants
into a common handle-visuals module. Update
src/extensions/core/cameraInfo/handles/OrbitHandles.ts lines 35-61 to import and
use the shared makeHandle, makeGlow, BASE_GLOW_OPACITY, HOVER_GLOW_OPACITY,
HOVER_SCALE, HANDLE_RADIUS, and GLOW_RADIUS symbols; apply the same replacement
to src/extensions/core/cameraInfo/handles/RollHandle.ts lines 19-32, removing
its duplicated builders and glow construction.
In `@src/extensions/core/cameraInfo/handles/rollDragMath.test.ts`:
- Around line 18-35: Strengthen both vertical-pole fallback tests for rollBasis
by asserting the exact deterministic up vector: straight-down must produce (0,
0, -1), and straight-up must produce (0, 0, 1). Add the missing right.x
assertion to the straight-up test while preserving the existing length and
orthogonality checks.
---
Outside diff comments:
In `@src/extensions/core/load3d/Viewport3d.test.ts`:
- Around line 442-517: Export the existing LetterboxDimmer type from
Viewport3d.ts, then update the test to import it and use it for
DimmerInternals.letterboxDimmer instead of redeclaring the scene, camera,
geometry, and material shape; leave the other test-only internals unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a73a55da-cb4c-4c3d-b0a9-de10b1ef9b70
📒 Files selected for processing (45)
src/components/cameraInfo/CameraInfo.test.tssrc/components/cameraInfo/CameraInfo.vuesrc/components/load3d/Load3DControls.vuesrc/components/load3d/controls/CameraControls.vuesrc/composables/useCameraInfo.test.tssrc/composables/useCameraInfo.tssrc/composables/useLoad3d.tssrc/extensions/core/cameraInfo.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.test.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.tssrc/extensions/core/cameraInfo/CameraInfoViewport.test.tssrc/extensions/core/cameraInfo/CameraInfoViewport.tssrc/extensions/core/cameraInfo/cameraTransform.test.tssrc/extensions/core/cameraInfo/cameraTransform.tssrc/extensions/core/cameraInfo/handles/CameraHandle.test.tssrc/extensions/core/cameraInfo/handles/CameraHandle.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.test.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.tssrc/extensions/core/cameraInfo/handles/RollHandle.test.tssrc/extensions/core/cameraInfo/handles/RollHandle.tssrc/extensions/core/cameraInfo/handles/TargetHandle.test.tssrc/extensions/core/cameraInfo/handles/TargetHandle.tssrc/extensions/core/cameraInfo/handles/handlePicking.test.tssrc/extensions/core/cameraInfo/handles/handlePicking.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.test.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.tssrc/extensions/core/cameraInfo/handles/rollDragMath.test.tssrc/extensions/core/cameraInfo/handles/rollDragMath.tssrc/extensions/core/cameraInfo/handles/types.tssrc/extensions/core/cameraInfo/lookThroughDragMath.test.tssrc/extensions/core/cameraInfo/lookThroughDragMath.tssrc/extensions/core/cameraInfo/types.tssrc/extensions/core/cameraInfo/widgetBridge.test.tssrc/extensions/core/cameraInfo/widgetBridge.tssrc/extensions/core/load3d/CameraManager.test.tssrc/extensions/core/load3d/CameraManager.tssrc/extensions/core/load3d/Load3d.test.tssrc/extensions/core/load3d/Viewport3d.test.tssrc/extensions/core/load3d/Viewport3d.tssrc/extensions/core/load3d/createViewport3d.tssrc/extensions/core/load3d/interfaces.tssrc/extensions/core/load3d/nodeTypes.tssrc/extensions/core/load3dLazy.tssrc/locales/en/main.jsonsrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts
| it('positions the yaw handle on the +Z side of the ring at yaw=0', () => { | ||
| handles.update({ | ||
| ...DEFAULT_CAMERA_INFO_STATE, | ||
| mode: 'orbit', | ||
| orbit: { yaw: 0, pitch: 0, distance: 5 } | ||
| }) | ||
|
|
||
| const yawHandle = handles | ||
| .pickableMeshes() | ||
| .find((m) => m.userData.handleType === 'yaw')! | ||
| expect(yawHandle.position.x).toBeCloseTo(0) | ||
| expect(yawHandle.position.z).toBeGreaterThan(0) | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
Strengthen the yaw-handle position assertion.
Only the sign of z is checked; the expected magnitude (RING_RADIUS) is never verified, so a scaling regression in the yaw-handle placement would slip through.
🧪 Proposed tightening
expect(yawHandle.position.x).toBeCloseTo(0)
- expect(yawHandle.position.z).toBeGreaterThan(0)
+ expect(yawHandle.position.z).toBeCloseTo(1.5)As per path instructions, ensure new geometry behaviors have meaningful assertions rather than weak change-detector-style checks.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it('positions the yaw handle on the +Z side of the ring at yaw=0', () => { | |
| handles.update({ | |
| ...DEFAULT_CAMERA_INFO_STATE, | |
| mode: 'orbit', | |
| orbit: { yaw: 0, pitch: 0, distance: 5 } | |
| }) | |
| const yawHandle = handles | |
| .pickableMeshes() | |
| .find((m) => m.userData.handleType === 'yaw')! | |
| expect(yawHandle.position.x).toBeCloseTo(0) | |
| expect(yawHandle.position.z).toBeGreaterThan(0) | |
| }) | |
| it('positions the yaw handle on the +Z side of the ring at yaw=0', () => { | |
| handles.update({ | |
| ...DEFAULT_CAMERA_INFO_STATE, | |
| mode: 'orbit', | |
| orbit: { yaw: 0, pitch: 0, distance: 5 } | |
| }) | |
| const yawHandle = handles | |
| .pickableMeshes() | |
| .find((m) => m.userData.handleType === 'yaw')! | |
| expect(yawHandle.position.x).toBeCloseTo(0) | |
| expect(yawHandle.position.z).toBeCloseTo(1.5) | |
| }) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/extensions/core/cameraInfo/handles/OrbitHandles.test.ts` around lines 33
- 45, Strengthen the yaw-handle assertion in the test around handles.update by
verifying yawHandle.position.z is close to the expected RING_RADIUS at yaw=0,
while retaining the x-position assertion. Replace the sign-only z check with a
magnitude check that directly validates the ring placement.
Source: Path instructions
f64c8fb to
d167e6a
Compare
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/composables/useCameraInfo.test.ts`:
- Around line 86-234: Restore a test in the useCameraInfo suite covering toolbar
actions before initialization: call setGizmosVisible, setTransformGizmoMode, and
setLookThrough without invoking initialize, then assert instances remains empty
to preserve the lazy-initialization guard.
In `@src/extensions/core/cameraInfo/CameraInfoViewport.test.ts`:
- Around line 386-388: Update the quaternion assertion in the camera drag test
around controlsOf(viewport.cameraHandle) to iterate over x, y, z, and w,
asserting onHandleDrag is called with each corresponding mode.quat_${axis} key
and a numeric value. Preserve the existing event dispatch and ensure all four
quaternion component emits are covered.
In `@src/extensions/core/cameraInfo/handles/CameraHandle.test.ts`:
- Around line 62-68: Update the setMode test around CameraHandle.setMode to
assert the underlying TransformControls instance’s mode after switching between
rotate and translate, rather than relying on handle.getMode(). Preserve coverage
of both mode transitions and verify the observable controls behavior.
In `@src/extensions/core/cameraInfo/handles/OrbitHandles.ts`:
- Around line 257-258: Change the module-level pure helper vec from a const
arrow function to a function declaration, preserving its Vector3Like input and
THREE.Vector3 output behavior. Leave buildArcCurve, makeHandle, and makeGlow
unchanged.
In `@src/extensions/core/cameraInfo/handles/RollHandle.ts`:
- Around line 112-118: Remove the redundant cameraVec object literals in both
update() and dragPlane(), and pass the cameraPos returned by
computeSubjectTransform(state) directly to rollBasis(). Preserve the existing
basis calculations and behavior.
In `@src/extensions/core/cameraInfo/lookThroughDragMath.test.ts`:
- Around line 185-209: Add a null-edge-case test for dollySubjectByWheel in
look_at mode, using stateWith to set lookAt.position equal to target and
asserting the result is null. Place it alongside the existing look_at dolly
tests and mirror the established null-path coverage pattern from
rotateSubjectByDrag.
In `@src/extensions/core/load3d/CameraManager.ts`:
- Around line 202-220: Update setCameraState so applying a state quaternion does
not unconditionally re-enable custom-up after setUseCustomUp(false). Respect the
existing usingCustomUp state when deciding whether to apply the
quaternion-derived activeCamera.up, customUp, and cameraUpStateChange update,
preserving explicit user-disabled custom-up behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 62f69acd-fea0-4971-be2c-4a71e1f961c1
📒 Files selected for processing (45)
src/components/cameraInfo/CameraInfo.test.tssrc/components/cameraInfo/CameraInfo.vuesrc/components/load3d/Load3DControls.vuesrc/components/load3d/controls/CameraControls.vuesrc/composables/useCameraInfo.test.tssrc/composables/useCameraInfo.tssrc/composables/useLoad3d.tssrc/extensions/core/cameraInfo.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.test.tssrc/extensions/core/cameraInfo/CameraInfoOverlay.tssrc/extensions/core/cameraInfo/CameraInfoViewport.test.tssrc/extensions/core/cameraInfo/CameraInfoViewport.tssrc/extensions/core/cameraInfo/cameraTransform.test.tssrc/extensions/core/cameraInfo/cameraTransform.tssrc/extensions/core/cameraInfo/handles/CameraHandle.test.tssrc/extensions/core/cameraInfo/handles/CameraHandle.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.test.tssrc/extensions/core/cameraInfo/handles/OrbitHandles.tssrc/extensions/core/cameraInfo/handles/RollHandle.test.tssrc/extensions/core/cameraInfo/handles/RollHandle.tssrc/extensions/core/cameraInfo/handles/TargetHandle.test.tssrc/extensions/core/cameraInfo/handles/TargetHandle.tssrc/extensions/core/cameraInfo/handles/handlePicking.test.tssrc/extensions/core/cameraInfo/handles/handlePicking.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.test.tssrc/extensions/core/cameraInfo/handles/orbitDragMath.tssrc/extensions/core/cameraInfo/handles/rollDragMath.test.tssrc/extensions/core/cameraInfo/handles/rollDragMath.tssrc/extensions/core/cameraInfo/handles/types.tssrc/extensions/core/cameraInfo/lookThroughDragMath.test.tssrc/extensions/core/cameraInfo/lookThroughDragMath.tssrc/extensions/core/cameraInfo/types.tssrc/extensions/core/cameraInfo/widgetBridge.test.tssrc/extensions/core/cameraInfo/widgetBridge.tssrc/extensions/core/load3d/CameraManager.test.tssrc/extensions/core/load3d/CameraManager.tssrc/extensions/core/load3d/Load3d.test.tssrc/extensions/core/load3d/Viewport3d.test.tssrc/extensions/core/load3d/Viewport3d.tssrc/extensions/core/load3d/createViewport3d.tssrc/extensions/core/load3d/interfaces.tssrc/extensions/core/load3d/nodeTypes.tssrc/extensions/core/load3dLazy.tssrc/locales/en/main.jsonsrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.ts
| describe('useCameraInfo', () => { | ||
| it('constructs the viewport from widget state and exposes the mode', () => { | ||
| const node = makeNode({ mode: 'look_at', 'mode.distance': 7 }) | ||
| const container = document.createElement('div') | ||
| const camera = useCameraInfo(nodeRef(node)) | ||
|
|
||
| camera.initialize(container) | ||
|
|
||
| expect(ViewportMock).toHaveBeenCalledOnce() | ||
| const [ctorContainer, initialState] = instances[0].ctorArgs as [ | ||
| HTMLElement, | ||
| { mode: string; orbit: { distance: number } } | ||
| ] | ||
| expect(ctorContainer).toBe(container) | ||
| expect(initialState.mode).toBe('look_at') | ||
| expect(initialState.orbit.distance).toBe(7) | ||
| expect(camera.mode.value).toBe('look_at') | ||
| }) | ||
|
|
||
| it('does nothing when the node is null', () => { | ||
| const camera = useCameraInfo(ref(null)) | ||
| camera.initialize(document.createElement('div')) | ||
|
|
||
| expect(ViewportMock).not.toHaveBeenCalled() | ||
| }) | ||
|
|
||
| it('alerts and does not throw when the viewport fails to construct', () => { | ||
| ViewportMock.mockImplementationOnce(() => { | ||
| throw new Error('webgl unavailable') | ||
| }) | ||
| const consoleError = vi.spyOn(console, 'error').mockImplementation(() => {}) | ||
| const camera = useCameraInfo(nodeRef(makeNode({ mode: 'orbit' }))) | ||
|
|
||
| expect(() => camera.initialize(document.createElement('div'))).not.toThrow() | ||
| expect(addAlert).toHaveBeenCalledOnce() | ||
|
|
||
| consoleError.mockRestore() | ||
| }) | ||
|
|
||
| it('forwards toolbar actions to the viewport', () => { | ||
| const camera = useCameraInfo(nodeRef(makeNode({ mode: 'orbit' }))) | ||
| camera.initialize(document.createElement('div')) | ||
|
|
||
| camera.setGizmosVisible(false) | ||
| camera.setTransformGizmoMode('camera-rotate') | ||
| camera.setLookThrough(true) | ||
|
|
||
| expect(instances[0].setGizmosVisible).toHaveBeenCalledWith(false) | ||
| expect(instances[0].setTransformGizmoMode).toHaveBeenCalledWith( | ||
| 'camera-rotate' | ||
| ) | ||
| expect(instances[0].setLookThrough).toHaveBeenCalledWith(true) | ||
| }) | ||
|
|
||
| it('re-applies state to the viewport when a widget changes, keeping the original callback', () => { | ||
| const node = makeNode({ mode: 'orbit', target_x: 0 }) | ||
| const original = vi.fn() | ||
| widget(node, 'target_x').callback = original | ||
| const camera = useCameraInfo(nodeRef(node)) | ||
| camera.initialize(document.createElement('div')) | ||
|
|
||
| const targetX = widget(node, 'target_x') | ||
| targetX.value = 3 | ||
| targetX.callback!(3) | ||
|
|
||
| expect(original).toHaveBeenCalledWith(3) | ||
| const applied = instances[0].applyState.mock.lastCall?.[0] as { | ||
| target: { x: number } | ||
| } | ||
| expect(applied.target.x).toBe(3) | ||
| }) | ||
|
|
||
| it('updates the mode ref when the mode widget changes', () => { | ||
| const node = makeNode({ mode: 'orbit' }) | ||
| const camera = useCameraInfo(nodeRef(node)) | ||
| camera.initialize(document.createElement('div')) | ||
|
|
||
| const modeWidget = widget(node, 'mode') | ||
| modeWidget.value = 'quaternion' | ||
| modeWidget.callback!('quaternion') | ||
|
|
||
| expect(camera.mode.value).toBe('quaternion') | ||
| }) | ||
|
|
||
| it('routes node hover into the viewport status flags', () => { | ||
| const node = makeNode({ mode: 'orbit' }) | ||
| const camera = useCameraInfo(nodeRef(node)) | ||
| camera.initialize(document.createElement('div')) | ||
|
|
||
| camera.handleMouseEnter() | ||
| camera.handleMouseLeave() | ||
| node.onMouseEnter?.() | ||
|
|
||
| expect(instances[0].viewport.updateStatusMouseOnScene).toHaveBeenCalledWith( | ||
| true | ||
| ) | ||
| expect(instances[0].viewport.updateStatusMouseOnScene).toHaveBeenCalledWith( | ||
| false | ||
| ) | ||
| expect(instances[0].viewport.updateStatusMouseOnNode).toHaveBeenCalledWith( | ||
| true | ||
| ) | ||
| }) | ||
|
|
||
| it('removes the viewport and restores widget callbacks on cleanup', () => { | ||
| const node = makeNode({ mode: 'orbit', target_x: 0 }) | ||
| const original = vi.fn() | ||
| widget(node, 'target_x').callback = original | ||
| const camera = useCameraInfo(nodeRef(node)) | ||
| camera.initialize(document.createElement('div')) | ||
|
|
||
| camera.cleanup() | ||
|
|
||
| expect(instances[0].remove).toHaveBeenCalledOnce() | ||
| expect(widget(node, 'target_x').callback).toBe(original) | ||
| }) | ||
|
|
||
| it('restores the node mouse handlers on cleanup', () => { | ||
| const node = makeNode({ mode: 'orbit' }) | ||
| const originalEnter = vi.fn() | ||
| const originalLeave = vi.fn() | ||
| node.onMouseEnter = originalEnter | ||
| node.onMouseLeave = originalLeave | ||
| const camera = useCameraInfo(nodeRef(node)) | ||
| camera.initialize(document.createElement('div')) | ||
|
|
||
| expect(node.onMouseEnter).not.toBe(originalEnter) | ||
|
|
||
| camera.cleanup() | ||
|
|
||
| expect(node.onMouseEnter).toBe(originalEnter) | ||
| expect(node.onMouseLeave).toBe(originalLeave) | ||
| }) | ||
|
|
||
| it('re-wires widgets on a second initialize after cleanup', () => { | ||
| const node = makeNode({ mode: 'orbit', target_x: 0 }) | ||
| const camera = useCameraInfo(nodeRef(node)) | ||
| camera.initialize(document.createElement('div')) | ||
| camera.cleanup() | ||
| camera.initialize(document.createElement('div')) | ||
|
|
||
| const targetX = widget(node, 'target_x') | ||
| targetX.value = 5 | ||
| targetX.callback!(5) | ||
|
|
||
| expect(instances).toHaveLength(2) | ||
| expect(instances[1].applyState).toHaveBeenCalled() | ||
| }) | ||
| }) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Restore the "toolbar actions before initialize()" regression test.
Based on learnings, a prior discussion on this exact file concluded that the test asserting instances stays empty when setGizmosVisible/setTransformGizmoMode/setLookThrough are called before camera.initialize() should be retained, since it verifies the lazy-initialization contract (not just a no-throw check). That test no longer appears in this revision — the line range it previously occupied (140-145) now holds an unrelated test. Please restore coverage for this guard, e.g.:
it('ignores toolbar actions before initialization', () => {
const camera = useCameraInfo(nodeRef(makeNode({ mode: 'orbit' })))
camera.setGizmosVisible(false)
camera.setTransformGizmoMode('camera-rotate')
camera.setLookThrough(true)
expect(instances).toHaveLength(0)
})🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/composables/useCameraInfo.test.ts` around lines 86 - 234, Restore a test
in the useCameraInfo suite covering toolbar actions before initialization: call
setGizmosVisible, setTransformGizmoMode, and setLookThrough without invoking
initialize, then assert instances remains empty to preserve the
lazy-initialization guard.
Source: Learnings
| controlsOf(viewport.cameraHandle).dispatchEvent({ type: 'objectChange' }) | ||
|
|
||
| expect(onHandleDrag).toHaveBeenCalledWith('mode.quat_w', expect.any(Number)) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert all four quaternion components, not just quat_w.
This mirrors the position/target tests (which already loop over x/y/z). As written, a regression that drops the mode.quat_x/y/z widget writes in handleCameraDrag would still pass. Loop over ['x','y','z','w'] and assert each mode.quat_${axis} emit.
As per path instructions, tests must cover the full behavioral contract for new logic.
💚 Proposed fix
- expect(onHandleDrag).toHaveBeenCalledWith('mode.quat_w', expect.any(Number))
+ for (const axis of ['x', 'y', 'z', 'w']) {
+ expect(onHandleDrag).toHaveBeenCalledWith(
+ `mode.quat_${axis}`,
+ expect.any(Number)
+ )
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| controlsOf(viewport.cameraHandle).dispatchEvent({ type: 'objectChange' }) | |
| expect(onHandleDrag).toHaveBeenCalledWith('mode.quat_w', expect.any(Number)) | |
| controlsOf(viewport.cameraHandle).dispatchEvent({ type: 'objectChange' }) | |
| for (const axis of ['x', 'y', 'z', 'w']) { | |
| expect(onHandleDrag).toHaveBeenCalledWith( | |
| `mode.quat_${axis}`, | |
| expect.any(Number) | |
| ) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/extensions/core/cameraInfo/CameraInfoViewport.test.ts` around lines 386 -
388, Update the quaternion assertion in the camera drag test around
controlsOf(viewport.cameraHandle) to iterate over x, y, z, and w, asserting
onHandleDrag is called with each corresponding mode.quat_${axis} key and a
numeric value. Preserve the existing event dispatch and ensure all four
quaternion component emits are covered.
Source: Path instructions
| it('setMode switches translate <-> rotate', () => { | ||
| handle.setMode('rotate') | ||
| expect(handle.getMode()).toBe('rotate') | ||
|
|
||
| handle.setMode('translate') | ||
| expect(handle.getMode()).toBe('translate') | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
Assert the underlying TransformControls mode, not just the wrapper's mirrored field.
handle.getMode() only echoes this.mode; it doesn't verify that controls.setMode() actually propagated to the real TransformControls instance. A regression that updates the local field but breaks the call to this.controls.setMode(mode) would pass this test.
🧪 Proposed fix
it('setMode switches translate <-> rotate', () => {
handle.setMode('rotate')
expect(handle.getMode()).toBe('rotate')
+ expect(controls().mode).toBe('rotate')
handle.setMode('translate')
expect(handle.getMode()).toBe('translate')
+ expect(controls().mode).toBe('translate')
})As per path instructions, avoid change-detector tests that assert implementation state instead of observable side effects.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it('setMode switches translate <-> rotate', () => { | |
| handle.setMode('rotate') | |
| expect(handle.getMode()).toBe('rotate') | |
| handle.setMode('translate') | |
| expect(handle.getMode()).toBe('translate') | |
| }) | |
| it('setMode switches translate <-> rotate', () => { | |
| handle.setMode('rotate') | |
| expect(handle.getMode()).toBe('rotate') | |
| expect(controls().mode).toBe('rotate') | |
| handle.setMode('translate') | |
| expect(handle.getMode()).toBe('translate') | |
| expect(controls().mode).toBe('translate') | |
| }) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/extensions/core/cameraInfo/handles/CameraHandle.test.ts` around lines 62
- 68, Update the setMode test around CameraHandle.setMode to assert the
underlying TransformControls instance’s mode after switching between rotate and
translate, rather than relying on handle.getMode(). Preserve coverage of both
mode transitions and verify the observable controls behavior.
Source: Path instructions
| const vec = (v: THREE.Vector3Like): THREE.Vector3 => | ||
| new THREE.Vector3(v.x, v.y, v.z) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Use a function declaration for the pure vec helper.
vec is a pure, non-callback helper but is defined as a const arrow function. Based on learnings, this repo prefers function declarations for pure functions (all other module-level helpers here — buildArcCurve, makeHandle, makeGlow — already follow this convention).
♻️ Proposed fix
-const vec = (v: THREE.Vector3Like): THREE.Vector3 =>
- new THREE.Vector3(v.x, v.y, v.z)
+function vec(v: THREE.Vector3Like): THREE.Vector3 {
+ return new THREE.Vector3(v.x, v.y, v.z)
+}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const vec = (v: THREE.Vector3Like): THREE.Vector3 => | |
| new THREE.Vector3(v.x, v.y, v.z) | |
| function vec(v: THREE.Vector3Like): THREE.Vector3 { | |
| return new THREE.Vector3(v.x, v.y, v.z) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/extensions/core/cameraInfo/handles/OrbitHandles.ts` around lines 257 -
258, Change the module-level pure helper vec from a const arrow function to a
function declaration, preserving its Vector3Like input and THREE.Vector3 output
behavior. Leave buildArcCurve, makeHandle, and makeGlow unchanged.
Source: Learnings
| it('look_at: moves the position toward the target, preserving direction', () => { | ||
| const state = stateWith({ | ||
| mode: 'look_at', | ||
| lookAt: { position: { x: 0, y: 0, z: 5 } }, | ||
| target: { x: 0, y: 0, z: 0 } | ||
| }) | ||
| const result = dollySubjectByWheel(state, -100) | ||
| const pos = result!.nextState.lookAt.position | ||
|
|
||
| expect(pos.z).toBeGreaterThan(0) | ||
| expect(pos.z).toBeLessThan(5) | ||
| expect(pos.x).toBeCloseTo(0) | ||
| expect(pos.y).toBeCloseTo(0) | ||
| }) | ||
|
|
||
| it('look_at: clamps distance to the shared maximum on scroll-out', () => { | ||
| const state = stateWith({ | ||
| mode: 'look_at', | ||
| lookAt: { position: { x: 0, y: 0, z: 5 } }, | ||
| target: { x: 0, y: 0, z: 0 } | ||
| }) | ||
| const pos = dollySubjectByWheel(state, 100000)!.nextState.lookAt.position | ||
|
|
||
| expect(Math.hypot(pos.x, pos.y, pos.z)).toBeCloseTo(100) | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
Missing null-edge-case test for dollySubjectByWheel in look_at mode.
dollyLookAt returns null when camera position coincides with the target (distance < 1e-6), mirroring the already-tested null path in rotateSubjectByDrag - look_at (Line 71-79). That branch has no coverage here.
🧪 Proposed test addition
it('look_at: clamps distance to the shared maximum on scroll-out', () => {
...
})
+
+ it('look_at: returns null when the camera sits on the target', () => {
+ const state = stateWith({
+ mode: 'look_at',
+ lookAt: { position: { x: 1, y: 1, z: 1 } },
+ target: { x: 1, y: 1, z: 1 }
+ })
+
+ expect(dollySubjectByWheel(state, -100)).toBeNull()
+ })As per path instructions, "ensuring edge cases/error/null scenarios are covered where behavior exists."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it('look_at: moves the position toward the target, preserving direction', () => { | |
| const state = stateWith({ | |
| mode: 'look_at', | |
| lookAt: { position: { x: 0, y: 0, z: 5 } }, | |
| target: { x: 0, y: 0, z: 0 } | |
| }) | |
| const result = dollySubjectByWheel(state, -100) | |
| const pos = result!.nextState.lookAt.position | |
| expect(pos.z).toBeGreaterThan(0) | |
| expect(pos.z).toBeLessThan(5) | |
| expect(pos.x).toBeCloseTo(0) | |
| expect(pos.y).toBeCloseTo(0) | |
| }) | |
| it('look_at: clamps distance to the shared maximum on scroll-out', () => { | |
| const state = stateWith({ | |
| mode: 'look_at', | |
| lookAt: { position: { x: 0, y: 0, z: 5 } }, | |
| target: { x: 0, y: 0, z: 0 } | |
| }) | |
| const pos = dollySubjectByWheel(state, 100000)!.nextState.lookAt.position | |
| expect(Math.hypot(pos.x, pos.y, pos.z)).toBeCloseTo(100) | |
| }) | |
| it('look_at: moves the position toward the target, preserving direction', () => { | |
| const state = stateWith({ | |
| mode: 'look_at', | |
| lookAt: { position: { x: 0, y: 0, z: 5 } }, | |
| target: { x: 0, y: 0, z: 0 } | |
| }) | |
| const result = dollySubjectByWheel(state, -100) | |
| const pos = result!.nextState.lookAt.position | |
| expect(pos.z).toBeGreaterThan(0) | |
| expect(pos.z).toBeLessThan(5) | |
| expect(pos.x).toBeCloseTo(0) | |
| expect(pos.y).toBeCloseTo(0) | |
| }) | |
| it('look_at: clamps distance to the shared maximum on scroll-out', () => { | |
| const state = stateWith({ | |
| mode: 'look_at', | |
| lookAt: { position: { x: 0, y: 0, z: 5 } }, | |
| target: { x: 0, y: 0, z: 0 } | |
| }) | |
| const pos = dollySubjectByWheel(state, 100000)!.nextState.lookAt.position | |
| expect(Math.hypot(pos.x, pos.y, pos.z)).toBeCloseTo(100) | |
| }) | |
| it('look_at: returns null when the camera sits on the target', () => { | |
| const state = stateWith({ | |
| mode: 'look_at', | |
| lookAt: { position: { x: 1, y: 1, z: 1 } }, | |
| target: { x: 1, y: 1, z: 1 } | |
| }) | |
| expect(dollySubjectByWheel(state, -100)).toBeNull() | |
| }) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/extensions/core/cameraInfo/lookThroughDragMath.test.ts` around lines 185
- 209, Add a null-edge-case test for dollySubjectByWheel in look_at mode, using
stateWith to set lookAt.position equal to target and asserting the result is
null. Place it alongside the existing look_at dolly tests and mirror the
established null-path coverage pattern from rotateSubjectByDrag.
Source: Path instructions
d167e6a to
5ab0757
Compare
christian-byrne
left a comment
There was a problem hiding this comment.
Can you follow domain-driven organization of code modules and files rather than technical layers like sr/ccomponents and src/composables, etc.?
See
christian-byrne
left a comment
There was a problem hiding this comment.
Multi-lens review (correctness/history, state & reactivity, leaks & perf, test quality, domain/ECS, surface/serialization), findings independently verified before posting. Overall: solid feature with symmetric lifecycle cleanup, strong pure-math test coverage, and correct lazy-loading boundaries. 5 issues worth addressing and 9 smaller notes below as inline comments.
Two cross-file notes that don't anchor to a single line:
issue (non-blocking, architecture): The camera-info feature is spread across src/composables/useCameraInfo.ts, src/components/cameraInfo/, and src/extensions/core/cameraInfo{,.ts} with imports running back and forth between them. The DDD guidance (.agents/checks/ddd-structure.md) asks for feature files that change together to be co-located as a domain module (e.g. src/workbench/extensions/cameraInfo/) rather than smeared across the legacy technical layers. Exact destination is your call, but co-locating now will be much cheaper than after ECS lands.
suggestion (non-blocking): This PR adds useCustomUp to CameraConfig and applies it in the composable path (useLoad3d.ts:536-541), but the pre-existing Load3DConfiguration.applyCameraConfig() (Load3DConfiguration.ts:272-278) never applies it, so the same serialized config restores differently depending on entry path. Worth a one-line follow-up (here or a separate PR).
Also noting for a follow-up issue rather than this PR: Viewport3d.test.ts builds instances via Object.create(Viewport3d.prototype) with all managers faked — that pattern predates this PR, but the new tests extend it; worth a targeted cleanup later.
| this.activeCamera.updateProjectionMatrix() | ||
| } | ||
|
|
||
| if (state.quaternion) { |
There was a problem hiding this comment.
issue (correctness): Two related problems in this restore path:
-
An all-zero quaternion passes straight through:
new THREE.Vector3(0, 1, 0).applyQuaternion(q)returns(0, 0, 0), which is copied intoactiveCamera.upbeforecontrols?.update(). UnlikecameraTransform.normalizeQuaternion, this path has no zero-length guard, and the camera-info widgets accept finite all-zero quaternion components. -
Restoring a
CameraStatewithout a quaternion leaves a previously captured custom up active — the custom-up bookkeeping (customUp,usingCustomUp,activeCamera.up) is only updated insideif (state.quaternion), andLoad3d.setCameraFromMatrices()builds states with no quaternion, so a matrix-derived or legacy restore after any quaternion restore can stay incorrectly rolled.
Suggest a zero-length guard (fall back to identity) and clearing the custom-up state on the no-quaternion branch.
| watch(gizmosOn, (on) => setGizmosVisible(on)) | ||
| watch(transformGizmoMode, (m) => setTransformGizmoMode(m)) | ||
| watch(lookingThrough, (on) => setLookThrough(on)) | ||
| watch(mode, () => { |
There was a problem hiding this comment.
suggestion (state): This watcher writes transformGizmoMode.value = 'none' which the watcher at L209 then observes — an internal effect chain through a ref, used to repair an invalid selection that is directly representable (e.g. mode === 'orbit' while transformGizmoMode === 'camera-rotate').
Per state-and-effects.md §4/§5, derive the effective value and sync only that outward:
const effectiveTransformGizmoMode = computed<TransformGizmoMode>(() =>
transformGizmoOptions.value.some(
({ value, enabled }) => value === transformGizmoMode.value && enabled
)
? transformGizmoMode.value
: 'none'
)
watch(effectiveTransformGizmoMode, setTransformGizmoMode)Use it for aria-pressed too, leaving the user's raw selection as the only stored fact.
| event.stopPropagation() | ||
| } | ||
|
|
||
| private readonly onPointerMove = (event: PointerEvent): void => { |
There was a problem hiding this comment.
issue (performance): The handle-drag path calls applyState(nextState) → forceRender() directly per raw pointermove, while the regular rAF render loop is also active (pointer is over the widget). Each render is two-pass (main scene + subject-camera preview) plus a full-canvas blit, so a 125 Hz pointer can drive ~125 event-driven renders/sec on top of the ~60 loop renders.
The look-through path already does this right — it accumulates movement and flushes once per rAF (L435-453). The drag path should use the same coalescing (or skip forceRender while the loop is running).
| } | ||
|
|
||
| private updatePointer(event: PointerEvent): void { | ||
| const rect = this.canvas.getBoundingClientRect() |
There was a problem hiding this comment.
nitpick (performance): updatePointer calls this.canvas.getBoundingClientRect() on every raw pointer event (synchronous layout in a hot path), the drag branch allocates a fresh new THREE.Vector3() per move, and pickHandleAtPointer clones/projects a vector per target per hover event. Bounded (≤4 targets), so not a leak — but caching the rect between resize events and reusing scratch vectors would take avoidable layout/GC pressure out of the same path that's already doing full renders.
| 'orthographic' | ||
| ] | ||
|
|
||
| function widgetByName( |
There was a problem hiding this comment.
issue (architecture/ECS): This bridge reads state by traversing node.widgets and dereferencing each legacy widget's .value, writes via direct .value mutation, and useCameraInfo.ts:131-159 monkey-patches each widget's callback to observe changes. This is the exact legacy pattern docs/architecture/ecs-migration-plan.md calls out (§2b: reads through widgetValueStore.getWidget/getNodeWidgets, writes through widgetValueStore.setValue; its extension-migration example names node.widgets?.find(...) as the pattern to replace).
With the ECS branch merging imminently, this isn't just a textual conflict — the component's state adapter will need architectural rework to consume WidgetId-keyed state/actions. Registering the Vue component in widgetRegistry.ts is fine; it's the read/write/callback-interception layer that should move onto the store, either in this PR or as an immediate follow-up after ECS lands.
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
repo="Comfy-Org/ComfyUI_frontend"
body=$(cat <<'EOF'
## Summary
Migrate the CameraInfo state adapter from legacy LiteGraph widget access to the ECS widget value store and WidgetId-keyed actions.
## Required changes
- Replace `node.widgets` traversal and direct `.value` reads in `src/extensions/core/cameraInfo/widgetBridge.ts`.
- Replace direct `.value` writes in `writeWidgetValue`.
- Remove widget callback monkey-patching in `src/composables/useCameraInfo.ts`.
- Read widget state through `widgetValueStore.getWidget` and `widgetValueStore.getNodeWidgets`.
- Write widget state through `widgetValueStore.setValue`.
- Subscribe to WidgetId-keyed state changes through the ECS-supported mechanism.
## Rationale
The current bridge uses the legacy widget pattern that the ECS migration plan identifies for replacement. The ECS branch requires WidgetId-keyed state and actions. This migration avoids an architectural conflict when ECS lands.
## Affected areas
- `src/extensions/core/cameraInfo/widgetBridge.ts`
- `src/composables/useCameraInfo.ts`
- CameraInfo widget synchronization tests
## Acceptance criteria
- CameraInfo reads state without traversing `node.widgets`.
- CameraInfo writes state without mutating widget `.value` directly.
- CameraInfo observes widget changes without replacing widget callbacks.
- The implementation uses the supported ECS widget value store APIs and WidgetId-keyed state/actions.
- Tests cover state reads, writes, and reactive updates through the ECS adapter.
## Backlinks
- Pull request: https://github.com/Comfy-Org/ComfyUI_frontend/pull/13741
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/13741#discussion_r3840304840
Requested by: `@christian-byrne`
EOF
)
gh issue create \
--repo "$repo" \
--title "Migrate CameraInfo widget state bridge to ECS widget value store" \
--body "$body" \
--assignee "christian-byrne"Length of output: 2125
@christian-byrne, created follow-up issue #15780: Migrate CameraInfo widget state bridge to ECS widget value store.
🧠 Learnings used
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 15443
File: docs/adr/0008-entity-component-system.md:22-24
Timestamp: 2026-08-20T19:30:30.807Z
Learning: In ComfyUI frontend entity and Pinia store code, use the established identity type for each concern: branded numbers for most entity IDs, number-or-string IDs for nodes, UUID strings for graphs, and composite string keys such as WidgetId for scoped entities. Do not introduce a new ID representation when an established store-specific type exists.
You are interacting with an AI system.
| handle.attach(scene) | ||
| }) | ||
|
|
||
| function controls(): TransformControls { |
There was a problem hiding this comment.
suggestion (test quality): These tests (and TargetHandle.test.ts:34-36) cast through unknown to reach the private controls and dispatch its private TransformControls events — coupling the tests to implementation internals and running against the repo's no-as unknown as X rule. Prefer typed vi.fn<(...) => void>() callbacks and exercising drag behavior through a public seam (or a deliberate testable collaborator interface).
| expect(result!.nextState.orbit.pitch).toBeCloseTo( | ||
| state.orbit.pitch + 0.05 * RAD2DEG | ||
| ) | ||
| expect(result!.updates.map((u) => u.fieldName)).toEqual([ |
There was a problem hiding this comment.
nitpick (test quality): These tests already assert the resulting camera transform (good), then additionally pin the exact updates field-name array and order. Batching or reordering equivalent widget writes would fail the test while behavior stays correct — a change-detector. Assert the required field/value set (unordered) only where widget synchronization is itself the contract.
| const TARGET = { x: 0, y: 0, z: 0 } | ||
| const SHIFTED_TARGET = { x: 2, y: 1, z: -3 } | ||
|
|
||
| describe('pointToYawAngle', () => { |
There was a problem hiding this comment.
suggestion (test quality): pointToYawAngle / pointToPitchAngle / pointToRollAngle have no case where the point coincides with the target — the zero-length-direction input most likely to produce NaN/unstable angles. (Zero-quaternion and position==target cases are covered elsewhere; this is the remaining gap.) Worth explicit finite-result/contract tests.
| expect(onChange).not.toHaveBeenCalled() | ||
| }) | ||
|
|
||
| it('setTarget is a no-op when the position already matches', () => { |
There was a problem hiding this comment.
nitpick (test quality): This assertion (and expect(() => isActive()).not.toThrow() in Viewport3d.test.ts:158-166) passes against an empty implementation — absence-of-callback / doesn't-throw checks aren't red-capable. Assert the returned state / preserved proxy position instead.
| @@ -0,0 +1,700 @@ | |||
| import * as THREE from 'three' | |||
|
|
|||
| import type { Viewport3d } from '@/extensions/core/load3d/Viewport3d' | |||
There was a problem hiding this comment.
suggestion (architecture): Camera-info imports the concrete Viewport3d and its factory by file path, constructs it directly, then reaches through the manager graph (viewport.sceneManager.scene, cameraManager.activeCamera, controlsManager.controls). load3d/interfaces.ts already defines SceneManagerInterface/CameraManagerInterface etc., and the new SceneOverlay contract is a good boundary — but there's no public viewport/factory contract, so camera-info stays coupled to load3d's implementation topology. Either expose a viewport interface/factory as the load3d API, or co-locate this with load3d.
- Guard zero-length quaternions in CameraManager.setCameraState and clear custom-up state when restoring a state without a quaternion - Model CustomUpConfig as a discriminated union on CameraConfig - Mark the camera_info_state presentation widget non-serializable in both workflow and prompt layers - Derive effectiveTransformGizmoMode instead of resetting the selection through a watcher chain; user selection is restored when re-enabled - Keep a single reactive CameraInfoState in useCameraInfo; mode is computed - Coalesce handle-drag and hover picking to one flush per animation frame, reuse a scratch vector in the drag path - Test quality: typed vi.fn callbacks, state-preserving no-op assertions, order-insensitive update-field assertions, point==target degenerate cases - Adapt createViewport3d to the new ControlsManager/ViewHelperManager constructor signatures after the rebase
5ab0757 to
cbe4997
Compare
Summary
Vue viewport widget for the CreateCameraInfo node, bound to the CAMERA_INFO_STATE input. It renders the configured camera in a Load3D-style 3D scene so the camera can be posed directly instead of by typing numbers into the yaw/pitch/position/quaternion widgets; every drag writes back to those widgets, which stay the source of truth.
Shared viewer changes (load3d):
BE Comfy-Org/ComfyUI#14964
Screenshots (if applicable)
2026-07-15.23-31-59.mp4