/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { Rectangle, Vector3 } from "@vertexvis/geometry";
import { EventDispatcher } from "@vertexvis/utils";
import regl from "regl";
import shapeBuilder from "regl-shape";
import { axisPositions, rotationAxisPositions, } from "../../lib/transforms/axis-lines";
import { xAxisRotationPositions, yAxisRotationPositions, zAxisRotationPositions, } from "../../lib/transforms/axis-rotation";
import { xAxisArrowPositions, xyAxisTranslationPositions, xzAxisTranslationPositions, yAxisArrowPositions, yzAxisTranslationPositions, zAxisArrowPositions, } from "../../lib/transforms/axis-translation";
import { computeDrawable2dBounds, } from "../../lib/transforms/drawable";
import { testDrawable } from "../../lib/transforms/hits";
import { AxisLine, RotationLine } from "../../lib/transforms/line";
import { TriangleMesh } from "../../lib/transforms/mesh";
import { ReglComponent } from "../../lib/webgl/regl-component";
export class TransformWidget extends ReglComponent {
    constructor(canvasElement, customization = {}, initialDisabledAxes = {}) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
        super(canvasElement);
        this.customization = customization;
        this.disabledAxis = {
            xTranslation: false,
            yTranslation: false,
            zTranslation: false,
            xyTranslation: false,
            xzTranslation: false,
            yzTranslation: false,
            xRotation: false,
            yRotation: false,
            zRotation: false,
        };
        this.axisLines = [];
        this.rotationLines = [];
        this.translationMeshes = [];
        this.rotationMeshes = [];
        this.hoveredChanged = new EventDispatcher();
        this.xArrowFillColor = (_a = customization.colors) === null || _a === void 0 ? void 0 : _a.xArrow;
        this.yArrowFillColor = (_b = customization.colors) === null || _b === void 0 ? void 0 : _b.yArrow;
        this.zArrowFillColor = (_c = customization.colors) === null || _c === void 0 ? void 0 : _c.zArrow;
        this.hoveredArrowFillColor = (_d = customization.colors) === null || _d === void 0 ? void 0 : _d.hovered;
        this.outlineColor = (_e = customization.colors) === null || _e === void 0 ? void 0 : _e.outline;
        this.disabledAxis.xTranslation = (_f = initialDisabledAxes.xTranslation) !== null && _f !== void 0 ? _f : false;
        this.disabledAxis.yTranslation = (_g = initialDisabledAxes.yTranslation) !== null && _g !== void 0 ? _g : false;
        this.disabledAxis.zTranslation = (_h = initialDisabledAxes.zTranslation) !== null && _h !== void 0 ? _h : false;
        this.disabledAxis.xyTranslation =
            (_j = initialDisabledAxes.xyTranslation) !== null && _j !== void 0 ? _j : false;
        this.disabledAxis.xzTranslation =
            (_k = initialDisabledAxes.xzTranslation) !== null && _k !== void 0 ? _k : false;
        this.disabledAxis.yzTranslation =
            (_l = initialDisabledAxes.yzTranslation) !== null && _l !== void 0 ? _l : false;
        this.disabledAxis.xRotation = (_m = initialDisabledAxes.xRotation) !== null && _m !== void 0 ? _m : false;
        this.disabledAxis.yRotation = (_o = initialDisabledAxes.yRotation) !== null && _o !== void 0 ? _o : false;
        this.disabledAxis.zRotation = (_p = initialDisabledAxes.zRotation) !== null && _p !== void 0 ? _p : false;
    }
    dispose() {
        var _a;
        (_a = this.reglFrameDisposable) === null || _a === void 0 ? void 0 : _a.cancel();
    }
    /**
     * @internal - visible for testing
     */
    getDrawableElements() {
        return this.drawableElements;
    }
    getFullBounds() {
        return this.fullBounds;
    }
    boundsContainsPoint(point) {
        return (this.interactiveBounds != null &&
            this.frame != null &&
            Rectangle.containsPoints(this.interactiveBounds, point));
    }
    updateDisabledAxis(axis) {
        this.disabledAxis = {
            ...this.disabledAxis,
            ...axis,
        };
        this.updateDisabledOnDrawables();
    }
    updateCursor(cursor) {
        this.cursor = cursor;
        if (cursor != null && this.frame != null) {
            this.updateHovered();
        }
        else {
            this.clearHovered();
        }
    }
    updateTransform(transform) {
        var _a;
        this.transform = transform;
        if (transform != null && this.frame != null) {
            this.updateAndDraw();
        }
        else {
            this.clear();
            (_a = this.reglFrameDisposable) === null || _a === void 0 ? void 0 : _a.cancel();
            this.reglFrameDisposable = undefined;
        }
    }
    updateColors(colors = {}) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
        this.xArrowFillColor = (_a = colors.xArrow) !== null && _a !== void 0 ? _a : this.xArrowFillColor;
        this.yArrowFillColor = (_b = colors.yArrow) !== null && _b !== void 0 ? _b : this.yArrowFillColor;
        this.zArrowFillColor = (_c = colors.zArrow) !== null && _c !== void 0 ? _c : this.zArrowFillColor;
        this.twoAxesSquareFillColor =
            (_d = colors.twoAxesSquare) !== null && _d !== void 0 ? _d : this.twoAxesSquareFillColor;
        this.hoveredArrowFillColor = (_e = colors.hovered) !== null && _e !== void 0 ? _e : this.hoveredArrowFillColor;
        this.outlineColor = (_f = colors.outline) !== null && _f !== void 0 ? _f : this.outlineColor;
        (_g = this.xArrow) === null || _g === void 0 ? void 0 : _g.updateFillColor(this.getXTranslationColor(), true);
        (_h = this.yArrow) === null || _h === void 0 ? void 0 : _h.updateFillColor(this.getYTranslationColor(), true);
        (_j = this.zArrow) === null || _j === void 0 ? void 0 : _j.updateFillColor(this.getZTranslationColor(), true);
        (_k = this.xRotation) === null || _k === void 0 ? void 0 : _k.updateFillColor(this.getXRotationColor(), true);
        (_l = this.yRotation) === null || _l === void 0 ? void 0 : _l.updateFillColor(this.getYRotationColor(), true);
        (_m = this.zRotation) === null || _m === void 0 ? void 0 : _m.updateFillColor(this.getZRotationColor(), true);
        (_o = this.xyTranslation) === null || _o === void 0 ? void 0 : _o.updateFillColor(this.getTwoAxesTranslationColor(), true);
        (_p = this.xzTranslation) === null || _p === void 0 ? void 0 : _p.updateFillColor(this.getTwoAxesTranslationColor(), true);
        (_q = this.yzTranslation) === null || _q === void 0 ? void 0 : _q.updateFillColor(this.getTwoAxesTranslationColor(), true);
        (_r = this.hoveredElement) === null || _r === void 0 ? void 0 : _r.updateFillColor(this.hoveredArrowFillColor);
    }
    updateScalars(scalars) {
        this.customization = {
            ...this.customization,
            scalars,
        };
        if (this.transform != null && this.frame != null) {
            this.updateElements(this.transform, this.frame);
        }
    }
    onHoveredChanged(listener) {
        return this.hoveredChanged.on(listener);
    }
    updateDisabledOnDrawables() {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
        (_a = this.xRotation) === null || _a === void 0 ? void 0 : _a.setDisabled(this.disabledAxis.xRotation);
        (_b = this.xyRotationLine) === null || _b === void 0 ? void 0 : _b.setDisabled(this.disabledAxis.xRotation);
        (_c = this.xzRotationLine) === null || _c === void 0 ? void 0 : _c.setDisabled(this.disabledAxis.xRotation);
        (_d = this.yRotation) === null || _d === void 0 ? void 0 : _d.setDisabled(this.disabledAxis.yRotation);
        (_e = this.yzRotationLine) === null || _e === void 0 ? void 0 : _e.setDisabled(this.disabledAxis.yRotation);
        (_f = this.yxRotationLine) === null || _f === void 0 ? void 0 : _f.setDisabled(this.disabledAxis.yRotation);
        (_g = this.zRotation) === null || _g === void 0 ? void 0 : _g.setDisabled(this.disabledAxis.zRotation);
        (_h = this.zxRotationLine) === null || _h === void 0 ? void 0 : _h.setDisabled(this.disabledAxis.zRotation);
        (_j = this.zyRotationLine) === null || _j === void 0 ? void 0 : _j.setDisabled(this.disabledAxis.zRotation);
        (_k = this.xArrow) === null || _k === void 0 ? void 0 : _k.setDisabled(this.disabledAxis.xTranslation);
        (_l = this.yArrow) === null || _l === void 0 ? void 0 : _l.setDisabled(this.disabledAxis.yTranslation);
        (_m = this.zArrow) === null || _m === void 0 ? void 0 : _m.setDisabled(this.disabledAxis.zTranslation);
        (_o = this.xyTranslation) === null || _o === void 0 ? void 0 : _o.setDisabled(this.disabledAxis.xyTranslation);
        (_p = this.xzTranslation) === null || _p === void 0 ? void 0 : _p.setDisabled(this.disabledAxis.xzTranslation);
        (_q = this.yzTranslation) === null || _q === void 0 ? void 0 : _q.setDisabled(this.disabledAxis.yzTranslation);
        this.updateColors();
    }
    updateHovered() {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
        const previousHovered = this.hoveredElement;
        const currentFrame = this.frame;
        if (currentFrame != null) {
            this.hoveredElement = [...this.translationMeshes, ...this.rotationMeshes]
                .filter((el) => el.points.valid && !el.isDisabled())
                .find((m) => this.cursor != null
                ? testDrawable(m, currentFrame, this.viewport, this.cursor)
                : false);
            if (this.hoveredElement !== previousHovered) {
                this.hoveredChanged.emit(this.hoveredElement);
                (_a = this.hoveredElement) === null || _a === void 0 ? void 0 : _a.updateFillColor(this.hoveredArrowFillColor);
                this.clearFillColorOfPreviouslyHovered(previousHovered);
                // Set the corresponding arrows to the hover fill color
                // when a 2-axes translation square is hovered over
                if (((_b = this.hoveredElement) === null || _b === void 0 ? void 0 : _b.identifier) === 'xy-translate') {
                    (_c = this.xArrow) === null || _c === void 0 ? void 0 : _c.updateFillColor(this.hoveredArrowFillColor);
                    (_d = this.yArrow) === null || _d === void 0 ? void 0 : _d.updateFillColor(this.hoveredArrowFillColor);
                }
                else if (((_e = this.hoveredElement) === null || _e === void 0 ? void 0 : _e.identifier) === 'xz-translate') {
                    (_f = this.xArrow) === null || _f === void 0 ? void 0 : _f.updateFillColor(this.hoveredArrowFillColor);
                    (_g = this.zArrow) === null || _g === void 0 ? void 0 : _g.updateFillColor(this.hoveredArrowFillColor);
                }
                else if (((_h = this.hoveredElement) === null || _h === void 0 ? void 0 : _h.identifier) === 'yz-translate') {
                    (_j = this.yArrow) === null || _j === void 0 ? void 0 : _j.updateFillColor(this.hoveredArrowFillColor);
                    (_k = this.zArrow) === null || _k === void 0 ? void 0 : _k.updateFillColor(this.hoveredArrowFillColor);
                }
            }
        }
    }
    clearHovered() {
        const previousHovered = this.hoveredElement;
        this.hoveredElement = undefined;
        if (this.hoveredElement !== previousHovered) {
            this.hoveredChanged.emit(this.hoveredElement);
            this.clearFillColorOfPreviouslyHovered(previousHovered);
        }
    }
    clearFillColorOfPreviouslyHovered(previousHovered) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
        previousHovered === null || previousHovered === void 0 ? void 0 : previousHovered.updateFillColor(previousHovered === null || previousHovered === void 0 ? void 0 : previousHovered.initialFillColor);
        // Also clear the hover fill color from the corresponding arrows
        // when a 2-axes translation square is no longer hovered over
        if ((previousHovered === null || previousHovered === void 0 ? void 0 : previousHovered.identifier) === 'xy-translate') {
            (_a = this.xArrow) === null || _a === void 0 ? void 0 : _a.updateFillColor((_b = this.xArrow) === null || _b === void 0 ? void 0 : _b.initialFillColor);
            (_c = this.yArrow) === null || _c === void 0 ? void 0 : _c.updateFillColor((_d = this.yArrow) === null || _d === void 0 ? void 0 : _d.initialFillColor);
        }
        else if ((previousHovered === null || previousHovered === void 0 ? void 0 : previousHovered.identifier) === 'xz-translate') {
            (_e = this.xArrow) === null || _e === void 0 ? void 0 : _e.updateFillColor((_f = this.xArrow) === null || _f === void 0 ? void 0 : _f.initialFillColor);
            (_g = this.zArrow) === null || _g === void 0 ? void 0 : _g.updateFillColor((_h = this.zArrow) === null || _h === void 0 ? void 0 : _h.initialFillColor);
        }
        else if ((previousHovered === null || previousHovered === void 0 ? void 0 : previousHovered.identifier) === 'yz-translate') {
            (_j = this.yArrow) === null || _j === void 0 ? void 0 : _j.updateFillColor((_k = this.yArrow) === null || _k === void 0 ? void 0 : _k.initialFillColor);
            (_l = this.zArrow) === null || _l === void 0 ? void 0 : _l.updateFillColor((_m = this.zArrow) === null || _m === void 0 ? void 0 : _m.initialFillColor);
        }
    }
    hasData() {
        return this.transform != null;
    }
    createOrUpdateElements() {
        if (this.transform != null && this.frame != null) {
            if (this.xArrow == null || this.yArrow == null || this.zArrow == null) {
                this.createElements(this.transform, this.frame);
            }
            else {
                this.updateElements(this.transform, this.frame);
            }
            this.interactiveBounds = computeDrawable2dBounds(this.viewport, ...this.rotationMeshes, ...this.translationMeshes);
            this.fullBounds = computeDrawable2dBounds(this.viewport, ...this.rotationMeshes, ...this.translationMeshes, ...this.axisLines);
        }
    }
    createElements(transform, frame) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
        this.reglCommand = regl({
            canvas: this.canvasElement,
            extensions: 'angle_instanced_arrays',
        });
        const { createShape } = shapeBuilder(this.reglCommand);
        const triangleSize = this.computeTriangleSize(Vector3.fromMatrixPosition(transform), frame);
        this.xArrow = new TriangleMesh(createShape, 'x-translate', xAxisArrowPositions(transform, frame.scene.camera, triangleSize, (_a = this.customization.scalars) === null || _a === void 0 ? void 0 : _a.xTranslation), this.outlineColor, this.getXTranslationColor());
        this.xRotation = new TriangleMesh(createShape, 'x-rotate', xAxisRotationPositions(transform, frame.scene.camera, triangleSize, (_b = this.customization.scalars) === null || _b === void 0 ? void 0 : _b.xRotation, (_c = this.customization.scalars) === null || _c === void 0 ? void 0 : _c.xTranslation), this.outlineColor, this.getXRotationColor());
        this.xAxis = new AxisLine(createShape, 'x-axis', axisPositions(transform, frame.scene.camera, this.xArrow), this.outlineColor, this.getXTranslationColor());
        this.yArrow = new TriangleMesh(createShape, 'y-translate', yAxisArrowPositions(transform, frame.scene.camera, triangleSize, (_d = this.customization.scalars) === null || _d === void 0 ? void 0 : _d.yTranslation), this.outlineColor, this.getYTranslationColor());
        this.yRotation = new TriangleMesh(createShape, 'y-rotate', yAxisRotationPositions(transform, frame.scene.camera, triangleSize, (_e = this.customization.scalars) === null || _e === void 0 ? void 0 : _e.yRotation, (_f = this.customization.scalars) === null || _f === void 0 ? void 0 : _f.yTranslation), this.outlineColor, this.getYRotationColor());
        this.yAxis = new AxisLine(createShape, 'y-axis', axisPositions(transform, frame.scene.camera, this.yArrow), this.outlineColor, this.getYTranslationColor());
        this.zArrow = new TriangleMesh(createShape, 'z-translate', zAxisArrowPositions(transform, frame.scene.camera, triangleSize, (_g = this.customization.scalars) === null || _g === void 0 ? void 0 : _g.zTranslation), this.outlineColor, this.getZTranslationColor());
        this.zAxis = new AxisLine(createShape, 'z-axis', axisPositions(transform, frame.scene.camera, this.zArrow), this.outlineColor, this.getZTranslationColor());
        this.zRotation = new TriangleMesh(createShape, 'z-rotate', zAxisRotationPositions(transform, frame.scene.camera, triangleSize, (_h = this.customization.scalars) === null || _h === void 0 ? void 0 : _h.zRotation, (_j = this.customization.scalars) === null || _j === void 0 ? void 0 : _j.zTranslation), this.outlineColor, this.getZRotationColor());
        this.xyTranslation = new TriangleMesh(createShape, 'xy-translate', xyAxisTranslationPositions(transform, frame.scene.camera, triangleSize, (_k = this.customization.scalars) === null || _k === void 0 ? void 0 : _k.xyTranslation), this.outlineColor, this.getTwoAxesTranslationColor());
        this.xzTranslation = new TriangleMesh(createShape, 'xz-translate', xzAxisTranslationPositions(transform, frame.scene.camera, triangleSize, (_l = this.customization.scalars) === null || _l === void 0 ? void 0 : _l.xzTranslation), this.outlineColor, this.getTwoAxesTranslationColor());
        this.yzTranslation = new TriangleMesh(createShape, 'yz-translate', yzAxisTranslationPositions(transform, frame.scene.camera, triangleSize, (_m = this.customization.scalars) === null || _m === void 0 ? void 0 : _m.yzTranslation), this.outlineColor, this.getTwoAxesTranslationColor());
        this.createRotationLines(createShape, transform, frame);
        this.axisLines = [this.xAxis, this.yAxis, this.zAxis];
        this.translationMeshes = [
            this.xArrow,
            this.yArrow,
            this.zArrow,
            this.xyTranslation,
            this.xzTranslation,
            this.yzTranslation,
        ];
        this.rotationMeshes = [this.xRotation, this.yRotation, this.zRotation];
        this.updateDisabledOnDrawables();
        this.availableElements = [
            ...this.axisLines,
            ...this.rotationLines,
            ...this.translationMeshes,
            ...this.rotationMeshes,
        ];
    }
    getXRotationColor() {
        return this.xArrowFillColor;
    }
    getYRotationColor() {
        return this.yArrowFillColor;
    }
    getZRotationColor() {
        return this.zArrowFillColor;
    }
    getXTranslationColor() {
        return this.xArrowFillColor;
    }
    getYTranslationColor() {
        return this.yArrowFillColor;
    }
    getZTranslationColor() {
        return this.zArrowFillColor;
    }
    getTwoAxesTranslationColor() {
        return this.twoAxesSquareFillColor;
    }
    createRotationLines(createShape, transform, frame) {
        var _a, _b, _c, _d, _e, _f;
        const triangleSize = this.computeTriangleSize(Vector3.fromMatrixPosition(transform), frame);
        const xyRotationLinePoints = rotationAxisPositions(frame.scene.camera, this.xRotation, (_a = this.yArrow) === null || _a === void 0 ? void 0 : _a.points.worldTip, triangleSize);
        const xzRotationLinePoints = rotationAxisPositions(frame.scene.camera, this.xRotation, (_b = this.zArrow) === null || _b === void 0 ? void 0 : _b.points.worldTip, triangleSize);
        const yxRotationLinePoints = rotationAxisPositions(frame.scene.camera, this.yRotation, (_c = this.xArrow) === null || _c === void 0 ? void 0 : _c.points.worldTip, triangleSize);
        const yzRotationLinePoints = rotationAxisPositions(frame.scene.camera, this.yRotation, (_d = this.zArrow) === null || _d === void 0 ? void 0 : _d.points.worldTip, triangleSize);
        const zxRotationLinePoints = rotationAxisPositions(frame.scene.camera, this.zRotation, (_e = this.xArrow) === null || _e === void 0 ? void 0 : _e.points.worldTip, triangleSize);
        const zyRotationLinePoints = rotationAxisPositions(frame.scene.camera, this.zRotation, (_f = this.yArrow) === null || _f === void 0 ? void 0 : _f.points.worldTip, triangleSize);
        if (xyRotationLinePoints != null) {
            this.xyRotationLine = new RotationLine(createShape, 'xy-rotation-line', xyRotationLinePoints, this.outlineColor);
        }
        if (xzRotationLinePoints != null) {
            this.xzRotationLine = new RotationLine(createShape, 'xz-rotation-line', xzRotationLinePoints, this.outlineColor);
        }
        if (yxRotationLinePoints != null) {
            this.yxRotationLine = new RotationLine(createShape, 'yx-rotation-line', yxRotationLinePoints, this.outlineColor);
        }
        if (yzRotationLinePoints != null) {
            this.yzRotationLine = new RotationLine(createShape, 'yz-rotation-line', yzRotationLinePoints, this.outlineColor);
        }
        if (zxRotationLinePoints != null) {
            this.zxRotationLine = new RotationLine(createShape, 'zx-rotation-line', zxRotationLinePoints, this.outlineColor);
        }
        if (zyRotationLinePoints != null) {
            this.zyRotationLine = new RotationLine(createShape, 'zy-rotation-line', zyRotationLinePoints, this.outlineColor);
        }
        this.rotationLines = [
            this.xyRotationLine,
            this.xzRotationLine,
            this.yxRotationLine,
            this.yzRotationLine,
            this.zxRotationLine,
            this.zyRotationLine,
        ].filter((l) => l != null);
    }
    updateElements(transform, frame) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
        const triangleSize = this.computeTriangleSize(Vector3.fromMatrixPosition(transform), frame);
        if (this.xArrow != null) {
            this.xArrow.updatePoints(xAxisArrowPositions(transform, frame.scene.camera, triangleSize, (_a = this.customization.scalars) === null || _a === void 0 ? void 0 : _a.xTranslation));
            (_b = this.xAxis) === null || _b === void 0 ? void 0 : _b.updatePoints(axisPositions(transform, frame.scene.camera, this.xArrow));
        }
        (_c = this.xRotation) === null || _c === void 0 ? void 0 : _c.updatePoints(xAxisRotationPositions(transform, frame.scene.camera, triangleSize, (_d = this.customization.scalars) === null || _d === void 0 ? void 0 : _d.xRotation, (_e = this.customization.scalars) === null || _e === void 0 ? void 0 : _e.xTranslation));
        if (this.yArrow != null) {
            this.yArrow.updatePoints(yAxisArrowPositions(transform, frame.scene.camera, triangleSize, (_f = this.customization.scalars) === null || _f === void 0 ? void 0 : _f.yTranslation));
            (_g = this.yAxis) === null || _g === void 0 ? void 0 : _g.updatePoints(axisPositions(transform, frame.scene.camera, this.yArrow));
        }
        (_h = this.yRotation) === null || _h === void 0 ? void 0 : _h.updatePoints(yAxisRotationPositions(transform, frame.scene.camera, triangleSize, (_j = this.customization.scalars) === null || _j === void 0 ? void 0 : _j.yRotation, (_k = this.customization.scalars) === null || _k === void 0 ? void 0 : _k.yTranslation));
        if (this.zArrow != null) {
            this.zArrow.updatePoints(zAxisArrowPositions(transform, frame.scene.camera, triangleSize, (_l = this.customization.scalars) === null || _l === void 0 ? void 0 : _l.zTranslation));
            (_m = this.zAxis) === null || _m === void 0 ? void 0 : _m.updatePoints(axisPositions(transform, frame.scene.camera, this.zArrow));
        }
        (_o = this.zRotation) === null || _o === void 0 ? void 0 : _o.updatePoints(zAxisRotationPositions(transform, frame.scene.camera, triangleSize, (_p = this.customization.scalars) === null || _p === void 0 ? void 0 : _p.zRotation, (_q = this.customization.scalars) === null || _q === void 0 ? void 0 : _q.zTranslation));
        (_r = this.xyRotationLine) === null || _r === void 0 ? void 0 : _r.updatePoints(rotationAxisPositions(frame.scene.camera, this.xRotation, (_s = this.yArrow) === null || _s === void 0 ? void 0 : _s.points.worldTip, triangleSize));
        (_t = this.xzRotationLine) === null || _t === void 0 ? void 0 : _t.updatePoints(rotationAxisPositions(frame.scene.camera, this.xRotation, (_u = this.zArrow) === null || _u === void 0 ? void 0 : _u.points.worldTip, triangleSize));
        (_v = this.yxRotationLine) === null || _v === void 0 ? void 0 : _v.updatePoints(rotationAxisPositions(frame.scene.camera, this.yRotation, (_w = this.xArrow) === null || _w === void 0 ? void 0 : _w.points.worldTip, triangleSize));
        (_x = this.yzRotationLine) === null || _x === void 0 ? void 0 : _x.updatePoints(rotationAxisPositions(frame.scene.camera, this.yRotation, (_y = this.zArrow) === null || _y === void 0 ? void 0 : _y.points.worldTip, triangleSize));
        (_z = this.zxRotationLine) === null || _z === void 0 ? void 0 : _z.updatePoints(rotationAxisPositions(frame.scene.camera, this.zRotation, (_0 = this.xArrow) === null || _0 === void 0 ? void 0 : _0.points.worldTip, triangleSize));
        (_1 = this.zyRotationLine) === null || _1 === void 0 ? void 0 : _1.updatePoints(rotationAxisPositions(frame.scene.camera, this.zRotation, (_2 = this.yArrow) === null || _2 === void 0 ? void 0 : _2.points.worldTip, triangleSize));
        if (this.xyTranslation != null) {
            this.xyTranslation.updatePoints(xyAxisTranslationPositions(transform, frame.scene.camera, triangleSize, (_3 = this.customization.scalars) === null || _3 === void 0 ? void 0 : _3.xyTranslation));
        }
        if (this.xzTranslation != null) {
            this.xzTranslation.updatePoints(xzAxisTranslationPositions(transform, frame.scene.camera, triangleSize, (_4 = this.customization.scalars) === null || _4 === void 0 ? void 0 : _4.xzTranslation));
        }
        if (this.yzTranslation != null) {
            this.yzTranslation.updatePoints(yzAxisTranslationPositions(transform, frame.scene.camera, triangleSize, (_5 = this.customization.scalars) === null || _5 === void 0 ? void 0 : _5.yzTranslation));
        }
    }
}
//# sourceMappingURL=widget.js.map
