Skip to content

NgtsGizmoHelper

NgtsGizmoHelper displays an orientation gizmo helper in a corner of the viewport. It renders in a separate portal with its own orthographic camera and allows users to click on axes to animate the camera to predefined views.

Usage

import { NgtsGizmoHelper, NgtsGizmoViewcube, NgtsGizmoViewport } from 'angular-three-soba/gizmos';
<ngts-gizmo-helper [options]="{ alignment: 'bottom-right', margin: [80, 80] }">
<ng-template gizmoHelperContent>
<ngts-gizmo-viewport />
</ng-template>
</ngts-gizmo-helper>

NgtsGizmoViewcube

A 3D cube-style orientation gizmo with labeled faces (Front, Back, Left, Right, Top, Bottom). Clickable faces, edges, and corners allow users to orient the camera to standard or diagonal views. Must be used inside NgtsGizmoHelper.

Options

PropertyTypeDefaultDescription
fontstring'20px Inter var, Arial, sans-serif'CSS font specification for face labels
opacitynumber1Opacity of the cube faces
colorstring'#f0f0f0'Background color of the cube faces
hoverColorstring'#999'Color when a face is hovered
textColorstring'black'Color of the face label text
strokeColorstring'black'Color of the face border stroke
facesstring[]['Right', 'Left', 'Top', 'Bottom', 'Front', 'Back']Labels for each face

Outputs

OutputDescription
clickEmits when a face/edge/corner is clicked
<ngts-gizmo-helper>
<ng-template gizmoHelperContent>
<ngts-gizmo-viewcube [options]="{ color: '#fff', hoverColor: '#ccc' }" />
</ng-template>
</ngts-gizmo-helper>

NgtsGizmoViewport

A viewport-style gizmo with colored axes (X, Y, Z) and interactive heads. Clicking on axis heads animates the camera to the corresponding view direction. Must be used inside NgtsGizmoHelper.

Options

PropertyTypeDefaultDescription
axisColors[string, string, string]['#ff2060', '#20df80', '#2080ff']Colors for the X, Y, and Z axes
axisScale[number, number, number]undefinedScale of the axis lines [x, y, z]
labels[string, string, string]['X', 'Y', 'Z']Labels for the X, Y, and Z axis heads
axisHeadScalenumber1Scale factor for the axis head sprites
labelColorstring'#000'Color of the axis labels
hideNegativeAxesbooleanfalseWhether to hide the negative axis heads
hideAxisHeadsbooleanfalseWhether to hide all axis heads
disabledbooleanfalseWhether the gizmo is non-interactive
fontstring'18px Inter var, Arial, sans-serif'CSS font specification for axis labels

Outputs

OutputDescription
clickEmits when an axis is clicked
<ngts-gizmo-helper>
<ng-template gizmoHelperContent>
<ngts-gizmo-viewport [options]="{ axisColors: ['red', 'green', 'blue'] }" />
</ng-template>
</ngts-gizmo-helper>

Outputs

name type description
update void Emits when the camera animation updates.

Options

Properties

name type description
alignment 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' Position of the gizmo in the viewport. Default: 'bottom-right'
margin [number, number] Margin from the edge of the viewport in pixels [x, y]. Default: [80, 80]
renderPriority number Render priority for the gizmo portal. Default: 1
autoClear boolean Whether to auto-clear the renderer before rendering. Default: undefined