app-16292: small component tweaks to support per-entity pose mutators#737
app-16292: small component tweaks to support per-entity pose mutators#737DTCurrie wants to merge 74 commits into
Conversation
🦋 Changeset detectedLatest commit: f376b4d 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 |
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.
The Details overlay component had grown to handle four entirely different entity shapes (color, geometry, line, matrix) inline. Split each into its own component under details/ so callers and reviewers can reason about one entity type at a time. * ColorDetails.svelte, GeometryDetails.svelte, MatrixDetails.svelte and LineDetails/LineDetails.svelte are now individual focused components. * linePositions.ts extracts the line-position derivation with its own spec. * MatrixDetails uses writeMatrix() added in the prior PR. * vitest-setup-client.ts stubs @threlte/extras Portal / PortalTarget / HTML so the refactored panel can render in unit tests. Behavior should be unchanged; existing Details.svelte.spec.ts continues to pass with the new mocks.
a9faa2f to
bf49747
Compare
Forward-looking changes to keep the next PR (Gizmos plugin) small.
* Entities/Line.svelte, Entities/Mesh.svelte: default opacity 1
instead of 0.7. The 0.7 default predated transparent materials
being opt-in; entities that want transparency now set
`opacity.current` explicitly.
* Entities/LineDots.svelte: track the IDs returned by `addInstance`
on each effect run rather than assuming sequential 0..N-1. Fixes
"Invalid instanceId" when positions change.
* Scene.svelte: enable BVH raycasting when `interactionMode` is
'gizmo', matching the existing 'measure' / 'select' branches.
* SelectedTransformControls.svelte: read `ref.position` /
`ref.quaternion` directly instead of `getWorldPosition` /
`getWorldQuaternion`. Frame-style renderers with
`matrixAutoUpdate = false` had stale world matrices, so the gizmo
visuals moved but the entity Matrix never updated.
* Popover.svelte: extend the trigger / children snippets with
`{ isOpen }` and `{ close }` props so consumers can react to open
state and close programmatically.
* dashboard/Button.svelte: add the `shapes` icon (lucide) and a
`disableTooltip` prop so tools with persistent active state can
suppress the noisy hover tooltip.
cddf5ac to
030b969
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.
- 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>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
- SelectedTransformControls: expand onChange comment to document the
flat-scene-hierarchy contract (non-FramesAPI entities must mount under
the scene root for local ≈ world; points to stageFrameTransform as the
parent-inverse reference if that ever changes)
- Button.svelte.spec.ts: add test verifying aria/role contract is
preserved when disableTooltip=true and active=true
Popover children type: Snippet<[]> (implicit children) is assignable to
Snippet<[{ close: () => void }]> under TypeScript callback-parameter
compatibility — pnpm check is clean, no change needed.
Co-authored-by: Devin T. Currie <DTCurrie@users.noreply.github.com>
- linePositions.ts: add bounds check to writeLinePosition; return copy unchanged on out-of-bounds index - Details.svelte: await navigator.clipboard.writeText() and wrap in try/catch to handle permission denial - MatrixDetails.svelte: add comments explaining useQuery vs configFrames and unconditional rendering - linePositions.spec.ts: add edge cases for out-of-bounds write and single-point removal guard - Add component tests for ColorDetails, GeometryDetails, MatrixDetails, and LineDetails Co-authored-by: Devin T. Currie <DTCurrie@users.noreply.github.com>
…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>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
- Details.svelte handleParentChange: add invalidate() after setParent() so reparenting non-frame entities triggers a Three.js re-render - ColorDetails, GeometryDetails, LineDetails: add useThrelte() and call invalidate() after every ECS trait mutation that affects rendering - Details.svelte: revert panel width w-80 → w-70 (accidental experiment change) - LineDetails.svelte.spec.ts: fix pre-existing prettier formatting Co-authored-by: Devin T. Currie <DTCurrie@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
…otion-tools into app-16292/2-details-refactor
…otion-tools into app-16292/3-component-tweaks
c73bc1c to
70a5b6f
Compare
|
@claude final review |
|
Claude finished @DTCurrie's task in 2m 45s —— View job Final Review
Overall: this is ready to merge. All five logic changes are correct, the comments are accurate and appropriately detailed for non-obvious invariants, and the tests adequately cover the new Per-file notes
Minor nit (non-blocking)In const close = $derived(() => api.setOpen(false))In practice this doesn't matter since the close callback only reads |
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
- vitest-setup-client.ts: `invalidate` was nested inside `scene` in the
useThrelte mock instead of at the top level; `const { invalidate } =
useThrelte()` returned undefined in all tests.
- linePositions.ts: `removeLinePosition` had a duplicate
`if (source.length <= 6) return source` guard (dead code after the
bounds-check fix in a prior commit).
Co-authored-by: Devin T. Currie <DTCurrie@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Devin T. Currie <DTCurrie@users.noreply.github.com>
…otion-tools into app-16292/3-component-tweaks
…otion-tools into app-16292/3-component-tweaks
…92/3-component-tweaks
ee8ba77 to
fec6d11
Compare
Small entity-rendering, raycasting, and UI primitive changes that unblock the Gizmos plugin in #738.
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/components/Entities/LineDots.svelte: tracks the instance IDs returned byaddInstanceper effect run instead of assuming a sequential 0..N-1 range. FixesInvalid instanceIderrors whenpositionschanges between runs.src/lib/components/Scene.svelte: enables BVH raycasting whensettings.interactionMode === 'gizmo', matching the existing'measure'and'select'branches.src/lib/components/SelectedTransformControls.svelte: readsref.positionandref.quaterniondirectly instead ofgetWorldPosition/getWorldQuaternion. Frame-style renderers setmatrixAutoUpdate = falseand re-compose their local matrix fromworldMatrixon every flush, so the world getters were returning the pre-drag transform and the entityMatrixtrait never updated.src/lib/components/overlay/Popover.svelte: extends thetriggersnippet signature with{ isOpen }and thechildrensnippet with{ close }so consumers can reflect open state in their trigger and dismiss the popover programmatically.src/lib/components/overlay/dashboard/Button.svelte: adds theshapes(lucide) icon and adisableTooltipprop for buttons whose persistent active state already conveys what the tool is.Testing
Ran
pnpm checkandpnpm test. Drag-rotated a frame entity withTransformControlsin the dev app to confirm theSelectedTransformControlschange actually mutates the entityMatrixafter the fix.