Table of Contents

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, exposed over /api/Vec3d by Widget/Vec3dController.cs.

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 updateVec3d from wwwroot-src/src/api/geometry.ts, which posts all three axes together to /api/Vec3d/Update, 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 showing
    • X, Y and Z Input Fields — the per-axis form, three fields side by side
    • Vector Text Field — the single-field form, standing in place of the three axis fields
    • Normalize 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 posts to /api/StaticRotation/NormalizeAxis, while wwwroot-src/src/components/topo/DynamicRotationEditor.vue and wwwroot-src/src/components/topo/DynamicTranslationEditor.vue call normalizeDynamicRotationAxis and normalizeDynamicTranslationAxis from wwwroot-src/src/api/transformer.ts.

Commit and special values

Edits commit on blur or Enter, never per keystroke, and a value is emitted only when it differs from the current model. 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 helpers
  • wwwroot-src/src/api/geometry.ts — the /api/Vec3d client the transformer editors use, and the Vec3dDto shape
  • Widget/Vec3dController.cs — the REST surface behind /api/Vec3d: New, NewWithValue, Get, Update, UpdateAt, ParseAndUpdate and Normalize. The SPA reaches Update.
  • wwwroot-src/src/components/topo/StaticRotationEditor.vue — the full binding contract in one place: v-model, @update:model-value, the normalize opt-in and its @normalize handler
  • wwwroot-src/src/components/topo/StaticTranslationEditor.vue — one instance, no normalize button
  • wwwroot-src/src/components/topo/DynamicRotationEditor.vue — axis with normalize, plus pivot
  • wwwroot-src/src/components/topo/DynamicTranslationEditor.vue — axis with normalize
  • wwwroot-src/src/components/geom/Box3dEditor.vue — four instances (min, max, dimension, center) whose readonly state follows the current edit mode, persisted through the Box3d endpoint
  • wwwroot-src/src/components/geom/StlFileEditor.vue — four display-only instances for the STL bounding-box pad
  • wwwroot-src/src/i18n/en/widgets.ts — the tooltip strings under widgets.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