/** * Draws a box with face and corner handles that resize it, keeping the opposite face or corner in * place, or the center with {@link BoxGizmo#centered}. * * ```javascript * const gizmo = new BoxGizmo(cameraComponent, layer); * gizmo.halfExtents.set(1, 0.5, 1); * gizmo.on('handle:move', () => { * collision.halfExtents = gizmo.halfExtents; * entity.setPosition(gizmo.position); * }); * ``` * * Relevant Engine API examples: * * - [Shape Gizmos](https://playcanvas.github.io/#/gizmos/shape) * * @category Gizmo */ export class BoxGizmo extends ShapeGizmo { /** * Creates a new BoxGizmo object. * * @param {CameraComponent} camera - The camera component. * @param {Layer} layer - The render layer. * @example * const gizmo = new BoxGizmo(camera, layer); */ constructor(camera: CameraComponent, layer: Layer); /** * The half extents of the box along its axes. * * @type {Vec3} */ halfExtents: Vec3; /** * Whether to show handles at the center of each face. Defaults to true. * * @type {boolean} */ faceHandles: boolean; /** * Whether to show handles at the corners. Defaults to true. * * @type {boolean} */ cornerHandles: boolean; /** * Whether a resize keeps the center in place. Defaults to false. * * @type {boolean} */ centered: boolean; /** * Whether corner handles scale evenly. Defaults to false. * * @type {boolean} */ uniform: boolean; /** * The position at the start of a resize. * * @private */ private _startPosition; /** * The half extents at the start of a resize. * * @private */ private _startHalfExtents; } import { ShapeGizmo } from './shape-gizmo.js'; import { Vec3 } from '../../../core/math/vec3.js'; import type { CameraComponent } from '../../../framework/components/camera/component.js'; import type { Layer } from '../../../scene/layer.js';