@vertexvis/viewer 1.0.2-canary.2 → 1.0.2-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/config-20ozv4y8.js.map +1 -1
- package/dist/cjs/controller-BhcNbaX_.js.map +1 -1
- package/dist/cjs/controller-CSwG6gbQ.js.map +1 -1
- package/dist/cjs/cursors-BZmDRtaZ.js.map +1 -1
- package/dist/cjs/dom-BBil4aN3.js.map +1 -1
- package/dist/cjs/dom-CvGkFQon.js.map +1 -1
- package/dist/cjs/entities-D6kgGria.js.map +1 -1
- package/dist/cjs/geometry_pb-BTko2Wi0.js.map +1 -1
- package/dist/cjs/grpc-BsWFEUrc.js.map +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/model-C9WvOKYT.js.map +1 -1
- package/dist/cjs/model-D17EQTIh.js.map +1 -1
- package/dist/cjs/model-DAB4oD5n.js.map +1 -1
- package/dist/cjs/model-DkXCzhs_.js.map +1 -1
- package/dist/cjs/multiElementInteractionHandler-BHvRKVIp.js.map +1 -1
- package/dist/cjs/overlays-B-06bUbI.js.map +1 -1
- package/dist/cjs/queries-Da9I-xMf.js.map +1 -1
- package/dist/cjs/regl-component-HhKCyGQ3.js.map +1 -1
- package/dist/cjs/representation_pb-CrCGjlyP.js.map +1 -1
- package/dist/cjs/results-1wRRZiYG.js.map +1 -1
- package/dist/cjs/row-Cet6xXup.js.map +1 -1
- package/dist/cjs/stencil-Hsr_8Chs.js.map +1 -1
- package/dist/cjs/streamAttributes-D_J-W8-2.js.map +1 -1
- package/dist/cjs/templates-DvjgjnlO.js.map +1 -1
- package/dist/cjs/util-DIJSIQXH.js.map +1 -1
- package/dist/cjs/utils-CibrnHQ4.js.map +1 -1
- package/dist/cjs/utils-D8MbXbwO.js.map +1 -1
- package/dist/cjs/utils-qErVs2Vt.js.map +1 -1
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js +6 -8
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +2 -2
- package/dist/cjs/vertex-scene-tree.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-markup.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +4 -5
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +9 -5
- package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
- package/dist/cjs/viewport-CG1VYkIU.js.map +1 -1
- package/dist/collection/components/scene-tree/errors.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/controller.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/dom.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/errors.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/grpc.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/handlers.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/row.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/viewer-ops.js.map +1 -1
- package/dist/collection/components/scene-tree/scene-tree.js +2 -2
- package/dist/collection/components/scene-tree/scene-tree.js.map +1 -1
- package/dist/collection/components/scene-tree-search/scene-tree-search.js.map +1 -1
- package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js +1 -1
- package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js.map +1 -1
- package/dist/collection/components/scene-tree-table-cell/utils.js.map +1 -1
- package/dist/collection/components/scene-tree-table-layout/lib/dom.js.map +1 -1
- package/dist/collection/components/scene-tree-table-layout/lib/window.js.map +1 -1
- package/dist/collection/components/scene-tree-table-layout/scene-tree-table-layout.js +5 -5
- package/dist/collection/components/scene-tree-table-layout/scene-tree-table-layout.js.map +1 -1
- package/dist/collection/components/viewer/utils.js.map +1 -1
- package/dist/collection/components/viewer/viewer.js +9 -5
- package/dist/collection/components/viewer/viewer.js.map +1 -1
- package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.js +2 -2
- package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.js.map +1 -1
- package/dist/collection/components/viewer-dom-element/utils.js.map +1 -1
- package/dist/collection/components/viewer-dom-element/viewer-dom-element.js +1 -1
- package/dist/collection/components/viewer-dom-element/viewer-dom-element.js.map +1 -1
- package/dist/collection/components/viewer-dom-group/utils.js.map +1 -1
- package/dist/collection/components/viewer-dom-group/viewer-dom-group.js +1 -1
- package/dist/collection/components/viewer-dom-group/viewer-dom-group.js.map +1 -1
- package/dist/collection/components/viewer-dom-renderer/renderer2d.js.map +1 -1
- package/dist/collection/components/viewer-dom-renderer/renderer3d.js.map +1 -1
- package/dist/collection/components/viewer-dom-renderer/viewer-dom-renderer.js.map +1 -1
- package/dist/collection/components/viewer-hit-result-indicator/lib/dom.js.map +1 -1
- package/dist/collection/components/viewer-hit-result-indicator/lib/indicator.js.map +1 -1
- package/dist/collection/components/viewer-hit-result-indicator/lib/plane.js.map +1 -1
- package/dist/collection/components/viewer-hit-result-indicator/lib/point.js.map +1 -1
- package/dist/collection/components/viewer-hit-result-indicator/viewer-hit-result-indicator.js +1 -1
- package/dist/collection/components/viewer-hit-result-indicator/viewer-hit-result-indicator.js.map +1 -1
- package/dist/collection/components/viewer-icon/viewer-icon.js.map +1 -1
- package/dist/collection/components/viewer-markup/markup-utils.js.map +1 -1
- package/dist/collection/components/viewer-markup/viewer-markup-components.js.map +1 -1
- package/dist/collection/components/viewer-markup/viewer-markup.js +1 -1
- package/dist/collection/components/viewer-markup/viewer-markup.js.map +1 -1
- package/dist/collection/components/viewer-markup-arrow/interactions.js.map +1 -1
- package/dist/collection/components/viewer-markup-arrow/utils.js.map +1 -1
- package/dist/collection/components/viewer-markup-arrow/viewer-markup-arrow-components.js.map +1 -1
- package/dist/collection/components/viewer-markup-arrow/viewer-markup-arrow.js.map +1 -1
- package/dist/collection/components/viewer-markup-circle/interactions.js.map +1 -1
- package/dist/collection/components/viewer-markup-circle/utils.js.map +1 -1
- package/dist/collection/components/viewer-markup-circle/viewer-markup-circle.js.map +1 -1
- package/dist/collection/components/viewer-markup-freeform/interactions.js.map +1 -1
- package/dist/collection/components/viewer-markup-freeform/utils.js.map +1 -1
- package/dist/collection/components/viewer-markup-freeform/viewer-markup-freeform.js.map +1 -1
- package/dist/collection/components/viewer-markup-tool/viewer-markup-tool.js.map +1 -1
- package/dist/collection/components/viewer-measurement-details/viewer-measurement-details.js.map +1 -1
- package/dist/collection/components/viewer-measurement-distance/hitTest.js.map +1 -1
- package/dist/collection/components/viewer-measurement-distance/interactions.js.map +1 -1
- package/dist/collection/components/viewer-measurement-distance/utils.js.map +1 -1
- package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance.js.map +1 -1
- package/dist/collection/components/viewer-measurement-line/viewer-measurement-line.js +1 -1
- package/dist/collection/components/viewer-measurement-line/viewer-measurement-line.js.map +1 -1
- package/dist/collection/components/viewer-measurement-overlays/viewer-measurement-overlays.js +1 -1
- package/dist/collection/components/viewer-measurement-overlays/viewer-measurement-overlays.js.map +1 -1
- package/dist/collection/components/viewer-measurement-precise/viewer-measurement-precise.js.map +1 -1
- package/dist/collection/components/viewer-pin-group/utils.js.map +1 -1
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.js +2 -2
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.js.map +1 -1
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js.map +1 -1
- package/dist/collection/components/viewer-pin-tool/utils.js.map +1 -1
- package/dist/collection/components/viewer-pin-tool/viewer-pin-tool.js +1 -1
- package/dist/collection/components/viewer-pin-tool/viewer-pin-tool.js.map +1 -1
- package/dist/collection/components/viewer-teleport-tool/viewer-teleport-tool.js.map +1 -1
- package/dist/collection/components/viewer-transform-widget/util.js +1 -2
- package/dist/collection/components/viewer-transform-widget/util.js.map +1 -1
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget-components.js.map +1 -1
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js +3 -3
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js.map +1 -1
- package/dist/collection/components/viewer-transform-widget/widget.js.map +1 -1
- package/dist/collection/components/viewer-view-cube/viewer-view-cube.js +1 -1
- package/dist/collection/components/viewer-view-cube/viewer-view-cube.js.map +1 -1
- package/dist/collection/components/viewer-walk-mode-tool/viewer-walk-mode-tool.js.map +1 -1
- package/dist/collection/lib/annotations/controller.js.map +1 -1
- package/dist/collection/lib/canvases/controller.js.map +1 -1
- package/dist/collection/lib/canvases/mapper.js.map +1 -1
- package/dist/collection/lib/config.js.map +1 -1
- package/dist/collection/lib/cursors.js.map +1 -1
- package/dist/collection/lib/dom.js.map +1 -1
- package/dist/collection/lib/grpc.js.map +1 -1
- package/dist/collection/lib/interactions/baseInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/flyToPartKeyInteraction.js.map +1 -1
- package/dist/collection/lib/interactions/flyToPositionKeyInteraction.js.map +1 -1
- package/dist/collection/lib/interactions/interactionApi.js.map +1 -1
- package/dist/collection/lib/interactions/interactionApiOrthographic.js.map +1 -1
- package/dist/collection/lib/interactions/interactionApiPerspective.js.map +1 -1
- package/dist/collection/lib/interactions/mouseInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/mouseInteractions.js.map +1 -1
- package/dist/collection/lib/interactions/multiElementInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/multiPointerInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/multiTouchInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/pointerInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/tapInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/touchInteractionHandler.js.map +1 -1
- package/dist/collection/lib/keyBinding.js.map +1 -1
- package/dist/collection/lib/mappers/annotation.js.map +1 -1
- package/dist/collection/lib/mappers/camera.js.map +1 -1
- package/dist/collection/lib/mappers/color.js.map +1 -1
- package/dist/collection/lib/mappers/colorMaterial.js.map +1 -1
- package/dist/collection/lib/mappers/corePb.js.map +1 -1
- package/dist/collection/lib/mappers/corePbJs.js.map +1 -1
- package/dist/collection/lib/mappers/frameStreaming.js.map +1 -1
- package/dist/collection/lib/mappers/geometry.js.map +1 -1
- package/dist/collection/lib/mappers/material.js.map +1 -1
- package/dist/collection/lib/mappers/pagination.js.map +1 -1
- package/dist/collection/lib/mappers/scalar.js.map +1 -1
- package/dist/collection/lib/mappers/streamAttributes.js.map +1 -1
- package/dist/collection/lib/markup/interactions.js.map +1 -1
- package/dist/collection/lib/measurement/controller.js.map +1 -1
- package/dist/collection/lib/measurement/entities.js.map +1 -1
- package/dist/collection/lib/measurement/interactions.js.map +1 -1
- package/dist/collection/lib/measurement/mapper.js.map +1 -1
- package/dist/collection/lib/measurement/model.js.map +1 -1
- package/dist/collection/lib/measurement/overlays.js.map +1 -1
- package/dist/collection/lib/measurement/results.js.map +1 -1
- package/dist/collection/lib/meters.js.map +1 -1
- package/dist/collection/lib/model-views/controller.js.map +1 -1
- package/dist/collection/lib/model-views/mapper.js.map +1 -1
- package/dist/collection/lib/pins/controller.js.map +1 -1
- package/dist/collection/lib/pins/interactions.js.map +1 -1
- package/dist/collection/lib/pmi/controller.js.map +1 -1
- package/dist/collection/lib/pmi/mapper.js.map +1 -1
- package/dist/collection/lib/rendering/canvas.js.map +1 -1
- package/dist/collection/lib/rendering/imageLoaders.js.map +1 -1
- package/dist/collection/lib/rendering/matrices.js.map +1 -1
- package/dist/collection/lib/rendering/timing.js.map +1 -1
- package/dist/collection/lib/rendering/utils.js.map +1 -1
- package/dist/collection/lib/rendering/vectors.js.map +1 -1
- package/dist/collection/lib/scene-items/controller.js.map +1 -1
- package/dist/collection/lib/scene-items/mapper.js.map +1 -1
- package/dist/collection/lib/scenes/camera.js.map +1 -1
- package/dist/collection/lib/scenes/cameraRenderResult.js.map +1 -1
- package/dist/collection/lib/scenes/colorMaterial.js.map +1 -1
- package/dist/collection/lib/scenes/crossSectioner.js.map +1 -1
- package/dist/collection/lib/scenes/mapper.js.map +1 -1
- package/dist/collection/lib/scenes/operations.js.map +1 -1
- package/dist/collection/lib/scenes/queries.js.map +1 -1
- package/dist/collection/lib/scenes/raycaster.js.map +1 -1
- package/dist/collection/lib/scenes/scene.js.map +1 -1
- package/dist/collection/lib/scenes/sceneOperationExecuteResult.js.map +1 -1
- package/dist/collection/lib/scenes/sceneViewStateLoader.js.map +1 -1
- package/dist/collection/lib/stencil.js.map +1 -1
- package/dist/collection/lib/storage.js.map +1 -1
- package/dist/collection/lib/stream/dispatcher.js.map +1 -1
- package/dist/collection/lib/stream/stream.js.map +1 -1
- package/dist/collection/lib/stream/utils.js.map +1 -1
- package/dist/collection/lib/teleportation/interactions.js.map +1 -1
- package/dist/collection/lib/templates.js.map +1 -1
- package/dist/collection/lib/token.js.map +1 -1
- package/dist/collection/lib/transforms/axis-lines.js.map +1 -1
- package/dist/collection/lib/transforms/axis-rotation.js.map +1 -1
- package/dist/collection/lib/transforms/axis-translation.js.map +1 -1
- package/dist/collection/lib/transforms/controller.js.map +1 -1
- package/dist/collection/lib/transforms/drawable.js.map +1 -1
- package/dist/collection/lib/transforms/hits.js.map +1 -1
- package/dist/collection/lib/transforms/line.js.map +1 -1
- package/dist/collection/lib/transforms/mesh.js.map +1 -1
- package/dist/collection/lib/transforms/shape.js.map +1 -1
- package/dist/collection/lib/transforms/transformation-delta.js.map +1 -1
- package/dist/collection/lib/transforms/util.js.map +1 -1
- package/dist/collection/lib/types/clippingPlanes.js.map +1 -1
- package/dist/collection/lib/types/depthBuffer.js.map +1 -1
- package/dist/collection/lib/types/featureMap.js.map +1 -1
- package/dist/collection/lib/types/flags.js.map +1 -1
- package/dist/collection/lib/types/frame.js.map +1 -1
- package/dist/collection/lib/types/frameCamera.js.map +1 -1
- package/dist/collection/lib/types/loadableResource.js.map +1 -1
- package/dist/collection/lib/types/orientation.js.map +1 -1
- package/dist/collection/lib/types/sceneViewStateIdentifier.js.map +1 -1
- package/dist/collection/lib/types/standardView.js.map +1 -1
- package/dist/collection/lib/types/stencilBuffer.js.map +1 -1
- package/dist/collection/lib/types/synchronizedClock.js.map +1 -1
- package/dist/collection/lib/types/viewport.js.map +1 -1
- package/dist/collection/lib/visibilityObserver.js.map +1 -1
- package/dist/collection/lib/volume-intersection/controller.js.map +1 -1
- package/dist/collection/lib/volume-intersection/interactions.js.map +1 -1
- package/dist/collection/lib/volume-intersection/model.js.map +1 -1
- package/dist/collection/lib/walk-mode/controller.js.map +1 -1
- package/dist/collection/lib/walk-mode/interactions.js.map +1 -1
- package/dist/collection/lib/walk-mode/model.js.map +1 -1
- package/dist/collection/lib/webgl/regl-component.js.map +1 -1
- package/dist/collection/testing/annotations.js.map +1 -1
- package/dist/collection/testing/canvases.js.map +1 -1
- package/dist/collection/testing/colors.js.map +1 -1
- package/dist/collection/testing/eventually.js.map +1 -1
- package/dist/collection/testing/fixtures.js.map +1 -1
- package/dist/collection/testing/grpc.js +3 -9
- package/dist/collection/testing/grpc.js.map +1 -1
- package/dist/collection/testing/modelViews.js.map +1 -1
- package/dist/collection/testing/pmi.js.map +1 -1
- package/dist/collection/testing/random.js.map +1 -1
- package/dist/collection/testing/resizeObserver.js.map +1 -1
- package/dist/collection/testing/scene-items-helper.js.map +1 -1
- package/dist/collection/testing/sceneTree.js.map +1 -1
- package/dist/collection/testing/viewer.js.map +1 -1
- package/dist/collection/testing/webgl.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-St4ctu2K.js → p-3-bKfpqr.js} +2 -2
- package/dist/components/{p-St4ctu2K.js.map → p-3-bKfpqr.js.map} +1 -1
- package/dist/components/p-3DqRAYgO.js.map +1 -1
- package/dist/components/p-B-ToCp8-.js.map +1 -1
- package/dist/components/p-B156bTbY.js +5 -0
- package/dist/components/p-B156bTbY.js.map +1 -0
- package/dist/components/p-B9R0QWr4.js.map +1 -1
- package/dist/components/p-BCOD9yfw.js.map +1 -1
- package/dist/components/p-BHAaIoH5.js.map +1 -1
- package/dist/components/{p-Doltf1wO.js → p-BOJJZ1cN.js} +2 -2
- package/dist/components/p-BOJJZ1cN.js.map +1 -0
- package/dist/components/p-BkHp-aAR.js.map +1 -1
- package/dist/components/p-Bkm6H5uq.js.map +1 -1
- package/dist/components/p-C-VWDW9n.js.map +1 -1
- package/dist/components/p-C79PxobX.js.map +1 -1
- package/dist/components/p-CAugdB_8.js.map +1 -1
- package/dist/components/p-CEzVEgdQ.js.map +1 -1
- package/dist/components/p-CGCJ5hbJ.js.map +1 -1
- package/dist/components/p-COlcifvm.js.map +1 -1
- package/dist/components/p-CXTH3zrN.js.map +1 -1
- package/dist/components/p-CZCXdo3t.js.map +1 -1
- package/dist/components/p-Cd7kap5W.js.map +1 -1
- package/dist/components/p-CiSHWNC4.js.map +1 -1
- package/dist/components/p-CjG1fMh1.js.map +1 -1
- package/dist/components/p-CkjXRDNL.js.map +1 -1
- package/dist/components/p-D0KZu516.js.map +1 -1
- package/dist/components/p-D12q-fpW.js.map +1 -1
- package/dist/components/p-D33gVA2W.js.map +1 -1
- package/dist/components/p-DC86ZXai.js.map +1 -1
- package/dist/components/{p-B80hfIq6.js → p-DF4kEsJU.js} +2 -2
- package/dist/components/p-DF4kEsJU.js.map +1 -0
- package/dist/components/p-DRh4_Z-g.js.map +1 -1
- package/dist/components/p-DRnMrHWY.js.map +1 -1
- package/dist/components/{p-b0ZzPHz8.js → p-DUC59SSO.js} +2 -2
- package/dist/components/p-DUC59SSO.js.map +1 -0
- package/dist/components/p-DVW2WZTq.js.map +1 -1
- package/dist/components/p-DZI8pnGz.js.map +1 -1
- package/dist/components/p-Dbz9yUqC.js.map +1 -1
- package/dist/components/p-Yfi0i5Kj.js.map +1 -1
- package/dist/components/p-abSJ29r7.js.map +1 -1
- package/dist/components/p-ahjMltGJ.js.map +1 -1
- package/dist/components/p-bal2RLiw.js.map +1 -1
- package/dist/components/{p-BopQW1sA.js → p-oK38ynrd.js} +2 -2
- package/dist/components/p-oK38ynrd.js.map +1 -0
- package/dist/components/vertex-scene-tree-table-cell.js +1 -1
- package/dist/components/vertex-scene-tree-table-cell.js.map +1 -1
- package/dist/components/vertex-scene-tree-table-layout.js +1 -1
- package/dist/components/vertex-scene-tree.js +1 -1
- package/dist/components/vertex-scene-tree.js.map +1 -1
- package/dist/components/vertex-viewer-box-query-tool.js +1 -1
- package/dist/components/vertex-viewer-box-query-tool.js.map +1 -1
- package/dist/components/vertex-viewer-dom-element.js +1 -1
- package/dist/components/vertex-viewer-dom-group.js +1 -1
- package/dist/components/vertex-viewer-hit-result-indicator.js +1 -1
- package/dist/components/vertex-viewer-hit-result-indicator.js.map +1 -1
- package/dist/components/vertex-viewer-markup-tool.js.map +1 -1
- package/dist/components/vertex-viewer-markup.js +1 -1
- package/dist/components/vertex-viewer-markup.js.map +1 -1
- package/dist/components/vertex-viewer-measurement-details.js.map +1 -1
- package/dist/components/vertex-viewer-measurement-distance.js +1 -1
- package/dist/components/vertex-viewer-measurement-distance.js.map +1 -1
- package/dist/components/vertex-viewer-measurement-line.js +1 -1
- package/dist/components/vertex-viewer-measurement-overlays.js +1 -1
- package/dist/components/vertex-viewer-measurement-precise.js +1 -1
- package/dist/components/vertex-viewer-measurement-precise.js.map +1 -1
- package/dist/components/vertex-viewer-pin-group.js +1 -1
- package/dist/components/vertex-viewer-pin-tool.js +1 -1
- package/dist/components/vertex-viewer-pin-tool.js.map +1 -1
- package/dist/components/vertex-viewer-transform-widget.js +1 -1
- package/dist/components/vertex-viewer-transform-widget.js.map +1 -1
- package/dist/components/vertex-viewer-view-cube.js +1 -1
- package/dist/components/vertex-viewer-view-cube.js.map +1 -1
- package/dist/components/vertex-viewer-walk-mode-tool.js.map +1 -1
- package/dist/components/vertex-viewer.js +1 -1
- package/dist/components/vertex-viewer.js.map +1 -1
- package/dist/esm/config-lglER3mU.js.map +1 -1
- package/dist/esm/controller-BMWGs-I6.js.map +1 -1
- package/dist/esm/controller-Iymb_J2R.js.map +1 -1
- package/dist/esm/cursors-BbBDEutb.js.map +1 -1
- package/dist/esm/dom-B3m2VjbN.js.map +1 -1
- package/dist/esm/dom-DX6pEG54.js.map +1 -1
- package/dist/esm/entities-zRken6VS.js.map +1 -1
- package/dist/esm/geometry_pb-BiZRfctN.js.map +1 -1
- package/dist/esm/grpc-CZAYqbTu.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model-BYW5YIye.js.map +1 -1
- package/dist/esm/model-CLtwOS0o.js.map +1 -1
- package/dist/esm/model-D0EJdHmW.js.map +1 -1
- package/dist/esm/model-DHJ5aE4y.js.map +1 -1
- package/dist/esm/multiElementInteractionHandler-DwjL-r55.js.map +1 -1
- package/dist/esm/overlays-BE1oqniA.js.map +1 -1
- package/dist/esm/queries-DEzCmbTD.js.map +1 -1
- package/dist/esm/regl-component-DmkowWhg.js.map +1 -1
- package/dist/esm/representation_pb-g4f0WC4k.js.map +1 -1
- package/dist/esm/results-CFB6nKu8.js.map +1 -1
- package/dist/esm/row-CiSHWNC4.js.map +1 -1
- package/dist/esm/stencil-BV-7pO4q.js.map +1 -1
- package/dist/esm/streamAttributes-Cp8PEH9A.js.map +1 -1
- package/dist/esm/templates-DRh4_Z-g.js.map +1 -1
- package/dist/esm/util-BCZZYmp4.js.map +1 -1
- package/dist/esm/utils-BvZ9-fs0.js.map +1 -1
- package/dist/esm/utils-DC86ZXai.js.map +1 -1
- package/dist/esm/utils-D_pIldrS.js.map +1 -1
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js +6 -8
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js.map +1 -1
- package/dist/esm/vertex-scene-tree-table-cell.entry.js +1 -1
- package/dist/esm/vertex-scene-tree-table-cell.entry.js.map +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +2 -2
- package/dist/esm/vertex-scene-tree.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-box-query-tool.entry.js +2 -2
- package/dist/esm/vertex-viewer-box-query-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
- package/dist/esm/vertex-viewer-dom-element_2.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-dom-group.entry.js +1 -1
- package/dist/esm/vertex-viewer-dom-group.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-hit-result-indicator.entry.js +1 -1
- package/dist/esm/vertex-viewer-hit-result-indicator.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-icon.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-markup-arrow_3.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-markup-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-markup.entry.js +1 -1
- package/dist/esm/vertex-viewer-markup.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-measurement-details.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-measurement-distance.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-measurement-precise.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-group.entry.js +2 -2
- package/dist/esm/vertex-viewer-pin-group.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-label_2.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-tool.entry.js +1 -1
- package/dist/esm/vertex-viewer-pin-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-teleport-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-transform-widget.entry.js +4 -5
- package/dist/esm/vertex-viewer-transform-widget.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-view-cube.entry.js +1 -1
- package/dist/esm/vertex-viewer-view-cube.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-walk-mode-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer.entry.js +9 -5
- package/dist/esm/vertex-viewer.entry.js.map +1 -1
- package/dist/esm/viewport-C8WQZxvx.js.map +1 -1
- package/dist/types/regl-shape.d.ts +1 -1
- package/dist/viewer/index.esm.js.map +1 -1
- package/dist/viewer/{p-eac63070.entry.js → p-051b5154.entry.js} +2 -2
- package/dist/viewer/p-051b5154.entry.js.map +1 -0
- package/dist/viewer/{p-3d3a7eeb.entry.js → p-0984c51f.entry.js} +2 -2
- package/dist/viewer/{p-3d3a7eeb.entry.js.map → p-0984c51f.entry.js.map} +1 -1
- package/dist/viewer/{p-864f40c7.entry.js → p-11cf755a.entry.js} +2 -2
- package/dist/viewer/p-11cf755a.entry.js.map +1 -0
- package/dist/viewer/{p-29d14611.entry.js → p-16775f7d.entry.js} +2 -2
- package/dist/viewer/p-16775f7d.entry.js.map +1 -0
- package/dist/viewer/{p-5a85cae5.entry.js → p-1eb636f8.entry.js} +2 -2
- package/dist/viewer/p-1eb636f8.entry.js.map +1 -0
- package/dist/viewer/{p-e993f300.entry.js → p-228d1d43.entry.js} +2 -2
- package/dist/viewer/p-228d1d43.entry.js.map +1 -0
- package/dist/viewer/p-33f44cc1.entry.js.map +1 -1
- package/dist/viewer/{p-3300d3dc.entry.js → p-35601c85.entry.js} +2 -2
- package/dist/viewer/p-35601c85.entry.js.map +1 -0
- package/dist/viewer/p-47766566.entry.js.map +1 -1
- package/dist/viewer/p-6e3a6bbd.entry.js.map +1 -1
- package/dist/viewer/p-7f388b45.entry.js.map +1 -1
- package/dist/viewer/p-89544066.entry.js.map +1 -1
- package/dist/viewer/{p-07b99ac9.entry.js → p-8c369777.entry.js} +2 -2
- package/dist/viewer/p-8c369777.entry.js.map +1 -0
- package/dist/viewer/{p-e59983dc.entry.js → p-9835c5e2.entry.js} +2 -2
- package/dist/viewer/p-9835c5e2.entry.js.map +1 -0
- package/dist/viewer/{p-aa95e21a.entry.js → p-9d8ff406.entry.js} +2 -2
- package/dist/viewer/p-9d8ff406.entry.js.map +1 -0
- package/dist/viewer/p-BDvACHun.js.map +1 -1
- package/dist/viewer/p-BIkuvTVH.js.map +1 -1
- package/dist/viewer/p-BRPkbTVP.js.map +1 -1
- package/dist/viewer/p-BsBIynwj.js.map +1 -1
- package/dist/viewer/p-BxtKMwBH.js.map +1 -1
- package/dist/viewer/p-C4y4Noe-.js.map +1 -1
- package/dist/viewer/p-C6KrfydC.js.map +1 -1
- package/dist/viewer/p-C7dYsPFU.js.map +1 -1
- package/dist/viewer/p-C9Cqbq6H.js.map +1 -1
- package/dist/viewer/p-CVWO4w6b.js.map +1 -1
- package/dist/viewer/p-ChqXy0cG.js.map +1 -1
- package/dist/viewer/p-CiSHWNC4.js.map +1 -1
- package/dist/viewer/p-CjG1fMh1.js.map +1 -1
- package/dist/viewer/p-Cs5KOvOQ.js.map +1 -1
- package/dist/viewer/p-CyGlYje2.js.map +1 -1
- package/dist/viewer/p-D6eJC1q4.js.map +1 -1
- package/dist/viewer/p-DC86ZXai.js.map +1 -1
- package/dist/viewer/p-DRh4_Z-g.js.map +1 -1
- package/dist/viewer/p-DUX5FvBC.js.map +1 -1
- package/dist/viewer/p-DX6pEG54.js.map +1 -1
- package/dist/viewer/p-D_ixWHO7.js.map +1 -1
- package/dist/viewer/p-DacE-wPp.js.map +1 -1
- package/dist/viewer/p-Dp56p_jX.js.map +1 -1
- package/dist/viewer/p-EsKoKfmx.js.map +1 -1
- package/dist/viewer/p-F8e15or2.js.map +1 -1
- package/dist/viewer/p-Jfxh0jq9.js.map +1 -1
- package/dist/viewer/p-WPRMWirY.js.map +1 -1
- package/dist/viewer/p-_93RRNxT.js.map +1 -1
- package/dist/viewer/p-a8a81cba.entry.js +5 -0
- package/dist/viewer/p-a8a81cba.entry.js.map +1 -0
- package/dist/viewer/p-a9282481.entry.js.map +1 -1
- package/dist/viewer/{p-63f4f702.entry.js → p-c7e62d66.entry.js} +2 -2
- package/dist/viewer/p-c7e62d66.entry.js.map +1 -0
- package/dist/viewer/p-d37e647b.entry.js.map +1 -1
- package/dist/viewer/{p-302f2078.entry.js → p-d9fe788f.entry.js} +2 -2
- package/dist/viewer/p-d9fe788f.entry.js.map +1 -0
- package/dist/viewer/p-e9b83dae.entry.js.map +1 -1
- package/dist/viewer/{p-70f3629d.entry.js → p-f271dc4a.entry.js} +2 -2
- package/dist/viewer/p-f271dc4a.entry.js.map +1 -0
- package/dist/viewer/p-f65c0769.entry.js.map +1 -1
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/dist/components/p-B80hfIq6.js.map +0 -1
- package/dist/components/p-BopQW1sA.js.map +0 -1
- package/dist/components/p-DNtS2F8J.js +0 -5
- package/dist/components/p-DNtS2F8J.js.map +0 -1
- package/dist/components/p-Doltf1wO.js.map +0 -1
- package/dist/components/p-b0ZzPHz8.js.map +0 -1
- package/dist/viewer/p-07b99ac9.entry.js.map +0 -1
- package/dist/viewer/p-29d14611.entry.js.map +0 -1
- package/dist/viewer/p-302f2078.entry.js.map +0 -1
- package/dist/viewer/p-3300d3dc.entry.js.map +0 -1
- package/dist/viewer/p-5a85cae5.entry.js.map +0 -1
- package/dist/viewer/p-60c915e3.entry.js +0 -5
- package/dist/viewer/p-60c915e3.entry.js.map +0 -1
- package/dist/viewer/p-63f4f702.entry.js.map +0 -1
- package/dist/viewer/p-70f3629d.entry.js.map +0 -1
- package/dist/viewer/p-864f40c7.entry.js.map +0 -1
- package/dist/viewer/p-aa95e21a.entry.js.map +0 -1
- package/dist/viewer/p-e59983dc.entry.js.map +0 -1
- package/dist/viewer/p-e993f300.entry.js.map +0 -1
- package/dist/viewer/p-eac63070.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport-C8WQZxvx.js","sources":["src/lib/types/viewport.ts"],"sourcesContent":["import {\n Dimensions,\n Matrix4,\n Point,\n Ray,\n Rectangle,\n Vector3,\n} from '@vertexvis/geometry';\n\nimport { DepthBuffer } from './depthBuffer';\nimport type { FrameCameraBase, FrameImageLike } from './frame';\n\n/**\n * A `Viewport` represents the drawing area in the viewer.\n *\n * When a frame is received from the rendering pipeline, it might not be the\n * same dimensions of the viewport because of an interactive frame or because of\n * bandwidth limitations or other performance reasons.\n *\n * The viewport contains methods to scale an image to the viewport, as well as\n * translate 2D coordinates between the viewport and the frame.\n */\nexport class Viewport implements Dimensions.Dimensions {\n /**\n * The center point of the viewport.\n */\n public readonly center: Point.Point;\n\n public constructor(\n /**\n * The width of the viewport.\n */\n public readonly width: number,\n\n /**\n * The height of the viewport.\n */\n public readonly height: number\n ) {\n this.center = Dimensions.center(this.dimensions);\n }\n\n /**\n * Returns a new viewport with the given dimensions.\n * @param dimensions The dimensions of the viewport\n * @returns A new viewport.\n */\n public static fromDimensions(dimensions: Dimensions.Dimensions): Viewport {\n return new Viewport(dimensions.width, dimensions.height);\n }\n\n /**\n * Transforms a normalized device coordinate to a 2D point within the\n * viewport.\n *\n * @param ndc A 2D point in NDC.\n * @returns A 2D point in the coordinate space of the viewport.\n */\n public transformNdcPointToViewport(ndc: Point.Point): Point.Point {\n return Point.create(\n ndc.x * this.center.x + this.center.x,\n -ndc.y * this.center.y + this.center.y\n );\n }\n\n /**\n * Transforms a normalized device coordinate to a 2D point within the\n * viewport.\n *\n * @param ndc A 3D point in NDC.\n * @returns A 2D point in the coordinate space of the viewport.\n */\n public transformVectorToViewport(ndc: Vector3.Vector3): Point.Point {\n return this.transformNdcPointToViewport(ndc);\n }\n\n /**\n * Transforms a world point to 2D point in viewport space.\n *\n * @param worldPt The world point to transform.\n * @param projectionViewMatrix The projection matrix to transform a 3D point to 2D point.\n * @returns A point in viewport space.\n */\n public transformWorldToViewport(\n worldPt: Vector3.Vector3,\n projectionViewMatrix: Matrix4.Matrix4\n ): Point.Point {\n const ndc = Vector3.transformMatrix(worldPt, projectionViewMatrix);\n return this.transformVectorToViewport(ndc);\n }\n\n public transformPointToViewport(\n pt: Point.Point,\n image: FrameImageLike\n ): Point.Point {\n const { x: scaleX, y: scaleY } = this.calculateFrameScale(image);\n return Point.scale(pt, 1 * scaleX, 1 * scaleY);\n }\n\n /**\n * Transforms a point in viewport coordinate space to a point in a frame's\n * coordinate space.\n *\n * @param pt A point in viewport coordinate space.\n * @param image An image of a frame.\n * @returns A point in the coordinate space of the frame.\n */\n public transformPointToFrame(\n pt: Point.Point,\n image: FrameImageLike\n ): Point.Point {\n const { x: scaleX, y: scaleY } = this.calculateFrameScale(image);\n return Point.scale(pt, 1 / scaleX, 1 / scaleY);\n }\n\n /**\n * Transforms a point in viewport coordinates to a point in world space\n * coordinates. This method expects a depth buffer in order to compute a value\n * for the Z axis.\n *\n * @param pt A point in viewport coordinates.\n * @param depthBuffer A depth buffer for computing the Z axis.\n * @param fallbackNormalizedDepth A fallback value if the depth is the max\n * depth value, or cannot be determined.\n * @returns\n */\n public transformPointToWorldSpace(\n pt: Point.Point,\n depthBuffer: DepthBuffer,\n fallbackNormalizedDepth?: number\n ): Vector3.Vector3 {\n const depthPt = this.transformPointToFrame(pt, depthBuffer);\n const ray = this.transformPointToRay(pt, depthBuffer, depthBuffer.camera);\n return depthBuffer.getWorldPoint(depthPt, ray, fallbackNormalizedDepth);\n }\n\n /**\n * Transforms a point in viewport coordinates to a ray.\n *\n * For perspective cameras, the returned ray will have an\n * origin that is at the position of the camera with a direction\n * that is pointing into world space away from the camera.\n *\n * For orthographic cameras, the returned ray will have an\n * origin that is at the world point of viewport coordinate\n * with a direction that is pointing into world space away\n * from the camera.\n *\n * @param pt A point in viewport coordinates.\n * @param image An image of a frame.\n * @param camera A camera used to determine orientation of the scene.\n * @returns A ray\n */\n public transformPointToRay(\n pt: Point.Point,\n image: FrameImageLike,\n camera: FrameCameraBase\n ): Ray.Ray {\n const ndc = this.transformScreenPointToNdc(pt, image);\n\n // Calculate the ray depending on the camera type\n if (camera.isPerspective()) {\n const origin = Vector3.fromMatrixPosition(camera.worldMatrix);\n const lookAtPoint = Vector3.transformNdcToWorldSpace(\n Vector3.create(ndc.x, ndc.y, 0.5),\n camera.worldMatrix,\n camera.projectionMatrixInverse\n );\n const direction = Vector3.normalize(\n Vector3.subtract(lookAtPoint, origin)\n );\n return Ray.create({ origin, direction });\n } else {\n const origin = Vector3.transformNdcToWorldSpace(\n Vector3.create(ndc.x, ndc.y, 0),\n camera.worldMatrix,\n camera.projectionMatrixInverse\n );\n return Ray.create({\n origin,\n direction: Vector3.normalize(camera.viewVector),\n });\n }\n }\n\n /**\n * Maps a screen point to normalized device coordinates (NDC). A screen point\n * at 0,0 represents the top-left of the viewport.\n *\n * @param screenPt A screen point.\n */\n public transformScreenPointToNdc(\n screenPt: Point.Point,\n image: FrameImageLike\n ): Point.Point {\n const framePt = this.transformPointToFrame(screenPt, image);\n return Point.create(\n (framePt.x / image.imageAttr.frameDimensions.width) * 2 - 1,\n -(framePt.y / image.imageAttr.frameDimensions.height) * 2 + 1\n );\n }\n\n /**\n * Computes a rectangle that is scaled correctly to be drawn within the\n * viewport.\n *\n * @param image The image to be drawn.\n * @param imageDimensions The dimensions of the received image.\n * @returns A rectangle.\n */\n public calculateDrawRect(image: FrameImageLike): Rectangle.Rectangle {\n const { x: scaleX, y: scaleY } = this.calculateFrameScale(image);\n return Rectangle.scale(image.imageAttr.imageRect, scaleX, scaleY);\n }\n\n private calculateFrameScale(image: FrameImageLike): Point.Point {\n const { frameDimensions: dimensions } = image.imageAttr;\n\n const imageRect = Rectangle.fromDimensions(dimensions);\n const viewport = Rectangle.fromDimensions(this.dimensions);\n const fit = Rectangle.containFit(viewport, imageRect);\n\n const scaleX = fit.width / imageRect.width;\n const scaleY = fit.height / imageRect.height;\n\n return Point.create(scaleX, scaleY);\n }\n\n public get dimensions(): Dimensions.Dimensions {\n return Dimensions.create(this.width, this.height);\n }\n}\n"],"names":["Dimensions","Point","Vector3","Ray","Rectangle"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"viewport-C8WQZxvx.js","sources":["src/lib/types/viewport.ts"],"sourcesContent":["import {\n Dimensions,\n Matrix4,\n Point,\n Ray,\n Rectangle,\n Vector3,\n} from '@vertexvis/geometry';\n\nimport { DepthBuffer } from './depthBuffer';\nimport type { FrameCameraBase, FrameImageLike } from './frame';\n\n/**\n * A `Viewport` represents the drawing area in the viewer.\n *\n * When a frame is received from the rendering pipeline, it might not be the\n * same dimensions of the viewport because of an interactive frame or because of\n * bandwidth limitations or other performance reasons.\n *\n * The viewport contains methods to scale an image to the viewport, as well as\n * translate 2D coordinates between the viewport and the frame.\n */\nexport class Viewport implements Dimensions.Dimensions {\n /**\n * The center point of the viewport.\n */\n public readonly center: Point.Point;\n\n public constructor(\n /**\n * The width of the viewport.\n */\n public readonly width: number,\n\n /**\n * The height of the viewport.\n */\n public readonly height: number,\n ) {\n this.center = Dimensions.center(this.dimensions);\n }\n\n /**\n * Returns a new viewport with the given dimensions.\n * @param dimensions The dimensions of the viewport\n * @returns A new viewport.\n */\n public static fromDimensions(dimensions: Dimensions.Dimensions): Viewport {\n return new Viewport(dimensions.width, dimensions.height);\n }\n\n /**\n * Transforms a normalized device coordinate to a 2D point within the\n * viewport.\n *\n * @param ndc A 2D point in NDC.\n * @returns A 2D point in the coordinate space of the viewport.\n */\n public transformNdcPointToViewport(ndc: Point.Point): Point.Point {\n return Point.create(\n ndc.x * this.center.x + this.center.x,\n -ndc.y * this.center.y + this.center.y,\n );\n }\n\n /**\n * Transforms a normalized device coordinate to a 2D point within the\n * viewport.\n *\n * @param ndc A 3D point in NDC.\n * @returns A 2D point in the coordinate space of the viewport.\n */\n public transformVectorToViewport(ndc: Vector3.Vector3): Point.Point {\n return this.transformNdcPointToViewport(ndc);\n }\n\n /**\n * Transforms a world point to 2D point in viewport space.\n *\n * @param worldPt The world point to transform.\n * @param projectionViewMatrix The projection matrix to transform a 3D point to 2D point.\n * @returns A point in viewport space.\n */\n public transformWorldToViewport(\n worldPt: Vector3.Vector3,\n projectionViewMatrix: Matrix4.Matrix4,\n ): Point.Point {\n const ndc = Vector3.transformMatrix(worldPt, projectionViewMatrix);\n return this.transformVectorToViewport(ndc);\n }\n\n public transformPointToViewport(\n pt: Point.Point,\n image: FrameImageLike,\n ): Point.Point {\n const { x: scaleX, y: scaleY } = this.calculateFrameScale(image);\n return Point.scale(pt, 1 * scaleX, 1 * scaleY);\n }\n\n /**\n * Transforms a point in viewport coordinate space to a point in a frame's\n * coordinate space.\n *\n * @param pt A point in viewport coordinate space.\n * @param image An image of a frame.\n * @returns A point in the coordinate space of the frame.\n */\n public transformPointToFrame(\n pt: Point.Point,\n image: FrameImageLike,\n ): Point.Point {\n const { x: scaleX, y: scaleY } = this.calculateFrameScale(image);\n return Point.scale(pt, 1 / scaleX, 1 / scaleY);\n }\n\n /**\n * Transforms a point in viewport coordinates to a point in world space\n * coordinates. This method expects a depth buffer in order to compute a value\n * for the Z axis.\n *\n * @param pt A point in viewport coordinates.\n * @param depthBuffer A depth buffer for computing the Z axis.\n * @param fallbackNormalizedDepth A fallback value if the depth is the max\n * depth value, or cannot be determined.\n * @returns\n */\n public transformPointToWorldSpace(\n pt: Point.Point,\n depthBuffer: DepthBuffer,\n fallbackNormalizedDepth?: number,\n ): Vector3.Vector3 {\n const depthPt = this.transformPointToFrame(pt, depthBuffer);\n const ray = this.transformPointToRay(pt, depthBuffer, depthBuffer.camera);\n return depthBuffer.getWorldPoint(depthPt, ray, fallbackNormalizedDepth);\n }\n\n /**\n * Transforms a point in viewport coordinates to a ray.\n *\n * For perspective cameras, the returned ray will have an\n * origin that is at the position of the camera with a direction\n * that is pointing into world space away from the camera.\n *\n * For orthographic cameras, the returned ray will have an\n * origin that is at the world point of viewport coordinate\n * with a direction that is pointing into world space away\n * from the camera.\n *\n * @param pt A point in viewport coordinates.\n * @param image An image of a frame.\n * @param camera A camera used to determine orientation of the scene.\n * @returns A ray\n */\n public transformPointToRay(\n pt: Point.Point,\n image: FrameImageLike,\n camera: FrameCameraBase,\n ): Ray.Ray {\n const ndc = this.transformScreenPointToNdc(pt, image);\n\n // Calculate the ray depending on the camera type\n if (camera.isPerspective()) {\n const origin = Vector3.fromMatrixPosition(camera.worldMatrix);\n const lookAtPoint = Vector3.transformNdcToWorldSpace(\n Vector3.create(ndc.x, ndc.y, 0.5),\n camera.worldMatrix,\n camera.projectionMatrixInverse,\n );\n const direction = Vector3.normalize(\n Vector3.subtract(lookAtPoint, origin),\n );\n return Ray.create({ origin, direction });\n } else {\n const origin = Vector3.transformNdcToWorldSpace(\n Vector3.create(ndc.x, ndc.y, 0),\n camera.worldMatrix,\n camera.projectionMatrixInverse,\n );\n return Ray.create({\n origin,\n direction: Vector3.normalize(camera.viewVector),\n });\n }\n }\n\n /**\n * Maps a screen point to normalized device coordinates (NDC). A screen point\n * at 0,0 represents the top-left of the viewport.\n *\n * @param screenPt A screen point.\n */\n public transformScreenPointToNdc(\n screenPt: Point.Point,\n image: FrameImageLike,\n ): Point.Point {\n const framePt = this.transformPointToFrame(screenPt, image);\n return Point.create(\n (framePt.x / image.imageAttr.frameDimensions.width) * 2 - 1,\n -(framePt.y / image.imageAttr.frameDimensions.height) * 2 + 1,\n );\n }\n\n /**\n * Computes a rectangle that is scaled correctly to be drawn within the\n * viewport.\n *\n * @param image The image to be drawn.\n * @param imageDimensions The dimensions of the received image.\n * @returns A rectangle.\n */\n public calculateDrawRect(image: FrameImageLike): Rectangle.Rectangle {\n const { x: scaleX, y: scaleY } = this.calculateFrameScale(image);\n return Rectangle.scale(image.imageAttr.imageRect, scaleX, scaleY);\n }\n\n private calculateFrameScale(image: FrameImageLike): Point.Point {\n const { frameDimensions: dimensions } = image.imageAttr;\n\n const imageRect = Rectangle.fromDimensions(dimensions);\n const viewport = Rectangle.fromDimensions(this.dimensions);\n const fit = Rectangle.containFit(viewport, imageRect);\n\n const scaleX = fit.width / imageRect.width;\n const scaleY = fit.height / imageRect.height;\n\n return Point.create(scaleX, scaleY);\n }\n\n public get dimensions(): Dimensions.Dimensions {\n return Dimensions.create(this.width, this.height);\n }\n}\n"],"names":["Dimensions","Point","Vector3","Ray","Rectangle"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["src/lib/transforms/transformation-delta.ts"],"sourcesContent":["import { Matrix4, Quaternion, Vector3 } from '@vertexvis/geometry';\n\nexport const ALMOST_ONE = 0.9999;\n\n/**\n * For any single normal vector, there are an infinite number of potential orthogonal vectors. This function will\n * calculate a single vector evaluating the length of two candidates, and picking the one with the higher squared magnitude\n * @param normal\n * @returns\n */\nexport function calculateOrthogonalCoordinate(\n norm: Vector3.Vector3
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["src/lib/transforms/transformation-delta.ts"],"sourcesContent":["import { Matrix4, Quaternion, Vector3 } from '@vertexvis/geometry';\n\nexport const ALMOST_ONE = 0.9999;\n\n/**\n * For any single normal vector, there are an infinite number of potential orthogonal vectors. This function will\n * calculate a single vector evaluating the length of two candidates, and picking the one with the higher squared magnitude\n * @param normal\n * @returns\n */\nexport function calculateOrthogonalCoordinate(\n norm: Vector3.Vector3,\n): Vector3.Vector3 {\n const orthogonalCandidate0 = Vector3.create(0, norm.z, -norm.y);\n const orthogonalCandidate1 = Vector3.create(-norm.z, 0, norm.x);\n\n const theChosenOne =\n Vector3.magnitudeSquared(orthogonalCandidate0) >\n Vector3.magnitudeSquared(orthogonalCandidate1)\n ? orthogonalCandidate0\n : orthogonalCandidate1;\n\n return Vector3.normalize(Vector3.cross(norm, theChosenOne));\n}\n\n/**\n * Computes the rotation matrix for two normals. If both normals are neither parallel nor anti-parallel,\n * this will compute the rotation matrix delta based on the angle from both normals.\n * If the normals are anti-parallel, the identity matrix will be returned, as no rotation is necessary in this case.\n * If the normals are parallel, an axis direction based on a chosen orthogonal vector will be used\n * to compute the rotation matrix to rotate the plane 180 degrees.\n * @param normal1\n * @param normal2\n * @returns an anti-parallel rotation Matrix4 between the given normals\n */\nexport function computeRotationMatrix(\n normal1: Vector3.Vector3,\n normal2: Vector3.Vector3,\n): Matrix4.Matrix4 {\n const dot = Vector3.dot(normal1, normal2);\n // the angle is almost 0 in this case.\n if (dot > ALMOST_ONE) {\n const axisDirection = calculateOrthogonalCoordinate(normal1);\n\n const quaternion = Quaternion.fromAxisAngle(axisDirection, Math.PI);\n return Matrix4.makeRotation(quaternion);\n }\n // the angle is almost 180 in this case.\n else if (dot <= -ALMOST_ONE) {\n return Matrix4.makeIdentity();\n }\n // the angle is between 0 & 180\n else {\n const angle = Vector3.angleTo(normal2, normal1);\n const axisDirection = Vector3.normalize(Vector3.cross(normal1, normal2));\n return Matrix4.makeRotation(\n Quaternion.fromAxisAngle(axisDirection, angle + Math.PI),\n );\n }\n}\n\n/**\n * Computes the translation & rotation matrix delta between two world positions and two normals.\n * such that the computed translation matrix will be the delta between position 1 and position 2,\n * and the rotation will be rotated to be anti-parallel.\n *\n * @param normal1\n * @param position1\n * @param normal2\n * @param position2\n *\n * @returns Matrix4 translation matrix delta from position1 to\n * position2 & an anti-parallel rotation delta.\n */\nexport function computeTransformationDelta(\n normal1: Vector3.Vector3,\n position1: Vector3.Vector3,\n normal2: Vector3.Vector3,\n position2: Vector3.Vector3,\n): Matrix4.Matrix4 {\n const rotationMatrix = computeRotationMatrix(normal1, normal2);\n\n const translationDeltaMatrix = Matrix4.makeTranslation(position2);\n return Matrix4.multiply(\n Matrix4.multiply(translationDeltaMatrix, rotationMatrix),\n Matrix4.makeTranslation(Vector3.negate(position1)),\n );\n}\n"],"names":["Vector3","quaternion","Quaternion","Matrix4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,UAAU,GAAG,MAAM;AAEhC;;;;;AAKG;AACG,SAAU,6BAA6B,CAC3C,IAAqB,EAAA;AAErB,IAAA,MAAM,oBAAoB,GAAGA,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/D,IAAA,MAAM,oBAAoB,GAAGA,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAE/D,IAAA,MAAM,YAAY,GAChBA,OAAO,CAAC,gBAAgB,CAAC,oBAAoB,CAAC;AAC9C,QAAAA,OAAO,CAAC,gBAAgB,CAAC,oBAAoB;AAC3C,UAAE;UACA,oBAAoB;AAE1B,IAAA,OAAOA,OAAO,CAAC,SAAS,CAACA,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAC7D;AAEA;;;;;;;;;AASG;AACG,SAAU,qBAAqB,CACnC,OAAwB,EACxB,OAAwB,EAAA;IAExB,MAAM,GAAG,GAAGA,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC;;AAEzC,IAAA,IAAI,GAAG,GAAG,UAAU,EAAE;AACpB,QAAA,MAAM,aAAa,GAAG,6BAA6B,CAAC,OAAO,CAAC;AAE5D,QAAA,MAAMC,YAAU,GAAGC,UAAU,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,EAAE,CAAC;AACnE,QAAA,OAAOC,OAAO,CAAC,YAAY,CAACF,YAAU,CAAC;;;AAGpC,SAAA,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE;AAC3B,QAAA,OAAOE,OAAO,CAAC,YAAY,EAAE;;;SAG1B;QACH,MAAM,KAAK,GAAGH,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;AAC/C,QAAA,MAAM,aAAa,GAAGA,OAAO,CAAC,SAAS,CAACA,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACxE,QAAA,OAAOG,OAAO,CAAC,YAAY,CACzBD,UAAU,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,CACzD;;AAEL;AAEA;;;;;;;;;;;;AAYG;AACG,SAAU,0BAA0B,CACxC,OAAwB,EACxB,SAA0B,EAC1B,OAAwB,EACxB,SAA0B,EAAA;IAE1B,MAAM,cAAc,GAAG,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC;IAE9D,MAAM,sBAAsB,GAAGC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC;IACjE,OAAOA,OAAO,CAAC,QAAQ,CACrBA,OAAO,CAAC,QAAQ,CAAC,sBAAsB,EAAE,cAAc,CAAC,EACxDA,OAAO,CAAC,eAAe,CAACH,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CACnD;AACH;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{h as i,r as t,c as s,H as n,a as o}from"./p-CCVkga9Q.js";import{p as l,v as h,r as e,b as r,a,m as d,h as u,g as v,q as c,e as f,c as w}from"./p-CkIzrpO0.js";import{c as p}from"./p-Dw4-tG-V.js";import{w as x,r as g}from"./p-BxtKMwBH.js";import{T as y}from"./p-D_ixWHO7.js";import{A as m,D as z}from"./p-Dp56p_jX.js";import"./p-BAhfr1Nx.js";import{E as b}from"./p-Ct0GdHoc.js";import{d as T,T as C,R as D,e as R,r as A,s as P,x as j,A as S,b as E,y as O,z as H,f as F,g as I,h as N,i as B,j as U}from"./p-F8e15or2.js";import"./p-CG9AChtV.js";import"./p-Og6pwwEB.js";import"./p-BRPkbTVP.js";import"./p-BsBIynwj.js";function $(i){if(window.document.activeElement!==i){i.focus();i.setSelectionRange(i.value.length,i.value.length)}}function k(i,t){return t!=null?l.create(i.x-t.left,i.y-t.top):undefined}function M(i,t,s,n){const o=n!=null?h.fromMatrixPosition(n):undefined;if(i!=null&&t!=null&&s!=null&&o!=null){const n=s.transformPointToRay(i,t.image,t.scene.camera);if(t.scene.camera.isOrthographic()){const i=e.at(e.create({origin:o,direction:t.scene.camera.direction}),h.magnitude(t.scene.camera.viewVector)*2);return e.intersectPlane(n,r.fromNormalAndCoplanarPoint(t.scene.camera.direction,i))}else{return e.intersectPlane(n,r.fromNormalAndCoplanarPoint(t.scene.camera.direction,o))}}return undefined}function _(i,t,s,n,o,l){return d.multiply(i,V(t,s,n,o,l))}function V(i,t,s,n,o){const l=new z(n);const e=new m(o);const r=()=>e.convertFrom(t-s);const a=()=>l.convertRealValueToWorld(t-s);switch(i){case"x-translate":return d.makeTranslation(h.create(a(),0,0));case"y-translate":return d.makeTranslation(h.create(0,a(),0));case"z-translate":return d.makeTranslation(h.create(0,0,a()));case"x-rotate":return d.makeRotation(c.fromAxisAngle(h.left(),r()));case"y-rotate":return d.makeRotation(c.fromAxisAngle(h.down(),r()));case"z-rotate":return d.makeRotation(c.fromAxisAngle(h.forward(),r()));default:return d.makeIdentity()}}function q(i){switch(i){case"x-rotate":return"xyz";case"y-rotate":return"yzx";case"z-rotate":return"zxy";default:return"xyz"}}function J(i,t,s,n,o){const l=new z(n);const e=new m(o);const r=()=>d.makeRotation(c.fromMatrixRotation(t));const v=()=>d.multiply(t,d.invert(s));const f=()=>h.transformMatrix(h.fromMatrixPosition(v()),d.invert(r()));const w=()=>u.fromRotationMatrix(d.multiply(d.invert(r()),s),q(i));switch(i){case"x-translate":return l.convertWorldValueToReal(f().x);case"y-translate":return l.convertWorldValueToReal(f().y);case"z-translate":return l.convertWorldValueToReal(f().z);case"x-rotate":return e.convertTo(a.normalizeRadians(w().x));case"y-rotate":return e.convertTo(a.normalizeRadians(w().y));case"z-rotate":return e.convertTo(a.normalizeRadians(w().z));default:return 0}}function X(i,t,s,n,o,l){return G(i,h.subtract(s,t),n,o,l)}function G(i,t,s,n,o){switch(o){case"x-translate":return Y(i,t,h.right());case"y-translate":return Y(i,t,h.up());case"z-translate":return Y(i,t,h.back());case"xy-translate":return Z(i,t,h.create(0,0,1));case"xz-translate":return Z(i,t,h.create(0,1,0));case"yz-translate":return Z(i,t,h.create(1,0,0));case"x-rotate":return K(i,s,h.right(),n);case"y-rotate":return K(i,s,h.up(),n);case"z-rotate":return K(i,s,h.forward(),n);default:return i}}function K(i,t,s,n){const o=L(i,t,s);const l=c.fromAxisAngle(o,n);const h=d.makeRotation(l);return d.multiply(i,h)}function L(i,t,s){const n=d.makeRotation(c.fromMatrixRotation(i));const o=h.transformMatrix(s,n);const l=h.transformMatrix(h.negate(s),n);return h.dot(t,o)>h.dot(t,l)?s:h.negate(s)}function Y(i,t,s){const n=h.normalize(s);const o=d.makeRotation(c.fromMatrixRotation(i));const l=h.transformMatrix(n,o);const e=h.project(t,l);const r=d.makeTranslation(e);return d.multiply(r,i)}function Z(i,t,s){const n=h.normalize(s);const o=d.makeRotation(c.fromMatrixRotation(i));const l=h.transformMatrix(n,o);const e=h.fromMatrixPosition(i);const a=r.fromNormalAndCoplanarPoint(l,e);const u=r.projectPoint(a,t);const v=h.add(u,h.scale(a.constant,a.normal));const f=d.makeTranslation(v);return d.multiply(f,i)}function Q(i,t,s){if(s.length===0){throw new Error("Unable to compute input position. At least one shape point must be provided.")}const n=v.pad(t,5);const o=s.map((t=>i.transformNdcPointToViewport(t)));const h=v.topLeft(n);const e=l.add(h,l.create(n.width,0));const r=v.bottomRight(n);const a=l.subtract(r,l.create(n.width,0));const d=l.scale(o.reduce(((i,t)=>l.add(i,t)),l.create()),1/o.length,1/o.length);const u=[e,a,r].reduce(((i,t)=>l.distance(d,t)<l.distance(d,i)?t:i),h);switch(u){case h:return{point:u,placement:"top-left"};case e:return{point:u,placement:"top-right"};case a:return{point:u,placement:"bottom-left"};default:return{point:u,placement:"bottom-right"}}}function W(i,t,s,n,o,l){const h=t==="alt"&&i.altKey||t==="ctrl"&&i.ctrlKey||t==="meta"&&i.metaKey||t==="shift"&&i.shiftKey;if(h&&l!=null&&l>0&&Number.isInteger(l)){const i=s-n;const t=a.toDegrees(i);const h=Math.round(t/l)*l;if(o!=null){const i=Math.round(o/l)*l;const t=o-i;const s=h-t;const e=a.toRadians(s);return e+n}else{const i=a.toRadians(h);return i+n}}else{return s}}const ii=({ref:t,bounds:s,viewport:n,point:o,placement:l,displayUnit:h},e)=>{const r=ni(n,s!==null&&s!==void 0?s:f.create(0,0),o,l);return i("div",{ref:t,class:"widget-input wrapper",style:{...r,height:(s===null||s===void 0?void 0:s.height)!=null?`${s.height}px`:undefined}},e,i("div",{class:"widget-input units"},h.unit.abbreviatedName))};const ti=({ref:t,identifier:s,disabled:n,onChange:o,onIncrement:l,onDecrement:h,onBlur:e,onUndo:r})=>{const a=i=>{if(i.target!=null){const t=parseFloat(i.target.value);if(!isNaN(t)){o===null||o===void 0?void 0:o(parseFloat(i.target.value))}}};const d=i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="ArrowUp"){l===null||l===void 0?void 0:l()}else if(i.key==="ArrowDown"){h===null||h===void 0?void 0:h()}else if(i.key==="z"&&t&&r){i.preventDefault();r()}};return i("input",{ref:t,disabled:n,class:`widget-input ${s}`,type:"text",onChange:a,onKeyDown:d,onBlur:e})};function si(i,t){return Math.min(i,Math.max(0,t))}function ni(i,t,s,n,o=5){const{width:l,height:h}=i.dimensions;const e=t.width+o;const r=t.height+o;function a(i){return`${i}px`}switch(n){case"top-left":return{right:a(si(l-e,l-s.x)),bottom:a(si(h-r,h-s.y))};case"top-right":return{left:a(si(l-e,s.x)),bottom:a(si(h-r,h-s.y))};case"bottom-left":return{right:a(si(l-e,l-s.x)),top:a(si(h-r,s.y))};case"bottom-right":default:return{left:a(si(l-e,s.x)),top:a(si(h-r,s.y))}}}function oi(i,t,s=3,n=1,o=1){return ei(i,t,h.back(),h.up(),s,n,o)}function li(i,t,s=3,n=1,o=1){return ei(i,t,h.right(),h.back(),s,n,o)}function hi(i,t,s=3,n=1,o=1){return ei(i,t,h.right(),h.up(),s,n,o)}function ei(i,t,s,n,o,l=1,r=1){const u=h.transformMatrix(h.add(s,n),d.makeRotation(c.fromMatrixRotation(i)));const v=h.transformMatrix(s,d.makeRotation(c.fromMatrixRotation(i)));const f=h.transformMatrix(n,d.makeRotation(c.fromMatrixRotation(i)));const w=10*r**.25;const p=h.fromMatrixPosition(i);const x=h.add(p,h.scale(o*w,u));const g=e.create({origin:x,direction:v});const y=e.create({origin:x,direction:f});const m=h.cross(v,f);const z=h.rotateAboutAxis(a.toRadians(45),e.at(y,-(o*l)),m,x);const b=h.rotateAboutAxis(a.toRadians(45),e.at(g,o*l),m,x);const C=h.rotateAboutAxis(a.toRadians(45),e.at(y,o*l),m,x);const D=h.rotateAboutAxis(a.toRadians(45),e.at(g,-(o*l)),m,x);return new T(h.dot(v,t.direction)!==-1&&h.dot(f,t.direction)!==-1,z,D,b,C,h.transformMatrix(z,t.projectionViewMatrix),h.transformMatrix(D,t.projectionViewMatrix),h.transformMatrix(b,t.projectionViewMatrix),h.transformMatrix(C,t.projectionViewMatrix))}function ri(i,t,s,n){if(i instanceof C){return ai(i,t,s,n)}return false}function ai(i,t,s,n){return di([i.points.worldLeft,i.points.worldRight,i.points.worldTip],t,s,n)||di([i.points.worldLeft,i.points.worldRight,i.points.worldBase],t,s,n)}function di(i,t,s,n){var o;if(i.length===3){const l=s.transformPointToRay(n,t.image,t.scene.camera);const e=h.subtract(i[1],i[0]);const r=h.subtract(i[2],i[0]);const a=w.epsilon((o=w.fromVectors([l.direction,l.origin,e,r]))!==null&&o!==void 0?o:w.create(e,r));const d=h.cross(l.direction,r);const u=h.dot(e,d);if(!(Math.abs(u)>=a)){return false}const v=h.subtract(l.origin,i[0]);const c=h.dot(v,d)/u;if(c<0||c>1){return false}const f=h.cross(v,e);const p=h.dot(l.direction,f)/u;if(p<0||c+p>1){return false}const x=h.dot(r,f)/u;return!isNaN(x)&&(x>0||t.scene.camera.isOrthographic())}return false}class ui extends D{constructor(i,t={},s={}){var n,o,l,h,e,r,a,d,u,v,c,f,w,p;super(i);this.customization=t;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 b;this.xArrowFillColor=(n=t.colors)===null||n===void 0?void 0:n.xArrow;this.yArrowFillColor=(o=t.colors)===null||o===void 0?void 0:o.yArrow;this.zArrowFillColor=(l=t.colors)===null||l===void 0?void 0:l.zArrow;this.hoveredArrowFillColor=(h=t.colors)===null||h===void 0?void 0:h.hovered;this.outlineColor=(e=t.colors)===null||e===void 0?void 0:e.outline;this.disabledAxis.xTranslation=(r=s.xTranslation)!==null&&r!==void 0?r:false;this.disabledAxis.yTranslation=(a=s.yTranslation)!==null&&a!==void 0?a:false;this.disabledAxis.zTranslation=(d=s.zTranslation)!==null&&d!==void 0?d:false;this.disabledAxis.xyTranslation=(u=s.xyTranslation)!==null&&u!==void 0?u:false;this.disabledAxis.xzTranslation=(v=s.xzTranslation)!==null&&v!==void 0?v:false;this.disabledAxis.yzTranslation=(c=s.yzTranslation)!==null&&c!==void 0?c:false;this.disabledAxis.xRotation=(f=s.xRotation)!==null&&f!==void 0?f:false;this.disabledAxis.yRotation=(w=s.yRotation)!==null&&w!==void 0?w:false;this.disabledAxis.zRotation=(p=s.zRotation)!==null&&p!==void 0?p:false}dispose(){var i;(i=this.reglFrameDisposable)===null||i===void 0?void 0:i.cancel()}getDrawableElements(){return this.drawableElements}getFullBounds(){return this.fullBounds}boundsContainsPoint(i){return this.interactiveBounds!=null&&this.frame!=null&&v.containsPoints(this.interactiveBounds,i)}updateDisabledAxis(i){this.disabledAxis={...this.disabledAxis,...i};this.updateDisabledOnDrawables()}updateCursor(i){this.cursor=i;if(i!=null&&this.frame!=null){this.updateHovered()}else{this.clearHovered()}}updateTransform(i){var t;this.transform=i;if(i!=null&&this.frame!=null){this.updateAndDraw()}else{this.clear();(t=this.reglFrameDisposable)===null||t===void 0?void 0:t.cancel();this.reglFrameDisposable=undefined}}updateColors(i={}){var t,s,n,o,l,h,e,r,a,d,u,v,c,f,w,p;this.xArrowFillColor=(t=i.xArrow)!==null&&t!==void 0?t:this.xArrowFillColor;this.yArrowFillColor=(s=i.yArrow)!==null&&s!==void 0?s:this.yArrowFillColor;this.zArrowFillColor=(n=i.zArrow)!==null&&n!==void 0?n:this.zArrowFillColor;this.twoAxesSquareFillColor=(o=i.twoAxesSquare)!==null&&o!==void 0?o:this.twoAxesSquareFillColor;this.hoveredArrowFillColor=(l=i.hovered)!==null&&l!==void 0?l:this.hoveredArrowFillColor;this.outlineColor=(h=i.outline)!==null&&h!==void 0?h:this.outlineColor;(e=this.xArrow)===null||e===void 0?void 0:e.updateFillColor(this.getXTranslationColor(),true);(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor(this.getYTranslationColor(),true);(a=this.zArrow)===null||a===void 0?void 0:a.updateFillColor(this.getZTranslationColor(),true);(d=this.xRotation)===null||d===void 0?void 0:d.updateFillColor(this.getXRotationColor(),true);(u=this.yRotation)===null||u===void 0?void 0:u.updateFillColor(this.getYRotationColor(),true);(v=this.zRotation)===null||v===void 0?void 0:v.updateFillColor(this.getZRotationColor(),true);(c=this.xyTranslation)===null||c===void 0?void 0:c.updateFillColor(this.getTwoAxesTranslationColor(),true);(f=this.xzTranslation)===null||f===void 0?void 0:f.updateFillColor(this.getTwoAxesTranslationColor(),true);(w=this.yzTranslation)===null||w===void 0?void 0:w.updateFillColor(this.getTwoAxesTranslationColor(),true);(p=this.hoveredElement)===null||p===void 0?void 0:p.updateFillColor(this.hoveredArrowFillColor)}updateScalars(i){this.customization={...this.customization,scalars:i};if(this.transform!=null&&this.frame!=null){this.updateElements(this.transform,this.frame)}}onHoveredChanged(i){return this.hoveredChanged.on(i)}updateDisabledOnDrawables(){var i,t,s,n,o,l,h,e,r,a,d,u,v,c,f;(i=this.xRotation)===null||i===void 0?void 0:i.setDisabled(this.disabledAxis.xRotation);(t=this.xyRotationLine)===null||t===void 0?void 0:t.setDisabled(this.disabledAxis.xRotation);(s=this.xzRotationLine)===null||s===void 0?void 0:s.setDisabled(this.disabledAxis.xRotation);(n=this.yRotation)===null||n===void 0?void 0:n.setDisabled(this.disabledAxis.yRotation);(o=this.yzRotationLine)===null||o===void 0?void 0:o.setDisabled(this.disabledAxis.yRotation);(l=this.yxRotationLine)===null||l===void 0?void 0:l.setDisabled(this.disabledAxis.yRotation);(h=this.zRotation)===null||h===void 0?void 0:h.setDisabled(this.disabledAxis.zRotation);(e=this.zxRotationLine)===null||e===void 0?void 0:e.setDisabled(this.disabledAxis.zRotation);(r=this.zyRotationLine)===null||r===void 0?void 0:r.setDisabled(this.disabledAxis.zRotation);(a=this.xArrow)===null||a===void 0?void 0:a.setDisabled(this.disabledAxis.xTranslation);(d=this.yArrow)===null||d===void 0?void 0:d.setDisabled(this.disabledAxis.yTranslation);(u=this.zArrow)===null||u===void 0?void 0:u.setDisabled(this.disabledAxis.zTranslation);(v=this.xyTranslation)===null||v===void 0?void 0:v.setDisabled(this.disabledAxis.xyTranslation);(c=this.xzTranslation)===null||c===void 0?void 0:c.setDisabled(this.disabledAxis.xzTranslation);(f=this.yzTranslation)===null||f===void 0?void 0:f.setDisabled(this.disabledAxis.yzTranslation);this.updateColors()}updateHovered(){var i,t,s,n,o,l,h,e,r,a;const d=this.hoveredElement;const u=this.frame;if(u!=null){this.hoveredElement=[...this.translationMeshes,...this.rotationMeshes].filter((i=>i.points.valid&&!i.isDisabled())).find((i=>this.cursor!=null?ri(i,u,this.viewport,this.cursor):false));if(this.hoveredElement!==d){this.hoveredChanged.emit(this.hoveredElement);(i=this.hoveredElement)===null||i===void 0?void 0:i.updateFillColor(this.hoveredArrowFillColor);this.clearFillColorOfPreviouslyHovered(d);if(((t=this.hoveredElement)===null||t===void 0?void 0:t.identifier)==="xy-translate"){(s=this.xArrow)===null||s===void 0?void 0:s.updateFillColor(this.hoveredArrowFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor(this.hoveredArrowFillColor)}else if(((o=this.hoveredElement)===null||o===void 0?void 0:o.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor(this.hoveredArrowFillColor);(h=this.zArrow)===null||h===void 0?void 0:h.updateFillColor(this.hoveredArrowFillColor)}else if(((e=this.hoveredElement)===null||e===void 0?void 0:e.identifier)==="yz-translate"){(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor(this.hoveredArrowFillColor);(a=this.zArrow)===null||a===void 0?void 0:a.updateFillColor(this.hoveredArrowFillColor)}}}}clearHovered(){const i=this.hoveredElement;this.hoveredElement=undefined;if(this.hoveredElement!==i){this.hoveredChanged.emit(this.hoveredElement);this.clearFillColorOfPreviouslyHovered(i)}}clearFillColorOfPreviouslyHovered(i){var t,s,n,o,l,h,e,r,a,d,u,v;i===null||i===void 0?void 0:i.updateFillColor(i===null||i===void 0?void 0:i.initialFillColor);if((i===null||i===void 0?void 0:i.identifier)==="xy-translate"){(t=this.xArrow)===null||t===void 0?void 0:t.updateFillColor((s=this.xArrow)===null||s===void 0?void 0:s.initialFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor((o=this.yArrow)===null||o===void 0?void 0:o.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor((h=this.xArrow)===null||h===void 0?void 0:h.initialFillColor);(e=this.zArrow)===null||e===void 0?void 0:e.updateFillColor((r=this.zArrow)===null||r===void 0?void 0:r.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="yz-translate"){(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor((d=this.yArrow)===null||d===void 0?void 0:d.initialFillColor);(u=this.zArrow)===null||u===void 0?void 0:u.updateFillColor((v=this.zArrow)===null||v===void 0?void 0:v.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=R(this.viewport,...this.rotationMeshes,...this.translationMeshes);this.fullBounds=R(this.viewport,...this.rotationMeshes,...this.translationMeshes,...this.axisLines)}}createElements(i,t){var s,n,o,l,e,r,a,d,u,v,c,f;this.reglCommand=A({canvas:this.canvasElement,extensions:"angle_instanced_arrays"});const{createShape:w}=P(this.reglCommand);const p=this.computeTriangleSize(h.fromMatrixPosition(i),t);this.xArrow=new C(w,"x-translate",j(i,t.scene.camera,p,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation),this.outlineColor,this.getXTranslationColor());this.xRotation=new C(w,"x-rotate",oi(i,t.scene.camera,p,(n=this.customization.scalars)===null||n===void 0?void 0:n.xRotation,(o=this.customization.scalars)===null||o===void 0?void 0:o.xTranslation),this.outlineColor,this.getXRotationColor());this.xAxis=new S(w,"x-axis",E(i,t.scene.camera,this.xArrow),this.outlineColor,this.getXTranslationColor());this.yArrow=new C(w,"y-translate",O(i,t.scene.camera,p,(l=this.customization.scalars)===null||l===void 0?void 0:l.yTranslation),this.outlineColor,this.getYTranslationColor());this.yRotation=new C(w,"y-rotate",li(i,t.scene.camera,p,(e=this.customization.scalars)===null||e===void 0?void 0:e.yRotation,(r=this.customization.scalars)===null||r===void 0?void 0:r.yTranslation),this.outlineColor,this.getYRotationColor());this.yAxis=new S(w,"y-axis",E(i,t.scene.camera,this.yArrow),this.outlineColor,this.getYTranslationColor());this.zArrow=new C(w,"z-translate",H(i,t.scene.camera,p,(a=this.customization.scalars)===null||a===void 0?void 0:a.zTranslation),this.outlineColor,this.getZTranslationColor());this.zAxis=new S(w,"z-axis",E(i,t.scene.camera,this.zArrow),this.outlineColor,this.getZTranslationColor());this.zRotation=new C(w,"z-rotate",hi(i,t.scene.camera,p,(d=this.customization.scalars)===null||d===void 0?void 0:d.zRotation,(u=this.customization.scalars)===null||u===void 0?void 0:u.zTranslation),this.outlineColor,this.getZRotationColor());this.xyTranslation=new C(w,"xy-translate",F(i,t.scene.camera,p,(v=this.customization.scalars)===null||v===void 0?void 0:v.xyTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.xzTranslation=new C(w,"xz-translate",I(i,t.scene.camera,p,(c=this.customization.scalars)===null||c===void 0?void 0:c.xzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.yzTranslation=new C(w,"yz-translate",N(i,t.scene.camera,p,(f=this.customization.scalars)===null||f===void 0?void 0:f.yzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.createRotationLines(w,i,t);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(i,t,s){var n,o,l,e,r,a;const d=this.computeTriangleSize(h.fromMatrixPosition(t),s);const u=B(s.scene.camera,this.xRotation,(n=this.yArrow)===null||n===void 0?void 0:n.points.worldTip,d);const v=B(s.scene.camera,this.xRotation,(o=this.zArrow)===null||o===void 0?void 0:o.points.worldTip,d);const c=B(s.scene.camera,this.yRotation,(l=this.xArrow)===null||l===void 0?void 0:l.points.worldTip,d);const f=B(s.scene.camera,this.yRotation,(e=this.zArrow)===null||e===void 0?void 0:e.points.worldTip,d);const w=B(s.scene.camera,this.zRotation,(r=this.xArrow)===null||r===void 0?void 0:r.points.worldTip,d);const p=B(s.scene.camera,this.zRotation,(a=this.yArrow)===null||a===void 0?void 0:a.points.worldTip,d);if(u!=null){this.xyRotationLine=new U(i,"xy-rotation-line",u,this.outlineColor)}if(v!=null){this.xzRotationLine=new U(i,"xz-rotation-line",v,this.outlineColor)}if(c!=null){this.yxRotationLine=new U(i,"yx-rotation-line",c,this.outlineColor)}if(f!=null){this.yzRotationLine=new U(i,"yz-rotation-line",f,this.outlineColor)}if(w!=null){this.zxRotationLine=new U(i,"zx-rotation-line",w,this.outlineColor)}if(p!=null){this.zyRotationLine=new U(i,"zy-rotation-line",p,this.outlineColor)}this.rotationLines=[this.xyRotationLine,this.xzRotationLine,this.yxRotationLine,this.yzRotationLine,this.zxRotationLine,this.zyRotationLine].filter((i=>i!=null))}updateElements(i,t){var s,n,o,l,e,r,a,d,u,v,c,f,w,p,x,g,y,m,z,b,T,C,D,R,A,P,S,U,$,k;const M=this.computeTriangleSize(h.fromMatrixPosition(i),t);if(this.xArrow!=null){this.xArrow.updatePoints(j(i,t.scene.camera,M,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation));(n=this.xAxis)===null||n===void 0?void 0:n.updatePoints(E(i,t.scene.camera,this.xArrow))}(o=this.xRotation)===null||o===void 0?void 0:o.updatePoints(oi(i,t.scene.camera,M,(l=this.customization.scalars)===null||l===void 0?void 0:l.xRotation,(e=this.customization.scalars)===null||e===void 0?void 0:e.xTranslation));if(this.yArrow!=null){this.yArrow.updatePoints(O(i,t.scene.camera,M,(r=this.customization.scalars)===null||r===void 0?void 0:r.yTranslation));(a=this.yAxis)===null||a===void 0?void 0:a.updatePoints(E(i,t.scene.camera,this.yArrow))}(d=this.yRotation)===null||d===void 0?void 0:d.updatePoints(li(i,t.scene.camera,M,(u=this.customization.scalars)===null||u===void 0?void 0:u.yRotation,(v=this.customization.scalars)===null||v===void 0?void 0:v.yTranslation));if(this.zArrow!=null){this.zArrow.updatePoints(H(i,t.scene.camera,M,(c=this.customization.scalars)===null||c===void 0?void 0:c.zTranslation));(f=this.zAxis)===null||f===void 0?void 0:f.updatePoints(E(i,t.scene.camera,this.zArrow))}(w=this.zRotation)===null||w===void 0?void 0:w.updatePoints(hi(i,t.scene.camera,M,(p=this.customization.scalars)===null||p===void 0?void 0:p.zRotation,(x=this.customization.scalars)===null||x===void 0?void 0:x.zTranslation));(g=this.xyRotationLine)===null||g===void 0?void 0:g.updatePoints(B(t.scene.camera,this.xRotation,(y=this.yArrow)===null||y===void 0?void 0:y.points.worldTip,M));(m=this.xzRotationLine)===null||m===void 0?void 0:m.updatePoints(B(t.scene.camera,this.xRotation,(z=this.zArrow)===null||z===void 0?void 0:z.points.worldTip,M));(b=this.yxRotationLine)===null||b===void 0?void 0:b.updatePoints(B(t.scene.camera,this.yRotation,(T=this.xArrow)===null||T===void 0?void 0:T.points.worldTip,M));(C=this.yzRotationLine)===null||C===void 0?void 0:C.updatePoints(B(t.scene.camera,this.yRotation,(D=this.zArrow)===null||D===void 0?void 0:D.points.worldTip,M));(R=this.zxRotationLine)===null||R===void 0?void 0:R.updatePoints(B(t.scene.camera,this.zRotation,(A=this.xArrow)===null||A===void 0?void 0:A.points.worldTip,M));(P=this.zyRotationLine)===null||P===void 0?void 0:P.updatePoints(B(t.scene.camera,this.zRotation,(S=this.yArrow)===null||S===void 0?void 0:S.points.worldTip,M));if(this.xyTranslation!=null){this.xyTranslation.updatePoints(F(i,t.scene.camera,M,(U=this.customization.scalars)===null||U===void 0?void 0:U.xyTranslation))}if(this.xzTranslation!=null){this.xzTranslation.updatePoints(I(i,t.scene.camera,M,($=this.customization.scalars)===null||$===void 0?void 0:$.xzTranslation))}if(this.yzTranslation!=null){this.yzTranslation.updatePoints(N(i,t.scene.camera,M,(k=this.customization.scalars)===null||k===void 0?void 0:k.yzTranslation))}}}const vi=()=>`:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-two-axes-square-color:var(--two-axes-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:8em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;pointer-events:auto;display:flex;align-items:center;border:1px solid #444444;border-radius:4px;width:var(--viewer-transform-widget-input-width);text-align:center;background-color:white;box-sizing:border-box}.widget-input.units{position:relative;width:25%;height:100%;padding:0 0.25rem;font-size:0.8125rem;color:#444444}input.widget-input{position:relative;text-align:center;box-sizing:border-box;width:75%;height:100%;outline:none;border-width:0 1px 0 0;border-color:#444444;border-radius:2px 0 0 2px;font-size:0.875rem;color:#444444}input.widget-input.x-translate,input.widget-input.x-rotate{border-left:5px solid var(--viewer-transform-widget-x-axis-arrow-color)}input.widget-input.y-translate,input.widget-input.y-rotate{border-left:5px solid var(--viewer-transform-widget-y-axis-arrow-color)}input.widget-input.z-translate,input.widget-input.z-rotate{border-left:5px solid var(--viewer-transform-widget-z-axis-arrow-color)}input.widget-input:disabled{color:#888888}input.widget-input:focus{outline:none}`;const ci=class{constructor(i){t(this,i);this.positionChanged=s(this,"positionChanged");this.rotationChanged=s(this,"rotationChanged");this.interactionEnded=s(this,"interactionEnded");this.interactionStarted=s(this,"interactionStarted");this.xRotationDisabled=false;this.yRotationDisabled=false;this.zRotationDisabled=false;this.xTranslationDisabled=false;this.yTranslationDisabled=false;this.zTranslationDisabled=false;this.xyTranslationDisabled=false;this.xzTranslationDisabled=false;this.yzTranslationDisabled=false;this.showInputs=true;this.distanceUnit="millimeters";this.angleUnit="degrees";this.decimalPlaces=1;this.rotationSnapKey="shift";this.translationHandleScalar=1;this.rotationHandleScalar=1;this.interactionThrottle=75;this.EXPERIMENTAL_undoKeybindings=false;this.inputValue=0;this.isEndingTransform=false;this.xArrowColor="#ea3324";this.yArrowColor="#4faf32";this.zArrowColor="#0000ff";this.twoAxesSquareColor="#e0e0e0";this.hoveredColor="#ffff00";this.lastAngle=0;this.inputShouldFocus=false;this.handleHoveredDrawableChanged=i=>{this.hovered=i};this.handleViewerFrameDrawn=()=>{this.updatePropsFromViewer()};this.handleViewerDimensionsChange=()=>{x((()=>{if(this.viewer!=null&&this.canvasRef!=null){this.canvasRef.width=this.viewer.viewport.width;this.canvasRef.height=this.viewer.viewport.height;this.updateCanvasBounds(this.canvasRef)}}))};this.handleResize=()=>{if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef)}};this.handleInputResize=()=>{if(this.inputWrapperRef!=null){const i=this.inputWrapperRef;g((()=>{this.inputBounds=i.getBoundingClientRect()}))}};this.handleStyleChange=()=>{g((()=>{const i=window.getComputedStyle(this.hostEl);this.xArrowColor=i.getPropertyValue("--viewer-transform-widget-x-axis-arrow-color").trim();this.yArrowColor=i.getPropertyValue("--viewer-transform-widget-y-axis-arrow-color").trim();this.zArrowColor=i.getPropertyValue("--viewer-transform-widget-z-axis-arrow-color").trim();this.twoAxesSquareColor=i.getPropertyValue("--viewer-transform-widget-two-axes-square-color").trim();this.hoveredColor=i.getPropertyValue("--viewer-transform-widget-hovered-arrow-color").trim();this.getTransformWidget().updateColors({xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor})}))};this.handlePointerMove=i=>{if(this.dragging==null){const t=k(l.create(i.clientX,i.clientY),this.getCanvasBounds());const s=this.getTransformWidget();if(t!=null&&s.boundsContainsPoint(t)){s.updateCursor(t)}else{s.updateCursor(undefined);this.hovered=undefined}}};this.handleBeginDrag=async i=>{var t,s,n;const o=this.getCanvasBounds();if(this.hovered!=null&&o!=null&&this.viewer!=null&&this.position!=null&&this.viewer.frame!=null){this.dragging=this.hovered;if(this.dragging.identifier!==((t=this.lastDragged)===null||t===void 0?void 0:t.identifier)){this.inputValue=0;this.dragStartTransform=this.currentTransform;this.updateInputPosition();this.updateInputValue()}this.lastDragged=undefined;const h=k(l.create(i.clientX,i.clientY),o);const e=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);this.lastAngle=h!=null?a.fromPoints(e,h):0;this.lastWorldPosition=M(h,(s=this.viewer)===null||s===void 0?void 0:s.frame,(n=this.viewer)===null||n===void 0?void 0:n.viewport,this.currentTransform);this.interactionStarted.emit();window.removeEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointermove",this.handleDragWithTimer);window.addEventListener("pointerup",this.handleEndTransform)}};this.handleDragWithTimer=async i=>{if(i!=null){i.preventDefault();this.lastMouseEvent=i}if(this.interactionTimer==null){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.handleDrag();this.lastMouseEvent=undefined}),this.interactionThrottle)}};this.handleDrag=async()=>{var i,t,s;const n=this.getCanvasBounds();if(this.dragging!=null&&this.lastWorldPosition!=null&&n!=null&&this.viewer!=null&&this.viewer.frame!=null&&this.position!=null&&this.lastMouseEvent!=null){await((i=this.controller)===null||i===void 0?void 0:i.beginTransform());const o=k(l.create(this.lastMouseEvent.clientX,this.lastMouseEvent.clientY),n);const h=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);const e=M(o,(t=this.viewer)===null||t===void 0?void 0:t.frame,(s=this.viewer)===null||s===void 0?void 0:s.viewport,this.currentTransform);if(e!=null&&o!=null&&h!=null){const i=a.fromPoints(h,o);const t=W(this.lastMouseEvent,this.rotationSnapKey,i,this.lastAngle,this.getDisplayedAngle(),this.rotationSnapDegrees);this.transform(this.lastWorldPosition,e,t-this.lastAngle);this.updateInputPosition();this.updateInputValue();this.lastWorldPosition=e;this.lastAngle=t}}};this.handleEndTransform=async i=>{var t,s;const n=k(l.create(i.clientX,i.clientY),this.getCanvasBounds());const o=this.getTransformWidget();this.lastDragged=this.dragging;this.dragging=undefined;this.lastWorldPosition=undefined;this.lastAngle=0;this.updateInputPosition();this.updateInputValue();o.updateCursor(n);o.updateTransform(this.currentTransform);this.beginEndTransform();window.removeEventListener("pointermove",this.handleDragWithTimer);window.removeEventListener("pointerup",this.handleEndTransform);try{const i=(t=this.controller)===null||t===void 0?void 0:t.getCurrentDelta();await((s=this.controller)===null||s===void 0?void 0:s.endTransform());this.interactionEnded.emit(i)}catch(i){console.error("Failed to end transform interaction",i)}window.addEventListener("pointermove",this.handlePointerMove);this.completeEndTransform()};this.handleInputStep=async i=>{if(this.inputValue!=null&&this.lastInputValue!=null){if(this.isModifyingAngleUnits()){const t=new m(this.angleUnit);const s=t.convertFrom(this.lastInputValue);const n=a.normalizeRadians(s+a.toRadians(i));this.inputValue=t.convertTo(n)}else{this.inputValue=this.lastInputValue+i}await this.updateTransformFromInput(this.inputValue)}};this.handleInputChange=async i=>{await this.updateTransformFromInput(i)};this.handleKeyDown=async i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="z"&&t&&this.EXPERIMENTAL_undoKeybindings){i.stopPropagation();await this.EXPERIMENTAL_undo()}};this.updateTransformFromInput=async i=>{var t,s,n;if(this.lastDragged!=null&&this.currentTransform!=null&&this.startingTransform!=null&&this.lastInputValue!=null){this.currentTransform=_(this.currentTransform,this.lastDragged.identifier,i,this.lastInputValue,this.distanceUnit,this.angleUnit);this.updateInputValue();this.lastInputValue=i;await((t=this.controller)===null||t===void 0?void 0:t.beginTransform());this.getTransformWidget().updateTransform(this.currentTransform);await((s=this.controller)===null||s===void 0?void 0:s.updateTransform(d.multiply(this.currentTransform,d.invert(this.startingTransform))));this.updateInputPosition();await((n=this.controller)===null||n===void 0?void 0:n.endTransformDebounced(this.beginEndTransform,this.completeEndTransform))}};this.updatePropsFromViewer=()=>{const{frame:i}=this.viewer||{};if(i!=null){const t=this.getTransformWidget();t.updateFrame(i,this.dragging==null);this.updateInputPosition()}};this.setupTransformWidget=i=>{var t,s;console.debug(`Initializing transform widget. [initial-position=${JSON.stringify(this.position)}, has-initial-frame=${((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null}]`);const n=this.getTranslationScalar();const o=this.getRotationScalar();this.widget=new ui(i,{colors:{xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor},scalars:{xTranslation:n,yTranslation:n,zTranslation:n,xyTranslation:o,xzTranslation:o,yzTranslation:o,xRotation:o,yRotation:o,zRotation:o}});if(this.rotation!=null){this.currentTransform=this.getTransformForNewRotation(this.rotation);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(this.position!=null){this.currentTransform=this.getTransformForNewPosition(this.position);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(((s=this.viewer)===null||s===void 0?void 0:s.frame)!=null){this.widget.updateFrame(this.viewer.frame,true)}this.handleSettingDisabledAxis();this.hoveredChangeDisposable=this.widget.onHoveredChanged(this.handleHoveredDrawableChanged);return this.widget};this.updateCanvasBounds=i=>{g((()=>{this.canvasBounds=i.getBoundingClientRect();this.getTransformWidget().updateDimensions(i)}))};this.updateInputValue=()=>{var i,t,s;const n=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const o=(n===null||n===void 0?void 0:n.identifier)==="xy-translate"||(n===null||n===void 0?void 0:n.identifier)==="xz-translate"||(n===null||n===void 0?void 0:n.identifier)==="yz-translate";if(n!=null&&this.currentTransform!=null&&this.dragStartTransform!=null&&!o){this.lastInputValue=this.inputValue;this.inputValue=J(n.identifier,this.currentTransform,this.dragStartTransform,this.distanceUnit,this.angleUnit);if(this.inputRef!=null){const i=(s=(t=this.getDisplayedDistance())!==null&&t!==void 0?t:this.getDisplayedAngle())!==null&&s!==void 0?s:0;const n=`${parseFloat(i.toFixed(this.decimalPlaces))}`;this.inputRef.value=n}}};this.updateInputPosition=()=>{var i,t;const s=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const n=(s===null||s===void 0?void 0:s.identifier)==="xy-translate"||(s===null||s===void 0?void 0:s.identifier)==="xz-translate"||(s===null||s===void 0?void 0:s.identifier)==="yz-translate";if(this.showInputs&&((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null&&this.position!=null&&s!=null&&!n){const i=this.getTransformWidget();const t=i.getFullBounds();this.inputPosition=t!=null?Q(this.viewer.viewport,t,s.points.toArray()):undefined}else if(n){this.inputPosition=undefined}};this.beginEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:true,yRotation:true,zRotation:true,xTranslation:true,yTranslation:true,zTranslation:true,xyTranslation:true,xzTranslation:true,yzTranslation:true});this.isEndingTransform=true};this.completeEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled});this.isEndingTransform=false;this.inputShouldFocus=true;if(this.currentTransform!=null){this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=u.fromRotationMatrix(this.currentTransform)}};this.isModifyingAngleUnits=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;return!!(n===null||n===void 0?void 0:n.includes("rotate"))};this.getTranslationScalar=()=>{if(this.translationHandleScalar>0){return this.translationHandleScalar}console.warn("Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getRotationScalar=()=>{if(this.rotationHandleScalar>0){return this.rotationHandleScalar}console.warn("Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getDisplayedUnits=()=>{if(this.isModifyingAngleUnits()){return new m(this.angleUnit)}return new z(this.distanceUnit)};this.getDisplayedAngle=()=>{if(this.isModifyingAngleUnits()){return this.inputValue}};this.getDisplayedDistance=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;if(n===null||n===void 0?void 0:n.includes("translate")){return this.inputValue}};this.getTransformForNewPosition=i=>{if(i!=null){const t=this.currentTransform!=null?this.currentTransform:d.makeIdentity();const s=d.makeRotation(c.fromMatrixRotation(t));const n=d.makeTranslation(i);return d.multiply(n,s)}};this.getTransformForNewRotation=i=>{const t=this.currentTransform!=null?this.currentTransform:d.makeIdentity();const s=d.invert(d.makeRotation(c.fromMatrixRotation(t)));const n=d.makeRotation(c.fromEuler(i));const o=d.multiply(t,s);return d.multiply(o,n)};this.getCanvasBounds=()=>{if(this.canvasBounds!=null){return this.canvasBounds}else if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef);return this.canvasBounds}};this.getTransformWidget=()=>{if(this.widget==null&&this.canvasRef!=null){return this.setupTransformWidget(this.canvasRef)}else if(this.widget!=null){return this.widget}else{throw new Error("Transform widget was not initialized. The canvas element may not have been initialized.")}}}componentDidLoad(){window.addEventListener("pointermove",this.handlePointerMove);this.canvasResizeObserver=new ResizeObserver(this.handleResize);this.inputResizeObserver=new ResizeObserver(this.handleInputResize);this.hostStyleObserver=new MutationObserver(this.handleStyleChange);if(this.canvasRef!=null){this.canvasResizeObserver.observe(this.canvasRef);this.setupTransformWidget(this.canvasRef)}this.hostStyleObserver.observe(this.hostEl,{attributes:true,attributeFilter:["style"]});this.handleViewerChanged(this.viewer,undefined);this.handleStyleChange()}disconnectedCallback(){var i,t,s,n,o;window.removeEventListener("pointermove",this.handlePointerMove);(i=this.canvasResizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.inputResizeObserver)===null||t===void 0?void 0:t.disconnect();(s=this.hostStyleObserver)===null||s===void 0?void 0:s.disconnect();(n=this.hoveredChangeDisposable)===null||n===void 0?void 0:n.dispose();(o=this.widget)===null||o===void 0?void 0:o.dispose()}componentDidRender(){if(this.inputShouldFocus&&this.inputRef!=null){$(this.inputRef);this.inputShouldFocus=false}}async EXPERIMENTAL_undo(){var i,t;const s=await((i=this.controller)===null||i===void 0?void 0:i.EXPERIMENTAL_undoTransform());if(this.currentTransform!=null&&s!=null){this.currentTransform=d.multiply(s,this.currentTransform);(t=this.widget)===null||t===void 0?void 0:t.updateTransform(this.currentTransform);this.updateInputPosition();this.updateInputValue();this.lastInputValue=this.inputValue;this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=u.fromRotationMatrix(this.currentTransform)}}handleViewerChanged(i,t){var s;t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.removeEventListener("dimensionschange",this.handleViewerDimensionsChange);i===null||i===void 0?void 0:i.addEventListener("frameDrawn",this.handleViewerFrameDrawn);i===null||i===void 0?void 0:i.addEventListener("dimensionschange",this.handleViewerDimensionsChange);if((i===null||i===void 0?void 0:i.stream)!=null){(s=this.controller)===null||s===void 0?void 0:s.dispose();this.controller=new y(i.stream)}}handleDisabledPropertyChanged(){var i;(i=this.widget)===null||i===void 0?void 0:i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}handleTransformHandleScalarChanged(){var i;const t=this.getTranslationScalar();const s=this.getRotationScalar();(i=this.widget)===null||i===void 0?void 0:i.updateScalars({xTranslation:t,yTranslation:t,zTranslation:t,xyTranslation:s,xzTranslation:s,yzTranslation:s,xRotation:s,yRotation:s,zRotation:s})}handleRotationChanged(i,t){var s;const n=i!==null&&i!==void 0?i:u.create();this.currentTransform=this.getTransformForNewRotation(n);this.startingTransform=this.currentTransform;if(i==null&&this.currentTransform!=null&&d.isIdentity(this.currentTransform)){this.currentTransform=undefined;this.startingTransform=this.currentTransform}(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);console.debug(`Updating widget rotation [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);this.rotationChanged.emit(i)}handlePositionChanged(i,t){var s,n;this.currentTransform=this.getTransformForNewPosition(i);this.startingTransform=this.currentTransform;console.debug(`Updating widget position [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);if(i==null){this.lastDragged=undefined;this.inputPosition=undefined;(n=this.controller)===null||n===void 0?void 0:n.clearTransform()}this.positionChanged.emit(i)}handleInputFormattingChanged(){this.updateInputValue();this.lastInputValue=this.inputValue}render(){var t,s,o,l,h,e;return i(n,{key:"aa99b642f46da67635bdfb1e22a61f3962446684"},i("canvas",{key:"3ea5a08ee3e8ae427b4010857a2ef9d126197bd6",ref:i=>{this.canvasRef=i},class:p("widget",{hovered:this.hovered!=null}),tabindex:"0",width:(t=this.viewer)===null||t===void 0?void 0:t.viewport.width,height:(s=this.viewer)===null||s===void 0?void 0:s.viewport.height,onPointerDown:this.handleBeginDrag,onKeyDown:this.handleKeyDown}),this.showInputs&&this.inputPosition&&((o=this.viewer)===null||o===void 0?void 0:o.viewport)&&i(ii,{key:"148947fe2816804ec05d3b04e7c45bd722f479f1",ref:i=>{var t,s;if(i!=null){(t=this.inputResizeObserver)===null||t===void 0?void 0:t.observe(i)}else if(this.inputWrapperRef!=null){(s=this.inputResizeObserver)===null||s===void 0?void 0:s.unobserve(this.inputWrapperRef)}this.inputWrapperRef=i},bounds:this.inputBounds,viewport:this.viewer.viewport,point:this.inputPosition.point,placement:this.inputPosition.placement,displayUnit:this.getDisplayedUnits()},i(ti,{key:"db03509252b8e72fb975337274e693cc4d0bebf1",ref:i=>{this.inputRef=i},identifier:(h=(l=this.dragging)===null||l===void 0?void 0:l.identifier)!==null&&h!==void 0?h:(e=this.lastDragged)===null||e===void 0?void 0:e.identifier,disabled:this.isEndingTransform,onChange:this.handleInputChange,onIncrement:()=>this.handleInputStep(1),onDecrement:()=>this.handleInputStep(-1),onBlur:()=>{this.inputShouldFocus=false},onUndo:this.EXPERIMENTAL_undoKeybindings?()=>this.EXPERIMENTAL_undo():undefined})))}transform(i,t,s){var n,o;if(this.position!=null&&this.startingTransform!=null&&this.currentTransform!=null&&this.dragging!=null&&this.viewer!=null&&this.viewer.frame!=null){this.currentTransform=X(this.currentTransform,i,t,(n=this.viewer)===null||n===void 0?void 0:n.frame.scene.camera.viewVector,s,this.dragging.identifier);this.getTransformWidget().updateTransform(this.currentTransform);(o=this.controller)===null||o===void 0?void 0:o.updateTransform(d.multiply(this.currentTransform,d.invert(this.startingTransform)))}}handleSettingDisabledAxis(){if(this.widget){this.widget.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}else{console.warn("Cannot set disabled values - no widget defined")}}get hostEl(){return o(this)}static get watchers(){return{viewer:[{handleViewerChanged:0}],xTranslationDisabled:[{handleDisabledPropertyChanged:0}],yTranslationDisabled:[{handleDisabledPropertyChanged:0}],zTranslationDisabled:[{handleDisabledPropertyChanged:0}],xyTranslationDisabled:[{handleDisabledPropertyChanged:0}],xzTranslationDisabled:[{handleDisabledPropertyChanged:0}],yzTranslationDisabled:[{handleDisabledPropertyChanged:0}],xRotationDisabled:[{handleDisabledPropertyChanged:0}],yRotationDisabled:[{handleDisabledPropertyChanged:0}],zRotationDisabled:[{handleDisabledPropertyChanged:0}],translationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotation:[{handleRotationChanged:0}],position:[{handlePositionChanged:0}],distanceUnit:[{handleInputFormattingChanged:0}],angleUnit:[{handleInputFormattingChanged:0}],decimalPlaces:[{handleInputFormattingChanged:0}]}}};ci.style=vi();export{ci as vertex_viewer_transform_widget};
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{h as i,r as t,c as s,H as n,a as o}from"./p-CCVkga9Q.js";import{p as l,v as h,r as e,b as r,a,m as d,h as u,g as v,q as c,e as f,c as w}from"./p-CkIzrpO0.js";import{c as p}from"./p-Dw4-tG-V.js";import{w as x,r as g}from"./p-BxtKMwBH.js";import{T as y}from"./p-D_ixWHO7.js";import{A as m,D as z}from"./p-Dp56p_jX.js";import"./p-BAhfr1Nx.js";import{E as b}from"./p-Ct0GdHoc.js";import{d as T,T as C,R as D,e as R,r as A,s as P,x as j,A as S,b as E,y as O,z as H,f as F,g as I,h as N,i as B,j as U}from"./p-F8e15or2.js";import"./p-CG9AChtV.js";import"./p-Og6pwwEB.js";import"./p-BRPkbTVP.js";import"./p-BsBIynwj.js";function $(i){if(window.document.activeElement!==i){i.focus();i.setSelectionRange(i.value.length,i.value.length)}}function k(i,t){return t!=null?l.create(i.x-t.left,i.y-t.top):undefined}function M(i,t,s,n){const o=n!=null?h.fromMatrixPosition(n):undefined;if(i!=null&&t!=null&&s!=null&&o!=null){const n=s.transformPointToRay(i,t.image,t.scene.camera);if(t.scene.camera.isOrthographic()){const i=e.at(e.create({origin:o,direction:t.scene.camera.direction}),h.magnitude(t.scene.camera.viewVector)*2);return e.intersectPlane(n,r.fromNormalAndCoplanarPoint(t.scene.camera.direction,i))}else{return e.intersectPlane(n,r.fromNormalAndCoplanarPoint(t.scene.camera.direction,o))}}return undefined}function _(i,t,s,n,o,l){return d.multiply(i,V(t,s,n,o,l))}function V(i,t,s,n,o){const l=new z(n);const e=new m(o);const r=()=>e.convertFrom(t-s);const a=()=>l.convertRealValueToWorld(t-s);switch(i){case"x-translate":return d.makeTranslation(h.create(a(),0,0));case"y-translate":return d.makeTranslation(h.create(0,a(),0));case"z-translate":return d.makeTranslation(h.create(0,0,a()));case"x-rotate":return d.makeRotation(c.fromAxisAngle(h.left(),r()));case"y-rotate":return d.makeRotation(c.fromAxisAngle(h.down(),r()));case"z-rotate":return d.makeRotation(c.fromAxisAngle(h.forward(),r()));default:return d.makeIdentity()}}function q(i){switch(i){case"x-rotate":return"xyz";case"y-rotate":return"yzx";case"z-rotate":return"zxy";default:return"xyz"}}function J(i,t,s,n,o){const l=new z(n);const e=new m(o);const r=()=>d.makeRotation(c.fromMatrixRotation(t));const v=()=>d.multiply(t,d.invert(s));const f=()=>h.transformMatrix(h.fromMatrixPosition(v()),d.invert(r()));const w=()=>u.fromRotationMatrix(d.multiply(d.invert(r()),s),q(i));switch(i){case"x-translate":return l.convertWorldValueToReal(f().x);case"y-translate":return l.convertWorldValueToReal(f().y);case"z-translate":return l.convertWorldValueToReal(f().z);case"x-rotate":return e.convertTo(a.normalizeRadians(w().x));case"y-rotate":return e.convertTo(a.normalizeRadians(w().y));case"z-rotate":return e.convertTo(a.normalizeRadians(w().z));default:return 0}}function X(i,t,s,n,o,l){return G(i,h.subtract(s,t),n,o,l)}function G(i,t,s,n,o){switch(o){case"x-translate":return Y(i,t,h.right());case"y-translate":return Y(i,t,h.up());case"z-translate":return Y(i,t,h.back());case"xy-translate":return Z(i,t,h.create(0,0,1));case"xz-translate":return Z(i,t,h.create(0,1,0));case"yz-translate":return Z(i,t,h.create(1,0,0));case"x-rotate":return K(i,s,h.right(),n);case"y-rotate":return K(i,s,h.up(),n);case"z-rotate":return K(i,s,h.forward(),n);default:return i}}function K(i,t,s,n){const o=L(i,t,s);const l=c.fromAxisAngle(o,n);const h=d.makeRotation(l);return d.multiply(i,h)}function L(i,t,s){const n=d.makeRotation(c.fromMatrixRotation(i));const o=h.transformMatrix(s,n);const l=h.transformMatrix(h.negate(s),n);return h.dot(t,o)>h.dot(t,l)?s:h.negate(s)}function Y(i,t,s){const n=h.normalize(s);const o=d.makeRotation(c.fromMatrixRotation(i));const l=h.transformMatrix(n,o);const e=h.project(t,l);const r=d.makeTranslation(e);return d.multiply(r,i)}function Z(i,t,s){const n=h.normalize(s);const o=d.makeRotation(c.fromMatrixRotation(i));const l=h.transformMatrix(n,o);const e=h.fromMatrixPosition(i);const a=r.fromNormalAndCoplanarPoint(l,e);const u=r.projectPoint(a,t);const v=h.add(u,h.scale(a.constant,a.normal));const f=d.makeTranslation(v);return d.multiply(f,i)}function Q(i,t,s){if(s.length===0){throw new Error("Unable to compute input position. At least one shape point must be provided.")}const n=v.pad(t,5);const o=s.map((t=>i.transformNdcPointToViewport(t)));const h=v.topLeft(n);const e=l.add(h,l.create(n.width,0));const r=v.bottomRight(n);const a=l.subtract(r,l.create(n.width,0));const d=l.scale(o.reduce(((i,t)=>l.add(i,t)),l.create()),1/o.length,1/o.length);const u=[e,a,r].reduce(((i,t)=>l.distance(d,t)<l.distance(d,i)?t:i),h);switch(u){case h:return{point:u,placement:"top-left"};case e:return{point:u,placement:"top-right"};case a:return{point:u,placement:"bottom-left"};default:return{point:u,placement:"bottom-right"}}}function W(i,t,s,n,o,l){const h=t==="alt"&&i.altKey||t==="ctrl"&&i.ctrlKey||t==="meta"&&i.metaKey||t==="shift"&&i.shiftKey;if(h&&l!=null&&l>0&&Number.isInteger(l)){const i=s-n;const t=a.toDegrees(i);const h=Math.round(t/l)*l;if(o!=null){const i=Math.round(o/l)*l;const t=o-i;const s=h-t;const e=a.toRadians(s);return e+n}else{const i=a.toRadians(h);return i+n}}else{return s}}const ii=({ref:t,bounds:s,viewport:n,point:o,placement:l,displayUnit:h},e)=>{const r=ni(n,s!==null&&s!==void 0?s:f.create(0,0),o,l);return i("div",{ref:t,class:"widget-input wrapper",style:{...r,height:(s===null||s===void 0?void 0:s.height)!=null?`${s.height}px`:undefined}},e,i("div",{class:"widget-input units"},h.unit.abbreviatedName))};const ti=({ref:t,identifier:s,disabled:n,onChange:o,onIncrement:l,onDecrement:h,onBlur:e,onUndo:r})=>{const a=i=>{if(i.target!=null){const t=parseFloat(i.target.value);if(!isNaN(t)){o===null||o===void 0?void 0:o(parseFloat(i.target.value))}}};const d=i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="ArrowUp"){l===null||l===void 0?void 0:l()}else if(i.key==="ArrowDown"){h===null||h===void 0?void 0:h()}else if(i.key==="z"&&t&&r){i.preventDefault();r()}};return i("input",{ref:t,disabled:n,class:`widget-input ${s}`,type:"text",onChange:a,onKeyDown:d,onBlur:e})};function si(i,t){return Math.min(i,Math.max(0,t))}function ni(i,t,s,n,o=5){const{width:l,height:h}=i.dimensions;const e=t.width+o;const r=t.height+o;function a(i){return`${i}px`}switch(n){case"top-left":return{right:a(si(l-e,l-s.x)),bottom:a(si(h-r,h-s.y))};case"top-right":return{left:a(si(l-e,s.x)),bottom:a(si(h-r,h-s.y))};case"bottom-left":return{right:a(si(l-e,l-s.x)),top:a(si(h-r,s.y))};case"bottom-right":default:return{left:a(si(l-e,s.x)),top:a(si(h-r,s.y))}}}function oi(i,t,s=3,n=1,o=1){return ei(i,t,h.back(),h.up(),s,n,o)}function li(i,t,s=3,n=1,o=1){return ei(i,t,h.right(),h.back(),s,n,o)}function hi(i,t,s=3,n=1,o=1){return ei(i,t,h.right(),h.up(),s,n,o)}function ei(i,t,s,n,o,l=1,r=1){const u=h.transformMatrix(h.add(s,n),d.makeRotation(c.fromMatrixRotation(i)));const v=h.transformMatrix(s,d.makeRotation(c.fromMatrixRotation(i)));const f=h.transformMatrix(n,d.makeRotation(c.fromMatrixRotation(i)));const w=10*r**.25;const p=h.fromMatrixPosition(i);const x=h.add(p,h.scale(o*w,u));const g=e.create({origin:x,direction:v});const y=e.create({origin:x,direction:f});const m=h.cross(v,f);const z=h.rotateAboutAxis(a.toRadians(45),e.at(y,-(o*l)),m,x);const b=h.rotateAboutAxis(a.toRadians(45),e.at(g,o*l),m,x);const C=h.rotateAboutAxis(a.toRadians(45),e.at(y,o*l),m,x);const D=h.rotateAboutAxis(a.toRadians(45),e.at(g,-(o*l)),m,x);return new T(h.dot(v,t.direction)!==-1&&h.dot(f,t.direction)!==-1,z,D,b,C,h.transformMatrix(z,t.projectionViewMatrix),h.transformMatrix(D,t.projectionViewMatrix),h.transformMatrix(b,t.projectionViewMatrix),h.transformMatrix(C,t.projectionViewMatrix))}function ri(i,t,s,n){if(i instanceof C){return ai(i,t,s,n)}return false}function ai(i,t,s,n){return di([i.points.worldLeft,i.points.worldRight,i.points.worldTip],t,s,n)||di([i.points.worldLeft,i.points.worldRight,i.points.worldBase],t,s,n)}function di(i,t,s,n){var o;if(i.length===3){const l=s.transformPointToRay(n,t.image,t.scene.camera);const e=h.subtract(i[1],i[0]);const r=h.subtract(i[2],i[0]);const a=w.epsilon((o=w.fromVectors([l.direction,l.origin,e,r]))!==null&&o!==void 0?o:w.create(e,r));const d=h.cross(l.direction,r);const u=h.dot(e,d);if(!(Math.abs(u)>=a)){return false}const v=h.subtract(l.origin,i[0]);const c=h.dot(v,d)/u;if(c<0||c>1){return false}const f=h.cross(v,e);const p=h.dot(l.direction,f)/u;if(p<0||c+p>1){return false}const x=h.dot(r,f)/u;return!isNaN(x)&&(x>0||t.scene.camera.isOrthographic())}return false}class ui extends D{constructor(i,t={},s={}){var n,o,l,h,e,r,a,d,u,v,c,f,w,p;super(i);this.customization=t;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 b;this.xArrowFillColor=(n=t.colors)===null||n===void 0?void 0:n.xArrow;this.yArrowFillColor=(o=t.colors)===null||o===void 0?void 0:o.yArrow;this.zArrowFillColor=(l=t.colors)===null||l===void 0?void 0:l.zArrow;this.hoveredArrowFillColor=(h=t.colors)===null||h===void 0?void 0:h.hovered;this.outlineColor=(e=t.colors)===null||e===void 0?void 0:e.outline;this.disabledAxis.xTranslation=(r=s.xTranslation)!==null&&r!==void 0?r:false;this.disabledAxis.yTranslation=(a=s.yTranslation)!==null&&a!==void 0?a:false;this.disabledAxis.zTranslation=(d=s.zTranslation)!==null&&d!==void 0?d:false;this.disabledAxis.xyTranslation=(u=s.xyTranslation)!==null&&u!==void 0?u:false;this.disabledAxis.xzTranslation=(v=s.xzTranslation)!==null&&v!==void 0?v:false;this.disabledAxis.yzTranslation=(c=s.yzTranslation)!==null&&c!==void 0?c:false;this.disabledAxis.xRotation=(f=s.xRotation)!==null&&f!==void 0?f:false;this.disabledAxis.yRotation=(w=s.yRotation)!==null&&w!==void 0?w:false;this.disabledAxis.zRotation=(p=s.zRotation)!==null&&p!==void 0?p:false}dispose(){var i;(i=this.reglFrameDisposable)===null||i===void 0?void 0:i.cancel()}getDrawableElements(){return this.drawableElements}getFullBounds(){return this.fullBounds}boundsContainsPoint(i){return this.interactiveBounds!=null&&this.frame!=null&&v.containsPoints(this.interactiveBounds,i)}updateDisabledAxis(i){this.disabledAxis={...this.disabledAxis,...i};this.updateDisabledOnDrawables()}updateCursor(i){this.cursor=i;if(i!=null&&this.frame!=null){this.updateHovered()}else{this.clearHovered()}}updateTransform(i){var t;this.transform=i;if(i!=null&&this.frame!=null){this.updateAndDraw()}else{this.clear();(t=this.reglFrameDisposable)===null||t===void 0?void 0:t.cancel();this.reglFrameDisposable=undefined}}updateColors(i={}){var t,s,n,o,l,h,e,r,a,d,u,v,c,f,w,p;this.xArrowFillColor=(t=i.xArrow)!==null&&t!==void 0?t:this.xArrowFillColor;this.yArrowFillColor=(s=i.yArrow)!==null&&s!==void 0?s:this.yArrowFillColor;this.zArrowFillColor=(n=i.zArrow)!==null&&n!==void 0?n:this.zArrowFillColor;this.twoAxesSquareFillColor=(o=i.twoAxesSquare)!==null&&o!==void 0?o:this.twoAxesSquareFillColor;this.hoveredArrowFillColor=(l=i.hovered)!==null&&l!==void 0?l:this.hoveredArrowFillColor;this.outlineColor=(h=i.outline)!==null&&h!==void 0?h:this.outlineColor;(e=this.xArrow)===null||e===void 0?void 0:e.updateFillColor(this.getXTranslationColor(),true);(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor(this.getYTranslationColor(),true);(a=this.zArrow)===null||a===void 0?void 0:a.updateFillColor(this.getZTranslationColor(),true);(d=this.xRotation)===null||d===void 0?void 0:d.updateFillColor(this.getXRotationColor(),true);(u=this.yRotation)===null||u===void 0?void 0:u.updateFillColor(this.getYRotationColor(),true);(v=this.zRotation)===null||v===void 0?void 0:v.updateFillColor(this.getZRotationColor(),true);(c=this.xyTranslation)===null||c===void 0?void 0:c.updateFillColor(this.getTwoAxesTranslationColor(),true);(f=this.xzTranslation)===null||f===void 0?void 0:f.updateFillColor(this.getTwoAxesTranslationColor(),true);(w=this.yzTranslation)===null||w===void 0?void 0:w.updateFillColor(this.getTwoAxesTranslationColor(),true);(p=this.hoveredElement)===null||p===void 0?void 0:p.updateFillColor(this.hoveredArrowFillColor)}updateScalars(i){this.customization={...this.customization,scalars:i};if(this.transform!=null&&this.frame!=null){this.updateElements(this.transform,this.frame)}}onHoveredChanged(i){return this.hoveredChanged.on(i)}updateDisabledOnDrawables(){var i,t,s,n,o,l,h,e,r,a,d,u,v,c,f;(i=this.xRotation)===null||i===void 0?void 0:i.setDisabled(this.disabledAxis.xRotation);(t=this.xyRotationLine)===null||t===void 0?void 0:t.setDisabled(this.disabledAxis.xRotation);(s=this.xzRotationLine)===null||s===void 0?void 0:s.setDisabled(this.disabledAxis.xRotation);(n=this.yRotation)===null||n===void 0?void 0:n.setDisabled(this.disabledAxis.yRotation);(o=this.yzRotationLine)===null||o===void 0?void 0:o.setDisabled(this.disabledAxis.yRotation);(l=this.yxRotationLine)===null||l===void 0?void 0:l.setDisabled(this.disabledAxis.yRotation);(h=this.zRotation)===null||h===void 0?void 0:h.setDisabled(this.disabledAxis.zRotation);(e=this.zxRotationLine)===null||e===void 0?void 0:e.setDisabled(this.disabledAxis.zRotation);(r=this.zyRotationLine)===null||r===void 0?void 0:r.setDisabled(this.disabledAxis.zRotation);(a=this.xArrow)===null||a===void 0?void 0:a.setDisabled(this.disabledAxis.xTranslation);(d=this.yArrow)===null||d===void 0?void 0:d.setDisabled(this.disabledAxis.yTranslation);(u=this.zArrow)===null||u===void 0?void 0:u.setDisabled(this.disabledAxis.zTranslation);(v=this.xyTranslation)===null||v===void 0?void 0:v.setDisabled(this.disabledAxis.xyTranslation);(c=this.xzTranslation)===null||c===void 0?void 0:c.setDisabled(this.disabledAxis.xzTranslation);(f=this.yzTranslation)===null||f===void 0?void 0:f.setDisabled(this.disabledAxis.yzTranslation);this.updateColors()}updateHovered(){var i,t,s,n,o,l,h,e,r,a;const d=this.hoveredElement;const u=this.frame;if(u!=null){this.hoveredElement=[...this.translationMeshes,...this.rotationMeshes].filter((i=>i.points.valid&&!i.isDisabled())).find((i=>this.cursor!=null?ri(i,u,this.viewport,this.cursor):false));if(this.hoveredElement!==d){this.hoveredChanged.emit(this.hoveredElement);(i=this.hoveredElement)===null||i===void 0?void 0:i.updateFillColor(this.hoveredArrowFillColor);this.clearFillColorOfPreviouslyHovered(d);if(((t=this.hoveredElement)===null||t===void 0?void 0:t.identifier)==="xy-translate"){(s=this.xArrow)===null||s===void 0?void 0:s.updateFillColor(this.hoveredArrowFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor(this.hoveredArrowFillColor)}else if(((o=this.hoveredElement)===null||o===void 0?void 0:o.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor(this.hoveredArrowFillColor);(h=this.zArrow)===null||h===void 0?void 0:h.updateFillColor(this.hoveredArrowFillColor)}else if(((e=this.hoveredElement)===null||e===void 0?void 0:e.identifier)==="yz-translate"){(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor(this.hoveredArrowFillColor);(a=this.zArrow)===null||a===void 0?void 0:a.updateFillColor(this.hoveredArrowFillColor)}}}}clearHovered(){const i=this.hoveredElement;this.hoveredElement=undefined;if(this.hoveredElement!==i){this.hoveredChanged.emit(this.hoveredElement);this.clearFillColorOfPreviouslyHovered(i)}}clearFillColorOfPreviouslyHovered(i){var t,s,n,o,l,h,e,r,a,d,u,v;i===null||i===void 0?void 0:i.updateFillColor(i===null||i===void 0?void 0:i.initialFillColor);if((i===null||i===void 0?void 0:i.identifier)==="xy-translate"){(t=this.xArrow)===null||t===void 0?void 0:t.updateFillColor((s=this.xArrow)===null||s===void 0?void 0:s.initialFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor((o=this.yArrow)===null||o===void 0?void 0:o.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor((h=this.xArrow)===null||h===void 0?void 0:h.initialFillColor);(e=this.zArrow)===null||e===void 0?void 0:e.updateFillColor((r=this.zArrow)===null||r===void 0?void 0:r.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="yz-translate"){(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor((d=this.yArrow)===null||d===void 0?void 0:d.initialFillColor);(u=this.zArrow)===null||u===void 0?void 0:u.updateFillColor((v=this.zArrow)===null||v===void 0?void 0:v.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=R(this.viewport,...this.rotationMeshes,...this.translationMeshes);this.fullBounds=R(this.viewport,...this.rotationMeshes,...this.translationMeshes,...this.axisLines)}}createElements(i,t){var s,n,o,l,e,r,a,d,u,v,c,f;this.reglCommand=A({canvas:this.canvasElement,extensions:"angle_instanced_arrays"});const{createShape:w}=P(this.reglCommand);const p=this.computeTriangleSize(h.fromMatrixPosition(i),t);this.xArrow=new C(w,"x-translate",j(i,t.scene.camera,p,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation),this.outlineColor,this.getXTranslationColor());this.xRotation=new C(w,"x-rotate",oi(i,t.scene.camera,p,(n=this.customization.scalars)===null||n===void 0?void 0:n.xRotation,(o=this.customization.scalars)===null||o===void 0?void 0:o.xTranslation),this.outlineColor,this.getXRotationColor());this.xAxis=new S(w,"x-axis",E(i,t.scene.camera,this.xArrow),this.outlineColor,this.getXTranslationColor());this.yArrow=new C(w,"y-translate",O(i,t.scene.camera,p,(l=this.customization.scalars)===null||l===void 0?void 0:l.yTranslation),this.outlineColor,this.getYTranslationColor());this.yRotation=new C(w,"y-rotate",li(i,t.scene.camera,p,(e=this.customization.scalars)===null||e===void 0?void 0:e.yRotation,(r=this.customization.scalars)===null||r===void 0?void 0:r.yTranslation),this.outlineColor,this.getYRotationColor());this.yAxis=new S(w,"y-axis",E(i,t.scene.camera,this.yArrow),this.outlineColor,this.getYTranslationColor());this.zArrow=new C(w,"z-translate",H(i,t.scene.camera,p,(a=this.customization.scalars)===null||a===void 0?void 0:a.zTranslation),this.outlineColor,this.getZTranslationColor());this.zAxis=new S(w,"z-axis",E(i,t.scene.camera,this.zArrow),this.outlineColor,this.getZTranslationColor());this.zRotation=new C(w,"z-rotate",hi(i,t.scene.camera,p,(d=this.customization.scalars)===null||d===void 0?void 0:d.zRotation,(u=this.customization.scalars)===null||u===void 0?void 0:u.zTranslation),this.outlineColor,this.getZRotationColor());this.xyTranslation=new C(w,"xy-translate",F(i,t.scene.camera,p,(v=this.customization.scalars)===null||v===void 0?void 0:v.xyTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.xzTranslation=new C(w,"xz-translate",I(i,t.scene.camera,p,(c=this.customization.scalars)===null||c===void 0?void 0:c.xzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.yzTranslation=new C(w,"yz-translate",N(i,t.scene.camera,p,(f=this.customization.scalars)===null||f===void 0?void 0:f.yzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.createRotationLines(w,i,t);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(i,t,s){var n,o,l,e,r,a;const d=this.computeTriangleSize(h.fromMatrixPosition(t),s);const u=B(s.scene.camera,this.xRotation,(n=this.yArrow)===null||n===void 0?void 0:n.points.worldTip,d);const v=B(s.scene.camera,this.xRotation,(o=this.zArrow)===null||o===void 0?void 0:o.points.worldTip,d);const c=B(s.scene.camera,this.yRotation,(l=this.xArrow)===null||l===void 0?void 0:l.points.worldTip,d);const f=B(s.scene.camera,this.yRotation,(e=this.zArrow)===null||e===void 0?void 0:e.points.worldTip,d);const w=B(s.scene.camera,this.zRotation,(r=this.xArrow)===null||r===void 0?void 0:r.points.worldTip,d);const p=B(s.scene.camera,this.zRotation,(a=this.yArrow)===null||a===void 0?void 0:a.points.worldTip,d);if(u!=null){this.xyRotationLine=new U(i,"xy-rotation-line",u,this.outlineColor)}if(v!=null){this.xzRotationLine=new U(i,"xz-rotation-line",v,this.outlineColor)}if(c!=null){this.yxRotationLine=new U(i,"yx-rotation-line",c,this.outlineColor)}if(f!=null){this.yzRotationLine=new U(i,"yz-rotation-line",f,this.outlineColor)}if(w!=null){this.zxRotationLine=new U(i,"zx-rotation-line",w,this.outlineColor)}if(p!=null){this.zyRotationLine=new U(i,"zy-rotation-line",p,this.outlineColor)}this.rotationLines=[this.xyRotationLine,this.xzRotationLine,this.yxRotationLine,this.yzRotationLine,this.zxRotationLine,this.zyRotationLine].filter((i=>i!=null))}updateElements(i,t){var s,n,o,l,e,r,a,d,u,v,c,f,w,p,x,g,y,m,z,b,T,C,D,R,A,P,S,U,$,k;const M=this.computeTriangleSize(h.fromMatrixPosition(i),t);if(this.xArrow!=null){this.xArrow.updatePoints(j(i,t.scene.camera,M,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation));(n=this.xAxis)===null||n===void 0?void 0:n.updatePoints(E(i,t.scene.camera,this.xArrow))}(o=this.xRotation)===null||o===void 0?void 0:o.updatePoints(oi(i,t.scene.camera,M,(l=this.customization.scalars)===null||l===void 0?void 0:l.xRotation,(e=this.customization.scalars)===null||e===void 0?void 0:e.xTranslation));if(this.yArrow!=null){this.yArrow.updatePoints(O(i,t.scene.camera,M,(r=this.customization.scalars)===null||r===void 0?void 0:r.yTranslation));(a=this.yAxis)===null||a===void 0?void 0:a.updatePoints(E(i,t.scene.camera,this.yArrow))}(d=this.yRotation)===null||d===void 0?void 0:d.updatePoints(li(i,t.scene.camera,M,(u=this.customization.scalars)===null||u===void 0?void 0:u.yRotation,(v=this.customization.scalars)===null||v===void 0?void 0:v.yTranslation));if(this.zArrow!=null){this.zArrow.updatePoints(H(i,t.scene.camera,M,(c=this.customization.scalars)===null||c===void 0?void 0:c.zTranslation));(f=this.zAxis)===null||f===void 0?void 0:f.updatePoints(E(i,t.scene.camera,this.zArrow))}(w=this.zRotation)===null||w===void 0?void 0:w.updatePoints(hi(i,t.scene.camera,M,(p=this.customization.scalars)===null||p===void 0?void 0:p.zRotation,(x=this.customization.scalars)===null||x===void 0?void 0:x.zTranslation));(g=this.xyRotationLine)===null||g===void 0?void 0:g.updatePoints(B(t.scene.camera,this.xRotation,(y=this.yArrow)===null||y===void 0?void 0:y.points.worldTip,M));(m=this.xzRotationLine)===null||m===void 0?void 0:m.updatePoints(B(t.scene.camera,this.xRotation,(z=this.zArrow)===null||z===void 0?void 0:z.points.worldTip,M));(b=this.yxRotationLine)===null||b===void 0?void 0:b.updatePoints(B(t.scene.camera,this.yRotation,(T=this.xArrow)===null||T===void 0?void 0:T.points.worldTip,M));(C=this.yzRotationLine)===null||C===void 0?void 0:C.updatePoints(B(t.scene.camera,this.yRotation,(D=this.zArrow)===null||D===void 0?void 0:D.points.worldTip,M));(R=this.zxRotationLine)===null||R===void 0?void 0:R.updatePoints(B(t.scene.camera,this.zRotation,(A=this.xArrow)===null||A===void 0?void 0:A.points.worldTip,M));(P=this.zyRotationLine)===null||P===void 0?void 0:P.updatePoints(B(t.scene.camera,this.zRotation,(S=this.yArrow)===null||S===void 0?void 0:S.points.worldTip,M));if(this.xyTranslation!=null){this.xyTranslation.updatePoints(F(i,t.scene.camera,M,(U=this.customization.scalars)===null||U===void 0?void 0:U.xyTranslation))}if(this.xzTranslation!=null){this.xzTranslation.updatePoints(I(i,t.scene.camera,M,($=this.customization.scalars)===null||$===void 0?void 0:$.xzTranslation))}if(this.yzTranslation!=null){this.yzTranslation.updatePoints(N(i,t.scene.camera,M,(k=this.customization.scalars)===null||k===void 0?void 0:k.yzTranslation))}}}const vi=()=>`:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-two-axes-square-color:var(--two-axes-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:8em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;pointer-events:auto;display:flex;align-items:center;border:1px solid #444444;border-radius:4px;width:var(--viewer-transform-widget-input-width);text-align:center;background-color:white;box-sizing:border-box}.widget-input.units{position:relative;width:25%;height:100%;padding:0 0.25rem;font-size:0.8125rem;color:#444444}input.widget-input{position:relative;text-align:center;box-sizing:border-box;width:75%;height:100%;outline:none;border-width:0 1px 0 0;border-color:#444444;border-radius:2px 0 0 2px;font-size:0.875rem;color:#444444}input.widget-input.x-translate,input.widget-input.x-rotate{border-left:5px solid var(--viewer-transform-widget-x-axis-arrow-color)}input.widget-input.y-translate,input.widget-input.y-rotate{border-left:5px solid var(--viewer-transform-widget-y-axis-arrow-color)}input.widget-input.z-translate,input.widget-input.z-rotate{border-left:5px solid var(--viewer-transform-widget-z-axis-arrow-color)}input.widget-input:disabled{color:#888888}input.widget-input:focus{outline:none}`;const ci=class{constructor(i){t(this,i);this.positionChanged=s(this,"positionChanged");this.rotationChanged=s(this,"rotationChanged");this.interactionEnded=s(this,"interactionEnded");this.interactionStarted=s(this,"interactionStarted");this.xRotationDisabled=false;this.yRotationDisabled=false;this.zRotationDisabled=false;this.xTranslationDisabled=false;this.yTranslationDisabled=false;this.zTranslationDisabled=false;this.xyTranslationDisabled=false;this.xzTranslationDisabled=false;this.yzTranslationDisabled=false;this.showInputs=true;this.distanceUnit="millimeters";this.angleUnit="degrees";this.decimalPlaces=1;this.rotationSnapKey="shift";this.translationHandleScalar=1;this.rotationHandleScalar=1;this.interactionThrottle=75;this.EXPERIMENTAL_undoKeybindings=false;this.inputValue=0;this.isEndingTransform=false;this.xArrowColor="#ea3324";this.yArrowColor="#4faf32";this.zArrowColor="#0000ff";this.twoAxesSquareColor="#e0e0e0";this.hoveredColor="#ffff00";this.lastAngle=0;this.inputShouldFocus=false;this.handleHoveredDrawableChanged=i=>{this.hovered=i};this.handleViewerFrameDrawn=()=>{this.updatePropsFromViewer()};this.handleViewerDimensionsChange=()=>{x((()=>{if(this.viewer!=null&&this.canvasRef!=null){this.canvasRef.width=this.viewer.viewport.width;this.canvasRef.height=this.viewer.viewport.height;this.updateCanvasBounds(this.canvasRef)}}))};this.handleResize=()=>{if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef)}};this.handleInputResize=()=>{if(this.inputWrapperRef!=null){const i=this.inputWrapperRef;g((()=>{this.inputBounds=i.getBoundingClientRect()}))}};this.handleStyleChange=()=>{g((()=>{const i=window.getComputedStyle(this.hostEl);this.xArrowColor=i.getPropertyValue("--viewer-transform-widget-x-axis-arrow-color").trim();this.yArrowColor=i.getPropertyValue("--viewer-transform-widget-y-axis-arrow-color").trim();this.zArrowColor=i.getPropertyValue("--viewer-transform-widget-z-axis-arrow-color").trim();this.twoAxesSquareColor=i.getPropertyValue("--viewer-transform-widget-two-axes-square-color").trim();this.hoveredColor=i.getPropertyValue("--viewer-transform-widget-hovered-arrow-color").trim();this.getTransformWidget().updateColors({xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor})}))};this.handlePointerMove=i=>{if(this.dragging==null){const t=k(l.create(i.clientX,i.clientY),this.getCanvasBounds());const s=this.getTransformWidget();if(t!=null&&s.boundsContainsPoint(t)){s.updateCursor(t)}else{s.updateCursor(undefined);this.hovered=undefined}}};this.handleBeginDrag=async i=>{var t,s,n;const o=this.getCanvasBounds();if(this.hovered!=null&&o!=null&&this.viewer!=null&&this.position!=null&&this.viewer.frame!=null){this.dragging=this.hovered;if(this.dragging.identifier!==((t=this.lastDragged)===null||t===void 0?void 0:t.identifier)){this.inputValue=0;this.dragStartTransform=this.currentTransform;this.updateInputPosition();this.updateInputValue()}this.lastDragged=undefined;const h=k(l.create(i.clientX,i.clientY),o);const e=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);this.lastAngle=h!=null?a.fromPoints(e,h):0;this.lastWorldPosition=M(h,(s=this.viewer)===null||s===void 0?void 0:s.frame,(n=this.viewer)===null||n===void 0?void 0:n.viewport,this.currentTransform);this.interactionStarted.emit();window.removeEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointermove",this.handleDragWithTimer);window.addEventListener("pointerup",this.handleEndTransform)}};this.handleDragWithTimer=async i=>{if(i!=null){i.preventDefault();this.lastMouseEvent=i}if(this.interactionTimer==null){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.handleDrag();this.lastMouseEvent=undefined}),this.interactionThrottle)}};this.handleDrag=async()=>{var i,t,s;const n=this.getCanvasBounds();if(this.dragging!=null&&this.lastWorldPosition!=null&&n!=null&&this.viewer!=null&&this.viewer.frame!=null&&this.position!=null&&this.lastMouseEvent!=null){await((i=this.controller)===null||i===void 0?void 0:i.beginTransform());const o=k(l.create(this.lastMouseEvent.clientX,this.lastMouseEvent.clientY),n);const h=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);const e=M(o,(t=this.viewer)===null||t===void 0?void 0:t.frame,(s=this.viewer)===null||s===void 0?void 0:s.viewport,this.currentTransform);if(e!=null&&o!=null&&h!=null){const i=a.fromPoints(h,o);const t=W(this.lastMouseEvent,this.rotationSnapKey,i,this.lastAngle,this.getDisplayedAngle(),this.rotationSnapDegrees);this.transform(this.lastWorldPosition,e,t-this.lastAngle);this.updateInputPosition();this.updateInputValue();this.lastWorldPosition=e;this.lastAngle=t}}};this.handleEndTransform=async i=>{var t,s;const n=k(l.create(i.clientX,i.clientY),this.getCanvasBounds());const o=this.getTransformWidget();this.lastDragged=this.dragging;this.dragging=undefined;this.lastWorldPosition=undefined;this.lastAngle=0;this.updateInputPosition();this.updateInputValue();o.updateCursor(n);o.updateTransform(this.currentTransform);this.beginEndTransform();window.removeEventListener("pointermove",this.handleDragWithTimer);window.removeEventListener("pointerup",this.handleEndTransform);try{const i=(t=this.controller)===null||t===void 0?void 0:t.getCurrentDelta();await((s=this.controller)===null||s===void 0?void 0:s.endTransform());this.interactionEnded.emit(i)}catch(i){console.error("Failed to end transform interaction",i)}window.addEventListener("pointermove",this.handlePointerMove);this.completeEndTransform()};this.handleInputStep=async i=>{if(this.inputValue!=null&&this.lastInputValue!=null){if(this.isModifyingAngleUnits()){const t=new m(this.angleUnit);const s=t.convertFrom(this.lastInputValue);const n=a.normalizeRadians(s+a.toRadians(i));this.inputValue=t.convertTo(n)}else{this.inputValue=this.lastInputValue+i}await this.updateTransformFromInput(this.inputValue)}};this.handleInputChange=async i=>{await this.updateTransformFromInput(i)};this.handleKeyDown=async i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="z"&&t&&this.EXPERIMENTAL_undoKeybindings){i.stopPropagation();await this.EXPERIMENTAL_undo()}};this.updateTransformFromInput=async i=>{var t,s,n;if(this.lastDragged!=null&&this.currentTransform!=null&&this.startingTransform!=null&&this.lastInputValue!=null){this.currentTransform=_(this.currentTransform,this.lastDragged.identifier,i,this.lastInputValue,this.distanceUnit,this.angleUnit);this.updateInputValue();this.lastInputValue=i;await((t=this.controller)===null||t===void 0?void 0:t.beginTransform());this.getTransformWidget().updateTransform(this.currentTransform);await((s=this.controller)===null||s===void 0?void 0:s.updateTransform(d.multiply(this.currentTransform,d.invert(this.startingTransform))));this.updateInputPosition();await((n=this.controller)===null||n===void 0?void 0:n.endTransformDebounced(this.beginEndTransform,this.completeEndTransform))}};this.updatePropsFromViewer=()=>{const{frame:i}=this.viewer||{};if(i!=null){const t=this.getTransformWidget();t.updateFrame(i,this.dragging==null);this.updateInputPosition()}};this.setupTransformWidget=i=>{var t,s;console.debug(`Initializing transform widget. [initial-position=${JSON.stringify(this.position)}, has-initial-frame=${((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null}]`);const n=this.getTranslationScalar();const o=this.getRotationScalar();this.widget=new ui(i,{colors:{xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor},scalars:{xTranslation:n,yTranslation:n,zTranslation:n,xyTranslation:o,xzTranslation:o,yzTranslation:o,xRotation:o,yRotation:o,zRotation:o}});if(this.rotation!=null){this.currentTransform=this.getTransformForNewRotation(this.rotation);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(this.position!=null){this.currentTransform=this.getTransformForNewPosition(this.position);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(((s=this.viewer)===null||s===void 0?void 0:s.frame)!=null){this.widget.updateFrame(this.viewer.frame,true)}this.handleSettingDisabledAxis();this.hoveredChangeDisposable=this.widget.onHoveredChanged(this.handleHoveredDrawableChanged);return this.widget};this.updateCanvasBounds=i=>{g((()=>{this.canvasBounds=i.getBoundingClientRect();this.getTransformWidget().updateDimensions(i)}))};this.updateInputValue=()=>{var i,t,s;const n=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const o=(n===null||n===void 0?void 0:n.identifier)==="xy-translate"||(n===null||n===void 0?void 0:n.identifier)==="xz-translate"||(n===null||n===void 0?void 0:n.identifier)==="yz-translate";if(n!=null&&this.currentTransform!=null&&this.dragStartTransform!=null&&!o){this.lastInputValue=this.inputValue;this.inputValue=J(n.identifier,this.currentTransform,this.dragStartTransform,this.distanceUnit,this.angleUnit);if(this.inputRef!=null){const i=(s=(t=this.getDisplayedDistance())!==null&&t!==void 0?t:this.getDisplayedAngle())!==null&&s!==void 0?s:0;const n=`${parseFloat(i.toFixed(this.decimalPlaces))}`;this.inputRef.value=n}}};this.updateInputPosition=()=>{var i,t;const s=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const n=(s===null||s===void 0?void 0:s.identifier)==="xy-translate"||(s===null||s===void 0?void 0:s.identifier)==="xz-translate"||(s===null||s===void 0?void 0:s.identifier)==="yz-translate";if(this.showInputs&&((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null&&this.position!=null&&s!=null&&!n){const i=this.getTransformWidget();const t=i.getFullBounds();this.inputPosition=t!=null?Q(this.viewer.viewport,t,s.points.toArray()):undefined}else if(n){this.inputPosition=undefined}};this.beginEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:true,yRotation:true,zRotation:true,xTranslation:true,yTranslation:true,zTranslation:true,xyTranslation:true,xzTranslation:true,yzTranslation:true});this.isEndingTransform=true};this.completeEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled});this.isEndingTransform=false;this.inputShouldFocus=true;if(this.currentTransform!=null){this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=u.fromRotationMatrix(this.currentTransform)}};this.isModifyingAngleUnits=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;return!!(n===null||n===void 0?void 0:n.includes("rotate"))};this.getTranslationScalar=()=>{if(this.translationHandleScalar>0){return this.translationHandleScalar}console.warn("Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getRotationScalar=()=>{if(this.rotationHandleScalar>0){return this.rotationHandleScalar}console.warn("Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getDisplayedUnits=()=>{if(this.isModifyingAngleUnits()){return new m(this.angleUnit)}return new z(this.distanceUnit)};this.getDisplayedAngle=()=>{if(this.isModifyingAngleUnits()){return this.inputValue}};this.getDisplayedDistance=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;if(n===null||n===void 0?void 0:n.includes("translate")){return this.inputValue}};this.getTransformForNewPosition=i=>{if(i!=null){const t=this.currentTransform!=null?this.currentTransform:d.makeIdentity();const s=d.makeRotation(c.fromMatrixRotation(t));const n=d.makeTranslation(i);return d.multiply(n,s)}};this.getTransformForNewRotation=i=>{const t=this.currentTransform!=null?this.currentTransform:d.makeIdentity();const s=d.invert(d.makeRotation(c.fromMatrixRotation(t)));const n=d.makeRotation(c.fromEuler(i));const o=d.multiply(t,s);return d.multiply(o,n)};this.getCanvasBounds=()=>{if(this.canvasBounds!=null){return this.canvasBounds}else if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef);return this.canvasBounds}};this.getTransformWidget=()=>{if(this.widget==null&&this.canvasRef!=null){return this.setupTransformWidget(this.canvasRef)}else if(this.widget!=null){return this.widget}else{throw new Error("Transform widget was not initialized. The canvas element may not have been initialized.")}}}componentDidLoad(){window.addEventListener("pointermove",this.handlePointerMove);this.canvasResizeObserver=new ResizeObserver(this.handleResize);this.inputResizeObserver=new ResizeObserver(this.handleInputResize);this.hostStyleObserver=new MutationObserver(this.handleStyleChange);if(this.canvasRef!=null){this.canvasResizeObserver.observe(this.canvasRef);this.setupTransformWidget(this.canvasRef)}this.hostStyleObserver.observe(this.hostEl,{attributes:true,attributeFilter:["style"]});this.handleViewerChanged(this.viewer,undefined);this.handleStyleChange()}disconnectedCallback(){var i,t,s,n,o;window.removeEventListener("pointermove",this.handlePointerMove);(i=this.canvasResizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.inputResizeObserver)===null||t===void 0?void 0:t.disconnect();(s=this.hostStyleObserver)===null||s===void 0?void 0:s.disconnect();(n=this.hoveredChangeDisposable)===null||n===void 0?void 0:n.dispose();(o=this.widget)===null||o===void 0?void 0:o.dispose()}componentDidRender(){if(this.inputShouldFocus&&this.inputRef!=null){$(this.inputRef);this.inputShouldFocus=false}}async EXPERIMENTAL_undo(){var i,t;const s=await((i=this.controller)===null||i===void 0?void 0:i.EXPERIMENTAL_undoTransform());if(this.currentTransform!=null&&s!=null){this.currentTransform=d.multiply(s,this.currentTransform);(t=this.widget)===null||t===void 0?void 0:t.updateTransform(this.currentTransform);this.updateInputPosition();this.updateInputValue();this.lastInputValue=this.inputValue;this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=u.fromRotationMatrix(this.currentTransform)}}handleViewerChanged(i,t){var s;t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.removeEventListener("dimensionschange",this.handleViewerDimensionsChange);i===null||i===void 0?void 0:i.addEventListener("frameDrawn",this.handleViewerFrameDrawn);i===null||i===void 0?void 0:i.addEventListener("dimensionschange",this.handleViewerDimensionsChange);if((i===null||i===void 0?void 0:i.stream)!=null){(s=this.controller)===null||s===void 0?void 0:s.dispose();this.controller=new y(i.stream)}}handleDisabledPropertyChanged(){var i;(i=this.widget)===null||i===void 0?void 0:i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}handleTransformHandleScalarChanged(){var i;const t=this.getTranslationScalar();const s=this.getRotationScalar();(i=this.widget)===null||i===void 0?void 0:i.updateScalars({xTranslation:t,yTranslation:t,zTranslation:t,xyTranslation:s,xzTranslation:s,yzTranslation:s,xRotation:s,yRotation:s,zRotation:s})}handleRotationChanged(i,t){var s;const n=i!==null&&i!==void 0?i:u.create();this.currentTransform=this.getTransformForNewRotation(n);this.startingTransform=this.currentTransform;if(i==null&&this.currentTransform!=null&&d.isIdentity(this.currentTransform)){this.currentTransform=undefined;this.startingTransform=this.currentTransform}(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);console.debug(`Updating widget rotation [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);this.rotationChanged.emit(i)}handlePositionChanged(i,t){var s,n;this.currentTransform=this.getTransformForNewPosition(i);this.startingTransform=this.currentTransform;console.debug(`Updating widget position [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);if(i==null){this.lastDragged=undefined;this.inputPosition=undefined;(n=this.controller)===null||n===void 0?void 0:n.clearTransform()}this.positionChanged.emit(i)}handleInputFormattingChanged(){this.updateInputValue();this.lastInputValue=this.inputValue}render(){var t,s,o,l,h,e;return i(n,{key:"5d32e8df03f363c836a8a6194f9ff945227a70c8"},i("canvas",{key:"ba1d8b8b1fb99b808809d32176f341d12708af32",ref:i=>{this.canvasRef=i},class:p("widget",{hovered:this.hovered!=null}),tabindex:"0",width:(t=this.viewer)===null||t===void 0?void 0:t.viewport.width,height:(s=this.viewer)===null||s===void 0?void 0:s.viewport.height,onPointerDown:this.handleBeginDrag,onKeyDown:this.handleKeyDown}),this.showInputs&&this.inputPosition&&((o=this.viewer)===null||o===void 0?void 0:o.viewport)&&i(ii,{key:"734bd29977c8efe57e5e4e9d838279c8d7777ead",ref:i=>{var t,s;if(i!=null){(t=this.inputResizeObserver)===null||t===void 0?void 0:t.observe(i)}else if(this.inputWrapperRef!=null){(s=this.inputResizeObserver)===null||s===void 0?void 0:s.unobserve(this.inputWrapperRef)}this.inputWrapperRef=i},bounds:this.inputBounds,viewport:this.viewer.viewport,point:this.inputPosition.point,placement:this.inputPosition.placement,displayUnit:this.getDisplayedUnits()},i(ti,{key:"0d8d997c37a534fcbfe24d452e520a321fea2f18",ref:i=>{this.inputRef=i},identifier:(h=(l=this.dragging)===null||l===void 0?void 0:l.identifier)!==null&&h!==void 0?h:(e=this.lastDragged)===null||e===void 0?void 0:e.identifier,disabled:this.isEndingTransform,onChange:this.handleInputChange,onIncrement:()=>this.handleInputStep(1),onDecrement:()=>this.handleInputStep(-1),onBlur:()=>{this.inputShouldFocus=false},onUndo:this.EXPERIMENTAL_undoKeybindings?()=>this.EXPERIMENTAL_undo():undefined})))}transform(i,t,s){var n,o;if(this.position!=null&&this.startingTransform!=null&&this.currentTransform!=null&&this.dragging!=null&&this.viewer!=null&&this.viewer.frame!=null){this.currentTransform=X(this.currentTransform,i,t,(n=this.viewer)===null||n===void 0?void 0:n.frame.scene.camera.viewVector,s,this.dragging.identifier);this.getTransformWidget().updateTransform(this.currentTransform);(o=this.controller)===null||o===void 0?void 0:o.updateTransform(d.multiply(this.currentTransform,d.invert(this.startingTransform)))}}handleSettingDisabledAxis(){if(this.widget){this.widget.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}else{console.warn("Cannot set disabled values - no widget defined")}}get hostEl(){return o(this)}static get watchers(){return{viewer:[{handleViewerChanged:0}],xTranslationDisabled:[{handleDisabledPropertyChanged:0}],yTranslationDisabled:[{handleDisabledPropertyChanged:0}],zTranslationDisabled:[{handleDisabledPropertyChanged:0}],xyTranslationDisabled:[{handleDisabledPropertyChanged:0}],xzTranslationDisabled:[{handleDisabledPropertyChanged:0}],yzTranslationDisabled:[{handleDisabledPropertyChanged:0}],xRotationDisabled:[{handleDisabledPropertyChanged:0}],yRotationDisabled:[{handleDisabledPropertyChanged:0}],zRotationDisabled:[{handleDisabledPropertyChanged:0}],translationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotation:[{handleRotationChanged:0}],position:[{handlePositionChanged:0}],distanceUnit:[{handleInputFormattingChanged:0}],angleUnit:[{handleInputFormattingChanged:0}],decimalPlaces:[{handleInputFormattingChanged:0}]}}};ci.style=vi();export{ci as vertex_viewer_transform_widget};
|
|
5
|
+
//# sourceMappingURL=p-051b5154.entry.js.map
|