Vec3dControl Component
Vec3dControl edits and displays a three-component vector. It is an embedded widget with no route and no Control-Tree node of its own, reached only through the editors that host it.
Key Model
The persisted model is vec3d_t, always as a value of the object that owns it — the translation of a static translation, the axis and pivot of a rotation, the two corners of a box — and written through that owner's route. A vector has no key and no route of its own.
The widget's own model is the plain { x, y, z } number triple exported as
interface Vec3 from wwwroot-src/src/components/widgets/Vec3Input.vue. The widget carries no key
and calls no endpoint: the host binds it with v-model plus an @update:model-value handler, and
that handler does the persisting, each host on its own terms. The four transformer editors call the
owner's wrapper from wwwroot-src/src/api/transformer.ts — updateStaticTranslationTrans,
updateStaticRotationAxis and updateStaticRotationPivot, updateDynamicRotationAxis and
updateDynamicRotationPivot, updateDynamicTranslationAxis — each posting the owner's key and all
three axes together to that owner's UpdateTrans, UpdateAxis or UpdatePivot action, while
wwwroot-src/src/components/geom/Box3dEditor.vue folds the edited triple back into a min and max
pair and posts that to /api/Box3d/Update.
The props are modelValue, disable, readonly, normalize, labels and textMode, and the
emits are update:modelValue and normalize. labels is a three-tuple defaulting to
['X', 'Y', 'Z'], and carries units where the host has them, as in ['X (mm)', 'Y (mm)', 'Z (mm)'].
textMode sets the initial mode only and defaults to false.
Layout
- Vec3dControl
Mode Toggle Button— always present; switches between the per-axis columns and the single-field text form, and is highlighted while the text form is showingX,YandZInput Fields — the per-axis form, three fields side by sideVector Text Field— the single-field form, standing in place of the three axis fieldsNormalize Button— present only when the normalize flag is set, and disabled while the control is disabled or readonly
Feature
Per-axis form
X, Y and Z in three separate fields, each rendering every finite value at full precision.
Single-field text form
The form is (x, y, z). Its parser strips surrounding brackets and splits on comma, semicolon
or whitespace, requiring at least three parts, and entering the text form re-syncs the field from
the current value so a stale in-progress edit is discarded.
Vector normalization
The normalize button is opt-in and off by default, through the normalize prop.
The button only raises a normalize event, and the embedding editor performs the
normalization on its own owning object: wwwroot-src/src/components/topo/StaticRotationEditor.vue,
wwwroot-src/src/components/topo/DynamicRotationEditor.vue and
wwwroot-src/src/components/topo/DynamicTranslationEditor.vue call normalizeStaticRotationAxis,
normalizeDynamicRotationAxis and normalizeDynamicTranslationAxis from
wwwroot-src/src/api/transformer.ts, each posting to the owner's NormalizeAxis action.
Commit and special values
Edits commit on blur or Enter, never per keystroke — not on the Enter that confirms an IME
conversion — and a value is emitted only when it differs from the current model. Full-width digits
and signs, the long-vowel mark ー and a minus sign − are read as their ASCII forms, as in
Numeric Input. An empty field parses to 0; any other unparseable text reverts the field to
the last valid value. Formatting and parsing are local to the component: NaN renders as NaN and
the infinities as Infinity and -Infinity, and the parser accepts those spellings
case-insensitively as well as the ∞ and -∞ glyphs.
Source Code Path
See HiNC App Anatomy for git repository links.
wwwroot-src/src/components/widgets/Vec3Input.vue— the widget itself: mode toggle, per-axis and single-field inputs, normalize button, and the local format and parse helperswwwroot-src/src/api/transformer.ts— the per-owner vector wrappers the transformer editors use:updateStaticTranslationTrans,updateStaticRotationAxis,updateStaticRotationPivot,updateDynamicRotationAxis,updateDynamicRotationPivot,updateDynamicTranslationAxisand the threenormalize…Axiscallswwwroot-src/src/api/geometry.ts— theVec3dDtowire shape a vector arrives inMech/Topo/StaticTranslationController.cs,StaticRotationController.cs,DynamicRotationController.csandDynamicTranslationController.cs— the REST surface behind the vector writes:UpdateTrans,UpdateAxis,UpdatePivotandNormalizeAxis, each taking the owner's key and, for the updates, the three axes as query parameterswwwroot-src/src/components/topo/StaticRotationEditor.vue— the full binding contract in one place:v-model,@update:model-value, the normalize opt-in and its@normalizehandlerwwwroot-src/src/components/topo/StaticTranslationEditor.vue— one instance, no normalize buttonwwwroot-src/src/components/topo/DynamicRotationEditor.vue— axis with normalize, plus pivotwwwroot-src/src/components/topo/DynamicTranslationEditor.vue— axis with normalizewwwroot-src/src/components/geom/Box3dEditor.vue— four instances (min, max, dimension, center) whosereadonlystate follows the current edit mode, persisted through the Box3d endpointwwwroot-src/src/components/geom/StlFileEditor.vue— four display-only instances for the STL bounding-box padwwwroot-src/src/i18n/en/widgets.ts— the tooltip strings underwidgets.vecInput
See Also
- Mat4dControl Component — the sibling numeric-geometry editor, and the one a reader usually wants next
- Numeric Input/Output — why NaN and the infinities are text on the wire, and how the three inputs differ