APP-16361 measurement and polyline improvements#743
Open
Devin T. Currie (DTCurrie) wants to merge 6 commits into
Open
APP-16361 measurement and polyline improvements#743Devin T. Currie (DTCurrie) wants to merge 6 commits into
Devin T. Currie (DTCurrie) wants to merge 6 commits into
Conversation
🦋 Changeset detectedLatest commit: 44ddc6a 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 |
Contributor
|
…tools into app-16361-measurement-and-polyline-improvements
…polyline-improvements
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.
Improves the measurement workflow with three additions: persistent measurements that can be hidden and deleted, draggable polyline vertices for measuring in empty space, and fixed-increment snapping in both measurement tools.
Frontend
src/lib/quantize.ts(new): sharedquantize(point, step)that rounds a Vector3 to a uniform grid. Lifted to the lib root so both<MeasureTool />and the Gizmos plugin can use it without depending on each other.MeasureTool.svelte: whensettings.snappingis on, quantizes the hit point to a 0.1 m grid before applying the existing per-axis lock, so locked axes still pin to the first point's exact value while unlocked axes snap to the grid.LineTool.svelte(Gizmos): extendsgetCursorPositionto grid-quantize the hit when no vertex-to-vertex snap matches.GRID_SNAP_STEP = 0.1matches thetranslationSnapused bySelectedTransformControls.useSelectedPolylineVertex.svelte.ts(new, Gizmos): Svelte context holding{ entity, index } | undefinedfor the currently picked polyline vertex. Provided at the root ofGizmos.svelte.PolylineVertexHandles.svelte(new, Gizmos): pickable sphere at each vertex of the selected polyline gizmo. Click sets the vertex context, withevent.stopPropagation()so the selection plugin does not fire alongside.PolylineVertexTransformControls.svelte(new, Gizmos): proxyObject3Dmounted at the picked vertex's world position with aTransformControlsbound to it. OnobjectChange, transforms the proxy's world position back to entity-local via inverse(WorldMatrix) and writes intoLinePositions. The proxy-reset effect tracks only the vertex selection (withuntrackaroundLinePositions) so it does not fight TransformControls during a drag.PolylineVertexEditor.svelte(new, Gizmos): coordinator that mounts handles and transform controls when the selected entity hasGizmo + LinePositions, is notPendingGizmo, and is not inherited-invisible. Auto-clears the vertex context when the selected entity changes or becomes non-editable.PolylineMeasureDetails.svelte(new, Gizmos): details-panel List (Off / Per segment / Total length) that adds, sets, or removes thePolylineMeasuretrait on the entity, so users can switch measurement mode after placement without redoing the polyline.Gizmos.svelte: callsprovideSelectedPolylineVertex(), mounts<PolylineVertexEditor />below<GizmoEntities />.GizmoDetails.svelte: gatesLineDetails,GeometryDetails, etc. by entity shape; mounts<PolylineMeasureDetails />alongside<LineDetails />for polyline gizmos.docs/plugins/gizmos.mdx: Polyline section documents placement snap, a new "Editing vertices after placement" subsection covering the handle drag workflow, and a "Persistent measurements" subsection that cross-links to<MeasureTool />for the ephemeral case.docs/plugins/measure-tool.mdx: new "Increment snap" section, plus a StarlightAsidecross-linking to the Gizmos polyline gizmo for persistent multi-segment measurement.Why?
Why keep
<MeasureTool />and<Gizmos />as separate plugins instead of folding measurement into the polyline gizmo?The two workflows are genuinely different.
<MeasureTool />is a one-click ruler for "what is the distance between these two surface points right now." The polyline gizmo withlineMeasureis for "leave this measurement in the scene for reference." Folding the first into the second would force consumers who just want a quick distance check to pull in the entire Gizmos plugin (popover, seven gizmo types, traits surface) and would replace a one-click UX with a popover, type-pick, mode-set sequence. Keeping them separate also lets the Gizmos plugin evolve its own details and pre-placement options independently of the lightweight measurement tool.Why
TransformControlson a proxy for empty-space measurement instead of a construction-plane fallback when the cursor misses geometry?A construction-plane fallback (project onto a horizontal plane through the last point, say) requires us to guess which plane the user meant, and a wrong guess produces a wildly off measurement. Direct manipulation is unambiguous: place the initial vertex on any nearby surface, then drag any vertex into position via the transform gizmo. The gizmo's axis arrows already provide per-axis constraint and
translationSnapalready provides grid snap, so no new UI is needed for either.Testing
Tests passing and manually tested.