This repository has been archived on 2026-10-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
HiNC-2025-win-desktop-Deploy/App/wwwroot/HiAPI-docsite/anatomy/widget/renderingcanvas-tool-bar.html
T
2026-09-12 18:16:27 +08:00

207 lines
15 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>RenderingCanvas Tool Bar | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="RenderingCanvas Tool Bar | 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 &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<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-RenderingCanvasToolBar">
<h1 id="renderingcanvas-tool-bar">RenderingCanvas Tool Bar</h1>
<p>The RenderingCanvas Tool Bar is the camera-preset menu that every 3D canvas in the app carries. It holds no engine of its own: it takes a <code>canvas</code> prop and calls that component's exposed <code>setView(name)</code>, which invokes the <code>SetView</code> hub method, and the hub is what drives the per-connection <a class="xref" href="../../api/Hi.Disp.DispEngine.html">DispEngine</a>.</p>
<h2 id="view-menu">View Menu</h2>
<p>The bar is a single <code>View ▾</code> menu. Its seven entries, in shipped order, are Isometric, Front, Back, Right, Left, Top and Bottom. The engine also understands a <code>home</code> view and <code>RenderingCanvas.vue</code> exposes <code>setViewToHomeView</code>, but this menu does not offer it.</p>
<table>
<thead>
<tr>
<th>Entry</th>
<th>API Method</th>
</tr>
</thead>
<tbody>
<tr>
<td>Isometric</td>
<td><a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SetViewToIsometricView">SetViewToIsometricView()</a></td>
</tr>
<tr>
<td>Front</td>
<td><a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SetViewToFrontView">SetViewToFrontView()</a></td>
</tr>
<tr>
<td>Back</td>
<td><a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SetViewToFrontView">SetViewToFrontView()</a> + <a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TurnBackView">TurnBackView()</a></td>
</tr>
<tr>
<td>Right</td>
<td><a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SetViewToRightView">SetViewToRightView()</a></td>
</tr>
<tr>
<td>Left</td>
<td><a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SetViewToRightView">SetViewToRightView()</a> + <a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TurnBackView">TurnBackView()</a></td>
</tr>
<tr>
<td>Top</td>
<td><a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SetViewToTopView">SetViewToTopView()</a></td>
</tr>
<tr>
<td>Bottom</td>
<td><a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_SetViewToTopView">SetViewToTopView()</a> + <a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TurnBackView">TurnBackView()</a></td>
</tr>
</tbody>
</table>
<h3 id="back-view-implementation">Back View Implementation</h3>
<p>Back / Left / Bottom views are composed by first calling the corresponding forward-view method (<code>SetViewToFrontView</code> / <code>SetViewToRightView</code> / <code>SetViewToTopView</code>) and then invoking <a class="xref" href="../../api/Hi.Disp.DispEngine.html#Hi_Disp_DispEngine_TurnBackView">TurnBackView()</a> to flip the camera about the view plane, composed in the hub's <code>SetView</code> switch.</p>
<h3 id="canvas-binding">Canvas Binding</h3>
<p>The tool bar declares exactly one prop, a nullable <code>canvas</code>, typed structurally as an object exposing <code>setView(v: string): Promise&lt;void&gt;</code> rather than as the <code>RenderingCanvas</code> component type. Every entry calls it optionally, so a tool bar with no canvas bound still opens and each entry is a no-op. The preset names travel to the hub untranslated; only the row labels are localized, from the <code>widgets.canvas.*</code> keys.</p>
<h2 id="scene-menu">Scene Menu</h2>
<p>Pages that sit next to a <code>RenderingCanvas</code> surface a per-page <code>Scene ▾</code> menu button — the <code>DisplayOptionsMenu</code> component, labelled from <code>widgets.canvas.scene</code> because no caller overrides the label. It chooses what the 3D scene draws (solids, coordinates, display aids), as distinct from the camera-oriented <code>View ▾</code> menu beside it. The layout (header + checkboxes + radio rows) is shared across four callers — the Execution page's extended tool bar, the General Setup equipment panel, the Tool House setup panel and the STL preview pane — so it is implemented once as a generic, schema-driven component.</p>
<h3 id="schema">Schema</h3>
<p>Each dropdown consumes a <code>DisplayGroup[]</code> array. A group has an optional header and a flat list of items:</p>
<ul>
<li><code>{ kind: 'check', label, modelValue, disable?, onUpdate }</code> — a checkbox row.</li>
<li><code>{ kind: 'radio', label, groupValue, value, disable?, onUpdate }</code> — a radio row; rows sharing a <code>groupValue</code> behave as one group, each row bound to its own <code>value</code>.</li>
</ul>
<p>The component is generic over the radio <code>value</code> type, so <code>RenderingMode</code> / <code>HolderRenderingMode</code> / etc. stay fully typed at the call site. Besides <code>groups</code> it accepts <code>label</code>, <code>disable</code>, <code>title</code>, <code>minWidthPx</code> (default 220), <code>size</code> (default <code>sm</code>), <code>contentClass</code> and <code>compact</code>. <code>compact</code> is a tighter-than-dense row mode, used by the General Setup and Tool House panels for their long option lists; the General Setup, Tool House and Execution callers pass <code>content-class=&quot;bg-white&quot;</code> to opt out of Quasar's transparent menu.</p>
<h3 id="hinc-2025-webservice-quasar-cli-spa">HiNC-2025-webservice (Quasar CLI SPA)</h3>
<ul>
<li><code>wwwroot-src/src/components/widgets/DisplayOptionsMenu.vue</code> — the shared <code>&lt;q-btn-dropdown&gt;</code> + <code>&lt;q-list&gt;</code> implementation behind all four of the app's Scene menus.</li>
<li>Callers (each reads a <code>DisplayGroup[]</code> computed from its page-local state and forwards <code>onUpdate</code> to its existing handlers):
<ul>
<li><code>wwwroot-src/src/components/execution/ExecutionExtendedToolBar.vue</code></li>
<li><code>wwwroot-src/src/components/mech/EquipmentSetupPanel.vue</code></li>
<li><code>wwwroot-src/src/components/toolhouse/ToolHouseSetupPanel.vue</code></li>
<li><code>wwwroot-src/src/components/StlPreviewPane.vue</code></li>
</ul>
</li>
<li>Backends — one per caller, each a different surface: <code>ExecutionExtendedToolBar.vue</code> reaches <code>/api/rendering-flags</code> (<code>Common/RenderingFlagsController.cs</code>), which flips bits in <code>ExecutionDisplayee.RenderingFlagBitArray</code>; <code>EquipmentSetupPanel.vue</code> reaches <code>/api/mech/equipment-setup-display/*</code> (<code>Mech/EquipmentSetupDisplayController.cs</code>); <code>ToolHouseSetupPanel.vue</code> reaches <code>/api/mech/tool-house-display/*</code> (<code>Mech/ToolHouseDisplayController.cs</code>); <code>StlPreviewPane.vue</code> reaches <code>/api/stl-preview/set-coordinate/*</code> (<code>Disp/StlPreviewController.cs</code>). Those last three route each POST by the caller's <code>renderingConnectionId</code>, so the toggle lands on that canvas's own engine; the rendering-flags surface carries no connection id and acts on the project-wide <code>ExecutionDisplayee</code> instead. <code>DisplayOptionsMenu.vue</code> is UI-only; it does no REST work itself — the caller owns the <code>onUpdate</code> handlers, so optimistic update and error reversion stay page-local.</li>
</ul>
<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>
<p>HiNC-2025-webservice (Quasar CLI SPA):</p>
<ul>
<li><code>wwwroot-src/src/components/RenderingCanvasToolBar.vue</code> — the <code>View ▾</code> menu. Seven callers embed it, one per canvas: <code>wwwroot-src/src/pages/ExecutionPage.vue</code> (teleported into the canvas panel's header, beside <code>ExecutionExtendedToolBar</code>), <code>wwwroot-src/src/pages/MachineToolPage.vue</code>, <code>wwwroot-src/src/pages/MechBuilderPage.vue</code>, <code>wwwroot-src/src/components/mech/EquipmentSetupPanel.vue</code> (the General Setup canvas column, mounted by <code>wwwroot-src/src/pages/GeneralSetupPage.vue</code>), <code>wwwroot-src/src/components/toolhouse/ToolHouseSetupPanel.vue</code> (mounted by <code>wwwroot-src/src/pages/ToolHousePage.vue</code>), <code>wwwroot-src/src/components/StlPreviewPane.vue</code> (the File Explorer preview pane, mounted by <code>wwwroot-src/src/components/FileExplorer.vue</code>) and <code>wwwroot-src/src/components/execution/StepVolumePanel.vue</code> (the CWE footprint canvas, teleported into its host expansion's header). Four of those sit beside a <code>Scene ▾</code> menu — the Execution, General Setup, Tool House and STL preview canvases; the Machine Tool, Mechanism Builder and CWE canvases carry the <code>View ▾</code> menu alone.</li>
<li><code>wwwroot-src/src/components/widgets/DisplayOptionsMenu.vue</code> — schema-driven dropdown described above.</li>
<li><code>wwwroot-src/src/components/RenderingCanvas.vue</code> — SignalR-hosted WebSocket canvas whose exposed <code>setView</code> / <code>setViewTo*View</code> methods the tool bar calls (see <a class="xref" href="../conventions/rendering-canvas-web-service.html">Rendering Canvas on Web Service</a>).</li>
<li><code>wwwroot-src/src/i18n/en/widgets.ts</code> — the <code>widgets.canvas.*</code> keys: <code>view</code>, the seven preset labels, and <code>scene</code>.</li>
<li>Backends:
<ul>
<li><code>Disp/RenderingHub.cs</code> — the <code>SetView(string)</code> hub method that maps each preset name onto engine calls.</li>
<li><code>Disp/RenderingService.cs</code> — <code>GetOrCreateEngine(connectionId)</code>, the per-connection <code>DispEngine</code> store the hub resolves against.</li>
<li><code>Common/RenderingFlagsController.cs</code> — the <code>/api/rendering-flags</code> surface (<code>GET</code>, <code>POST update</code>, <code>POST batch</code>) behind the Execution page's Scene menu, wrapped by <code>wwwroot-src/src/api/renderingFlags.ts</code>. It reads and writes <code>ExecutionDisplayee.RenderingFlagBitArray</code> through <code>ProjectDisplayeeService</code>.</li>
<li><code>wwwroot-src/src/api/equipmentSetup.ts</code>, <code>wwwroot-src/src/api/toolHouse.ts</code> and <code>wwwroot-src/src/api/stlPreview.ts</code> — the typed wrappers the other three Scene menus post through.</li>
</ul>
</li>
</ul>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../execution/index.html">Execution Page</a> — the page whose canvas header adopts this tool bar</li>
<li><a class="xref" href="../execution/execution-extended-renderingcanvas-tool-bar.html">Execution Extended RenderingCanvas Tool Bar</a> — the run-specific controls that sit beside it</li>
<li><a class="xref" href="../conventions/rendering-canvas-web-service.html">Rendering Canvas on Web Service Application</a> — the SignalR transport whose hub actually moves the camera this menu asks for</li>
<li><a class="xref" href="../util/stl-preview-pane.html">STL Preview Pane</a> — the one caller whose canvas is a single file rather than a project scene</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>