app-16292: shared ECS traits and helpers for entity pose plugins#735
Merged
Conversation
🦋 Changeset detectedLatest commit: d076b3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This was referenced Jun 1, 2026
Contributor
|
Foundation for the upcoming Gizmos plugin. No callers yet; these symbols are consumed by follow-up PRs in the stack. * writeMatrix(entity, patch): patch a Pose onto an entity's Matrix trait via createPose/matrixToPose/poseToMatrix, then dirty the trait. Used by the refactored Details panel and the Gizmos plugin. * CustomDetails trait: marker so the Details panel suppresses its default frame/pose UI for entities that render their own. * useMouseRaycaster firstHitOnly option (forwarded to three-mesh-bvh). * 'gizmo' value added to Settings.interactionMode. * Re-exports of DEFAULT_LINE_WIDTH and ARROW_LENGTH for downstream consumers.
681bd0b to
9e637c6
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
- Move writeMatrix below updateGeometryTrait for consistent file layout - Add JSDoc to writeMatrix documenting round-trip semantics and no-op behavior - Filter undefined values from patch before Object.assign to prevent NaN in matrix - Add comment clarifying firstHitOnly affects both hover and click handlers - Strengthen orientation test with oX/oY/oZ assertions Co-authored-by: Devin T. Currie <DTCurrie@users.noreply.github.com>
Comment on lines
+78
to
+84
| /** | ||
| * Suppresses the default frame-style world/local pose and parent-frame blocks | ||
| * in the details panel. Entities that render their own pose UI via the | ||
| * `details-extensions` portal target (e.g. gizmo plugin entities) opt in by | ||
| * adding this trait. | ||
| */ | ||
| export const CustomDetails = trait(() => true) |
Member
Author
There was a problem hiding this comment.
This can probably be removed when frame editing is made a plugin
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
…stHitOnly effect split - Add early-exit guard in writeMatrix when filtered patch is empty to avoid spurious entity.changed(Matrix) notifications - Add tests for undefined field filtering and empty/all-undefined patch paths - Split firstHitOnly assignment into its own $effect so toggling it doesn't tear down and re-attach event listeners Co-authored-by: Devin T. Currie <DTCurrie@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Micheal Parks (micheal-parks)
approved these changes
Jun 2, 2026
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.
Adds shared ECS traits and helpers (
writeMatrix,CustomDetails), a'gizmo'interaction mode, and afirstHitOnlyraycaster option. Foundation for the Gizmos plugin in #738. No consumers in this PR.Note
Use this PR preview to view all of the changes from this stack: https://viamrobotics.github.io/visualization/pr-preview/pr-739/snapshot
Stack
Frontend
src/lib/ecs/traits.ts: addswriteMatrix(entity, patch)that mutates an entity'sMatrixtrait via the existingcreatePose/matrixToPose/poseToMatrixround-trip and then dirties the trait.src/lib/ecs/traits.ts: adds theCustomDetailsmarker trait so the refactored Details panel can suppress its default frame and pose blocks for entities that render their own. May be removed after frame editing becomes a plugin.src/lib/hooks/useMouseRaycaster.svelte.ts: accepts afirstHitOnlyoption that is forwarded tothree-mesh-bvh, for tools that only care about the closest hit.src/lib/hooks/useSettings.svelte.ts: extends theSettings.interactionModeunion with'gizmo'.Testing
Added
src/lib/ecs/__tests__/writeMatrix.spec.tscovering eachPosefield individually and the no-op path when the entity has noMatrixtrait. Ranpnpm checkandpnpm test.