Skip to content

Right-click the axis gizmo to show or hide the coordinate frame - #151

Open
Myuavbug66 wants to merge 1 commit into
CNCKitchen:mainfrom
Myuavbug66:contribution/gizmo-Scan-Datum-Planes-menu
Open

Myuavbug66 wants to merge 1 commit into
CNCKitchen:mainfrom
Myuavbug66:contribution/gizmo-Scan-Datum-Planes-menu

Conversation

@Myuavbug66

Copy link
Copy Markdown
Contributor

Right-click the axis gizmo to show or hide the coordinate frame

What it does: right-click the X Y Z gizmo in the corner of a 3D viewport and
tick what you want to see of the coordinate frame at zero:

  • Axes at zero: the X, Y and Z arrows out of the origin.
  • XYZ planes at zero: the labelled X = 0, Y = 0 and Z = 0 planes.

The XYZ datum menu opened over the axis gizmo, with Axes at zero and XYZ planes at zero

How to use it

  1. Load a scan and right-click the gizmo in the bottom-right corner.
  2. Tick Axes at zero and/or XYZ planes at zero. Untick to hide them again.
Planes and axes on Axes only Off (as before)
Scan with the three labelled planes and the axis arrows The same scan with only the axis arrows The same scan with the frame off

Good to know

  • The planes and axes stand at the origin of the scan's coordinates, which is
    the part's zero once it has been aligned.
  • The switches last for the session; they are not saved in the project.
  • The gizmo itself always stays: with it hidden, nothing on screen would say
    where to right-click to bring it back.
  • The Align part editor still shows the whole frame while it is open, whatever
    the switches say, and puts them back as they were when it closes.
  • An agent has the same two switches as the axes and planes keys of
    view.set and view.render.

Why

The coordinate frame (the "datum stage") was visible only while the Align part
editor was open, so there was no way to see where zero is on a part during
normal work, and no way to switch it on or off.

How it works

  • src/viewer/axisGizmo.ts: contains(x, y) tells whether a point is in the
    gizmo's corner; hitTest uses it.
  • src/viewer/datumStage.ts: the stage is split into a planes group and an
    axes group with setParts(planes, axes). Labels are switched explicitly
    because the CSS2D renderer ignores a parent's visibility.
  • src/viewer/SceneManager.ts: stageAligning (the Align editor is open) and
    stageShown (the person's switches). syncStage() makes the stage match both
    and is repeated wherever the model size changes. New planesShown,
    setPlanesShown, axesShown, setAxesShown and overGizmo. Fit to view
    counts the stage only while the Align editor is open, so the switches never
    move the camera.
  • src/ui/Viewer.tsx, src/ui/ContextMenu.tsx, src/styles.css: the menu on
    the viewport's onContextMenu, opened only over the gizmo; MenuItem gains
    an optional checked (role menuitemcheckbox, aria-checked, a check mark).
  • src/commands/core/view.ts, mcp/src/commands.json: the axes and planes
    show keys (regenerated with UPDATE_MCP_COMMANDS=1).
  • Docs and tests: a paragraph with the screenshots in docs/manual.md, an
    ## Unreleased entry in CHANGELOG.md, and a test in
    tests/commandsView.test.ts.

Validation

  • node scripts/check-plugin-boundary.mjs and node scripts/check-units.mjs: pass.
  • npm run build (tsc and vite): passes.
  • npm test: passes. On a loaded Windows machine commandsSessionHolds and
    ossCredits timed out in one run; both pass when run alone.
  • npm --prefix mcp test: 149 pass.
  • Headless Chrome against an isolated dev server with a small test scan: no menu
    away from the gizmo; each switch works; the Align part editor shows the whole
    frame and removes it on close. npm run e2e:ci was not run.

Limitations

  • Session-only: not stored in .scanruler projects.
  • Right-click only; no toolbar button or keyboard shortcut.

… frame

Right-clicking the corner gizmo opens an XYZ datum menu with checkable Axes at zero and XYZ planes at zero. The gizmo itself always stays. The Align part editor still shows the whole frame while open. Agents get the same switches as the axes and planes keys of view.set and view.render. Adds manual section with screenshots and a changelog entry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant