Repository navigation
Select asset-backed elements in the 3D view - #51
Open
haphantran wants to merge 1 commit into
Open
haphantran wants to merge 1 commit into
haphantran wants to merge 1 commit into
Conversation
Clicking an element whose 3D notation binds a GLB asset did nothing. The pointer handlers only accepted a hit on the element's own mesh or on a direct child of its group, but a hit on an asset lands on a mesh nested inside the loaded model. Conveyors, robots, charging stations, output locations, and pathway areas in the Smart Warehouse views could therefore not be selected, dragged, or edited in 3D. Accept any hit below the element's group.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix preserves interaction guards, includes targeted regression tests, and has no identified blocking issues.
0 open findings
What changed in this PR
Fixes selection of asset-backed elements in the 3D view by recognizing hits on nested model meshes.
Changes:
- Adds an ancestor-based hit-checking utility.
- Uses it in
Node3Dclick and pointer-down handlers. - Adds regression tests for nested assets, fallback shapes, and unrelated hits.
| File | Description |
|---|---|
| frontend/src/components/diagram/Node3D.tsx | Applies descendant-aware hit checks. |
| frontend/src/components/diagram/3d/utils/selection.ts | Adds the hit ancestry helper. |
| frontend/src/components/diagram/3d/utils/index.ts | Exports the selection utility. |
| frontend/src/__tests__/services/3d-selection.test.ts | Tests accepted and rejected hits. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the 3D view, clicking an element whose notation binds a GLB asset did nothing.
Node3Donly handled a pointer hit when the hit object was the element's own mesh or a direct child of its group. A hit on an asset lands on a mesh nested inside the loaded model, several levels below the group, so the check always failed and the event was swallowed.In the Smart Warehouse floor-plan views this affects conveyors, mobile robots, charging stations, output locations, and pathway areas. None of them could be selected, dragged, or edited through Position & Rotation. That blocks the paper scenario and reviewer guide step "in 3D, move one conveyor onto the other". Fallback shapes (racks, docks, drones, all Smart Home devices) were not affected.
Change
isHitWithin(object, roots)incomponents/diagram/3d/utils/selection.tsaccepts a hit on any object at or below the element's mesh or group.Node3Duses it in the click and pointer-down handlers instead of the direct-child check.Testing
3d-selection.test.tscovers a nested asset mesh, a fallback mesh and its child, and hits on other elements.tsc --noEmitpasses, and the changed files lint clean.LoginPageandViewpointManager, and both suites pass when run alone (27/27).validate-modelpipeline run on a checkpoint reports the same issue.