Archived
189 lines
11 KiB
HTML
189 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Vec3dControl Component | HiAPI-C# 2025 </title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="title" content="Vec3dControl Component | HiAPI-C# 2025 ">
|
|
|
|
|
|
<link rel="icon" href="../../img/HiAPI.favicon.ico">
|
|
<link rel="stylesheet" href="../../public/docfx.min.css">
|
|
<link rel="stylesheet" href="../../public/main.css">
|
|
<meta name="docfx:navrel" content="../../toc.html">
|
|
<meta name="docfx:tocrel" content="toc.html">
|
|
|
|
<meta name="docfx:rel" content="../../">
|
|
|
|
|
|
|
|
<meta name="loc:inThisArticle" content="In this article">
|
|
<meta name="loc:searchResultsCount" content="{count} results for "{query}"">
|
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
|
<meta name="loc:tocFilter" content="Filter by title">
|
|
<meta name="loc:nextArticle" content="Next">
|
|
<meta name="loc:prevArticle" content="Previous">
|
|
<meta name="loc:themeLight" content="Light">
|
|
<meta name="loc:themeDark" content="Dark">
|
|
<meta name="loc:themeAuto" content="Auto">
|
|
<meta name="loc:changeTheme" content="Change theme">
|
|
<meta name="loc:copy" content="Copy">
|
|
<meta name="loc:downloadPdf" content="Download PDF">
|
|
|
|
<script type="module" src="./../../public/docfx.min.js"></script>
|
|
|
|
<script>
|
|
const theme = localStorage.getItem('theme') || 'auto'
|
|
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
|
|
<header class="bg-body border-bottom">
|
|
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
|
<div class="container-xxl flex-nowrap">
|
|
<a class="navbar-brand" href="../../index.html">
|
|
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
|
|
|
|
</a>
|
|
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
|
|
<i class="bi bi-three-dots"></i>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navpanel">
|
|
<div id="navbar">
|
|
<form class="search" role="search" id="search">
|
|
<i class="bi bi-search"></i>
|
|
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<main class="container-xxl">
|
|
<div class="toc-offcanvas">
|
|
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
|
|
<div class="offcanvas-header">
|
|
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
|
|
</div>
|
|
<div class="offcanvas-body">
|
|
<nav class="toc" id="toc"></nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content">
|
|
<div class="actionbar">
|
|
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
|
|
<i class="bi bi-list"></i>
|
|
</button>
|
|
|
|
<nav id="breadcrumb"></nav>
|
|
</div>
|
|
|
|
<article data-uid="Anatomy-Vec3dControl">
|
|
<h1 id="vec3dcontrol-component">Vec3dControl Component</h1>
|
|
|
|
<p>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.</p>
|
|
<h2 id="key-model">Key Model</h2>
|
|
<p>The persisted model is <a class="xref" href="../../api/Hi.Geom.Vec3d.html">Vec3d</a>, exposed over <code>/api/Vec3d</code> by <code>Widget/Vec3dController.cs</code>.</p>
|
|
<p>The widget's own model is the plain <code>{ x, y, z }</code> number triple exported as
|
|
<code>interface Vec3</code> from <code>wwwroot-src/src/components/widgets/Vec3Input.vue</code>. The widget carries no key
|
|
and calls no endpoint: the host binds it with <code>v-model</code> plus an <code>@update:model-value</code> handler, and
|
|
that handler does the persisting, each host on its own terms. The four transformer editors call
|
|
<code>updateVec3d</code> from <code>wwwroot-src/src/api/geometry.ts</code>, which posts all three axes together to
|
|
<code>/api/Vec3d/Update</code>, while <code>wwwroot-src/src/components/geom/Box3dEditor.vue</code> folds the edited triple
|
|
back into a min and max pair and posts that to <code>/api/Box3d/Update</code>.</p>
|
|
<p>The props are <code>modelValue</code>, <code>disable</code>, <code>readonly</code>, <code>normalize</code>, <code>labels</code> and <code>textMode</code>, and the
|
|
emits are <code>update:modelValue</code> and <code>normalize</code>. <code>labels</code> is a three-tuple defaulting to
|
|
<code>['X', 'Y', 'Z']</code>, and carries units where the host has them, as in <code>['X (mm)', 'Y (mm)', 'Z (mm)']</code>.
|
|
<code>textMode</code> sets the initial mode only and defaults to false.</p>
|
|
<h2 id="layout">Layout</h2>
|
|
<ul>
|
|
<li>Vec3dControl
|
|
<ul>
|
|
<li><code>Mode Toggle Button</code> — always present; switches between the per-axis columns and the
|
|
single-field text form, and is highlighted while the text form is showing</li>
|
|
<li><code>X</code>, <code>Y</code> and <code>Z</code> Input Fields — the per-axis form, three fields side by side</li>
|
|
<li><code>Vector Text Field</code> — the single-field form, standing in place of the three axis fields</li>
|
|
<li><code>Normalize Button</code> — present only when the normalize flag is set, and disabled while the
|
|
control is disabled or readonly</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h2 id="feature">Feature</h2>
|
|
<h3 id="per-axis-form">Per-axis form</h3>
|
|
<p>X, Y and Z in three separate fields, each rendering every finite value at full precision.</p>
|
|
<h3 id="single-field-text-form">Single-field text form</h3>
|
|
<p>The form is <code>(x, y, z)</code>. 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.</p>
|
|
<h3 id="vector-normalization">Vector normalization</h3>
|
|
<p>The normalize button is opt-in and off by default, through the <code>normalize</code> prop.</p>
|
|
<p>The button only raises a <code>normalize</code> event, and the embedding editor performs the
|
|
normalization on its own owning object. <code>wwwroot-src/src/components/topo/StaticRotationEditor.vue</code>
|
|
posts to <code>/api/StaticRotation/NormalizeAxis</code>, while
|
|
<code>wwwroot-src/src/components/topo/DynamicRotationEditor.vue</code> and
|
|
<code>wwwroot-src/src/components/topo/DynamicTranslationEditor.vue</code> call <code>normalizeDynamicRotationAxis</code>
|
|
and <code>normalizeDynamicTranslationAxis</code> from <code>wwwroot-src/src/api/transformer.ts</code>.</p>
|
|
<h3 id="commit-and-special-values">Commit and special values</h3>
|
|
<p>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 <code>NaN</code> and
|
|
the infinities as <code>Infinity</code> and <code>-Infinity</code>, and the parser accepts those spellings
|
|
case-insensitively as well as the <code>∞</code> and <code>-∞</code> glyphs.</p>
|
|
<h2 id="source-code-path">Source Code Path</h2>
|
|
<p>See <a class="xref" href="../index.html">HiNC App Anatomy</a> for git repository links.</p>
|
|
<ul>
|
|
<li><code>wwwroot-src/src/components/widgets/Vec3Input.vue</code> — the widget itself: mode toggle, per-axis and
|
|
single-field inputs, normalize button, and the local format and parse helpers</li>
|
|
<li><code>wwwroot-src/src/api/geometry.ts</code> — the <code>/api/Vec3d</code> client the transformer editors use, and the <code>Vec3dDto</code> shape</li>
|
|
<li><code>Widget/Vec3dController.cs</code> — the REST surface behind <code>/api/Vec3d</code>: New, NewWithValue, Get, Update,
|
|
UpdateAt, ParseAndUpdate and Normalize. The SPA reaches Update.</li>
|
|
<li><code>wwwroot-src/src/components/topo/StaticRotationEditor.vue</code> — the full binding contract in one
|
|
place: <code>v-model</code>, <code>@update:model-value</code>, the normalize opt-in and its <code>@normalize</code> handler</li>
|
|
<li><code>wwwroot-src/src/components/topo/StaticTranslationEditor.vue</code> — one instance, no normalize button</li>
|
|
<li><code>wwwroot-src/src/components/topo/DynamicRotationEditor.vue</code> — axis with normalize, plus pivot</li>
|
|
<li><code>wwwroot-src/src/components/topo/DynamicTranslationEditor.vue</code> — axis with normalize</li>
|
|
<li><code>wwwroot-src/src/components/geom/Box3dEditor.vue</code> — four instances (min, max, dimension, center)
|
|
whose <code>readonly</code> state follows the current edit mode, persisted through the Box3d endpoint</li>
|
|
<li><code>wwwroot-src/src/components/geom/StlFileEditor.vue</code> — four display-only instances for the STL
|
|
bounding-box pad</li>
|
|
<li><code>wwwroot-src/src/i18n/en/widgets.ts</code> — the tooltip strings under <code>widgets.vecInput</code></li>
|
|
</ul>
|
|
<h2 id="see-also">See Also</h2>
|
|
<ul>
|
|
<li><a class="xref" href="mat4d-control.html">Mat4dControl Component</a> — the sibling numeric-geometry editor, and the one a reader usually wants next</li>
|
|
<li><a class="xref" href="../conventions/numeric-io-utilities.html">Numeric Input/Output</a> — why NaN and the infinities are text on the wire, and how the three inputs differ</li>
|
|
</ul>
|
|
|
|
</article>
|
|
|
|
<div class="contribution d-print-none">
|
|
</div>
|
|
|
|
<div class="next-article d-print-none border-top" id="nextArticle"></div>
|
|
|
|
</div>
|
|
|
|
<div class="affix">
|
|
<nav id="affix"></nav>
|
|
</div>
|
|
</main>
|
|
|
|
<div class="container-xxl search-results" id="search-results"></div>
|
|
|
|
<footer class="border-top text-secondary">
|
|
<div class="container-xxl">
|
|
<div class="flex-fill">
|
|
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|