@vertexvis/viewer 1.0.0-testing.3 → 1.0.0-testing.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-CBFIZ5gy.js → config-C1xbl3Qa.js} +3 -3
- package/dist/cjs/{config-CBFIZ5gy.js.map → config-C1xbl3Qa.js.map} +1 -1
- package/dist/cjs/{entities-CAphDi6v.js → entities-D6AUMclh.js} +4 -4
- package/dist/cjs/{entities-CAphDi6v.js.map → entities-D6AUMclh.js.map} +1 -1
- package/dist/cjs/{geometry_pb-DW53co_-.js → geometry_pb-Ctp-Gcjm.js} +3 -3
- package/dist/cjs/{geometry_pb-DW53co_-.js.map → geometry_pb-Ctp-Gcjm.js.map} +1 -1
- package/dist/cjs/index.cjs.js +5 -5
- package/dist/cjs/{queries-uJfbbPWV.js → queries-CZmukyhu.js} +4 -4
- package/dist/cjs/{queries-uJfbbPWV.js.map → queries-CZmukyhu.js.map} +1 -1
- package/dist/cjs/{regl-component-CF41rUUv.js → regl-component-DOa8eHGy.js} +3 -3
- package/dist/cjs/{regl-component-CF41rUUv.js.map → regl-component-DOa8eHGy.js.map} +1 -1
- package/dist/cjs/{representation_pb-u7t5FI12.js → representation_pb-BrMsFavQ.js} +3 -3
- package/dist/cjs/{representation_pb-u7t5FI12.js.map → representation_pb-BrMsFavQ.js.map} +1 -1
- package/dist/cjs/{streamAttributes-BX291dI6.js → streamAttributes-DQm8yx7F.js} +6 -4
- package/dist/cjs/streamAttributes-DQm8yx7F.js.map +1 -0
- package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +4 -4
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +3 -3
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +27 -7
- package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
- package/dist/collection/lib/meters.js +15 -1
- package/dist/collection/lib/meters.js.map +1 -1
- package/dist/collection/lib/storage.js +8 -2
- package/dist/collection/lib/storage.js.map +1 -1
- package/dist/collection/workers/png-decoder-pool.js +4 -2
- package/dist/collection/workers/png-decoder-pool.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-BhgrvpJL.js → p-BLSuslo8.js} +2 -2
- package/dist/components/{p-D7rQku5u.js → p-Bmj32MLp.js} +2 -2
- package/dist/components/{p-MYlndA6B.js → p-Bo49wgwt.js} +2 -2
- package/dist/components/{p-BjcO9U8D.js → p-BvOB1WAv.js} +2 -2
- package/dist/components/{p-DSeOWYJ_.js → p-BygjJ1WP.js} +2 -2
- package/dist/components/{p-CJuOe1O1.js → p-CGpWfqFr.js} +2 -2
- package/dist/components/{p-uwvTj3Cw.js → p-CHQ7ZKZd.js} +2 -2
- package/dist/components/{p-Lx4iaHhY.js → p-CYhNWr6k.js} +2 -2
- package/dist/components/{p-JSB7V_jW.js → p-DLV-gg65.js} +2 -2
- package/dist/components/{p-JSB7V_jW.js.map → p-DLV-gg65.js.map} +1 -1
- package/dist/components/{p-DyPaZtSF.js → p-gFMW2KYT.js} +2 -2
- package/dist/components/vertex-scene-tree-table-cell.js +1 -1
- package/dist/components/vertex-scene-tree.js +1 -1
- package/dist/components/vertex-viewer-dom-renderer.js +1 -1
- package/dist/components/vertex-viewer-hit-result-indicator.js +1 -1
- package/dist/components/vertex-viewer-measurement-details.js +1 -1
- package/dist/components/vertex-viewer-measurement-distance.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-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.js +1 -1
- package/dist/components/vertex-viewer.js.map +1 -1
- package/dist/esm/{config-_vT0BdS-.js → config-BrYuY-7v.js} +3 -3
- package/dist/esm/{config-_vT0BdS-.js.map → config-BrYuY-7v.js.map} +1 -1
- package/dist/esm/{entities-8QCEsVRy.js → entities-DxpPFj9w.js} +4 -4
- package/dist/esm/{entities-8QCEsVRy.js.map → entities-DxpPFj9w.js.map} +1 -1
- package/dist/esm/{geometry_pb-Dj0yGTFi.js → geometry_pb-BLGp5Nq8.js} +3 -3
- package/dist/esm/{geometry_pb-Dj0yGTFi.js.map → geometry_pb-BLGp5Nq8.js.map} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.mjs +5 -5
- package/dist/esm/{queries-W4aeN1vv.js → queries-Coo1RH5H.js} +4 -4
- package/dist/esm/{queries-W4aeN1vv.js.map → queries-Coo1RH5H.js.map} +1 -1
- package/dist/esm/{regl-component-Rio5LpoO.js → regl-component-B30675op.js} +3 -3
- package/dist/esm/{regl-component-Rio5LpoO.js.map → regl-component-B30675op.js.map} +1 -1
- package/dist/esm/{representation_pb-CCDsiQtg.js → representation_pb-DYkJtHQo.js} +3 -3
- package/dist/esm/{representation_pb-CCDsiQtg.js.map → representation_pb-DYkJtHQo.js.map} +1 -1
- package/dist/esm/{streamAttributes-DhQVsxJf.js → streamAttributes-Cfp9UX5m.js} +6 -4
- package/dist/esm/streamAttributes-Cfp9UX5m.js.map +1 -0
- package/dist/esm/vertex-scene-tree-table-cell.entry.js +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +2 -2
- package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
- package/dist/esm/vertex-viewer-hit-result-indicator.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-details.entry.js +1 -1
- package/dist/esm/vertex-viewer-measurement-distance.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-line_2.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +4 -4
- package/dist/esm/vertex-viewer-pin-group.entry.js +3 -3
- package/dist/esm/vertex-viewer-transform-widget.entry.js +2 -2
- package/dist/esm/vertex-viewer-view-cube.entry.js +1 -1
- package/dist/esm/vertex-viewer.entry.js +27 -7
- package/dist/esm/vertex-viewer.entry.js.map +1 -1
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/{p-baec8489.entry.js → p-0287e1ba.entry.js} +2 -2
- package/dist/viewer/{p-2bd6cd13.entry.js → p-380e0112.entry.js} +2 -2
- package/dist/viewer/{p-101825c2.entry.js → p-40d90c6e.entry.js} +2 -2
- package/dist/viewer/{p-317da1b6.entry.js → p-6a546084.entry.js} +2 -2
- package/dist/viewer/p-7189eb18.entry.js +5 -0
- package/dist/viewer/p-7189eb18.entry.js.map +1 -0
- package/dist/viewer/{p-807aa9d0.entry.js → p-72fa9fba.entry.js} +2 -2
- package/dist/viewer/{p-0bf39fff.entry.js → p-81391d86.entry.js} +2 -2
- package/dist/viewer/{p-5VxzXVFc.js → p-B7mOY-Vi.js} +2 -2
- package/dist/viewer/{p-5VxzXVFc.js.map → p-B7mOY-Vi.js.map} +1 -1
- package/dist/viewer/{p-B9AGwrOP.js → p-CVRW2Plt.js} +2 -2
- package/dist/viewer/{p-B9AGwrOP.js.map → p-CVRW2Plt.js.map} +1 -1
- package/dist/viewer/{p-C0bm56qJ.js → p-CrcoZmKt.js} +2 -2
- package/dist/viewer/p-CrcoZmKt.js.map +1 -0
- package/dist/viewer/{p-BNiP3SE7.js → p-DKKHW33X.js} +2 -2
- package/dist/viewer/{p-BNiP3SE7.js.map → p-DKKHW33X.js.map} +1 -1
- package/dist/viewer/p-F9YPK1I7.js +5 -0
- package/dist/viewer/{p-DOMCeSTr.js.map → p-F9YPK1I7.js.map} +1 -1
- package/dist/viewer/p-Nk8SgPHE.js +5 -0
- package/dist/viewer/{p-CrwKMz5f.js.map → p-Nk8SgPHE.js.map} +1 -1
- package/dist/viewer/{p-BoFi-Uyu.js → p-_19YlCN5.js} +2 -2
- package/dist/viewer/{p-BoFi-Uyu.js.map → p-_19YlCN5.js.map} +1 -1
- package/dist/viewer/{p-dd2f92e3.entry.js → p-c7eb05ec.entry.js} +2 -2
- package/dist/viewer/{p-fade0dba.entry.js → p-c9d71f1e.entry.js} +2 -2
- package/dist/viewer/{p-49b9bba2.entry.js → p-d50b2449.entry.js} +2 -2
- package/dist/viewer/{p-0fa89933.entry.js → p-e80260d3.entry.js} +2 -2
- package/dist/viewer/{p-71c08a04.entry.js → p-fc082185.entry.js} +2 -2
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +8 -7
- package/dist/cjs/streamAttributes-BX291dI6.js.map +0 -1
- package/dist/esm/streamAttributes-DhQVsxJf.js.map +0 -1
- package/dist/viewer/p-C0bm56qJ.js.map +0 -1
- package/dist/viewer/p-CrwKMz5f.js +0 -5
- package/dist/viewer/p-DOMCeSTr.js +0 -5
- package/dist/viewer/p-ea736bd1.entry.js +0 -5
- package/dist/viewer/p-ea736bd1.entry.js.map +0 -1
- /package/dist/components/{p-BhgrvpJL.js.map → p-BLSuslo8.js.map} +0 -0
- /package/dist/components/{p-D7rQku5u.js.map → p-Bmj32MLp.js.map} +0 -0
- /package/dist/components/{p-MYlndA6B.js.map → p-Bo49wgwt.js.map} +0 -0
- /package/dist/components/{p-BjcO9U8D.js.map → p-BvOB1WAv.js.map} +0 -0
- /package/dist/components/{p-DSeOWYJ_.js.map → p-BygjJ1WP.js.map} +0 -0
- /package/dist/components/{p-CJuOe1O1.js.map → p-CGpWfqFr.js.map} +0 -0
- /package/dist/components/{p-uwvTj3Cw.js.map → p-CHQ7ZKZd.js.map} +0 -0
- /package/dist/components/{p-Lx4iaHhY.js.map → p-CYhNWr6k.js.map} +0 -0
- /package/dist/components/{p-DyPaZtSF.js.map → p-gFMW2KYT.js.map} +0 -0
- /package/dist/viewer/{p-baec8489.entry.js.map → p-0287e1ba.entry.js.map} +0 -0
- /package/dist/viewer/{p-2bd6cd13.entry.js.map → p-380e0112.entry.js.map} +0 -0
- /package/dist/viewer/{p-101825c2.entry.js.map → p-40d90c6e.entry.js.map} +0 -0
- /package/dist/viewer/{p-317da1b6.entry.js.map → p-6a546084.entry.js.map} +0 -0
- /package/dist/viewer/{p-807aa9d0.entry.js.map → p-72fa9fba.entry.js.map} +0 -0
- /package/dist/viewer/{p-0bf39fff.entry.js.map → p-81391d86.entry.js.map} +0 -0
- /package/dist/viewer/{p-dd2f92e3.entry.js.map → p-c7eb05ec.entry.js.map} +0 -0
- /package/dist/viewer/{p-fade0dba.entry.js.map → p-c9d71f1e.entry.js.map} +0 -0
- /package/dist/viewer/{p-49b9bba2.entry.js.map → p-d50b2449.entry.js.map} +0 -0
- /package/dist/viewer/{p-0fa89933.entry.js.map → p-e80260d3.entry.js.map} +0 -0
- /package/dist/viewer/{p-71c08a04.entry.js.map → p-fc082185.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["focusInputElement","element","window","document","activeElement","focus","setSelectionRange","value","length","convertPointToCanvas","point","bounds","Point","create","x","left","y","top","undefined","convertCanvasPointToWorld","frame","viewport","transform","position","Vector3","fromMatrixPosition","ray","transformPointToRay","image","scene","camera","isOrthographic","offsetPoint","Ray","at","origin","direction","magnitude","viewVector","intersectPlane","Plane","fromNormalAndCoplanarPoint","computeInputDeltaTransform","current","identifier","lastValue","distanceUnit","angleUnit","Matrix4","multiply","computeInputGlobalTransform","units","DistanceUnits","angles","AngleUnits","rotation","convertFrom","convertRealValueToWorld","makeTranslation","makeRotation","Quaternion","fromAxisAngle","down","forward","makeIdentity","eulerOrderForIdentifier","computeInputDisplayValue","start","fromMatrixRotation","transformDiff","invert","relativeTranslationDiff","transformMatrix","relativeRotationDiff","Euler","fromRotationMatrix","convertWorldValueToReal","z","convertTo","Angle","normalizeRadians","computeHandleDeltaTransform","previous","next","angle","computeHandleGlobalTransform","subtract","currentTransformationMatrix","translationVectorWorld","performTranslationConstrainedToAxis","right","up","back","performTranslationConstrainedToPlane","performRotationAroundAxis","localRotationAxis","rotationAngle","worldRotationAxis","computeRotationAxis","worldRotationQuaternion","worldRotationMatrix","changeOfBasisToWorld","worldNegatedRotationAxis","negate","dot","constrainToLocalAxis","constrainToLocalAxisUnitVector","normalize","constrainToWorldAxis","translationVectorProjectedToWorldAxis","project","translationMatrix","localNormalVectorToPlane","localNormalVectorToPlaneUnitVector","worldNormalVectorToPlane","currentPosition","worldPlaneToConstrainTranslationTo","translationVectorProjectedToWorldPlane","projectPoint","constrainedTranslationVector","add","scale","constant","normal","computeInputPosition","shapePoints","Error","paddedBounds","Rectangle","pad","canvasPoints","map","sp","transformNdcPointToViewport","topLeft","topRight","width","bottomRight","bottomLeft","center","reduce","sum","pt","closestPoint","closest","distance","placement","calculateNewRotationAngle","event","rotationSnapKey","angleOfRotation","lastAngle","existingAngle","rotationSnapDegrees","rotationSnapKeyIsHeld","altKey","ctrlKey","metaKey","shiftKey","Number","isInteger","angleChangeRelativeToLastAngle","angleChangeRelativeToLastAngleDegrees","toDegrees","angleChangeRounded","Math","round","existingAngleRounded","neededAdjustmentDueToExistingAngle","adjustedAngle","angleChangeRoundedRadians","toRadians","TransformWidgetInputWrapper","ref","displayUnit","children","inputPlacement","constrainInputToViewport","Dimensions","h","class","style","height","unit","abbreviatedName","TransformWidgetInput","disabled","onChange","onIncrement","onDecrement","onBlur","onUndo","handleChange","target","parsed","parseFloat","isNaN","handleKeyDown","commandOrControlModifier","key","preventDefault","type","onKeyDown","constrainTo","dimension","min","max","inputDimensions","padding","dimensions","paddedWidth","paddedHeight","toCssLength","bottom","xAxisRotationPositions","widgetTransform","triangleSize","rotationSizeScalar","translationSizeScalar","computeRotationNdcValues","yAxisRotationPositions","zAxisRotationPositions","xDirection","yDirection","transformedDirection","transformedX","transformedY","relativePositionScalar","basePosition","xRay","yRay","rotationAxis","cross","base","rotateAboutAxis","TriangleMeshPoints","projectionViewMatrix","testDrawable","drawable","TriangleMesh","testTriangleMesh","mesh","testTriangle","points","worldLeft","worldRight","worldTip","worldBase","edge1","edge2","epsilon","BoundingBox","_a","fromVectors","p","det","abs","t","u","q","v","r","TransformWidget","ReglComponent","constructor","canvasElement","customization","initialDisabledAxes","super","this","disabledAxis","xTranslation","yTranslation","zTranslation","xyTranslation","xzTranslation","yzTranslation","xRotation","yRotation","zRotation","axisLines","rotationLines","translationMeshes","rotationMeshes","hoveredChanged","EventDispatcher","xArrowFillColor","colors","xArrow","yArrowFillColor","_b","yArrow","zArrowFillColor","_c","zArrow","hoveredArrowFillColor","_d","hovered","outlineColor","_e","outline","_f","_g","_h","_j","_k","_l","_m","_o","_p","dispose","reglFrameDisposable","cancel","getDrawableElements","drawableElements","getFullBounds","fullBounds","boundsContainsPoint","interactiveBounds","containsPoints","updateDisabledAxis","axis","updateDisabledOnDrawables","updateCursor","cursor","updateHovered","clearHovered","updateTransform","updateAndDraw","clear","updateColors","twoAxesSquareFillColor","twoAxesSquare","updateFillColor","getXTranslationColor","getYTranslationColor","getZTranslationColor","getXRotationColor","getYRotationColor","getZRotationColor","getTwoAxesTranslationColor","_q","_r","hoveredElement","updateScalars","scalars","updateElements","onHoveredChanged","listener","on","setDisabled","xyRotationLine","xzRotationLine","yzRotationLine","yxRotationLine","zxRotationLine","zyRotationLine","previousHovered","currentFrame","filter","el","valid","isDisabled","find","m","emit","clearFillColorOfPreviouslyHovered","initialFillColor","hasData","createOrUpdateElements","createElements","computeDrawable2dBounds","reglCommand","regl","canvas","extensions","createShape","shapeBuilder","computeTriangleSize","xAxisArrowPositions","xAxis","AxisLine","axisPositions","yAxisArrowPositions","yAxis","zAxisArrowPositions","zAxis","xyAxisTranslationPositions","xzAxisTranslationPositions","yzAxisTranslationPositions","createRotationLines","availableElements","xyRotationLinePoints","rotationAxisPositions","xzRotationLinePoints","yxRotationLinePoints","yzRotationLinePoints","zxRotationLinePoints","zyRotationLinePoints","RotationLine","l","updatePoints","_s","_t","_u","_v","_w","_x","_y","_z","_0","_1","_2","_3","_4","_5","viewerTransformWidgetCss","ViewerTransformWidget","__stencil_proxyCustomElement","HTMLElement","registerHost","xRotationDisabled","yRotationDisabled","zRotationDisabled","xTranslationDisabled","yTranslationDisabled","zTranslationDisabled","xyTranslationDisabled","xzTranslationDisabled","yzTranslationDisabled","showInputs","decimalPlaces","translationHandleScalar","rotationHandleScalar","interactionThrottle","EXPERIMENTAL_undoKeybindings","inputValue","isEndingTransform","inputShouldFocus","xArrowColor","yArrowColor","zArrowColor","twoAxesSquareColor","hoveredColor","handleHoveredDrawableChanged","handleViewerFrameDrawn","updatePropsFromViewer","handleViewerDimensionsChange","writeDOM","viewer","canvasRef","updateCanvasBounds","handleResize","handleInputResize","inputWrapperRef","wrapperElement","readDOM","inputBounds","getBoundingClientRect","handleStyleChange","hostStyles","getComputedStyle","hostEl","getPropertyValue","trim","getTransformWidget","handlePointerMove","dragging","canvasPoint","clientX","clientY","getCanvasBounds","widget","handleBeginDrag","async","canvasBounds","lastDragged","dragStartTransform","currentTransform","updateInputPosition","updateInputValue","currentCanvas","widgetCenter","transformWorldToViewport","fromPoints","lastWorldPosition","interactionStarted","removeEventListener","addEventListener","handleDragWithTimer","handleEndTransform","lastMouseEvent","interactionTimer","setTimeout","handleDrag","controller","beginTransform","currentWorld","angleToUse","getDisplayedAngle","beginEndTransform","delta","getCurrentDelta","endTransform","interactionEnded","e","console","error","completeEndTransform","handleInputStep","step","lastInputValue","isModifyingAngleUnits","updateTransformFromInput","handleInputChange","stopPropagation","EXPERIMENTAL_undo","startingTransform","endTransformDebounced","updateFrame","setupTransformWidget","debug","JSON","stringify","effectiveArrowScalar","getTranslationScalar","effectiveSquareScalar","getRotationScalar","getTransformForNewRotation","getTransformForNewPosition","handleSettingDisabledAxis","hoveredChangeDisposable","updateDimensions","isDraggingTwoAxesTranslation","inputRef","definedValue","getDisplayedDistance","displayValue","toFixed","widgetBounds","inputPosition","toArray","draggingIdentifier","includes","warn","getDisplayedUnits","newPosition","c","currentRotation","newRotationEuler","oldRotation","newRotation","fromEuler","oldTranslation","componentDidLoad","canvasResizeObserver","ResizeObserver","inputResizeObserver","hostStyleObserver","MutationObserver","observe","attributes","attributeFilter","handleViewerChanged","disconnectedCallback","disconnect","componentDidRender","undoDelta","EXPERIMENTAL_undoTransform","newViewer","oldViewer","stream","TransformController","handleDisabledPropertyChanged","handleTransformHandleScalarChanged","handleRotationChanged","rotationToApply","isIdentity","rotationChanged","handlePositionChanged","oldPosition","clearTransform","positionChanged","handleInputFormattingChanged","render","Host","classNames","tabindex","onPointerDown","unobserve"],"sources":["src/components/viewer-transform-widget/dom.ts","src/components/viewer-transform-widget/util.ts","src/components/viewer-transform-widget/viewer-transform-widget-components.tsx","src/lib/transforms/axis-rotation.ts","src/lib/transforms/hits.ts","src/components/viewer-transform-widget/widget.ts","src/components/viewer-transform-widget/viewer-transform-widget.css?tag=vertex-viewer-transform-widget&encapsulation=shadow","src/components/viewer-transform-widget/viewer-transform-widget.tsx"],"sourcesContent":["export function focusInputElement(element: HTMLInputElement): void {\n if (window.document.activeElement !== element) {\n element.focus();\n element.setSelectionRange(element.value.length, element.value.length);\n }\n}\n","import {\n Angle,\n Euler,\n Matrix4,\n Plane,\n Point,\n Quaternion,\n Ray,\n Rectangle,\n Vector3,\n} from '@vertexvis/geometry';\n\nimport {\n AngleUnits,\n AngleUnitType,\n DistanceUnits,\n DistanceUnitType,\n Frame,\n Viewport,\n} from '../../lib/types';\nimport { ModifierKey } from '../../lib/types/keys';\nimport { TransformWidgetInputPlacement } from './viewer-transform-widget-components';\n\nexport interface PointAndPlacement {\n point: Point.Point;\n placement: TransformWidgetInputPlacement;\n}\n\nexport function convertPointToCanvas(\n point: Point.Point,\n bounds?: DOMRect\n): Point.Point | undefined {\n return bounds != null\n ? Point.create(point.x - bounds.left, point.y - bounds.top)\n : undefined;\n}\n\nexport function convertCanvasPointToWorld(\n point?: Point.Point,\n frame?: Frame,\n viewport?: Viewport,\n transform?: Matrix4.Matrix4\n): Vector3.Vector3 | undefined {\n const position =\n transform != null ? Vector3.fromMatrixPosition(transform) : undefined;\n\n if (point != null && frame != null && viewport != null && position != null) {\n const ray = viewport.transformPointToRay(\n point,\n frame.image,\n frame.scene.camera\n );\n\n if (frame.scene.camera.isOrthographic()) {\n // Offset the point to past the bounding sphere of the model to\n // adjust the position plane location.\n const offsetPoint = Ray.at(\n Ray.create({\n origin: position,\n direction: frame.scene.camera.direction,\n }),\n Vector3.magnitude(frame.scene.camera.viewVector) * 2\n );\n\n return Ray.intersectPlane(\n ray,\n Plane.fromNormalAndCoplanarPoint(\n frame.scene.camera.direction,\n offsetPoint\n )\n );\n } else {\n return Ray.intersectPlane(\n ray,\n Plane.fromNormalAndCoplanarPoint(frame.scene.camera.direction, position)\n );\n }\n }\n return undefined;\n}\n\nexport function computeInputDeltaTransform(\n current: Matrix4.Matrix4,\n identifier: string,\n value: number,\n lastValue: number,\n distanceUnit: DistanceUnitType,\n angleUnit: AngleUnitType\n): Matrix4.Matrix4 {\n return Matrix4.multiply(\n current,\n computeInputGlobalTransform(\n identifier,\n value,\n lastValue,\n distanceUnit,\n angleUnit\n )\n );\n}\n\nfunction computeInputGlobalTransform(\n identifier: string,\n value: number,\n lastValue: number,\n distanceUnit: DistanceUnitType,\n angleUnit: AngleUnitType\n): Matrix4.Matrix4 {\n const units = new DistanceUnits(distanceUnit);\n const angles = new AngleUnits(angleUnit);\n\n const rotation = (): number => angles.convertFrom(value - lastValue);\n const position = (): number =>\n units.convertRealValueToWorld(value - lastValue);\n\n switch (identifier) {\n case 'x-translate':\n return Matrix4.makeTranslation(Vector3.create(position(), 0, 0));\n case 'y-translate':\n return Matrix4.makeTranslation(Vector3.create(0, position(), 0));\n case 'z-translate':\n return Matrix4.makeTranslation(Vector3.create(0, 0, position()));\n case 'x-rotate':\n return Matrix4.makeRotation(\n Quaternion.fromAxisAngle(Vector3.left(), rotation())\n );\n case 'y-rotate':\n return Matrix4.makeRotation(\n Quaternion.fromAxisAngle(Vector3.down(), rotation())\n );\n case 'z-rotate':\n return Matrix4.makeRotation(\n Quaternion.fromAxisAngle(Vector3.forward(), rotation())\n );\n default:\n return Matrix4.makeIdentity();\n }\n}\n\nexport function eulerOrderForIdentifier(identifier: string): Euler.EulerOrder {\n switch (identifier) {\n case 'x-rotate':\n return 'xyz';\n case 'y-rotate':\n return 'yzx';\n case 'z-rotate':\n return 'zxy';\n default:\n return 'xyz';\n }\n}\n\nexport function computeInputDisplayValue(\n identifier: string,\n current: Matrix4.Matrix4,\n start: Matrix4.Matrix4,\n distanceUnit: DistanceUnitType,\n angleUnit: AngleUnitType\n): number {\n const units = new DistanceUnits(distanceUnit);\n const angles = new AngleUnits(angleUnit);\n\n const rotation = (): Matrix4.Matrix4 =>\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(current));\n const transformDiff = (): Matrix4.Matrix4 =>\n Matrix4.multiply(current, Matrix4.invert(start));\n const relativeTranslationDiff = (): Vector3.Vector3 =>\n Vector3.transformMatrix(\n Vector3.fromMatrixPosition(transformDiff()),\n Matrix4.invert(rotation())\n );\n const relativeRotationDiff = (): Euler.Euler =>\n Euler.fromRotationMatrix(\n Matrix4.multiply(Matrix4.invert(rotation()), start),\n eulerOrderForIdentifier(identifier)\n );\n\n switch (identifier) {\n case 'x-translate':\n return units.convertWorldValueToReal(relativeTranslationDiff().x);\n case 'y-translate':\n return units.convertWorldValueToReal(relativeTranslationDiff().y);\n case 'z-translate':\n return units.convertWorldValueToReal(relativeTranslationDiff().z);\n case 'x-rotate':\n return angles.convertTo(Angle.normalizeRadians(relativeRotationDiff().x));\n case 'y-rotate':\n return angles.convertTo(Angle.normalizeRadians(relativeRotationDiff().y));\n case 'z-rotate':\n return angles.convertTo(Angle.normalizeRadians(relativeRotationDiff().z));\n default:\n return 0;\n }\n}\n\nexport function computeHandleDeltaTransform(\n current: Matrix4.Matrix4,\n previous: Vector3.Vector3,\n next: Vector3.Vector3,\n viewVector: Vector3.Vector3,\n angle: number,\n identifier: string\n): Matrix4.Matrix4 {\n return computeHandleGlobalTransform(\n current,\n Vector3.subtract(next, previous),\n viewVector,\n angle,\n identifier\n );\n}\n\nfunction computeHandleGlobalTransform(\n currentTransformationMatrix: Matrix4.Matrix4,\n translationVectorWorld: Vector3.Vector3,\n viewVector: Vector3.Vector3,\n angle: number,\n identifier: string\n): Matrix4.Matrix4 {\n switch (identifier) {\n case 'x-translate':\n return performTranslationConstrainedToAxis(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.right()\n );\n case 'y-translate':\n return performTranslationConstrainedToAxis(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.up()\n );\n case 'z-translate':\n return performTranslationConstrainedToAxis(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.back()\n );\n case 'xy-translate':\n return performTranslationConstrainedToPlane(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.create(0, 0, 1)\n );\n case 'xz-translate':\n return performTranslationConstrainedToPlane(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.create(0, 1, 0)\n );\n case 'yz-translate':\n return performTranslationConstrainedToPlane(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.create(1, 0, 0)\n );\n case 'x-rotate':\n return performRotationAroundAxis(\n currentTransformationMatrix,\n viewVector,\n Vector3.right(),\n angle\n );\n case 'y-rotate':\n return performRotationAroundAxis(\n currentTransformationMatrix,\n viewVector,\n Vector3.up(),\n angle\n );\n case 'z-rotate':\n return performRotationAroundAxis(\n currentTransformationMatrix,\n viewVector,\n Vector3.forward(),\n angle\n );\n default:\n return currentTransformationMatrix;\n }\n}\n\nexport function performRotationAroundAxis(\n currentTransformationMatrix: Matrix4.Matrix4,\n viewVector: Vector3.Vector3,\n localRotationAxis: Vector3.Vector3,\n rotationAngle: number\n): Matrix4.Matrix4 {\n // Determine the rotation axis in world coordinates\n const worldRotationAxis = computeRotationAxis(\n currentTransformationMatrix,\n viewVector,\n localRotationAxis\n );\n\n // Determine the rotation matrix in world coordinates\n const worldRotationQuaternion = Quaternion.fromAxisAngle(\n worldRotationAxis,\n rotationAngle\n );\n const worldRotationMatrix = Matrix4.makeRotation(worldRotationQuaternion);\n\n return Matrix4.multiply(currentTransformationMatrix, worldRotationMatrix);\n}\n\nexport function computeRotationAxis(\n currentTransformationMatrix: Matrix4.Matrix4,\n viewVector: Vector3.Vector3,\n localRotationAxis: Vector3.Vector3\n): Vector3.Vector3 {\n const changeOfBasisToWorld = Matrix4.makeRotation(\n Quaternion.fromMatrixRotation(currentTransformationMatrix)\n );\n const worldRotationAxis = Vector3.transformMatrix(\n localRotationAxis,\n changeOfBasisToWorld\n );\n const worldNegatedRotationAxis = Vector3.transformMatrix(\n Vector3.negate(localRotationAxis),\n changeOfBasisToWorld\n );\n\n return Vector3.dot(viewVector, worldRotationAxis) >\n Vector3.dot(viewVector, worldNegatedRotationAxis)\n ? localRotationAxis\n : Vector3.negate(localRotationAxis);\n}\n\nexport function performTranslationConstrainedToAxis(\n currentTransformationMatrix: Matrix4.Matrix4,\n translationVectorWorld: Vector3.Vector3,\n constrainToLocalAxis: Vector3.Vector3\n): Matrix4.Matrix4 {\n // Ensure that constrainToLocalAxis is a unit vector\n const constrainToLocalAxisUnitVector =\n Vector3.normalize(constrainToLocalAxis);\n\n // Convert the axis to constrain the translation to from local to world\n const changeOfBasisToWorld = Matrix4.makeRotation(\n Quaternion.fromMatrixRotation(currentTransformationMatrix)\n );\n const constrainToWorldAxis = Vector3.transformMatrix(\n constrainToLocalAxisUnitVector,\n changeOfBasisToWorld\n );\n\n // Project the translation vector onto the desired axis for translation\n const translationVectorProjectedToWorldAxis = Vector3.project(\n translationVectorWorld,\n constrainToWorldAxis\n );\n\n // Use the projected vector to determine the translation matrix\n const translationMatrix = Matrix4.makeTranslation(\n translationVectorProjectedToWorldAxis\n );\n\n // Multiply the translation matrix with the current transformation matrix to\n // determine the new transformation matrix\n return Matrix4.multiply(translationMatrix, currentTransformationMatrix);\n}\n\nexport function performTranslationConstrainedToPlane(\n currentTransformationMatrix: Matrix4.Matrix4,\n translationVectorWorld: Vector3.Vector3,\n localNormalVectorToPlane: Vector3.Vector3\n): Matrix4.Matrix4 {\n // Ensure that localNormalVectorToPlane is a unit vector\n const localNormalVectorToPlaneUnitVector = Vector3.normalize(\n localNormalVectorToPlane\n );\n\n // Convert the normal vector from local to world\n const changeOfBasisToWorld = Matrix4.makeRotation(\n Quaternion.fromMatrixRotation(currentTransformationMatrix)\n );\n const worldNormalVectorToPlane = Vector3.transformMatrix(\n localNormalVectorToPlaneUnitVector,\n changeOfBasisToWorld\n );\n\n // Use the worldNormalVectorToPlane and the current position of the widget to define the plane to translate on\n const currentPosition = Vector3.fromMatrixPosition(\n currentTransformationMatrix\n );\n const worldPlaneToConstrainTranslationTo = Plane.fromNormalAndCoplanarPoint(\n worldNormalVectorToPlane,\n currentPosition\n );\n\n // Project the translation vector onto the desired plane for translation\n const translationVectorProjectedToWorldPlane = Plane.projectPoint(\n worldPlaneToConstrainTranslationTo,\n translationVectorWorld\n );\n\n // Account for the plane offset to calculate the position change (the vector to translate by)\n const constrainedTranslationVector = Vector3.add(\n translationVectorProjectedToWorldPlane,\n Vector3.scale(\n worldPlaneToConstrainTranslationTo.constant,\n worldPlaneToConstrainTranslationTo.normal\n )\n );\n\n // Use the projected vector to perform the translation and determine the new transformation matrix\n const translationMatrix = Matrix4.makeTranslation(\n constrainedTranslationVector\n );\n return Matrix4.multiply(translationMatrix, currentTransformationMatrix);\n}\n\nexport function computeInputPosition(\n viewport: Viewport,\n bounds: Rectangle.Rectangle,\n shapePoints: Point.Point[]\n): PointAndPlacement {\n if (shapePoints.length === 0) {\n throw new Error(\n 'Unable to compute input position. At least one shape point must be provided.'\n );\n }\n\n const paddedBounds = Rectangle.pad(bounds, 5);\n const canvasPoints = shapePoints.map((sp) =>\n viewport.transformNdcPointToViewport(sp)\n );\n\n const topLeft = Rectangle.topLeft(paddedBounds);\n const topRight = Point.add(topLeft, Point.create(paddedBounds.width, 0));\n const bottomRight = Rectangle.bottomRight(paddedBounds);\n const bottomLeft = Point.subtract(\n bottomRight,\n Point.create(paddedBounds.width, 0)\n );\n\n const center = Point.scale(\n canvasPoints.reduce((sum, pt) => Point.add(sum, pt), Point.create()),\n 1 / canvasPoints.length,\n 1 / canvasPoints.length\n );\n\n const closestPoint = [topRight, bottomLeft, bottomRight].reduce(\n (closest, pt) =>\n Point.distance(center, pt) < Point.distance(center, closest)\n ? pt\n : closest,\n topLeft\n );\n\n switch (closestPoint) {\n case topLeft:\n return { point: closestPoint, placement: 'top-left' };\n case topRight:\n return { point: closestPoint, placement: 'top-right' };\n case bottomLeft:\n return { point: closestPoint, placement: 'bottom-left' };\n default:\n return { point: closestPoint, placement: 'bottom-right' };\n }\n}\n\nexport function calculateNewRotationAngle(\n event: PointerEvent,\n rotationSnapKey: ModifierKey,\n angleOfRotation: number, // In radians\n lastAngle: number, // In radians\n existingAngle?: number, // In degrees\n rotationSnapDegrees?: number // In degrees\n): number {\n const rotationSnapKeyIsHeld =\n (rotationSnapKey === 'alt' && event.altKey) ||\n (rotationSnapKey === 'ctrl' && event.ctrlKey) ||\n (rotationSnapKey === 'meta' && event.metaKey) ||\n (rotationSnapKey === 'shift' && event.shiftKey);\n\n // Check if the widget should snap to a certain angle\n if (\n rotationSnapKeyIsHeld &&\n rotationSnapDegrees != null &&\n rotationSnapDegrees > 0 &&\n Number.isInteger(rotationSnapDegrees)\n ) {\n const angleChangeRelativeToLastAngle = angleOfRotation - lastAngle;\n const angleChangeRelativeToLastAngleDegrees = Angle.toDegrees(\n angleChangeRelativeToLastAngle\n );\n\n // This method rounds the angle change to the nearest multiple of this.rotationSnapDegrees\n const angleChangeRounded =\n Math.round(angleChangeRelativeToLastAngleDegrees / rotationSnapDegrees) *\n rotationSnapDegrees;\n\n // Check if there is already an existing rotation angle\n if (existingAngle != null) {\n // If there is an existing angle displayed in the widget, it might not be a multiple of the\n // desired number, so the difference needs to be accounted for\n const existingAngleRounded =\n Math.round(existingAngle / rotationSnapDegrees) * rotationSnapDegrees;\n const neededAdjustmentDueToExistingAngle =\n existingAngle - existingAngleRounded;\n\n // Adjust the rounded angle change to account for the existing angle, then\n // covert the rounded value to radians and return\n const adjustedAngle =\n angleChangeRounded - neededAdjustmentDueToExistingAngle;\n const angleChangeRoundedRadians = Angle.toRadians(adjustedAngle);\n return angleChangeRoundedRadians + lastAngle;\n } else {\n // There isn't an existing angle to account for, so convert the rounded value to radians and return\n const angleChangeRoundedRadians = Angle.toRadians(angleChangeRounded);\n return angleChangeRoundedRadians + lastAngle;\n }\n } else {\n // Angle should not be snapped, so return the original angle\n return angleOfRotation;\n }\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { FunctionalComponent, h } from '@stencil/core';\nimport { Dimensions, Point } from '@vertexvis/geometry';\n\nimport { AngleUnits, DistanceUnits, Viewport } from '../../lib/types';\n\nexport type TransformWidgetInputPlacement =\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nexport interface TransformWidgetInputWrapperProps {\n ref: (el?: HTMLDivElement) => void;\n bounds?: DOMRect;\n\n viewport: Viewport;\n point: Point.Point;\n placement: TransformWidgetInputPlacement;\n\n displayUnit: DistanceUnits | AngleUnits;\n}\n\nexport const TransformWidgetInputWrapper: FunctionalComponent<\n TransformWidgetInputWrapperProps\n> = ({ ref, bounds, viewport, point, placement, displayUnit }, children) => {\n const inputPlacement = constrainInputToViewport(\n viewport,\n bounds ?? Dimensions.create(0, 0),\n point,\n placement\n );\n\n return (\n <div\n ref={ref}\n class=\"widget-input wrapper\"\n style={{\n ...inputPlacement,\n height: bounds?.height != null ? `${bounds.height}px` : undefined,\n }}\n >\n {children}\n <div class=\"widget-input units\">{displayUnit.unit.abbreviatedName}</div>\n </div>\n );\n};\n\nexport interface TransformWidgetInputProps {\n ref: (el?: HTMLInputElement) => void;\n\n identifier?: string;\n disabled?: boolean;\n\n onChange?: (value: number) => void | Promise<void>;\n onIncrement?: VoidFunction;\n onDecrement?: VoidFunction;\n onBlur?: VoidFunction;\n onUndo?: VoidFunction;\n}\n\nexport const TransformWidgetInput: FunctionalComponent<\n TransformWidgetInputProps\n> = ({\n ref,\n identifier,\n disabled,\n onChange,\n onIncrement,\n onDecrement,\n onBlur,\n onUndo,\n}) => {\n const handleChange = (event: Event): void => {\n if (event.target != null) {\n const parsed = parseFloat((event.target as HTMLInputElement).value);\n\n if (!isNaN(parsed)) {\n onChange?.(parseFloat((event.target as HTMLInputElement).value));\n }\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent): void => {\n const commandOrControlModifier = event.ctrlKey || event.metaKey;\n\n if (event.key === 'ArrowUp') {\n onIncrement?.();\n } else if (event.key === 'ArrowDown') {\n onDecrement?.();\n } else if (event.key === 'z' && commandOrControlModifier && onUndo) {\n event.preventDefault();\n\n onUndo();\n }\n };\n\n return (\n <input\n ref={ref}\n disabled={disabled}\n class={`widget-input ${identifier}`}\n type=\"text\"\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onBlur={onBlur}\n ></input>\n );\n};\n\nfunction constrainTo(dimension: number, length: number): number {\n return Math.min(dimension, Math.max(0, length));\n}\n\ninterface InputPlacement {\n left?: string;\n right?: string;\n top?: string;\n bottom?: string;\n}\n\nfunction constrainInputToViewport(\n viewport: Viewport,\n inputDimensions: Dimensions.Dimensions,\n point: Point.Point,\n placement: TransformWidgetInputPlacement,\n padding = 5\n): InputPlacement {\n const { width, height } = viewport.dimensions;\n const paddedWidth = inputDimensions.width + padding;\n const paddedHeight = inputDimensions.height + padding;\n\n function toCssLength(length: number): string {\n return `${length}px`;\n }\n\n switch (placement) {\n case 'top-left':\n return {\n right: toCssLength(constrainTo(width - paddedWidth, width - point.x)),\n bottom: toCssLength(\n constrainTo(height - paddedHeight, height - point.y)\n ),\n };\n case 'top-right':\n return {\n left: toCssLength(constrainTo(width - paddedWidth, point.x)),\n bottom: toCssLength(\n constrainTo(height - paddedHeight, height - point.y)\n ),\n };\n case 'bottom-left':\n return {\n right: toCssLength(constrainTo(width - paddedWidth, width - point.x)),\n top: toCssLength(constrainTo(height - paddedHeight, point.y)),\n };\n case 'bottom-right':\n default:\n return {\n left: toCssLength(constrainTo(width - paddedWidth, point.x)),\n top: toCssLength(constrainTo(height - paddedHeight, point.y)),\n };\n }\n}\n","import { Angle, Matrix4, Quaternion, Ray, Vector3 } from '@vertexvis/geometry';\n\nimport { FrameCameraBase } from '../types';\nimport { TriangleMeshPoints } from './mesh';\n\nexport function xAxisRotationPositions(\n widgetTransform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n triangleSize = 3,\n rotationSizeScalar = 1,\n translationSizeScalar = 1\n): TriangleMeshPoints {\n return computeRotationNdcValues(\n widgetTransform,\n camera,\n Vector3.back(),\n Vector3.up(),\n triangleSize,\n rotationSizeScalar,\n translationSizeScalar\n );\n}\n\nexport function yAxisRotationPositions(\n widgetTransform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n triangleSize = 3,\n rotationSizeScalar = 1,\n translationSizeScalar = 1\n): TriangleMeshPoints {\n return computeRotationNdcValues(\n widgetTransform,\n camera,\n Vector3.right(),\n Vector3.back(),\n triangleSize,\n rotationSizeScalar,\n translationSizeScalar\n );\n}\n\nexport function zAxisRotationPositions(\n widgetTransform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n triangleSize = 3,\n rotationSizeScalar = 1,\n translationSizeScalar = 1\n): TriangleMeshPoints {\n return computeRotationNdcValues(\n widgetTransform,\n camera,\n Vector3.right(),\n Vector3.up(),\n triangleSize,\n rotationSizeScalar,\n translationSizeScalar\n );\n}\n\nfunction computeRotationNdcValues(\n widgetTransform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n xDirection: Vector3.Vector3,\n yDirection: Vector3.Vector3,\n triangleSize: number,\n rotationSizeScalar = 1,\n translationSizeScalar = 1\n): TriangleMeshPoints {\n const transformedDirection = Vector3.transformMatrix(\n Vector3.add(xDirection, yDirection),\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(widgetTransform))\n );\n const transformedX = Vector3.transformMatrix(\n xDirection,\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(widgetTransform))\n );\n const transformedY = Vector3.transformMatrix(\n yDirection,\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(widgetTransform))\n );\n // Position the rotation handle relative to the translation scale to\n // ensure that the rotation axis lines are angled inward.\n // This is a loose line of best fit based on the base scale of\n // `1` corresponding to a scalar of `10` and some experimentation.\n const relativePositionScalar = 10 * translationSizeScalar ** 0.25;\n\n const basePosition = Vector3.fromMatrixPosition(widgetTransform);\n const position = Vector3.add(\n basePosition,\n Vector3.scale(triangleSize * relativePositionScalar, transformedDirection)\n );\n\n const xRay = Ray.create({\n origin: position,\n direction: transformedX,\n });\n const yRay = Ray.create({\n origin: position,\n direction: transformedY,\n });\n const rotationAxis = Vector3.cross(transformedX, transformedY);\n\n const base = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(yRay, -(triangleSize * rotationSizeScalar)),\n rotationAxis,\n position\n );\n const right = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(xRay, triangleSize * rotationSizeScalar),\n rotationAxis,\n position\n );\n const up = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(yRay, triangleSize * rotationSizeScalar),\n rotationAxis,\n position\n );\n const left = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(xRay, -(triangleSize * rotationSizeScalar)),\n rotationAxis,\n position\n );\n\n return new TriangleMeshPoints(\n Vector3.dot(transformedX, camera.direction) !== -1 &&\n Vector3.dot(transformedY, camera.direction) !== -1,\n base,\n left,\n right,\n up,\n Vector3.transformMatrix(base, camera.projectionViewMatrix),\n Vector3.transformMatrix(left, camera.projectionViewMatrix),\n Vector3.transformMatrix(right, camera.projectionViewMatrix),\n Vector3.transformMatrix(up, camera.projectionViewMatrix)\n );\n}\n","import { BoundingBox, Point, Vector3 } from '@vertexvis/geometry';\n\nimport { Frame, Viewport } from '../../lib/types';\nimport { Drawable } from './drawable';\nimport { TriangleMesh } from './mesh';\n\nexport function testDrawable(\n drawable: Drawable,\n frame: Frame,\n viewport: Viewport,\n point: Point.Point\n): boolean {\n if (drawable instanceof TriangleMesh) {\n return testTriangleMesh(drawable, frame, viewport, point);\n }\n return false;\n}\n\nexport function testTriangleMesh(\n mesh: TriangleMesh,\n frame: Frame,\n viewport: Viewport,\n point: Point.Point\n): boolean {\n return (\n testTriangle(\n [mesh.points.worldLeft, mesh.points.worldRight, mesh.points.worldTip],\n frame,\n viewport,\n point\n ) ||\n testTriangle(\n [mesh.points.worldLeft, mesh.points.worldRight, mesh.points.worldBase],\n frame,\n viewport,\n point\n )\n );\n}\n\n/**\n * Adapted from https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm.\n */\nexport function testTriangle(\n points: Vector3.Vector3[],\n frame: Frame,\n viewport: Viewport,\n point: Point.Point\n): boolean {\n if (points.length === 3) {\n const ray = viewport.transformPointToRay(\n point,\n frame.image,\n frame.scene.camera\n );\n\n const edge1 = Vector3.subtract(points[1], points[0]);\n const edge2 = Vector3.subtract(points[2], points[0]);\n\n const epsilon = BoundingBox.epsilon(\n BoundingBox.fromVectors([ray.direction, ray.origin, edge1, edge2]) ??\n BoundingBox.create(edge1, edge2)\n );\n\n const p = Vector3.cross(ray.direction, edge2);\n const det = Vector3.dot(edge1, p);\n\n // This check causes a `det` of NaN or 0 to return false\n // without needing to perform the subsequent calculations.\n if (!(Math.abs(det) >= epsilon)) {\n return false;\n }\n\n const t = Vector3.subtract(ray.origin, points[0]);\n const u = Vector3.dot(t, p) / det;\n\n if (u < 0 || u > 1) {\n return false;\n }\n\n const q = Vector3.cross(t, edge1);\n const v = Vector3.dot(ray.direction, q) / det;\n\n if (v < 0 || u + v > 1) {\n return false;\n }\n\n const r = Vector3.dot(edge2, q) / det;\n\n // Ignore the case where the computed hit position is negative\n // if in orthographic to correctly return hit results when close\n // to the camera.\n // TODO: revisit with https://vertexvis.atlassian.net/browse/PLAT-1549\n return !isNaN(r) && (r > 0 || frame.scene.camera.isOrthographic());\n }\n return false;\n}\n","import { Matrix4 } from '@vertexvis/geometry';\nimport { Point, Rectangle, Vector3 } from '@vertexvis/geometry';\nimport { Color, Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\nimport regl from 'regl';\nimport shapeBuilder from 'regl-shape';\n\nimport {\n axisPositions,\n rotationAxisPositions,\n} from '../../lib/transforms/axis-lines';\nimport {\n xAxisRotationPositions,\n yAxisRotationPositions,\n zAxisRotationPositions,\n} from '../../lib/transforms/axis-rotation';\nimport {\n xAxisArrowPositions,\n xyAxisTranslationPositions,\n xzAxisTranslationPositions,\n yAxisArrowPositions,\n yzAxisTranslationPositions,\n zAxisArrowPositions,\n} from '../../lib/transforms/axis-translation';\nimport {\n computeDrawable2dBounds,\n Drawable,\n} from '../../lib/transforms/drawable';\nimport { testDrawable } from '../../lib/transforms/hits';\nimport { AxisLine, RotationLine } from '../../lib/transforms/line';\nimport { TriangleMesh } from '../../lib/transforms/mesh';\nimport { CreateShape } from '../../lib/transforms/shape';\nimport { Frame } from '../../lib/types';\nimport { ReglComponent } from '../../lib/webgl/regl-component';\n\nexport interface DrawableElementColors {\n xArrow?: Color.Color | string;\n yArrow?: Color.Color | string;\n zArrow?: Color.Color | string;\n twoAxesSquare?: Color.Color | string;\n hovered?: Color.Color | string;\n outline?: Color.Color | string;\n}\n\nexport interface DrawableElementSizeScalars {\n xRotation?: number;\n yRotation?: number;\n zRotation?: number;\n xTranslation?: number;\n yTranslation?: number;\n zTranslation?: number;\n xyTranslation?: number;\n xzTranslation?: number;\n yzTranslation?: number;\n}\n\nexport interface DisabledAxis {\n xRotation: boolean;\n yRotation: boolean;\n zRotation: boolean;\n xTranslation: boolean;\n yTranslation: boolean;\n zTranslation: boolean;\n xyTranslation: boolean;\n xzTranslation: boolean;\n yzTranslation: boolean;\n}\n\nexport interface TransformWidgetCustomization {\n colors?: DrawableElementColors;\n scalars?: DrawableElementSizeScalars;\n}\n\nexport class TransformWidget extends ReglComponent {\n private cursor?: Point.Point;\n\n private xAxis?: AxisLine;\n private yAxis?: AxisLine;\n private zAxis?: AxisLine;\n\n private xArrow?: TriangleMesh;\n private yArrow?: TriangleMesh;\n private zArrow?: TriangleMesh;\n\n private xRotation?: TriangleMesh;\n private xyRotationLine?: RotationLine;\n private xzRotationLine?: RotationLine;\n\n private yRotation?: TriangleMesh;\n private yxRotationLine?: RotationLine;\n private yzRotationLine?: RotationLine;\n\n private zRotation?: TriangleMesh;\n private zxRotationLine?: RotationLine;\n private zyRotationLine?: RotationLine;\n\n private xyTranslation?: TriangleMesh;\n private xzTranslation?: TriangleMesh;\n private yzTranslation?: TriangleMesh;\n\n private disabledAxis: DisabledAxis = {\n xTranslation: false,\n yTranslation: false,\n zTranslation: false,\n xyTranslation: false,\n xzTranslation: false,\n yzTranslation: false,\n xRotation: false,\n yRotation: false,\n zRotation: false,\n };\n\n private axisLines: AxisLine[] = [];\n private rotationLines: RotationLine[] = [];\n private translationMeshes: TriangleMesh[] = [];\n private rotationMeshes: TriangleMesh[] = [];\n private hoveredElement?: Drawable;\n\n private transform?: Matrix4.Matrix4;\n private interactiveBounds?: Rectangle.Rectangle;\n private fullBounds?: Rectangle.Rectangle;\n\n private hoveredChanged = new EventDispatcher<Drawable | undefined>();\n\n private xArrowFillColor?: Color.Color | string;\n private yArrowFillColor?: Color.Color | string;\n private zArrowFillColor?: Color.Color | string;\n\n private twoAxesSquareFillColor?: Color.Color | string;\n\n private hoveredArrowFillColor?: Color.Color | string;\n private outlineColor?: Color.Color | string;\n\n public constructor(\n canvasElement: HTMLCanvasElement,\n private customization: TransformWidgetCustomization = {},\n initialDisabledAxes: Partial<DisabledAxis> = {}\n ) {\n super(canvasElement);\n\n this.xArrowFillColor = customization.colors?.xArrow;\n this.yArrowFillColor = customization.colors?.yArrow;\n this.zArrowFillColor = customization.colors?.zArrow;\n this.hoveredArrowFillColor = customization.colors?.hovered;\n this.outlineColor = customization.colors?.outline;\n\n this.disabledAxis.xTranslation = initialDisabledAxes.xTranslation ?? false;\n this.disabledAxis.yTranslation = initialDisabledAxes.yTranslation ?? false;\n this.disabledAxis.zTranslation = initialDisabledAxes.zTranslation ?? false;\n this.disabledAxis.xyTranslation =\n initialDisabledAxes.xyTranslation ?? false;\n this.disabledAxis.xzTranslation =\n initialDisabledAxes.xzTranslation ?? false;\n this.disabledAxis.yzTranslation =\n initialDisabledAxes.yzTranslation ?? false;\n this.disabledAxis.xRotation = initialDisabledAxes.xRotation ?? false;\n this.disabledAxis.yRotation = initialDisabledAxes.yRotation ?? false;\n this.disabledAxis.zRotation = initialDisabledAxes.zRotation ?? false;\n }\n\n public dispose(): void {\n this.reglFrameDisposable?.cancel();\n }\n\n /**\n * @internal - visible for testing\n */\n public getDrawableElements(): Drawable[] {\n return this.drawableElements;\n }\n\n public getFullBounds(): Rectangle.Rectangle | undefined {\n return this.fullBounds;\n }\n\n public boundsContainsPoint(point: Point.Point): boolean {\n return (\n this.interactiveBounds != null &&\n this.frame != null &&\n Rectangle.containsPoints(this.interactiveBounds, point)\n );\n }\n\n public updateDisabledAxis(axis: Partial<DisabledAxis>): void {\n this.disabledAxis = {\n ...this.disabledAxis,\n ...axis,\n };\n this.updateDisabledOnDrawables();\n }\n\n public updateCursor(cursor?: Point.Point): void {\n this.cursor = cursor;\n\n if (cursor != null && this.frame != null) {\n this.updateHovered();\n } else {\n this.clearHovered();\n }\n }\n\n public updateTransform(transform?: Matrix4.Matrix4): void {\n this.transform = transform;\n\n if (transform != null && this.frame != null) {\n this.updateAndDraw();\n } else {\n this.clear();\n this.reglFrameDisposable?.cancel();\n this.reglFrameDisposable = undefined;\n }\n }\n\n public updateColors(colors: DrawableElementColors = {}): void {\n this.xArrowFillColor = colors.xArrow ?? this.xArrowFillColor;\n this.yArrowFillColor = colors.yArrow ?? this.yArrowFillColor;\n this.zArrowFillColor = colors.zArrow ?? this.zArrowFillColor;\n this.twoAxesSquareFillColor =\n colors.twoAxesSquare ?? this.twoAxesSquareFillColor;\n this.hoveredArrowFillColor = colors.hovered ?? this.hoveredArrowFillColor;\n this.outlineColor = colors.outline ?? this.outlineColor;\n\n this.xArrow?.updateFillColor(this.getXTranslationColor(), true);\n this.yArrow?.updateFillColor(this.getYTranslationColor(), true);\n this.zArrow?.updateFillColor(this.getZTranslationColor(), true);\n this.xRotation?.updateFillColor(this.getXRotationColor(), true);\n this.yRotation?.updateFillColor(this.getYRotationColor(), true);\n this.zRotation?.updateFillColor(this.getZRotationColor(), true);\n this.xyTranslation?.updateFillColor(\n this.getTwoAxesTranslationColor(),\n true\n );\n this.xzTranslation?.updateFillColor(\n this.getTwoAxesTranslationColor(),\n true\n );\n this.yzTranslation?.updateFillColor(\n this.getTwoAxesTranslationColor(),\n true\n );\n\n this.hoveredElement?.updateFillColor(this.hoveredArrowFillColor);\n }\n\n public updateScalars(scalars: DrawableElementSizeScalars): void {\n this.customization = {\n ...this.customization,\n scalars,\n };\n\n if (this.transform != null && this.frame != null) {\n this.updateElements(this.transform, this.frame);\n }\n }\n\n public onHoveredChanged(\n listener: Listener<Drawable | undefined>\n ): Disposable {\n return this.hoveredChanged.on(listener);\n }\n\n private updateDisabledOnDrawables(): void {\n this.xRotation?.setDisabled(this.disabledAxis.xRotation);\n this.xyRotationLine?.setDisabled(this.disabledAxis.xRotation);\n this.xzRotationLine?.setDisabled(this.disabledAxis.xRotation);\n\n this.yRotation?.setDisabled(this.disabledAxis.yRotation);\n this.yzRotationLine?.setDisabled(this.disabledAxis.yRotation);\n this.yxRotationLine?.setDisabled(this.disabledAxis.yRotation);\n\n this.zRotation?.setDisabled(this.disabledAxis.zRotation);\n this.zxRotationLine?.setDisabled(this.disabledAxis.zRotation);\n this.zyRotationLine?.setDisabled(this.disabledAxis.zRotation);\n\n this.xArrow?.setDisabled(this.disabledAxis.xTranslation);\n this.yArrow?.setDisabled(this.disabledAxis.yTranslation);\n this.zArrow?.setDisabled(this.disabledAxis.zTranslation);\n\n this.xyTranslation?.setDisabled(this.disabledAxis.xyTranslation);\n this.xzTranslation?.setDisabled(this.disabledAxis.xzTranslation);\n this.yzTranslation?.setDisabled(this.disabledAxis.yzTranslation);\n\n this.updateColors();\n }\n\n private updateHovered(): void {\n const previousHovered = this.hoveredElement;\n const currentFrame = this.frame;\n\n if (currentFrame != null) {\n this.hoveredElement = [...this.translationMeshes, ...this.rotationMeshes]\n .filter((el) => el.points.valid && !el.isDisabled())\n .find((m) =>\n this.cursor != null\n ? testDrawable(m, currentFrame, this.viewport, this.cursor)\n : false\n );\n\n if (this.hoveredElement !== previousHovered) {\n this.hoveredChanged.emit(this.hoveredElement);\n this.hoveredElement?.updateFillColor(this.hoveredArrowFillColor);\n this.clearFillColorOfPreviouslyHovered(previousHovered);\n\n // Set the corresponding arrows to the hover fill color\n // when a 2-axes translation square is hovered over\n if (this.hoveredElement?.identifier === 'xy-translate') {\n this.xArrow?.updateFillColor(this.hoveredArrowFillColor);\n this.yArrow?.updateFillColor(this.hoveredArrowFillColor);\n } else if (this.hoveredElement?.identifier === 'xz-translate') {\n this.xArrow?.updateFillColor(this.hoveredArrowFillColor);\n this.zArrow?.updateFillColor(this.hoveredArrowFillColor);\n } else if (this.hoveredElement?.identifier === 'yz-translate') {\n this.yArrow?.updateFillColor(this.hoveredArrowFillColor);\n this.zArrow?.updateFillColor(this.hoveredArrowFillColor);\n }\n }\n }\n }\n\n private clearHovered(): void {\n const previousHovered = this.hoveredElement;\n this.hoveredElement = undefined;\n\n if (this.hoveredElement !== previousHovered) {\n this.hoveredChanged.emit(this.hoveredElement);\n this.clearFillColorOfPreviouslyHovered(previousHovered);\n }\n }\n\n private clearFillColorOfPreviouslyHovered(previousHovered?: Drawable): void {\n previousHovered?.updateFillColor(previousHovered?.initialFillColor);\n\n // Also clear the hover fill color from the corresponding arrows\n // when a 2-axes translation square is no longer hovered over\n if (previousHovered?.identifier === 'xy-translate') {\n this.xArrow?.updateFillColor(this.xArrow?.initialFillColor);\n this.yArrow?.updateFillColor(this.yArrow?.initialFillColor);\n } else if (previousHovered?.identifier === 'xz-translate') {\n this.xArrow?.updateFillColor(this.xArrow?.initialFillColor);\n this.zArrow?.updateFillColor(this.zArrow?.initialFillColor);\n } else if (previousHovered?.identifier === 'yz-translate') {\n this.yArrow?.updateFillColor(this.yArrow?.initialFillColor);\n this.zArrow?.updateFillColor(this.zArrow?.initialFillColor);\n }\n }\n\n protected hasData(): boolean {\n return this.transform != null;\n }\n\n protected createOrUpdateElements(): void {\n if (this.transform != null && this.frame != null) {\n if (this.xArrow == null || this.yArrow == null || this.zArrow == null) {\n this.createElements(this.transform, this.frame);\n } else {\n this.updateElements(this.transform, this.frame);\n }\n\n this.interactiveBounds = computeDrawable2dBounds(\n this.viewport,\n ...this.rotationMeshes,\n ...this.translationMeshes\n );\n this.fullBounds = computeDrawable2dBounds(\n this.viewport,\n ...this.rotationMeshes,\n ...this.translationMeshes,\n ...this.axisLines\n );\n }\n }\n\n private createElements(transform: Matrix4.Matrix4, frame: Frame): void {\n this.reglCommand = regl({\n canvas: this.canvasElement,\n extensions: 'angle_instanced_arrays',\n });\n const { createShape } = shapeBuilder(this.reglCommand);\n\n const triangleSize = this.computeTriangleSize(\n Vector3.fromMatrixPosition(transform),\n frame\n );\n\n this.xArrow = new TriangleMesh(\n createShape,\n 'x-translate',\n xAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xTranslation\n ),\n this.outlineColor,\n this.getXTranslationColor()\n );\n this.xRotation = new TriangleMesh(\n createShape,\n 'x-rotate',\n xAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xRotation,\n this.customization.scalars?.xTranslation\n ),\n this.outlineColor,\n this.getXRotationColor()\n );\n this.xAxis = new AxisLine(\n createShape,\n 'x-axis',\n axisPositions(transform, frame.scene.camera, this.xArrow),\n this.outlineColor,\n this.getXTranslationColor()\n );\n\n this.yArrow = new TriangleMesh(\n createShape,\n 'y-translate',\n yAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yTranslation\n ),\n this.outlineColor,\n this.getYTranslationColor()\n );\n this.yRotation = new TriangleMesh(\n createShape,\n 'y-rotate',\n yAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yRotation,\n this.customization.scalars?.yTranslation\n ),\n this.outlineColor,\n this.getYRotationColor()\n );\n this.yAxis = new AxisLine(\n createShape,\n 'y-axis',\n axisPositions(transform, frame.scene.camera, this.yArrow),\n this.outlineColor,\n this.getYTranslationColor()\n );\n\n this.zArrow = new TriangleMesh(\n createShape,\n 'z-translate',\n zAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.zTranslation\n ),\n this.outlineColor,\n this.getZTranslationColor()\n );\n this.zAxis = new AxisLine(\n createShape,\n 'z-axis',\n axisPositions(transform, frame.scene.camera, this.zArrow),\n this.outlineColor,\n this.getZTranslationColor()\n );\n this.zRotation = new TriangleMesh(\n createShape,\n 'z-rotate',\n zAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.zRotation,\n this.customization.scalars?.zTranslation\n ),\n this.outlineColor,\n this.getZRotationColor()\n );\n\n this.xyTranslation = new TriangleMesh(\n createShape,\n 'xy-translate',\n xyAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xyTranslation\n ),\n this.outlineColor,\n this.getTwoAxesTranslationColor()\n );\n this.xzTranslation = new TriangleMesh(\n createShape,\n 'xz-translate',\n xzAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xzTranslation\n ),\n this.outlineColor,\n this.getTwoAxesTranslationColor()\n );\n this.yzTranslation = new TriangleMesh(\n createShape,\n 'yz-translate',\n yzAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yzTranslation\n ),\n this.outlineColor,\n this.getTwoAxesTranslationColor()\n );\n\n this.createRotationLines(createShape, transform, frame);\n\n this.axisLines = [this.xAxis, this.yAxis, this.zAxis];\n this.translationMeshes = [\n this.xArrow,\n this.yArrow,\n this.zArrow,\n this.xyTranslation,\n this.xzTranslation,\n this.yzTranslation,\n ];\n this.rotationMeshes = [this.xRotation, this.yRotation, this.zRotation];\n this.updateDisabledOnDrawables();\n\n this.availableElements = [\n ...this.axisLines,\n ...this.rotationLines,\n ...this.translationMeshes,\n ...this.rotationMeshes,\n ];\n }\n\n private getXRotationColor(): Color.Color | string | undefined {\n return this.xArrowFillColor;\n }\n\n private getYRotationColor(): Color.Color | string | undefined {\n return this.yArrowFillColor;\n }\n\n private getZRotationColor(): Color.Color | string | undefined {\n return this.zArrowFillColor;\n }\n\n private getXTranslationColor(): Color.Color | string | undefined {\n return this.xArrowFillColor;\n }\n\n private getYTranslationColor(): Color.Color | string | undefined {\n return this.yArrowFillColor;\n }\n\n private getZTranslationColor(): Color.Color | string | undefined {\n return this.zArrowFillColor;\n }\n\n private getTwoAxesTranslationColor(): Color.Color | string | undefined {\n return this.twoAxesSquareFillColor;\n }\n\n private createRotationLines(\n createShape: CreateShape,\n transform: Matrix4.Matrix4,\n frame: Frame\n ): void {\n const triangleSize = this.computeTriangleSize(\n Vector3.fromMatrixPosition(transform),\n frame\n );\n\n const xyRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.xRotation,\n this.yArrow?.points.worldTip,\n triangleSize\n );\n const xzRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.xRotation,\n this.zArrow?.points.worldTip,\n triangleSize\n );\n const yxRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.yRotation,\n this.xArrow?.points.worldTip,\n triangleSize\n );\n const yzRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.yRotation,\n this.zArrow?.points.worldTip,\n triangleSize\n );\n const zxRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.zRotation,\n this.xArrow?.points.worldTip,\n triangleSize\n );\n const zyRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.zRotation,\n this.yArrow?.points.worldTip,\n triangleSize\n );\n\n if (xyRotationLinePoints != null) {\n this.xyRotationLine = new RotationLine(\n createShape,\n 'xy-rotation-line',\n xyRotationLinePoints,\n this.outlineColor\n );\n }\n if (xzRotationLinePoints != null) {\n this.xzRotationLine = new RotationLine(\n createShape,\n 'xz-rotation-line',\n xzRotationLinePoints,\n this.outlineColor\n );\n }\n if (yxRotationLinePoints != null) {\n this.yxRotationLine = new RotationLine(\n createShape,\n 'yx-rotation-line',\n yxRotationLinePoints,\n this.outlineColor\n );\n }\n if (yzRotationLinePoints != null) {\n this.yzRotationLine = new RotationLine(\n createShape,\n 'yz-rotation-line',\n yzRotationLinePoints,\n this.outlineColor\n );\n }\n if (zxRotationLinePoints != null) {\n this.zxRotationLine = new RotationLine(\n createShape,\n 'zx-rotation-line',\n zxRotationLinePoints,\n this.outlineColor\n );\n }\n if (zyRotationLinePoints != null) {\n this.zyRotationLine = new RotationLine(\n createShape,\n 'zy-rotation-line',\n zyRotationLinePoints,\n this.outlineColor\n );\n }\n\n this.rotationLines = [\n this.xyRotationLine,\n this.xzRotationLine,\n this.yxRotationLine,\n this.yzRotationLine,\n this.zxRotationLine,\n this.zyRotationLine,\n ].filter((l) => l != null) as RotationLine[];\n }\n\n private updateElements(transform: Matrix4.Matrix4, frame: Frame): void {\n const triangleSize = this.computeTriangleSize(\n Vector3.fromMatrixPosition(transform),\n frame\n );\n\n if (this.xArrow != null) {\n this.xArrow.updatePoints(\n xAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xTranslation\n )\n );\n this.xAxis?.updatePoints(\n axisPositions(transform, frame.scene.camera, this.xArrow)\n );\n }\n this.xRotation?.updatePoints(\n xAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xRotation,\n this.customization.scalars?.xTranslation\n )\n );\n\n if (this.yArrow != null) {\n this.yArrow.updatePoints(\n yAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yTranslation\n )\n );\n this.yAxis?.updatePoints(\n axisPositions(transform, frame.scene.camera, this.yArrow)\n );\n }\n this.yRotation?.updatePoints(\n yAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yRotation,\n this.customization.scalars?.yTranslation\n )\n );\n\n if (this.zArrow != null) {\n this.zArrow.updatePoints(\n zAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.zTranslation\n )\n );\n this.zAxis?.updatePoints(\n axisPositions(transform, frame.scene.camera, this.zArrow)\n );\n }\n this.zRotation?.updatePoints(\n zAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.zRotation,\n this.customization.scalars?.zTranslation\n )\n );\n\n this.xyRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.xRotation,\n this.yArrow?.points.worldTip,\n triangleSize\n )\n );\n this.xzRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.xRotation,\n this.zArrow?.points.worldTip,\n triangleSize\n )\n );\n this.yxRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.yRotation,\n this.xArrow?.points.worldTip,\n triangleSize\n )\n );\n this.yzRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.yRotation,\n this.zArrow?.points.worldTip,\n triangleSize\n )\n );\n this.zxRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.zRotation,\n this.xArrow?.points.worldTip,\n triangleSize\n )\n );\n this.zyRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.zRotation,\n this.yArrow?.points.worldTip,\n triangleSize\n )\n );\n\n if (this.xyTranslation != null) {\n this.xyTranslation.updatePoints(\n xyAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xyTranslation\n )\n );\n }\n if (this.xzTranslation != null) {\n this.xzTranslation.updatePoints(\n xzAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xzTranslation\n )\n );\n }\n if (this.yzTranslation != null) {\n this.yzTranslation.updatePoints(\n yzAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yzTranslation\n )\n );\n }\n }\n}\n",":host {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n /**\n * @prop --viewer-transform-widget-x-axis-arrow-color: A CSS color for the arrow\n * at the end of the X axis on this widget. Defaults to `#ea3324`.\n */\n --viewer-transform-widget-x-axis-arrow-color: var(--x-axis-color);\n\n /**\n * @prop --viewer-transform-widget-y-axis-arrow-color: A CSS color for the arrow\n * at the end of the Y axis on this widget. Defaults to `#4faf32`.\n */\n --viewer-transform-widget-y-axis-arrow-color: var(--y-axis-color);\n\n /**\n * @prop --viewer-transform-widget-z-axis-arrow-color: A CSS color for the arrow\n * at the end of the Z axis on this widget. Defaults to `#0000ff`.\n */\n --viewer-transform-widget-z-axis-arrow-color: var(--z-axis-color);\n\n /**\n * @prop --viewer-transform-widget-two-axes-square-color: A CSS color for the squares\n * to translate by two axes at a time. Defaults to `#e0e0e0`.\n */\n --viewer-transform-widget-two-axes-square-color: var(--two-axes-color);\n\n\n /**\n * @prop --viewer-transform-widget-hovered-arrow-color: A CSS color for the arrow\n * when it is hovered. Defaults to `#ffff00`.\n */\n --viewer-transform-widget-hovered-arrow-color: #ffff00;\n\n /**\n * @prop --viewer-transform-widget-input-width: A CSS length for the width of the\n * input displayed near the handles. Defaults to `8em`.\n */\n --viewer-transform-widget-input-width: 8em;\n}\n\n.widget {\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.widget.hovered {\n pointer-events: auto;\n}\n\n.widget-input.wrapper {\n position: absolute;\n pointer-events: auto;\n display: flex;\n align-items: center;\n border: 1px solid #444444;\n border-radius: 4px;\n width: var(--viewer-transform-widget-input-width);\n text-align: center;\n background-color: white;\n box-sizing: border-box;\n}\n\n.widget-input.units {\n position: relative;\n width: 25%;\n height: 100%;\n padding: 0 0.25rem;\n font-size: 0.8125rem;\n color: #444444;\n}\n\ninput.widget-input {\n position: relative;\n text-align: center;\n box-sizing: border-box;\n width: 75%;\n height: 100%;\n outline: none;\n border-width: 0 1px 0 0;\n border-color: #444444;\n border-radius: 2px 0 0 2px;\n font-size: 0.875rem;\n color: #444444;\n}\n\ninput.widget-input.x-translate,\ninput.widget-input.x-rotate {\n border-left: 5px solid var(--viewer-transform-widget-x-axis-arrow-color);\n}\n\ninput.widget-input.y-translate,\ninput.widget-input.y-rotate {\n border-left: 5px solid var(--viewer-transform-widget-y-axis-arrow-color);\n}\n\ninput.widget-input.z-translate,\ninput.widget-input.z-rotate {\n border-left: 5px solid var(--viewer-transform-widget-z-axis-arrow-color);\n}\n\ninput.widget-input:disabled {\n color: #888888;\n}\n\ninput.widget-input:focus {\n outline: none;\n}","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport {\n Angle,\n Euler,\n Matrix4,\n Point,\n Quaternion,\n Vector3,\n} from '@vertexvis/geometry';\nimport { Color, Disposable } from '@vertexvis/utils';\nimport classNames from 'classnames';\n\nimport { readDOM, writeDOM } from '../../lib/stencil';\nimport { TransformController } from '../../lib/transforms/controller';\nimport { Drawable } from '../../lib/transforms/drawable';\nimport {\n AngleUnits,\n AngleUnitType,\n DistanceUnits,\n DistanceUnitType,\n} from '../../lib/types';\nimport { ModifierKey } from '../../lib/types/keys';\nimport { focusInputElement } from './dom';\nimport {\n calculateNewRotationAngle,\n computeHandleDeltaTransform,\n computeInputDeltaTransform,\n computeInputDisplayValue,\n computeInputPosition,\n convertCanvasPointToWorld,\n convertPointToCanvas,\n PointAndPlacement,\n} from './util';\nimport {\n TransformWidgetInput,\n TransformWidgetInputWrapper,\n} from './viewer-transform-widget-components';\nimport { TransformWidget } from './widget';\n\n@Component({\n tag: 'vertex-viewer-transform-widget',\n styleUrl: 'viewer-transform-widget.css',\n shadow: true,\n})\nexport class ViewerTransformWidget {\n /**\n * An event that is emitted when the position of the widget changes.\n */\n @Event({ bubbles: true })\n public positionChanged!: EventEmitter<Vector3.Vector3 | undefined>;\n\n /**\n * An event that is emitted when the rotation of the widget changes.\n */\n @Event({ bubbles: true })\n public rotationChanged!: EventEmitter<Euler.Euler | undefined>;\n\n /**\n * An event that is emitted when the interaction has ended\n */\n @Event({ bubbles: true })\n public interactionEnded!: EventEmitter<Matrix4.Matrix4 | undefined>;\n\n /**\n * An event that is emitted an interaction with the widget has started\n */\n @Event({ bubbles: true })\n public interactionStarted!: EventEmitter<void>;\n\n /**\n * The viewer to connect to transforms. If nested within a <vertex-viewer>,\n * this property will be populated automatically.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The starting position of this transform widget. This position will be updated\n * as transforms occur. Setting this value to `undefined` will remove the widget.\n */\n @Prop({ mutable: true })\n public position?: Vector3.Vector3;\n\n /**\n * The starting angle for the transform widget. This rotation will be updated\n * as the rotations occur.\n */\n @Prop({ mutable: true })\n public rotation?: Euler.Euler;\n\n /**\n * The controller that is responsible for performing transforms.\n */\n @Prop({ mutable: true })\n public controller?: TransformController;\n\n /**\n * Determines whether the x-rotation is disabled on the widget\n */\n @Prop({ mutable: true })\n public xRotationDisabled = false;\n\n /**\n * Determines whether the y-rotation is disabled on the widget\n */\n @Prop({ mutable: true })\n public yRotationDisabled = false;\n\n /**\n * Determines whether the z-rotation is disabled on the widget\n */\n @Prop({ mutable: true })\n public zRotationDisabled = false;\n\n /**\n * Determines whether the x-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public xTranslationDisabled = false;\n\n /**\n * Determines whether the y-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public yTranslationDisabled = false;\n\n /**\n * Determines whether the z-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public zTranslationDisabled = false;\n\n /**\n * Determines whether the xy-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public xyTranslationDisabled = false;\n\n /**\n * Determines whether the xz-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public xzTranslationDisabled = false;\n\n /**\n * Determines whether the yz-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public yzTranslationDisabled = false;\n\n /**\n * Whether to show inputs beside the widget handles when they are interacted with.\n * Defaults to `true`.\n */\n @Prop()\n public showInputs = true;\n\n /**\n * The unit to show for translation inputs. Defaults to `millimeters`.\n *\n * @see DistanceUnitType\n */\n @Prop()\n public distanceUnit: DistanceUnitType = 'millimeters';\n\n /**\n * The unit to show for rotation inputs. Defaults to `degrees`.\n *\n * @see AngleUnitType\n */\n @Prop()\n public angleUnit: AngleUnitType = 'degrees';\n\n /**\n * The number of decimal places to show in the input. Defaults to `1`.\n */\n @Prop()\n public decimalPlaces = 1;\n\n /**\n * When defined, the widget will snap to the degree of the nearest multiple of\n * the given number when the user is rotating with the widget and holding the\n * key defined by rotationSnapKey. Defaults to undefined.\n */\n @Prop()\n public rotationSnapDegrees?: number;\n\n /**\n * When rotationSnapDegrees is defined, the widget will snap to the degree of the\n * nearest multiple of the given number when the user is rotating with the widget\n * and holding the key defined here. Defaults to the shift key.\n */\n @Prop()\n public rotationSnapKey: ModifierKey = 'shift';\n\n /**\n * Scalar to increase the size of the translation handles of this widget.\n * Values above zero and below three will result in the best visual representation\n * of the handles, and values above three may produce unexpected results.\n *\n * Defaults to `1`.\n */\n @Prop()\n public translationHandleScalar = 1;\n\n /**\n * Scalar to increase the size of the rotation handles of this widget.\n * Values above zero and below three will result in the best visual representation\n * of the handles, and values above three may produce unexpected results.\n *\n * Defaults to `1`.\n */\n @Prop()\n public rotationHandleScalar = 1;\n\n /**\n * Specifies the frequency, in milliseconds, to update the transform while interacting with the widget.\n *\n * This delay is used to group events happening in quick succession and results in smoother\n * widget movement.\n */\n @Prop()\n public interactionThrottle = 75;\n\n /**\n * **EXPERIMENTAL.**\n *\n * Enables Command+Z and Control+Z keybindings to perform an undo of\n * the previous delta transformation.\n *\n * @see `EXPERIMENTAL_undo`\n */\n @Prop()\n public EXPERIMENTAL_undoKeybindings = false;\n\n /**\n * @internal\n * @ignore\n *\n * Visible for testing.\n */\n @Prop({ mutable: true })\n public hovered?: Drawable;\n\n @State()\n protected inputPosition?: PointAndPlacement;\n\n @State()\n protected inputValue = 0;\n\n @State()\n protected isEndingTransform = false;\n\n @State()\n protected inputShouldFocus = false;\n\n @Element()\n private hostEl!: HTMLElement;\n\n private startingTransform?: Matrix4.Matrix4;\n private currentTransform?: Matrix4.Matrix4;\n private dragStartTransform?: Matrix4.Matrix4;\n\n private xArrowColor: Color.Color | string = '#ea3324';\n private yArrowColor: Color.Color | string = '#4faf32';\n private zArrowColor: Color.Color | string = '#0000ff';\n private twoAxesSquareColor: Color.Color | string = '#e0e0e0';\n private hoveredColor: Color.Color | string = '#ffff00';\n\n private widget?: TransformWidget;\n private lastDragged?: Drawable;\n private dragging?: Drawable;\n private lastAngle = 0;\n private lastWorldPosition?: Vector3.Vector3;\n private lastInputValue?: number;\n\n private canvasBounds?: DOMRect;\n private inputBounds?: DOMRect;\n private canvasResizeObserver?: ResizeObserver;\n private inputResizeObserver?: ResizeObserver;\n private hostStyleObserver?: MutationObserver;\n private canvasRef?: HTMLCanvasElement;\n private inputWrapperRef?: HTMLDivElement;\n private inputRef?: HTMLInputElement;\n\n private hoveredChangeDisposable?: Disposable;\n\n private interactionTimer?: number;\n private lastMouseEvent?: PointerEvent;\n\n protected componentDidLoad(): void {\n window.addEventListener('pointermove', this.handlePointerMove);\n\n this.canvasResizeObserver = new ResizeObserver(this.handleResize);\n this.inputResizeObserver = new ResizeObserver(this.handleInputResize);\n this.hostStyleObserver = new MutationObserver(this.handleStyleChange);\n\n if (this.canvasRef != null) {\n this.canvasResizeObserver.observe(this.canvasRef);\n\n this.setupTransformWidget(this.canvasRef);\n }\n\n this.hostStyleObserver.observe(this.hostEl, {\n attributes: true,\n attributeFilter: ['style'],\n });\n\n this.handleViewerChanged(this.viewer, undefined);\n this.handleStyleChange();\n }\n\n protected disconnectedCallback(): void {\n window.removeEventListener('pointermove', this.handlePointerMove);\n\n this.canvasResizeObserver?.disconnect();\n this.inputResizeObserver?.disconnect();\n this.hostStyleObserver?.disconnect();\n\n this.hoveredChangeDisposable?.dispose();\n this.widget?.dispose();\n }\n\n protected componentDidRender(): void {\n if (this.inputShouldFocus && this.inputRef != null) {\n focusInputElement(this.inputRef);\n this.inputShouldFocus = false;\n }\n }\n\n /**\n * **EXPERIMENTAL.**\n *\n * Performs an undo of the most recent set of transform manipulations,\n * categorized by the last pause in interactivity (pointerup on a handle,\n * Enter press on an input, keyup on an input).\n *\n * Note that this *does not* work repeatedly. I.e. only one undo can be\n * performed, and once another set of transform manipulations is performed,\n * the history is lost.\n */\n @Method()\n public async EXPERIMENTAL_undo(): Promise<void> {\n const undoDelta = await this.controller?.EXPERIMENTAL_undoTransform();\n\n if (this.currentTransform != null && undoDelta != null) {\n this.currentTransform = Matrix4.multiply(\n undoDelta,\n this.currentTransform\n );\n\n this.widget?.updateTransform(this.currentTransform);\n\n this.updateInputPosition();\n this.updateInputValue();\n this.lastInputValue = this.inputValue;\n\n this.position = Vector3.fromMatrixPosition(this.currentTransform);\n this.rotation = Euler.fromRotationMatrix(this.currentTransform);\n }\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(\n newViewer?: HTMLVertexViewerElement,\n oldViewer?: HTMLVertexViewerElement\n ): void {\n oldViewer?.removeEventListener('frameDrawn', this.handleViewerFrameDrawn);\n oldViewer?.removeEventListener(\n 'dimensionschange',\n this.handleViewerDimensionsChange\n );\n newViewer?.addEventListener('frameDrawn', this.handleViewerFrameDrawn);\n newViewer?.addEventListener(\n 'dimensionschange',\n this.handleViewerDimensionsChange\n );\n\n if (newViewer?.stream != null) {\n this.controller?.dispose();\n this.controller = new TransformController(newViewer.stream);\n }\n }\n\n /**\n * @ignore\n */\n @Watch('xTranslationDisabled')\n @Watch('yTranslationDisabled')\n @Watch('zTranslationDisabled')\n @Watch('xyTranslationDisabled')\n @Watch('xzTranslationDisabled')\n @Watch('yzTranslationDisabled')\n @Watch('xRotationDisabled')\n @Watch('yRotationDisabled')\n @Watch('zRotationDisabled')\n protected handleDisabledPropertyChanged(): void {\n this.widget?.updateDisabledAxis({\n xRotation: this.xRotationDisabled,\n yRotation: this.yRotationDisabled,\n zRotation: this.zRotationDisabled,\n\n xTranslation: this.xTranslationDisabled,\n yTranslation: this.yTranslationDisabled,\n zTranslation: this.zTranslationDisabled,\n\n xyTranslation: this.xyTranslationDisabled,\n xzTranslation: this.xzTranslationDisabled,\n yzTranslation: this.yzTranslationDisabled,\n });\n }\n\n /**\n * @ignore\n */\n @Watch('translationHandleScalar')\n @Watch('rotationHandleScalar')\n protected handleTransformHandleScalarChanged(): void {\n const effectiveArrowScalar = this.getTranslationScalar();\n const effectiveSquareScalar = this.getRotationScalar();\n\n this.widget?.updateScalars({\n xTranslation: effectiveArrowScalar,\n yTranslation: effectiveArrowScalar,\n zTranslation: effectiveArrowScalar,\n xyTranslation: effectiveSquareScalar,\n xzTranslation: effectiveSquareScalar,\n yzTranslation: effectiveSquareScalar,\n xRotation: effectiveSquareScalar,\n yRotation: effectiveSquareScalar,\n zRotation: effectiveSquareScalar,\n });\n }\n\n /**\n * @ignore\n */\n @Watch('rotation')\n protected handleRotationChanged(\n newRotation?: Euler.Euler,\n oldRotation?: Euler.Euler\n ): void {\n const rotationToApply = newRotation ?? Euler.create();\n\n this.currentTransform = this.getTransformForNewRotation(rotationToApply);\n this.startingTransform = this.currentTransform;\n\n // If the removal of the previous rotation above results in an identity matrix,\n // clear the transformation on the widget to prevent it from appearing at the origin.\n if (\n newRotation == null &&\n this.currentTransform != null &&\n Matrix4.isIdentity(this.currentTransform)\n ) {\n this.currentTransform = undefined;\n this.startingTransform = this.currentTransform;\n }\n\n this.widget?.updateTransform(this.currentTransform);\n\n console.debug(\n `Updating widget rotation [previous=${JSON.stringify(\n oldRotation\n )}, current=${JSON.stringify(newRotation)}]`\n );\n\n this.rotationChanged.emit(newRotation);\n }\n\n /**\n * @ignore\n */\n @Watch('position')\n protected handlePositionChanged(\n newPosition?: Vector3.Vector3,\n oldPosition?: Vector3.Vector3\n ): void {\n this.currentTransform = this.getTransformForNewPosition(newPosition);\n this.startingTransform = this.currentTransform;\n\n console.debug(\n `Updating widget position [previous=${JSON.stringify(\n oldPosition\n )}, current=${JSON.stringify(newPosition)}]`\n );\n this.widget?.updateTransform(this.currentTransform);\n\n if (newPosition == null) {\n this.lastDragged = undefined;\n this.inputPosition = undefined;\n this.controller?.clearTransform();\n }\n\n this.positionChanged.emit(newPosition);\n }\n\n /**\n * @ignore\n */\n @Watch('distanceUnit')\n @Watch('angleUnit')\n @Watch('decimalPlaces')\n protected handleInputFormattingChanged(): void {\n this.updateInputValue();\n this.lastInputValue = this.inputValue;\n }\n\n public render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <canvas\n ref={(el) => {\n this.canvasRef = el;\n }}\n class={classNames('widget', {\n hovered: this.hovered != null,\n })}\n tabindex=\"0\"\n width={this.viewer?.viewport.width}\n height={this.viewer?.viewport.height}\n onPointerDown={this.handleBeginDrag}\n onKeyDown={this.handleKeyDown}\n />\n\n {this.showInputs && this.inputPosition && this.viewer?.viewport && (\n <TransformWidgetInputWrapper\n ref={(el) => {\n if (el != null) {\n this.inputResizeObserver?.observe(el);\n } else if (this.inputRef != null) {\n this.inputResizeObserver?.unobserve(this.inputRef);\n }\n this.inputWrapperRef = el;\n }}\n bounds={this.inputBounds}\n viewport={this.viewer.viewport}\n point={this.inputPosition.point}\n placement={this.inputPosition.placement}\n displayUnit={this.getDisplayedUnits()}\n >\n <TransformWidgetInput\n ref={(el) => {\n this.inputRef = el;\n }}\n identifier={\n this.dragging?.identifier ?? this.lastDragged?.identifier\n }\n disabled={this.isEndingTransform}\n onChange={this.handleInputChange}\n onIncrement={() => this.handleInputStep(1)}\n onDecrement={() => this.handleInputStep(-1)}\n onBlur={() => {\n this.inputShouldFocus = false;\n }}\n onUndo={\n this.EXPERIMENTAL_undoKeybindings\n ? () => this.EXPERIMENTAL_undo()\n : undefined\n }\n />\n </TransformWidgetInputWrapper>\n )}\n </Host>\n );\n }\n\n private handleHoveredDrawableChanged = (drawable?: Drawable): void => {\n this.hovered = drawable;\n };\n\n private handleViewerFrameDrawn = (): void => {\n this.updatePropsFromViewer();\n };\n\n private handleViewerDimensionsChange = (): void => {\n writeDOM(() => {\n if (this.viewer != null && this.canvasRef != null) {\n this.canvasRef.width = this.viewer.viewport.width;\n this.canvasRef.height = this.viewer.viewport.height;\n\n this.updateCanvasBounds(this.canvasRef);\n }\n });\n };\n\n private handleResize = (): void => {\n if (this.canvasRef != null) {\n this.updateCanvasBounds(this.canvasRef);\n }\n };\n\n private handleInputResize = (): void => {\n if (this.inputWrapperRef != null) {\n const wrapperElement = this.inputWrapperRef;\n\n readDOM(() => {\n this.inputBounds = wrapperElement.getBoundingClientRect();\n });\n }\n };\n\n private handleStyleChange = (): void => {\n readDOM(() => {\n const hostStyles = window.getComputedStyle(this.hostEl);\n\n this.xArrowColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-x-axis-arrow-color')\n .trim();\n this.yArrowColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-y-axis-arrow-color')\n .trim();\n this.zArrowColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-z-axis-arrow-color')\n .trim();\n this.twoAxesSquareColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-two-axes-square-color')\n .trim();\n this.hoveredColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-hovered-arrow-color')\n .trim();\n\n this.getTransformWidget().updateColors({\n xArrow: this.xArrowColor,\n yArrow: this.yArrowColor,\n zArrow: this.zArrowColor,\n twoAxesSquare: this.twoAxesSquareColor,\n hovered: this.hoveredColor,\n });\n });\n };\n\n private handlePointerMove = (event: PointerEvent): void => {\n if (this.dragging == null) {\n const canvasPoint = convertPointToCanvas(\n Point.create(event.clientX, event.clientY),\n this.getCanvasBounds()\n );\n const widget = this.getTransformWidget();\n\n if (canvasPoint != null && widget.boundsContainsPoint(canvasPoint)) {\n widget.updateCursor(canvasPoint);\n } else {\n widget.updateCursor(undefined);\n this.hovered = undefined;\n }\n }\n };\n\n private handleBeginDrag = async (event: PointerEvent): Promise<void> => {\n const canvasBounds = this.getCanvasBounds();\n\n if (\n this.hovered != null &&\n canvasBounds != null &&\n this.viewer != null &&\n this.position != null &&\n this.viewer.frame != null\n ) {\n this.dragging = this.hovered;\n\n if (this.dragging.identifier !== this.lastDragged?.identifier) {\n this.inputValue = 0;\n this.dragStartTransform = this.currentTransform;\n this.updateInputPosition();\n this.updateInputValue();\n }\n this.lastDragged = undefined;\n\n const currentCanvas = convertPointToCanvas(\n Point.create(event.clientX, event.clientY),\n canvasBounds\n );\n const widgetCenter = this.viewer.viewport.transformWorldToViewport(\n this.position,\n this.viewer.frame.scene.camera.projectionViewMatrix\n );\n\n this.lastAngle =\n currentCanvas != null\n ? Angle.fromPoints(widgetCenter, currentCanvas)\n : 0;\n\n this.lastWorldPosition = convertCanvasPointToWorld(\n currentCanvas,\n this.viewer?.frame,\n this.viewer?.viewport,\n this.currentTransform\n );\n\n this.interactionStarted.emit();\n\n window.removeEventListener('pointermove', this.handlePointerMove);\n window.addEventListener('pointermove', this.handleDragWithTimer);\n window.addEventListener('pointerup', this.handleEndTransform);\n }\n };\n\n private handleDragWithTimer = async (event: PointerEvent): Promise<void> => {\n if (event != null) {\n // Prevent selection of text and interaction with view cube while dragging the widget\n event.preventDefault();\n\n this.lastMouseEvent = event;\n }\n\n if (this.interactionTimer == null) {\n this.interactionTimer = window.setTimeout(async () => {\n this.interactionTimer = undefined;\n await this.handleDrag();\n this.lastMouseEvent = undefined;\n }, this.interactionThrottle);\n }\n };\n\n private handleDrag = async (): Promise<void> => {\n const canvasBounds = this.getCanvasBounds();\n\n if (\n this.dragging != null &&\n this.lastWorldPosition != null &&\n canvasBounds != null &&\n this.viewer != null &&\n this.viewer.frame != null &&\n this.position != null &&\n this.lastMouseEvent != null\n ) {\n // Begin the transform on the first `pointermove` event as opposed to the\n // `pointerdown` to prevent accidental no-op transforms (identity matrix).\n await this.controller?.beginTransform();\n\n const currentCanvas = convertPointToCanvas(\n Point.create(this.lastMouseEvent.clientX, this.lastMouseEvent.clientY),\n canvasBounds\n );\n const widgetCenter = this.viewer.viewport.transformWorldToViewport(\n this.position,\n this.viewer.frame.scene.camera.projectionViewMatrix\n );\n\n const currentWorld = convertCanvasPointToWorld(\n currentCanvas,\n this.viewer?.frame,\n this.viewer?.viewport,\n this.currentTransform\n );\n\n if (\n currentWorld != null &&\n currentCanvas != null &&\n widgetCenter != null\n ) {\n const angle = Angle.fromPoints(widgetCenter, currentCanvas);\n const angleToUse = calculateNewRotationAngle(\n this.lastMouseEvent,\n this.rotationSnapKey,\n angle,\n this.lastAngle,\n this.getDisplayedAngle(),\n this.rotationSnapDegrees\n );\n\n this.transform(\n this.lastWorldPosition,\n currentWorld,\n angleToUse - this.lastAngle\n );\n\n this.updateInputPosition();\n this.updateInputValue();\n\n this.lastWorldPosition = currentWorld;\n this.lastAngle = angleToUse;\n }\n }\n };\n\n private handleEndTransform = async (event: PointerEvent): Promise<void> => {\n const canvasPoint = convertPointToCanvas(\n Point.create(event.clientX, event.clientY),\n this.getCanvasBounds()\n );\n const widget = this.getTransformWidget();\n this.lastDragged = this.dragging;\n\n this.dragging = undefined;\n this.lastWorldPosition = undefined;\n this.lastAngle = 0;\n\n this.updateInputPosition();\n this.updateInputValue();\n\n widget.updateCursor(canvasPoint);\n widget.updateTransform(this.currentTransform);\n\n this.beginEndTransform();\n\n window.removeEventListener('pointermove', this.handleDragWithTimer);\n window.removeEventListener('pointerup', this.handleEndTransform);\n\n try {\n const delta = this.controller?.getCurrentDelta();\n\n await this.controller?.endTransform();\n\n this.interactionEnded.emit(delta);\n } catch (e) {\n console.error('Failed to end transform interaction', e);\n }\n\n window.addEventListener('pointermove', this.handlePointerMove);\n\n this.completeEndTransform();\n };\n\n private handleInputStep = async (step: number): Promise<void> => {\n if (this.inputValue != null && this.lastInputValue != null) {\n // If modifying angle units, we want to adjust the step to always\n // perform the equivalent of a 1 degree rotation.\n if (this.isModifyingAngleUnits()) {\n const angles = new AngleUnits(this.angleUnit);\n const previous = angles.convertFrom(this.lastInputValue);\n const next = Angle.normalizeRadians(previous + Angle.toRadians(step));\n\n this.inputValue = angles.convertTo(next);\n } else {\n this.inputValue = this.lastInputValue + step;\n }\n await this.updateTransformFromInput(this.inputValue);\n }\n };\n\n private handleInputChange = async (value: number): Promise<void> => {\n await this.updateTransformFromInput(value);\n };\n\n private handleKeyDown = async (event: KeyboardEvent): Promise<void> => {\n const commandOrControlModifier = event.ctrlKey || event.metaKey;\n\n if (\n event.key === 'z' &&\n commandOrControlModifier &&\n this.EXPERIMENTAL_undoKeybindings\n ) {\n event.stopPropagation();\n await this.EXPERIMENTAL_undo();\n }\n };\n\n private updateTransformFromInput = async (value: number): Promise<void> => {\n if (\n this.lastDragged != null &&\n this.currentTransform != null &&\n this.startingTransform != null &&\n this.lastInputValue != null\n ) {\n this.currentTransform = computeInputDeltaTransform(\n this.currentTransform,\n this.lastDragged.identifier,\n value,\n this.lastInputValue,\n this.distanceUnit,\n this.angleUnit\n );\n\n this.updateInputValue();\n this.lastInputValue = value;\n\n await this.controller?.beginTransform();\n this.getTransformWidget().updateTransform(this.currentTransform);\n await this.controller?.updateTransform(\n Matrix4.multiply(\n this.currentTransform,\n Matrix4.invert(this.startingTransform)\n )\n );\n this.updateInputPosition();\n await this.controller?.endTransformDebounced(\n this.beginEndTransform,\n this.completeEndTransform\n );\n }\n };\n\n private updatePropsFromViewer = (): void => {\n const { frame } = this.viewer || {};\n\n if (frame != null) {\n const widget = this.getTransformWidget();\n\n widget.updateFrame(frame, this.dragging == null);\n this.updateInputPosition();\n }\n };\n\n private transform(\n previous: Vector3.Vector3,\n next: Vector3.Vector3,\n angle: number\n ): void {\n if (\n this.position != null &&\n this.startingTransform != null &&\n this.currentTransform != null &&\n this.dragging != null &&\n this.viewer != null &&\n this.viewer.frame != null\n ) {\n this.currentTransform = computeHandleDeltaTransform(\n this.currentTransform,\n previous,\n next,\n this.viewer?.frame.scene.camera.viewVector,\n angle,\n this.dragging.identifier\n );\n\n this.getTransformWidget().updateTransform(this.currentTransform);\n this.controller?.updateTransform(\n Matrix4.multiply(\n this.currentTransform,\n Matrix4.invert(this.startingTransform)\n )\n );\n }\n }\n\n private handleSettingDisabledAxis(): void {\n if (this.widget) {\n this.widget.updateDisabledAxis({\n xRotation: this.xRotationDisabled,\n yRotation: this.yRotationDisabled,\n zRotation: this.zRotationDisabled,\n xTranslation: this.xTranslationDisabled,\n yTranslation: this.yTranslationDisabled,\n zTranslation: this.zTranslationDisabled,\n xyTranslation: this.xyTranslationDisabled,\n xzTranslation: this.xzTranslationDisabled,\n yzTranslation: this.yzTranslationDisabled,\n });\n } else {\n console.warn('Cannot set disabled values - no widget defined');\n }\n }\n\n private setupTransformWidget = (\n canvasRef: HTMLCanvasElement\n ): TransformWidget => {\n console.debug(\n `Initializing transform widget. [initial-position=${JSON.stringify(\n this.position\n )}, has-initial-frame=${this.viewer?.frame != null}]`\n );\n\n const effectiveArrowScalar = this.getTranslationScalar();\n const effectiveSquareScalar = this.getRotationScalar();\n\n this.widget = new TransformWidget(canvasRef, {\n colors: {\n xArrow: this.xArrowColor,\n yArrow: this.yArrowColor,\n zArrow: this.zArrowColor,\n twoAxesSquare: this.twoAxesSquareColor,\n hovered: this.hoveredColor,\n },\n scalars: {\n xTranslation: effectiveArrowScalar,\n yTranslation: effectiveArrowScalar,\n zTranslation: effectiveArrowScalar,\n xyTranslation: effectiveSquareScalar,\n xzTranslation: effectiveSquareScalar,\n yzTranslation: effectiveSquareScalar,\n xRotation: effectiveSquareScalar,\n yRotation: effectiveSquareScalar,\n zRotation: effectiveSquareScalar,\n },\n });\n\n if (this.rotation != null) {\n this.currentTransform = this.getTransformForNewRotation(this.rotation);\n this.startingTransform = this.currentTransform;\n this.widget.updateTransform(this.currentTransform);\n }\n\n if (this.position != null) {\n this.currentTransform = this.getTransformForNewPosition(this.position);\n this.startingTransform = this.currentTransform;\n this.widget.updateTransform(this.currentTransform);\n }\n if (this.viewer?.frame != null) {\n this.widget.updateFrame(this.viewer.frame, true);\n }\n\n this.handleSettingDisabledAxis();\n\n this.hoveredChangeDisposable = this.widget.onHoveredChanged(\n this.handleHoveredDrawableChanged\n );\n\n return this.widget;\n };\n\n private updateCanvasBounds = (canvasElement: HTMLCanvasElement): void => {\n readDOM(() => {\n this.canvasBounds = canvasElement.getBoundingClientRect();\n\n this.getTransformWidget().updateDimensions(canvasElement);\n });\n };\n\n private updateInputValue = (): void => {\n const dragging = this.dragging ?? this.lastDragged;\n const isDraggingTwoAxesTranslation =\n dragging?.identifier === 'xy-translate' ||\n dragging?.identifier === 'xz-translate' ||\n dragging?.identifier === 'yz-translate';\n\n if (\n dragging != null &&\n this.currentTransform != null &&\n this.dragStartTransform != null &&\n !isDraggingTwoAxesTranslation\n ) {\n this.lastInputValue = this.inputValue;\n\n this.inputValue = computeInputDisplayValue(\n dragging.identifier,\n this.currentTransform,\n this.dragStartTransform,\n this.distanceUnit,\n this.angleUnit\n );\n\n if (this.inputRef != null) {\n const definedValue =\n this.getDisplayedDistance() ?? this.getDisplayedAngle() ?? 0;\n const displayValue = `${parseFloat(\n definedValue.toFixed(this.decimalPlaces)\n )}`;\n\n this.inputRef.value = displayValue;\n }\n }\n };\n\n private updateInputPosition = (): void => {\n const dragging = this.dragging ?? this.lastDragged;\n\n const isDraggingTwoAxesTranslation =\n dragging?.identifier === 'xy-translate' ||\n dragging?.identifier === 'xz-translate' ||\n dragging?.identifier === 'yz-translate';\n\n if (\n this.showInputs &&\n this.viewer?.frame != null &&\n this.position != null &&\n dragging != null &&\n !isDraggingTwoAxesTranslation\n ) {\n const widget = this.getTransformWidget();\n const widgetBounds = widget.getFullBounds();\n\n this.inputPosition =\n widgetBounds != null\n ? computeInputPosition(\n this.viewer.viewport,\n widgetBounds,\n dragging.points.toArray()\n )\n : undefined;\n } else if (isDraggingTwoAxesTranslation) {\n this.inputPosition = undefined;\n }\n };\n\n private beginEndTransform = (): void => {\n const widget = this.getTransformWidget();\n\n widget.updateDisabledAxis({\n xRotation: true,\n yRotation: true,\n zRotation: true,\n xTranslation: true,\n yTranslation: true,\n zTranslation: true,\n xyTranslation: true,\n xzTranslation: true,\n yzTranslation: true,\n });\n\n this.isEndingTransform = true;\n };\n\n private completeEndTransform = (): void => {\n const widget = this.getTransformWidget();\n\n widget.updateDisabledAxis({\n xRotation: this.xRotationDisabled,\n yRotation: this.yRotationDisabled,\n zRotation: this.zRotationDisabled,\n\n xTranslation: this.xTranslationDisabled,\n yTranslation: this.yTranslationDisabled,\n zTranslation: this.zTranslationDisabled,\n\n xyTranslation: this.xyTranslationDisabled,\n xzTranslation: this.xzTranslationDisabled,\n yzTranslation: this.yzTranslationDisabled,\n });\n\n this.isEndingTransform = false;\n this.inputShouldFocus = true;\n\n if (this.currentTransform != null) {\n this.position = Vector3.fromMatrixPosition(this.currentTransform);\n this.rotation = Euler.fromRotationMatrix(this.currentTransform);\n }\n };\n\n private isModifyingAngleUnits = (): boolean => {\n const draggingIdentifier =\n this.dragging?.identifier ?? this.lastDragged?.identifier;\n\n return !!draggingIdentifier?.includes('rotate');\n };\n\n private getTranslationScalar = (): number => {\n if (this.translationHandleScalar > 0) {\n return this.translationHandleScalar;\n }\n console.warn(\n 'Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.'\n );\n return 1;\n };\n\n private getRotationScalar = (): number => {\n if (this.rotationHandleScalar > 0) {\n return this.rotationHandleScalar;\n }\n console.warn(\n 'Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.'\n );\n return 1;\n };\n\n private getDisplayedUnits = (): AngleUnits | DistanceUnits => {\n if (this.isModifyingAngleUnits()) {\n return new AngleUnits(this.angleUnit);\n }\n return new DistanceUnits(this.distanceUnit);\n };\n\n private getDisplayedAngle = (): number | undefined => {\n if (this.isModifyingAngleUnits()) {\n return this.inputValue;\n }\n };\n\n private getDisplayedDistance = (): number | undefined => {\n const draggingIdentifier =\n this.dragging?.identifier ?? this.lastDragged?.identifier;\n if (draggingIdentifier?.includes('translate')) {\n return this.inputValue;\n }\n };\n\n private getTransformForNewPosition = (\n newPosition?: Vector3.Vector3\n ): Matrix4.Matrix4 | undefined => {\n if (newPosition != null) {\n const c =\n this.currentTransform != null\n ? this.currentTransform\n : Matrix4.makeIdentity();\n\n const currentRotation = Matrix4.makeRotation(\n Quaternion.fromMatrixRotation(c)\n );\n const position = Matrix4.makeTranslation(newPosition);\n\n return Matrix4.multiply(position, currentRotation);\n }\n };\n\n private getTransformForNewRotation = (\n newRotationEuler: Euler.Euler\n ): Matrix4.Matrix4 | undefined => {\n const c =\n this.currentTransform != null\n ? this.currentTransform\n : Matrix4.makeIdentity();\n\n const oldRotation = Matrix4.invert(\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(c))\n );\n\n const newRotation = Matrix4.makeRotation(\n Quaternion.fromEuler(newRotationEuler)\n );\n const oldTranslation = Matrix4.multiply(c, oldRotation);\n\n return Matrix4.multiply(oldTranslation, newRotation);\n };\n\n private getCanvasBounds = (): DOMRect | undefined => {\n if (this.canvasBounds != null) {\n return this.canvasBounds;\n } else if (this.canvasRef != null) {\n this.updateCanvasBounds(this.canvasRef);\n return this.canvasBounds;\n }\n };\n\n private getTransformWidget = (): TransformWidget => {\n if (this.widget == null && this.canvasRef != null) {\n return this.setupTransformWidget(this.canvasRef);\n } else if (this.widget != null) {\n return this.widget;\n } else {\n throw new Error(\n 'Transform widget was not initialized. The canvas element may not have been initialized.'\n );\n }\n };\n}\n"],"mappings":";;;sfAAM,SAAUA,EAAkBC,GAChC,GAAIC,OAAOC,SAASC,gBAAkBH,EAAS,CAC7CA,EAAQI,QACRJ,EAAQK,kBAAkBL,EAAQM,MAAMC,OAAQP,EAAQM,MAAMC,O,CAElE,CCuBM,SAAUC,EACdC,EACAC,GAEA,OAAOA,GAAU,KACbC,EAAMC,OAAOH,EAAMI,EAAIH,EAAOI,KAAML,EAAMM,EAAIL,EAAOM,KACrDC,SACN,CAEM,SAAUC,EACdT,EACAU,EACAC,EACAC,GAEA,MAAMC,EACJD,GAAa,KAAOE,EAAQC,mBAAmBH,GAAaJ,UAE9D,GAAIR,GAAS,MAAQU,GAAS,MAAQC,GAAY,MAAQE,GAAY,KAAM,CAC1E,MAAMG,EAAML,EAASM,oBACnBjB,EACAU,EAAMQ,MACNR,EAAMS,MAAMC,QAGd,GAAIV,EAAMS,MAAMC,OAAOC,iBAAkB,CAGvC,MAAMC,EAAcC,EAAIC,GACtBD,EAAIpB,OAAO,CACTsB,OAAQZ,EACRa,UAAWhB,EAAMS,MAAMC,OAAOM,YAEhCZ,EAAQa,UAAUjB,EAAMS,MAAMC,OAAOQ,YAAc,GAGrD,OAAOL,EAAIM,eACTb,EACAc,EAAMC,2BACJrB,EAAMS,MAAMC,OAAOM,UACnBJ,G,KAGC,CACL,OAAOC,EAAIM,eACTb,EACAc,EAAMC,2BAA2BrB,EAAMS,MAAMC,OAAOM,UAAWb,G,EAIrE,OAAOL,SACT,CAEM,SAAUwB,EACdC,EACAC,EACArC,EACAsC,EACAC,EACAC,GAEA,OAAOC,EAAQC,SACbN,EACAO,EACEN,EACArC,EACAsC,EACAC,EACAC,GAGN,CAEA,SAASG,EACPN,EACArC,EACAsC,EACAC,EACAC,GAEA,MAAMI,EA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,KAAKqP,kBACftU,YAAa,IAAMiF,KAAKgP,gBAAgB,GACxChU,YAAa,IAAMgF,KAAKgP,iBAAgB,GACxC/T,OAAQ,KACN+E,KAAKyK,iBAAmB,KAAK,EAE/BvP,OACE8E,KAAKsK,6BACD,IAAMtK,KAAKuP,oBACXlf,a,CAiVV,SAAAI,CACN4D,EACAC,EACAC,G,QAEA,GACEyL,KAAKtP,UAAY,MACjBsP,KAAKwP,mBAAqB,MAC1BxP,KAAKiN,kBAAoB,MACzBjN,KAAKsM,UAAY,MACjBtM,KAAKoL,QAAU,MACfpL,KAAKoL,OAAO7a,OAAS,KACrB,CACAyP,KAAKiN,iBAAmB7Y,EACtB4L,KAAKiN,iBACL5Y,EACAC,GACAyK,EAAAiB,KAAKoL,UAAM,MAAArM,SAAA,SAAAA,EAAExO,MAAMS,MAAMC,OAAOQ,WAChC8C,EACAyL,KAAKsM,SAASva,YAGhBiO,KAAKoM,qBAAqB1I,gBAAgB1D,KAAKiN,mBAC/C5L,EAAArB,KAAKkO,cAAU,MAAA7M,SAAA,SAAAA,EAAEqC,gBACfvR,EAAQC,SACN4N,KAAKiN,iBACL9a,EAAQsB,OAAOuM,KAAKwP,oB,EAMpB,yBAAAa,GACN,GAAIrQ,KAAK2M,OAAQ,CACf3M,KAAK2M,OAAOxJ,mBAAmB,CAC7B3C,UAAWR,KAAKwJ,kBAChB/I,UAAWT,KAAKyJ,kBAChB/I,UAAWV,KAAK0J,kBAChBxJ,aAAcF,KAAK2J,qBACnBxJ,aAAcH,KAAK4J,qBACnBxJ,aAAcJ,KAAK6J,qBACnBxJ,cAAeL,KAAK8J,sBACpBxJ,cAAeN,KAAK+J,sBACpBxJ,cAAeP,KAAKgK,uB,KAEjB,CACL6E,QAAQsC,KAAK,iD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["focusInputElement","element","window","document","activeElement","focus","setSelectionRange","value","length","convertPointToCanvas","point","bounds","Point","create","x","left","y","top","undefined","convertCanvasPointToWorld","frame","viewport","transform","position","Vector3","fromMatrixPosition","ray","transformPointToRay","image","scene","camera","isOrthographic","offsetPoint","Ray","at","origin","direction","magnitude","viewVector","intersectPlane","Plane","fromNormalAndCoplanarPoint","computeInputDeltaTransform","current","identifier","lastValue","distanceUnit","angleUnit","Matrix4","multiply","computeInputGlobalTransform","units","DistanceUnits","angles","AngleUnits","rotation","convertFrom","convertRealValueToWorld","makeTranslation","makeRotation","Quaternion","fromAxisAngle","down","forward","makeIdentity","eulerOrderForIdentifier","computeInputDisplayValue","start","fromMatrixRotation","transformDiff","invert","relativeTranslationDiff","transformMatrix","relativeRotationDiff","Euler","fromRotationMatrix","convertWorldValueToReal","z","convertTo","Angle","normalizeRadians","computeHandleDeltaTransform","previous","next","angle","computeHandleGlobalTransform","subtract","currentTransformationMatrix","translationVectorWorld","performTranslationConstrainedToAxis","right","up","back","performTranslationConstrainedToPlane","performRotationAroundAxis","localRotationAxis","rotationAngle","worldRotationAxis","computeRotationAxis","worldRotationQuaternion","worldRotationMatrix","changeOfBasisToWorld","worldNegatedRotationAxis","negate","dot","constrainToLocalAxis","constrainToLocalAxisUnitVector","normalize","constrainToWorldAxis","translationVectorProjectedToWorldAxis","project","translationMatrix","localNormalVectorToPlane","localNormalVectorToPlaneUnitVector","worldNormalVectorToPlane","currentPosition","worldPlaneToConstrainTranslationTo","translationVectorProjectedToWorldPlane","projectPoint","constrainedTranslationVector","add","scale","constant","normal","computeInputPosition","shapePoints","Error","paddedBounds","Rectangle","pad","canvasPoints","map","sp","transformNdcPointToViewport","topLeft","topRight","width","bottomRight","bottomLeft","center","reduce","sum","pt","closestPoint","closest","distance","placement","calculateNewRotationAngle","event","rotationSnapKey","angleOfRotation","lastAngle","existingAngle","rotationSnapDegrees","rotationSnapKeyIsHeld","altKey","ctrlKey","metaKey","shiftKey","Number","isInteger","angleChangeRelativeToLastAngle","angleChangeRelativeToLastAngleDegrees","toDegrees","angleChangeRounded","Math","round","existingAngleRounded","neededAdjustmentDueToExistingAngle","adjustedAngle","angleChangeRoundedRadians","toRadians","TransformWidgetInputWrapper","ref","displayUnit","children","inputPlacement","constrainInputToViewport","Dimensions","h","class","style","height","unit","abbreviatedName","TransformWidgetInput","disabled","onChange","onIncrement","onDecrement","onBlur","onUndo","handleChange","target","parsed","parseFloat","isNaN","handleKeyDown","commandOrControlModifier","key","preventDefault","type","onKeyDown","constrainTo","dimension","min","max","inputDimensions","padding","dimensions","paddedWidth","paddedHeight","toCssLength","bottom","xAxisRotationPositions","widgetTransform","triangleSize","rotationSizeScalar","translationSizeScalar","computeRotationNdcValues","yAxisRotationPositions","zAxisRotationPositions","xDirection","yDirection","transformedDirection","transformedX","transformedY","relativePositionScalar","basePosition","xRay","yRay","rotationAxis","cross","base","rotateAboutAxis","TriangleMeshPoints","projectionViewMatrix","testDrawable","drawable","TriangleMesh","testTriangleMesh","mesh","testTriangle","points","worldLeft","worldRight","worldTip","worldBase","edge1","edge2","epsilon","BoundingBox","_a","fromVectors","p","det","abs","t","u","q","v","r","TransformWidget","ReglComponent","constructor","canvasElement","customization","initialDisabledAxes","super","this","disabledAxis","xTranslation","yTranslation","zTranslation","xyTranslation","xzTranslation","yzTranslation","xRotation","yRotation","zRotation","axisLines","rotationLines","translationMeshes","rotationMeshes","hoveredChanged","EventDispatcher","xArrowFillColor","colors","xArrow","yArrowFillColor","_b","yArrow","zArrowFillColor","_c","zArrow","hoveredArrowFillColor","_d","hovered","outlineColor","_e","outline","_f","_g","_h","_j","_k","_l","_m","_o","_p","dispose","reglFrameDisposable","cancel","getDrawableElements","drawableElements","getFullBounds","fullBounds","boundsContainsPoint","interactiveBounds","containsPoints","updateDisabledAxis","axis","updateDisabledOnDrawables","updateCursor","cursor","updateHovered","clearHovered","updateTransform","updateAndDraw","clear","updateColors","twoAxesSquareFillColor","twoAxesSquare","updateFillColor","getXTranslationColor","getYTranslationColor","getZTranslationColor","getXRotationColor","getYRotationColor","getZRotationColor","getTwoAxesTranslationColor","_q","_r","hoveredElement","updateScalars","scalars","updateElements","onHoveredChanged","listener","on","setDisabled","xyRotationLine","xzRotationLine","yzRotationLine","yxRotationLine","zxRotationLine","zyRotationLine","previousHovered","currentFrame","filter","el","valid","isDisabled","find","m","emit","clearFillColorOfPreviouslyHovered","initialFillColor","hasData","createOrUpdateElements","createElements","computeDrawable2dBounds","reglCommand","regl","canvas","extensions","createShape","shapeBuilder","computeTriangleSize","xAxisArrowPositions","xAxis","AxisLine","axisPositions","yAxisArrowPositions","yAxis","zAxisArrowPositions","zAxis","xyAxisTranslationPositions","xzAxisTranslationPositions","yzAxisTranslationPositions","createRotationLines","availableElements","xyRotationLinePoints","rotationAxisPositions","xzRotationLinePoints","yxRotationLinePoints","yzRotationLinePoints","zxRotationLinePoints","zyRotationLinePoints","RotationLine","l","updatePoints","_s","_t","_u","_v","_w","_x","_y","_z","_0","_1","_2","_3","_4","_5","viewerTransformWidgetCss","ViewerTransformWidget","__stencil_proxyCustomElement","HTMLElement","registerHost","xRotationDisabled","yRotationDisabled","zRotationDisabled","xTranslationDisabled","yTranslationDisabled","zTranslationDisabled","xyTranslationDisabled","xzTranslationDisabled","yzTranslationDisabled","showInputs","decimalPlaces","translationHandleScalar","rotationHandleScalar","interactionThrottle","EXPERIMENTAL_undoKeybindings","inputValue","isEndingTransform","inputShouldFocus","xArrowColor","yArrowColor","zArrowColor","twoAxesSquareColor","hoveredColor","handleHoveredDrawableChanged","handleViewerFrameDrawn","updatePropsFromViewer","handleViewerDimensionsChange","writeDOM","viewer","canvasRef","updateCanvasBounds","handleResize","handleInputResize","inputWrapperRef","wrapperElement","readDOM","inputBounds","getBoundingClientRect","handleStyleChange","hostStyles","getComputedStyle","hostEl","getPropertyValue","trim","getTransformWidget","handlePointerMove","dragging","canvasPoint","clientX","clientY","getCanvasBounds","widget","handleBeginDrag","async","canvasBounds","lastDragged","dragStartTransform","currentTransform","updateInputPosition","updateInputValue","currentCanvas","widgetCenter","transformWorldToViewport","fromPoints","lastWorldPosition","interactionStarted","removeEventListener","addEventListener","handleDragWithTimer","handleEndTransform","lastMouseEvent","interactionTimer","setTimeout","handleDrag","controller","beginTransform","currentWorld","angleToUse","getDisplayedAngle","beginEndTransform","delta","getCurrentDelta","endTransform","interactionEnded","e","console","error","completeEndTransform","handleInputStep","step","lastInputValue","isModifyingAngleUnits","updateTransformFromInput","handleInputChange","stopPropagation","EXPERIMENTAL_undo","startingTransform","endTransformDebounced","updateFrame","setupTransformWidget","debug","JSON","stringify","effectiveArrowScalar","getTranslationScalar","effectiveSquareScalar","getRotationScalar","getTransformForNewRotation","getTransformForNewPosition","handleSettingDisabledAxis","hoveredChangeDisposable","updateDimensions","isDraggingTwoAxesTranslation","inputRef","definedValue","getDisplayedDistance","displayValue","toFixed","widgetBounds","inputPosition","toArray","draggingIdentifier","includes","warn","getDisplayedUnits","newPosition","c","currentRotation","newRotationEuler","oldRotation","newRotation","fromEuler","oldTranslation","componentDidLoad","canvasResizeObserver","ResizeObserver","inputResizeObserver","hostStyleObserver","MutationObserver","observe","attributes","attributeFilter","handleViewerChanged","disconnectedCallback","disconnect","componentDidRender","undoDelta","EXPERIMENTAL_undoTransform","newViewer","oldViewer","stream","TransformController","handleDisabledPropertyChanged","handleTransformHandleScalarChanged","handleRotationChanged","rotationToApply","isIdentity","rotationChanged","handlePositionChanged","oldPosition","clearTransform","positionChanged","handleInputFormattingChanged","render","Host","classNames","tabindex","onPointerDown","unobserve"],"sources":["src/components/viewer-transform-widget/dom.ts","src/components/viewer-transform-widget/util.ts","src/components/viewer-transform-widget/viewer-transform-widget-components.tsx","src/lib/transforms/axis-rotation.ts","src/lib/transforms/hits.ts","src/components/viewer-transform-widget/widget.ts","src/components/viewer-transform-widget/viewer-transform-widget.css?tag=vertex-viewer-transform-widget&encapsulation=shadow","src/components/viewer-transform-widget/viewer-transform-widget.tsx"],"sourcesContent":["export function focusInputElement(element: HTMLInputElement): void {\n if (window.document.activeElement !== element) {\n element.focus();\n element.setSelectionRange(element.value.length, element.value.length);\n }\n}\n","import {\n Angle,\n Euler,\n Matrix4,\n Plane,\n Point,\n Quaternion,\n Ray,\n Rectangle,\n Vector3,\n} from '@vertexvis/geometry';\n\nimport {\n AngleUnits,\n AngleUnitType,\n DistanceUnits,\n DistanceUnitType,\n Frame,\n Viewport,\n} from '../../lib/types';\nimport { ModifierKey } from '../../lib/types/keys';\nimport { TransformWidgetInputPlacement } from './viewer-transform-widget-components';\n\nexport interface PointAndPlacement {\n point: Point.Point;\n placement: TransformWidgetInputPlacement;\n}\n\nexport function convertPointToCanvas(\n point: Point.Point,\n bounds?: DOMRect\n): Point.Point | undefined {\n return bounds != null\n ? Point.create(point.x - bounds.left, point.y - bounds.top)\n : undefined;\n}\n\nexport function convertCanvasPointToWorld(\n point?: Point.Point,\n frame?: Frame,\n viewport?: Viewport,\n transform?: Matrix4.Matrix4\n): Vector3.Vector3 | undefined {\n const position =\n transform != null ? Vector3.fromMatrixPosition(transform) : undefined;\n\n if (point != null && frame != null && viewport != null && position != null) {\n const ray = viewport.transformPointToRay(\n point,\n frame.image,\n frame.scene.camera\n );\n\n if (frame.scene.camera.isOrthographic()) {\n // Offset the point to past the bounding sphere of the model to\n // adjust the position plane location.\n const offsetPoint = Ray.at(\n Ray.create({\n origin: position,\n direction: frame.scene.camera.direction,\n }),\n Vector3.magnitude(frame.scene.camera.viewVector) * 2\n );\n\n return Ray.intersectPlane(\n ray,\n Plane.fromNormalAndCoplanarPoint(\n frame.scene.camera.direction,\n offsetPoint\n )\n );\n } else {\n return Ray.intersectPlane(\n ray,\n Plane.fromNormalAndCoplanarPoint(frame.scene.camera.direction, position)\n );\n }\n }\n return undefined;\n}\n\nexport function computeInputDeltaTransform(\n current: Matrix4.Matrix4,\n identifier: string,\n value: number,\n lastValue: number,\n distanceUnit: DistanceUnitType,\n angleUnit: AngleUnitType\n): Matrix4.Matrix4 {\n return Matrix4.multiply(\n current,\n computeInputGlobalTransform(\n identifier,\n value,\n lastValue,\n distanceUnit,\n angleUnit\n )\n );\n}\n\nfunction computeInputGlobalTransform(\n identifier: string,\n value: number,\n lastValue: number,\n distanceUnit: DistanceUnitType,\n angleUnit: AngleUnitType\n): Matrix4.Matrix4 {\n const units = new DistanceUnits(distanceUnit);\n const angles = new AngleUnits(angleUnit);\n\n const rotation = (): number => angles.convertFrom(value - lastValue);\n const position = (): number =>\n units.convertRealValueToWorld(value - lastValue);\n\n switch (identifier) {\n case 'x-translate':\n return Matrix4.makeTranslation(Vector3.create(position(), 0, 0));\n case 'y-translate':\n return Matrix4.makeTranslation(Vector3.create(0, position(), 0));\n case 'z-translate':\n return Matrix4.makeTranslation(Vector3.create(0, 0, position()));\n case 'x-rotate':\n return Matrix4.makeRotation(\n Quaternion.fromAxisAngle(Vector3.left(), rotation())\n );\n case 'y-rotate':\n return Matrix4.makeRotation(\n Quaternion.fromAxisAngle(Vector3.down(), rotation())\n );\n case 'z-rotate':\n return Matrix4.makeRotation(\n Quaternion.fromAxisAngle(Vector3.forward(), rotation())\n );\n default:\n return Matrix4.makeIdentity();\n }\n}\n\nexport function eulerOrderForIdentifier(identifier: string): Euler.EulerOrder {\n switch (identifier) {\n case 'x-rotate':\n return 'xyz';\n case 'y-rotate':\n return 'yzx';\n case 'z-rotate':\n return 'zxy';\n default:\n return 'xyz';\n }\n}\n\nexport function computeInputDisplayValue(\n identifier: string,\n current: Matrix4.Matrix4,\n start: Matrix4.Matrix4,\n distanceUnit: DistanceUnitType,\n angleUnit: AngleUnitType\n): number {\n const units = new DistanceUnits(distanceUnit);\n const angles = new AngleUnits(angleUnit);\n\n const rotation = (): Matrix4.Matrix4 =>\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(current));\n const transformDiff = (): Matrix4.Matrix4 =>\n Matrix4.multiply(current, Matrix4.invert(start));\n const relativeTranslationDiff = (): Vector3.Vector3 =>\n Vector3.transformMatrix(\n Vector3.fromMatrixPosition(transformDiff()),\n Matrix4.invert(rotation())\n );\n const relativeRotationDiff = (): Euler.Euler =>\n Euler.fromRotationMatrix(\n Matrix4.multiply(Matrix4.invert(rotation()), start),\n eulerOrderForIdentifier(identifier)\n );\n\n switch (identifier) {\n case 'x-translate':\n return units.convertWorldValueToReal(relativeTranslationDiff().x);\n case 'y-translate':\n return units.convertWorldValueToReal(relativeTranslationDiff().y);\n case 'z-translate':\n return units.convertWorldValueToReal(relativeTranslationDiff().z);\n case 'x-rotate':\n return angles.convertTo(Angle.normalizeRadians(relativeRotationDiff().x));\n case 'y-rotate':\n return angles.convertTo(Angle.normalizeRadians(relativeRotationDiff().y));\n case 'z-rotate':\n return angles.convertTo(Angle.normalizeRadians(relativeRotationDiff().z));\n default:\n return 0;\n }\n}\n\nexport function computeHandleDeltaTransform(\n current: Matrix4.Matrix4,\n previous: Vector3.Vector3,\n next: Vector3.Vector3,\n viewVector: Vector3.Vector3,\n angle: number,\n identifier: string\n): Matrix4.Matrix4 {\n return computeHandleGlobalTransform(\n current,\n Vector3.subtract(next, previous),\n viewVector,\n angle,\n identifier\n );\n}\n\nfunction computeHandleGlobalTransform(\n currentTransformationMatrix: Matrix4.Matrix4,\n translationVectorWorld: Vector3.Vector3,\n viewVector: Vector3.Vector3,\n angle: number,\n identifier: string\n): Matrix4.Matrix4 {\n switch (identifier) {\n case 'x-translate':\n return performTranslationConstrainedToAxis(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.right()\n );\n case 'y-translate':\n return performTranslationConstrainedToAxis(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.up()\n );\n case 'z-translate':\n return performTranslationConstrainedToAxis(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.back()\n );\n case 'xy-translate':\n return performTranslationConstrainedToPlane(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.create(0, 0, 1)\n );\n case 'xz-translate':\n return performTranslationConstrainedToPlane(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.create(0, 1, 0)\n );\n case 'yz-translate':\n return performTranslationConstrainedToPlane(\n currentTransformationMatrix,\n translationVectorWorld,\n Vector3.create(1, 0, 0)\n );\n case 'x-rotate':\n return performRotationAroundAxis(\n currentTransformationMatrix,\n viewVector,\n Vector3.right(),\n angle\n );\n case 'y-rotate':\n return performRotationAroundAxis(\n currentTransformationMatrix,\n viewVector,\n Vector3.up(),\n angle\n );\n case 'z-rotate':\n return performRotationAroundAxis(\n currentTransformationMatrix,\n viewVector,\n Vector3.forward(),\n angle\n );\n default:\n return currentTransformationMatrix;\n }\n}\n\nexport function performRotationAroundAxis(\n currentTransformationMatrix: Matrix4.Matrix4,\n viewVector: Vector3.Vector3,\n localRotationAxis: Vector3.Vector3,\n rotationAngle: number\n): Matrix4.Matrix4 {\n // Determine the rotation axis in world coordinates\n const worldRotationAxis = computeRotationAxis(\n currentTransformationMatrix,\n viewVector,\n localRotationAxis\n );\n\n // Determine the rotation matrix in world coordinates\n const worldRotationQuaternion = Quaternion.fromAxisAngle(\n worldRotationAxis,\n rotationAngle\n );\n const worldRotationMatrix = Matrix4.makeRotation(worldRotationQuaternion);\n\n return Matrix4.multiply(currentTransformationMatrix, worldRotationMatrix);\n}\n\nexport function computeRotationAxis(\n currentTransformationMatrix: Matrix4.Matrix4,\n viewVector: Vector3.Vector3,\n localRotationAxis: Vector3.Vector3\n): Vector3.Vector3 {\n const changeOfBasisToWorld = Matrix4.makeRotation(\n Quaternion.fromMatrixRotation(currentTransformationMatrix)\n );\n const worldRotationAxis = Vector3.transformMatrix(\n localRotationAxis,\n changeOfBasisToWorld\n );\n const worldNegatedRotationAxis = Vector3.transformMatrix(\n Vector3.negate(localRotationAxis),\n changeOfBasisToWorld\n );\n\n return Vector3.dot(viewVector, worldRotationAxis) >\n Vector3.dot(viewVector, worldNegatedRotationAxis)\n ? localRotationAxis\n : Vector3.negate(localRotationAxis);\n}\n\nexport function performTranslationConstrainedToAxis(\n currentTransformationMatrix: Matrix4.Matrix4,\n translationVectorWorld: Vector3.Vector3,\n constrainToLocalAxis: Vector3.Vector3\n): Matrix4.Matrix4 {\n // Ensure that constrainToLocalAxis is a unit vector\n const constrainToLocalAxisUnitVector =\n Vector3.normalize(constrainToLocalAxis);\n\n // Convert the axis to constrain the translation to from local to world\n const changeOfBasisToWorld = Matrix4.makeRotation(\n Quaternion.fromMatrixRotation(currentTransformationMatrix)\n );\n const constrainToWorldAxis = Vector3.transformMatrix(\n constrainToLocalAxisUnitVector,\n changeOfBasisToWorld\n );\n\n // Project the translation vector onto the desired axis for translation\n const translationVectorProjectedToWorldAxis = Vector3.project(\n translationVectorWorld,\n constrainToWorldAxis\n );\n\n // Use the projected vector to determine the translation matrix\n const translationMatrix = Matrix4.makeTranslation(\n translationVectorProjectedToWorldAxis\n );\n\n // Multiply the translation matrix with the current transformation matrix to\n // determine the new transformation matrix\n return Matrix4.multiply(translationMatrix, currentTransformationMatrix);\n}\n\nexport function performTranslationConstrainedToPlane(\n currentTransformationMatrix: Matrix4.Matrix4,\n translationVectorWorld: Vector3.Vector3,\n localNormalVectorToPlane: Vector3.Vector3\n): Matrix4.Matrix4 {\n // Ensure that localNormalVectorToPlane is a unit vector\n const localNormalVectorToPlaneUnitVector = Vector3.normalize(\n localNormalVectorToPlane\n );\n\n // Convert the normal vector from local to world\n const changeOfBasisToWorld = Matrix4.makeRotation(\n Quaternion.fromMatrixRotation(currentTransformationMatrix)\n );\n const worldNormalVectorToPlane = Vector3.transformMatrix(\n localNormalVectorToPlaneUnitVector,\n changeOfBasisToWorld\n );\n\n // Use the worldNormalVectorToPlane and the current position of the widget to define the plane to translate on\n const currentPosition = Vector3.fromMatrixPosition(\n currentTransformationMatrix\n );\n const worldPlaneToConstrainTranslationTo = Plane.fromNormalAndCoplanarPoint(\n worldNormalVectorToPlane,\n currentPosition\n );\n\n // Project the translation vector onto the desired plane for translation\n const translationVectorProjectedToWorldPlane = Plane.projectPoint(\n worldPlaneToConstrainTranslationTo,\n translationVectorWorld\n );\n\n // Account for the plane offset to calculate the position change (the vector to translate by)\n const constrainedTranslationVector = Vector3.add(\n translationVectorProjectedToWorldPlane,\n Vector3.scale(\n worldPlaneToConstrainTranslationTo.constant,\n worldPlaneToConstrainTranslationTo.normal\n )\n );\n\n // Use the projected vector to perform the translation and determine the new transformation matrix\n const translationMatrix = Matrix4.makeTranslation(\n constrainedTranslationVector\n );\n return Matrix4.multiply(translationMatrix, currentTransformationMatrix);\n}\n\nexport function computeInputPosition(\n viewport: Viewport,\n bounds: Rectangle.Rectangle,\n shapePoints: Point.Point[]\n): PointAndPlacement {\n if (shapePoints.length === 0) {\n throw new Error(\n 'Unable to compute input position. At least one shape point must be provided.'\n );\n }\n\n const paddedBounds = Rectangle.pad(bounds, 5);\n const canvasPoints = shapePoints.map((sp) =>\n viewport.transformNdcPointToViewport(sp)\n );\n\n const topLeft = Rectangle.topLeft(paddedBounds);\n const topRight = Point.add(topLeft, Point.create(paddedBounds.width, 0));\n const bottomRight = Rectangle.bottomRight(paddedBounds);\n const bottomLeft = Point.subtract(\n bottomRight,\n Point.create(paddedBounds.width, 0)\n );\n\n const center = Point.scale(\n canvasPoints.reduce((sum, pt) => Point.add(sum, pt), Point.create()),\n 1 / canvasPoints.length,\n 1 / canvasPoints.length\n );\n\n const closestPoint = [topRight, bottomLeft, bottomRight].reduce(\n (closest, pt) =>\n Point.distance(center, pt) < Point.distance(center, closest)\n ? pt\n : closest,\n topLeft\n );\n\n switch (closestPoint) {\n case topLeft:\n return { point: closestPoint, placement: 'top-left' };\n case topRight:\n return { point: closestPoint, placement: 'top-right' };\n case bottomLeft:\n return { point: closestPoint, placement: 'bottom-left' };\n default:\n return { point: closestPoint, placement: 'bottom-right' };\n }\n}\n\nexport function calculateNewRotationAngle(\n event: PointerEvent,\n rotationSnapKey: ModifierKey,\n angleOfRotation: number, // In radians\n lastAngle: number, // In radians\n existingAngle?: number, // In degrees\n rotationSnapDegrees?: number // In degrees\n): number {\n const rotationSnapKeyIsHeld =\n (rotationSnapKey === 'alt' && event.altKey) ||\n (rotationSnapKey === 'ctrl' && event.ctrlKey) ||\n (rotationSnapKey === 'meta' && event.metaKey) ||\n (rotationSnapKey === 'shift' && event.shiftKey);\n\n // Check if the widget should snap to a certain angle\n if (\n rotationSnapKeyIsHeld &&\n rotationSnapDegrees != null &&\n rotationSnapDegrees > 0 &&\n Number.isInteger(rotationSnapDegrees)\n ) {\n const angleChangeRelativeToLastAngle = angleOfRotation - lastAngle;\n const angleChangeRelativeToLastAngleDegrees = Angle.toDegrees(\n angleChangeRelativeToLastAngle\n );\n\n // This method rounds the angle change to the nearest multiple of this.rotationSnapDegrees\n const angleChangeRounded =\n Math.round(angleChangeRelativeToLastAngleDegrees / rotationSnapDegrees) *\n rotationSnapDegrees;\n\n // Check if there is already an existing rotation angle\n if (existingAngle != null) {\n // If there is an existing angle displayed in the widget, it might not be a multiple of the\n // desired number, so the difference needs to be accounted for\n const existingAngleRounded =\n Math.round(existingAngle / rotationSnapDegrees) * rotationSnapDegrees;\n const neededAdjustmentDueToExistingAngle =\n existingAngle - existingAngleRounded;\n\n // Adjust the rounded angle change to account for the existing angle, then\n // covert the rounded value to radians and return\n const adjustedAngle =\n angleChangeRounded - neededAdjustmentDueToExistingAngle;\n const angleChangeRoundedRadians = Angle.toRadians(adjustedAngle);\n return angleChangeRoundedRadians + lastAngle;\n } else {\n // There isn't an existing angle to account for, so convert the rounded value to radians and return\n const angleChangeRoundedRadians = Angle.toRadians(angleChangeRounded);\n return angleChangeRoundedRadians + lastAngle;\n }\n } else {\n // Angle should not be snapped, so return the original angle\n return angleOfRotation;\n }\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { FunctionalComponent, h } from '@stencil/core';\nimport { Dimensions, Point } from '@vertexvis/geometry';\n\nimport { AngleUnits, DistanceUnits, Viewport } from '../../lib/types';\n\nexport type TransformWidgetInputPlacement =\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right';\n\nexport interface TransformWidgetInputWrapperProps {\n ref: (el?: HTMLDivElement) => void;\n bounds?: DOMRect;\n\n viewport: Viewport;\n point: Point.Point;\n placement: TransformWidgetInputPlacement;\n\n displayUnit: DistanceUnits | AngleUnits;\n}\n\nexport const TransformWidgetInputWrapper: FunctionalComponent<\n TransformWidgetInputWrapperProps\n> = ({ ref, bounds, viewport, point, placement, displayUnit }, children) => {\n const inputPlacement = constrainInputToViewport(\n viewport,\n bounds ?? Dimensions.create(0, 0),\n point,\n placement\n );\n\n return (\n <div\n ref={ref}\n class=\"widget-input wrapper\"\n style={{\n ...inputPlacement,\n height: bounds?.height != null ? `${bounds.height}px` : undefined,\n }}\n >\n {children}\n <div class=\"widget-input units\">{displayUnit.unit.abbreviatedName}</div>\n </div>\n );\n};\n\nexport interface TransformWidgetInputProps {\n ref: (el?: HTMLInputElement) => void;\n\n identifier?: string;\n disabled?: boolean;\n\n onChange?: (value: number) => void | Promise<void>;\n onIncrement?: VoidFunction;\n onDecrement?: VoidFunction;\n onBlur?: VoidFunction;\n onUndo?: VoidFunction;\n}\n\nexport const TransformWidgetInput: FunctionalComponent<\n TransformWidgetInputProps\n> = ({\n ref,\n identifier,\n disabled,\n onChange,\n onIncrement,\n onDecrement,\n onBlur,\n onUndo,\n}) => {\n const handleChange = (event: Event): void => {\n if (event.target != null) {\n const parsed = parseFloat((event.target as HTMLInputElement).value);\n\n if (!isNaN(parsed)) {\n onChange?.(parseFloat((event.target as HTMLInputElement).value));\n }\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent): void => {\n const commandOrControlModifier = event.ctrlKey || event.metaKey;\n\n if (event.key === 'ArrowUp') {\n onIncrement?.();\n } else if (event.key === 'ArrowDown') {\n onDecrement?.();\n } else if (event.key === 'z' && commandOrControlModifier && onUndo) {\n event.preventDefault();\n\n onUndo();\n }\n };\n\n return (\n <input\n ref={ref}\n disabled={disabled}\n class={`widget-input ${identifier}`}\n type=\"text\"\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onBlur={onBlur}\n ></input>\n );\n};\n\nfunction constrainTo(dimension: number, length: number): number {\n return Math.min(dimension, Math.max(0, length));\n}\n\ninterface InputPlacement {\n left?: string;\n right?: string;\n top?: string;\n bottom?: string;\n}\n\nfunction constrainInputToViewport(\n viewport: Viewport,\n inputDimensions: Dimensions.Dimensions,\n point: Point.Point,\n placement: TransformWidgetInputPlacement,\n padding = 5\n): InputPlacement {\n const { width, height } = viewport.dimensions;\n const paddedWidth = inputDimensions.width + padding;\n const paddedHeight = inputDimensions.height + padding;\n\n function toCssLength(length: number): string {\n return `${length}px`;\n }\n\n switch (placement) {\n case 'top-left':\n return {\n right: toCssLength(constrainTo(width - paddedWidth, width - point.x)),\n bottom: toCssLength(\n constrainTo(height - paddedHeight, height - point.y)\n ),\n };\n case 'top-right':\n return {\n left: toCssLength(constrainTo(width - paddedWidth, point.x)),\n bottom: toCssLength(\n constrainTo(height - paddedHeight, height - point.y)\n ),\n };\n case 'bottom-left':\n return {\n right: toCssLength(constrainTo(width - paddedWidth, width - point.x)),\n top: toCssLength(constrainTo(height - paddedHeight, point.y)),\n };\n case 'bottom-right':\n default:\n return {\n left: toCssLength(constrainTo(width - paddedWidth, point.x)),\n top: toCssLength(constrainTo(height - paddedHeight, point.y)),\n };\n }\n}\n","import { Angle, Matrix4, Quaternion, Ray, Vector3 } from '@vertexvis/geometry';\n\nimport { FrameCameraBase } from '../types';\nimport { TriangleMeshPoints } from './mesh';\n\nexport function xAxisRotationPositions(\n widgetTransform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n triangleSize = 3,\n rotationSizeScalar = 1,\n translationSizeScalar = 1\n): TriangleMeshPoints {\n return computeRotationNdcValues(\n widgetTransform,\n camera,\n Vector3.back(),\n Vector3.up(),\n triangleSize,\n rotationSizeScalar,\n translationSizeScalar\n );\n}\n\nexport function yAxisRotationPositions(\n widgetTransform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n triangleSize = 3,\n rotationSizeScalar = 1,\n translationSizeScalar = 1\n): TriangleMeshPoints {\n return computeRotationNdcValues(\n widgetTransform,\n camera,\n Vector3.right(),\n Vector3.back(),\n triangleSize,\n rotationSizeScalar,\n translationSizeScalar\n );\n}\n\nexport function zAxisRotationPositions(\n widgetTransform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n triangleSize = 3,\n rotationSizeScalar = 1,\n translationSizeScalar = 1\n): TriangleMeshPoints {\n return computeRotationNdcValues(\n widgetTransform,\n camera,\n Vector3.right(),\n Vector3.up(),\n triangleSize,\n rotationSizeScalar,\n translationSizeScalar\n );\n}\n\nfunction computeRotationNdcValues(\n widgetTransform: Matrix4.Matrix4,\n camera: FrameCameraBase,\n xDirection: Vector3.Vector3,\n yDirection: Vector3.Vector3,\n triangleSize: number,\n rotationSizeScalar = 1,\n translationSizeScalar = 1\n): TriangleMeshPoints {\n const transformedDirection = Vector3.transformMatrix(\n Vector3.add(xDirection, yDirection),\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(widgetTransform))\n );\n const transformedX = Vector3.transformMatrix(\n xDirection,\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(widgetTransform))\n );\n const transformedY = Vector3.transformMatrix(\n yDirection,\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(widgetTransform))\n );\n // Position the rotation handle relative to the translation scale to\n // ensure that the rotation axis lines are angled inward.\n // This is a loose line of best fit based on the base scale of\n // `1` corresponding to a scalar of `10` and some experimentation.\n const relativePositionScalar = 10 * translationSizeScalar ** 0.25;\n\n const basePosition = Vector3.fromMatrixPosition(widgetTransform);\n const position = Vector3.add(\n basePosition,\n Vector3.scale(triangleSize * relativePositionScalar, transformedDirection)\n );\n\n const xRay = Ray.create({\n origin: position,\n direction: transformedX,\n });\n const yRay = Ray.create({\n origin: position,\n direction: transformedY,\n });\n const rotationAxis = Vector3.cross(transformedX, transformedY);\n\n const base = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(yRay, -(triangleSize * rotationSizeScalar)),\n rotationAxis,\n position\n );\n const right = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(xRay, triangleSize * rotationSizeScalar),\n rotationAxis,\n position\n );\n const up = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(yRay, triangleSize * rotationSizeScalar),\n rotationAxis,\n position\n );\n const left = Vector3.rotateAboutAxis(\n Angle.toRadians(45),\n Ray.at(xRay, -(triangleSize * rotationSizeScalar)),\n rotationAxis,\n position\n );\n\n return new TriangleMeshPoints(\n Vector3.dot(transformedX, camera.direction) !== -1 &&\n Vector3.dot(transformedY, camera.direction) !== -1,\n base,\n left,\n right,\n up,\n Vector3.transformMatrix(base, camera.projectionViewMatrix),\n Vector3.transformMatrix(left, camera.projectionViewMatrix),\n Vector3.transformMatrix(right, camera.projectionViewMatrix),\n Vector3.transformMatrix(up, camera.projectionViewMatrix)\n );\n}\n","import { BoundingBox, Point, Vector3 } from '@vertexvis/geometry';\n\nimport { Frame, Viewport } from '../../lib/types';\nimport { Drawable } from './drawable';\nimport { TriangleMesh } from './mesh';\n\nexport function testDrawable(\n drawable: Drawable,\n frame: Frame,\n viewport: Viewport,\n point: Point.Point\n): boolean {\n if (drawable instanceof TriangleMesh) {\n return testTriangleMesh(drawable, frame, viewport, point);\n }\n return false;\n}\n\nexport function testTriangleMesh(\n mesh: TriangleMesh,\n frame: Frame,\n viewport: Viewport,\n point: Point.Point\n): boolean {\n return (\n testTriangle(\n [mesh.points.worldLeft, mesh.points.worldRight, mesh.points.worldTip],\n frame,\n viewport,\n point\n ) ||\n testTriangle(\n [mesh.points.worldLeft, mesh.points.worldRight, mesh.points.worldBase],\n frame,\n viewport,\n point\n )\n );\n}\n\n/**\n * Adapted from https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm.\n */\nexport function testTriangle(\n points: Vector3.Vector3[],\n frame: Frame,\n viewport: Viewport,\n point: Point.Point\n): boolean {\n if (points.length === 3) {\n const ray = viewport.transformPointToRay(\n point,\n frame.image,\n frame.scene.camera\n );\n\n const edge1 = Vector3.subtract(points[1], points[0]);\n const edge2 = Vector3.subtract(points[2], points[0]);\n\n const epsilon = BoundingBox.epsilon(\n BoundingBox.fromVectors([ray.direction, ray.origin, edge1, edge2]) ??\n BoundingBox.create(edge1, edge2)\n );\n\n const p = Vector3.cross(ray.direction, edge2);\n const det = Vector3.dot(edge1, p);\n\n // This check causes a `det` of NaN or 0 to return false\n // without needing to perform the subsequent calculations.\n if (!(Math.abs(det) >= epsilon)) {\n return false;\n }\n\n const t = Vector3.subtract(ray.origin, points[0]);\n const u = Vector3.dot(t, p) / det;\n\n if (u < 0 || u > 1) {\n return false;\n }\n\n const q = Vector3.cross(t, edge1);\n const v = Vector3.dot(ray.direction, q) / det;\n\n if (v < 0 || u + v > 1) {\n return false;\n }\n\n const r = Vector3.dot(edge2, q) / det;\n\n // Ignore the case where the computed hit position is negative\n // if in orthographic to correctly return hit results when close\n // to the camera.\n // TODO: revisit with https://vertexvis.atlassian.net/browse/PLAT-1549\n return !isNaN(r) && (r > 0 || frame.scene.camera.isOrthographic());\n }\n return false;\n}\n","import { Matrix4 } from '@vertexvis/geometry';\nimport { Point, Rectangle, Vector3 } from '@vertexvis/geometry';\nimport { Color, Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\nimport regl from 'regl';\nimport shapeBuilder from 'regl-shape';\n\nimport {\n axisPositions,\n rotationAxisPositions,\n} from '../../lib/transforms/axis-lines';\nimport {\n xAxisRotationPositions,\n yAxisRotationPositions,\n zAxisRotationPositions,\n} from '../../lib/transforms/axis-rotation';\nimport {\n xAxisArrowPositions,\n xyAxisTranslationPositions,\n xzAxisTranslationPositions,\n yAxisArrowPositions,\n yzAxisTranslationPositions,\n zAxisArrowPositions,\n} from '../../lib/transforms/axis-translation';\nimport {\n computeDrawable2dBounds,\n Drawable,\n} from '../../lib/transforms/drawable';\nimport { testDrawable } from '../../lib/transforms/hits';\nimport { AxisLine, RotationLine } from '../../lib/transforms/line';\nimport { TriangleMesh } from '../../lib/transforms/mesh';\nimport { CreateShape } from '../../lib/transforms/shape';\nimport { Frame } from '../../lib/types';\nimport { ReglComponent } from '../../lib/webgl/regl-component';\n\nexport interface DrawableElementColors {\n xArrow?: Color.Color | string;\n yArrow?: Color.Color | string;\n zArrow?: Color.Color | string;\n twoAxesSquare?: Color.Color | string;\n hovered?: Color.Color | string;\n outline?: Color.Color | string;\n}\n\nexport interface DrawableElementSizeScalars {\n xRotation?: number;\n yRotation?: number;\n zRotation?: number;\n xTranslation?: number;\n yTranslation?: number;\n zTranslation?: number;\n xyTranslation?: number;\n xzTranslation?: number;\n yzTranslation?: number;\n}\n\nexport interface DisabledAxis {\n xRotation: boolean;\n yRotation: boolean;\n zRotation: boolean;\n xTranslation: boolean;\n yTranslation: boolean;\n zTranslation: boolean;\n xyTranslation: boolean;\n xzTranslation: boolean;\n yzTranslation: boolean;\n}\n\nexport interface TransformWidgetCustomization {\n colors?: DrawableElementColors;\n scalars?: DrawableElementSizeScalars;\n}\n\nexport class TransformWidget extends ReglComponent {\n private cursor?: Point.Point;\n\n private xAxis?: AxisLine;\n private yAxis?: AxisLine;\n private zAxis?: AxisLine;\n\n private xArrow?: TriangleMesh;\n private yArrow?: TriangleMesh;\n private zArrow?: TriangleMesh;\n\n private xRotation?: TriangleMesh;\n private xyRotationLine?: RotationLine;\n private xzRotationLine?: RotationLine;\n\n private yRotation?: TriangleMesh;\n private yxRotationLine?: RotationLine;\n private yzRotationLine?: RotationLine;\n\n private zRotation?: TriangleMesh;\n private zxRotationLine?: RotationLine;\n private zyRotationLine?: RotationLine;\n\n private xyTranslation?: TriangleMesh;\n private xzTranslation?: TriangleMesh;\n private yzTranslation?: TriangleMesh;\n\n private disabledAxis: DisabledAxis = {\n xTranslation: false,\n yTranslation: false,\n zTranslation: false,\n xyTranslation: false,\n xzTranslation: false,\n yzTranslation: false,\n xRotation: false,\n yRotation: false,\n zRotation: false,\n };\n\n private axisLines: AxisLine[] = [];\n private rotationLines: RotationLine[] = [];\n private translationMeshes: TriangleMesh[] = [];\n private rotationMeshes: TriangleMesh[] = [];\n private hoveredElement?: Drawable;\n\n private transform?: Matrix4.Matrix4;\n private interactiveBounds?: Rectangle.Rectangle;\n private fullBounds?: Rectangle.Rectangle;\n\n private hoveredChanged = new EventDispatcher<Drawable | undefined>();\n\n private xArrowFillColor?: Color.Color | string;\n private yArrowFillColor?: Color.Color | string;\n private zArrowFillColor?: Color.Color | string;\n\n private twoAxesSquareFillColor?: Color.Color | string;\n\n private hoveredArrowFillColor?: Color.Color | string;\n private outlineColor?: Color.Color | string;\n\n public constructor(\n canvasElement: HTMLCanvasElement,\n private customization: TransformWidgetCustomization = {},\n initialDisabledAxes: Partial<DisabledAxis> = {}\n ) {\n super(canvasElement);\n\n this.xArrowFillColor = customization.colors?.xArrow;\n this.yArrowFillColor = customization.colors?.yArrow;\n this.zArrowFillColor = customization.colors?.zArrow;\n this.hoveredArrowFillColor = customization.colors?.hovered;\n this.outlineColor = customization.colors?.outline;\n\n this.disabledAxis.xTranslation = initialDisabledAxes.xTranslation ?? false;\n this.disabledAxis.yTranslation = initialDisabledAxes.yTranslation ?? false;\n this.disabledAxis.zTranslation = initialDisabledAxes.zTranslation ?? false;\n this.disabledAxis.xyTranslation =\n initialDisabledAxes.xyTranslation ?? false;\n this.disabledAxis.xzTranslation =\n initialDisabledAxes.xzTranslation ?? false;\n this.disabledAxis.yzTranslation =\n initialDisabledAxes.yzTranslation ?? false;\n this.disabledAxis.xRotation = initialDisabledAxes.xRotation ?? false;\n this.disabledAxis.yRotation = initialDisabledAxes.yRotation ?? false;\n this.disabledAxis.zRotation = initialDisabledAxes.zRotation ?? false;\n }\n\n public dispose(): void {\n this.reglFrameDisposable?.cancel();\n }\n\n /**\n * @internal - visible for testing\n */\n public getDrawableElements(): Drawable[] {\n return this.drawableElements;\n }\n\n public getFullBounds(): Rectangle.Rectangle | undefined {\n return this.fullBounds;\n }\n\n public boundsContainsPoint(point: Point.Point): boolean {\n return (\n this.interactiveBounds != null &&\n this.frame != null &&\n Rectangle.containsPoints(this.interactiveBounds, point)\n );\n }\n\n public updateDisabledAxis(axis: Partial<DisabledAxis>): void {\n this.disabledAxis = {\n ...this.disabledAxis,\n ...axis,\n };\n this.updateDisabledOnDrawables();\n }\n\n public updateCursor(cursor?: Point.Point): void {\n this.cursor = cursor;\n\n if (cursor != null && this.frame != null) {\n this.updateHovered();\n } else {\n this.clearHovered();\n }\n }\n\n public updateTransform(transform?: Matrix4.Matrix4): void {\n this.transform = transform;\n\n if (transform != null && this.frame != null) {\n this.updateAndDraw();\n } else {\n this.clear();\n this.reglFrameDisposable?.cancel();\n this.reglFrameDisposable = undefined;\n }\n }\n\n public updateColors(colors: DrawableElementColors = {}): void {\n this.xArrowFillColor = colors.xArrow ?? this.xArrowFillColor;\n this.yArrowFillColor = colors.yArrow ?? this.yArrowFillColor;\n this.zArrowFillColor = colors.zArrow ?? this.zArrowFillColor;\n this.twoAxesSquareFillColor =\n colors.twoAxesSquare ?? this.twoAxesSquareFillColor;\n this.hoveredArrowFillColor = colors.hovered ?? this.hoveredArrowFillColor;\n this.outlineColor = colors.outline ?? this.outlineColor;\n\n this.xArrow?.updateFillColor(this.getXTranslationColor(), true);\n this.yArrow?.updateFillColor(this.getYTranslationColor(), true);\n this.zArrow?.updateFillColor(this.getZTranslationColor(), true);\n this.xRotation?.updateFillColor(this.getXRotationColor(), true);\n this.yRotation?.updateFillColor(this.getYRotationColor(), true);\n this.zRotation?.updateFillColor(this.getZRotationColor(), true);\n this.xyTranslation?.updateFillColor(\n this.getTwoAxesTranslationColor(),\n true\n );\n this.xzTranslation?.updateFillColor(\n this.getTwoAxesTranslationColor(),\n true\n );\n this.yzTranslation?.updateFillColor(\n this.getTwoAxesTranslationColor(),\n true\n );\n\n this.hoveredElement?.updateFillColor(this.hoveredArrowFillColor);\n }\n\n public updateScalars(scalars: DrawableElementSizeScalars): void {\n this.customization = {\n ...this.customization,\n scalars,\n };\n\n if (this.transform != null && this.frame != null) {\n this.updateElements(this.transform, this.frame);\n }\n }\n\n public onHoveredChanged(\n listener: Listener<Drawable | undefined>\n ): Disposable {\n return this.hoveredChanged.on(listener);\n }\n\n private updateDisabledOnDrawables(): void {\n this.xRotation?.setDisabled(this.disabledAxis.xRotation);\n this.xyRotationLine?.setDisabled(this.disabledAxis.xRotation);\n this.xzRotationLine?.setDisabled(this.disabledAxis.xRotation);\n\n this.yRotation?.setDisabled(this.disabledAxis.yRotation);\n this.yzRotationLine?.setDisabled(this.disabledAxis.yRotation);\n this.yxRotationLine?.setDisabled(this.disabledAxis.yRotation);\n\n this.zRotation?.setDisabled(this.disabledAxis.zRotation);\n this.zxRotationLine?.setDisabled(this.disabledAxis.zRotation);\n this.zyRotationLine?.setDisabled(this.disabledAxis.zRotation);\n\n this.xArrow?.setDisabled(this.disabledAxis.xTranslation);\n this.yArrow?.setDisabled(this.disabledAxis.yTranslation);\n this.zArrow?.setDisabled(this.disabledAxis.zTranslation);\n\n this.xyTranslation?.setDisabled(this.disabledAxis.xyTranslation);\n this.xzTranslation?.setDisabled(this.disabledAxis.xzTranslation);\n this.yzTranslation?.setDisabled(this.disabledAxis.yzTranslation);\n\n this.updateColors();\n }\n\n private updateHovered(): void {\n const previousHovered = this.hoveredElement;\n const currentFrame = this.frame;\n\n if (currentFrame != null) {\n this.hoveredElement = [...this.translationMeshes, ...this.rotationMeshes]\n .filter((el) => el.points.valid && !el.isDisabled())\n .find((m) =>\n this.cursor != null\n ? testDrawable(m, currentFrame, this.viewport, this.cursor)\n : false\n );\n\n if (this.hoveredElement !== previousHovered) {\n this.hoveredChanged.emit(this.hoveredElement);\n this.hoveredElement?.updateFillColor(this.hoveredArrowFillColor);\n this.clearFillColorOfPreviouslyHovered(previousHovered);\n\n // Set the corresponding arrows to the hover fill color\n // when a 2-axes translation square is hovered over\n if (this.hoveredElement?.identifier === 'xy-translate') {\n this.xArrow?.updateFillColor(this.hoveredArrowFillColor);\n this.yArrow?.updateFillColor(this.hoveredArrowFillColor);\n } else if (this.hoveredElement?.identifier === 'xz-translate') {\n this.xArrow?.updateFillColor(this.hoveredArrowFillColor);\n this.zArrow?.updateFillColor(this.hoveredArrowFillColor);\n } else if (this.hoveredElement?.identifier === 'yz-translate') {\n this.yArrow?.updateFillColor(this.hoveredArrowFillColor);\n this.zArrow?.updateFillColor(this.hoveredArrowFillColor);\n }\n }\n }\n }\n\n private clearHovered(): void {\n const previousHovered = this.hoveredElement;\n this.hoveredElement = undefined;\n\n if (this.hoveredElement !== previousHovered) {\n this.hoveredChanged.emit(this.hoveredElement);\n this.clearFillColorOfPreviouslyHovered(previousHovered);\n }\n }\n\n private clearFillColorOfPreviouslyHovered(previousHovered?: Drawable): void {\n previousHovered?.updateFillColor(previousHovered?.initialFillColor);\n\n // Also clear the hover fill color from the corresponding arrows\n // when a 2-axes translation square is no longer hovered over\n if (previousHovered?.identifier === 'xy-translate') {\n this.xArrow?.updateFillColor(this.xArrow?.initialFillColor);\n this.yArrow?.updateFillColor(this.yArrow?.initialFillColor);\n } else if (previousHovered?.identifier === 'xz-translate') {\n this.xArrow?.updateFillColor(this.xArrow?.initialFillColor);\n this.zArrow?.updateFillColor(this.zArrow?.initialFillColor);\n } else if (previousHovered?.identifier === 'yz-translate') {\n this.yArrow?.updateFillColor(this.yArrow?.initialFillColor);\n this.zArrow?.updateFillColor(this.zArrow?.initialFillColor);\n }\n }\n\n protected hasData(): boolean {\n return this.transform != null;\n }\n\n protected createOrUpdateElements(): void {\n if (this.transform != null && this.frame != null) {\n if (this.xArrow == null || this.yArrow == null || this.zArrow == null) {\n this.createElements(this.transform, this.frame);\n } else {\n this.updateElements(this.transform, this.frame);\n }\n\n this.interactiveBounds = computeDrawable2dBounds(\n this.viewport,\n ...this.rotationMeshes,\n ...this.translationMeshes\n );\n this.fullBounds = computeDrawable2dBounds(\n this.viewport,\n ...this.rotationMeshes,\n ...this.translationMeshes,\n ...this.axisLines\n );\n }\n }\n\n private createElements(transform: Matrix4.Matrix4, frame: Frame): void {\n this.reglCommand = regl({\n canvas: this.canvasElement,\n extensions: 'angle_instanced_arrays',\n });\n const { createShape } = shapeBuilder(this.reglCommand);\n\n const triangleSize = this.computeTriangleSize(\n Vector3.fromMatrixPosition(transform),\n frame\n );\n\n this.xArrow = new TriangleMesh(\n createShape,\n 'x-translate',\n xAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xTranslation\n ),\n this.outlineColor,\n this.getXTranslationColor()\n );\n this.xRotation = new TriangleMesh(\n createShape,\n 'x-rotate',\n xAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xRotation,\n this.customization.scalars?.xTranslation\n ),\n this.outlineColor,\n this.getXRotationColor()\n );\n this.xAxis = new AxisLine(\n createShape,\n 'x-axis',\n axisPositions(transform, frame.scene.camera, this.xArrow),\n this.outlineColor,\n this.getXTranslationColor()\n );\n\n this.yArrow = new TriangleMesh(\n createShape,\n 'y-translate',\n yAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yTranslation\n ),\n this.outlineColor,\n this.getYTranslationColor()\n );\n this.yRotation = new TriangleMesh(\n createShape,\n 'y-rotate',\n yAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yRotation,\n this.customization.scalars?.yTranslation\n ),\n this.outlineColor,\n this.getYRotationColor()\n );\n this.yAxis = new AxisLine(\n createShape,\n 'y-axis',\n axisPositions(transform, frame.scene.camera, this.yArrow),\n this.outlineColor,\n this.getYTranslationColor()\n );\n\n this.zArrow = new TriangleMesh(\n createShape,\n 'z-translate',\n zAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.zTranslation\n ),\n this.outlineColor,\n this.getZTranslationColor()\n );\n this.zAxis = new AxisLine(\n createShape,\n 'z-axis',\n axisPositions(transform, frame.scene.camera, this.zArrow),\n this.outlineColor,\n this.getZTranslationColor()\n );\n this.zRotation = new TriangleMesh(\n createShape,\n 'z-rotate',\n zAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.zRotation,\n this.customization.scalars?.zTranslation\n ),\n this.outlineColor,\n this.getZRotationColor()\n );\n\n this.xyTranslation = new TriangleMesh(\n createShape,\n 'xy-translate',\n xyAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xyTranslation\n ),\n this.outlineColor,\n this.getTwoAxesTranslationColor()\n );\n this.xzTranslation = new TriangleMesh(\n createShape,\n 'xz-translate',\n xzAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xzTranslation\n ),\n this.outlineColor,\n this.getTwoAxesTranslationColor()\n );\n this.yzTranslation = new TriangleMesh(\n createShape,\n 'yz-translate',\n yzAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yzTranslation\n ),\n this.outlineColor,\n this.getTwoAxesTranslationColor()\n );\n\n this.createRotationLines(createShape, transform, frame);\n\n this.axisLines = [this.xAxis, this.yAxis, this.zAxis];\n this.translationMeshes = [\n this.xArrow,\n this.yArrow,\n this.zArrow,\n this.xyTranslation,\n this.xzTranslation,\n this.yzTranslation,\n ];\n this.rotationMeshes = [this.xRotation, this.yRotation, this.zRotation];\n this.updateDisabledOnDrawables();\n\n this.availableElements = [\n ...this.axisLines,\n ...this.rotationLines,\n ...this.translationMeshes,\n ...this.rotationMeshes,\n ];\n }\n\n private getXRotationColor(): Color.Color | string | undefined {\n return this.xArrowFillColor;\n }\n\n private getYRotationColor(): Color.Color | string | undefined {\n return this.yArrowFillColor;\n }\n\n private getZRotationColor(): Color.Color | string | undefined {\n return this.zArrowFillColor;\n }\n\n private getXTranslationColor(): Color.Color | string | undefined {\n return this.xArrowFillColor;\n }\n\n private getYTranslationColor(): Color.Color | string | undefined {\n return this.yArrowFillColor;\n }\n\n private getZTranslationColor(): Color.Color | string | undefined {\n return this.zArrowFillColor;\n }\n\n private getTwoAxesTranslationColor(): Color.Color | string | undefined {\n return this.twoAxesSquareFillColor;\n }\n\n private createRotationLines(\n createShape: CreateShape,\n transform: Matrix4.Matrix4,\n frame: Frame\n ): void {\n const triangleSize = this.computeTriangleSize(\n Vector3.fromMatrixPosition(transform),\n frame\n );\n\n const xyRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.xRotation,\n this.yArrow?.points.worldTip,\n triangleSize\n );\n const xzRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.xRotation,\n this.zArrow?.points.worldTip,\n triangleSize\n );\n const yxRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.yRotation,\n this.xArrow?.points.worldTip,\n triangleSize\n );\n const yzRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.yRotation,\n this.zArrow?.points.worldTip,\n triangleSize\n );\n const zxRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.zRotation,\n this.xArrow?.points.worldTip,\n triangleSize\n );\n const zyRotationLinePoints = rotationAxisPositions(\n frame.scene.camera,\n this.zRotation,\n this.yArrow?.points.worldTip,\n triangleSize\n );\n\n if (xyRotationLinePoints != null) {\n this.xyRotationLine = new RotationLine(\n createShape,\n 'xy-rotation-line',\n xyRotationLinePoints,\n this.outlineColor\n );\n }\n if (xzRotationLinePoints != null) {\n this.xzRotationLine = new RotationLine(\n createShape,\n 'xz-rotation-line',\n xzRotationLinePoints,\n this.outlineColor\n );\n }\n if (yxRotationLinePoints != null) {\n this.yxRotationLine = new RotationLine(\n createShape,\n 'yx-rotation-line',\n yxRotationLinePoints,\n this.outlineColor\n );\n }\n if (yzRotationLinePoints != null) {\n this.yzRotationLine = new RotationLine(\n createShape,\n 'yz-rotation-line',\n yzRotationLinePoints,\n this.outlineColor\n );\n }\n if (zxRotationLinePoints != null) {\n this.zxRotationLine = new RotationLine(\n createShape,\n 'zx-rotation-line',\n zxRotationLinePoints,\n this.outlineColor\n );\n }\n if (zyRotationLinePoints != null) {\n this.zyRotationLine = new RotationLine(\n createShape,\n 'zy-rotation-line',\n zyRotationLinePoints,\n this.outlineColor\n );\n }\n\n this.rotationLines = [\n this.xyRotationLine,\n this.xzRotationLine,\n this.yxRotationLine,\n this.yzRotationLine,\n this.zxRotationLine,\n this.zyRotationLine,\n ].filter((l) => l != null) as RotationLine[];\n }\n\n private updateElements(transform: Matrix4.Matrix4, frame: Frame): void {\n const triangleSize = this.computeTriangleSize(\n Vector3.fromMatrixPosition(transform),\n frame\n );\n\n if (this.xArrow != null) {\n this.xArrow.updatePoints(\n xAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xTranslation\n )\n );\n this.xAxis?.updatePoints(\n axisPositions(transform, frame.scene.camera, this.xArrow)\n );\n }\n this.xRotation?.updatePoints(\n xAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xRotation,\n this.customization.scalars?.xTranslation\n )\n );\n\n if (this.yArrow != null) {\n this.yArrow.updatePoints(\n yAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yTranslation\n )\n );\n this.yAxis?.updatePoints(\n axisPositions(transform, frame.scene.camera, this.yArrow)\n );\n }\n this.yRotation?.updatePoints(\n yAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yRotation,\n this.customization.scalars?.yTranslation\n )\n );\n\n if (this.zArrow != null) {\n this.zArrow.updatePoints(\n zAxisArrowPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.zTranslation\n )\n );\n this.zAxis?.updatePoints(\n axisPositions(transform, frame.scene.camera, this.zArrow)\n );\n }\n this.zRotation?.updatePoints(\n zAxisRotationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.zRotation,\n this.customization.scalars?.zTranslation\n )\n );\n\n this.xyRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.xRotation,\n this.yArrow?.points.worldTip,\n triangleSize\n )\n );\n this.xzRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.xRotation,\n this.zArrow?.points.worldTip,\n triangleSize\n )\n );\n this.yxRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.yRotation,\n this.xArrow?.points.worldTip,\n triangleSize\n )\n );\n this.yzRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.yRotation,\n this.zArrow?.points.worldTip,\n triangleSize\n )\n );\n this.zxRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.zRotation,\n this.xArrow?.points.worldTip,\n triangleSize\n )\n );\n this.zyRotationLine?.updatePoints(\n rotationAxisPositions(\n frame.scene.camera,\n this.zRotation,\n this.yArrow?.points.worldTip,\n triangleSize\n )\n );\n\n if (this.xyTranslation != null) {\n this.xyTranslation.updatePoints(\n xyAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xyTranslation\n )\n );\n }\n if (this.xzTranslation != null) {\n this.xzTranslation.updatePoints(\n xzAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.xzTranslation\n )\n );\n }\n if (this.yzTranslation != null) {\n this.yzTranslation.updatePoints(\n yzAxisTranslationPositions(\n transform,\n frame.scene.camera,\n triangleSize,\n this.customization.scalars?.yzTranslation\n )\n );\n }\n }\n}\n",":host {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n /**\n * @prop --viewer-transform-widget-x-axis-arrow-color: A CSS color for the arrow\n * at the end of the X axis on this widget. Defaults to `#ea3324`.\n */\n --viewer-transform-widget-x-axis-arrow-color: var(--x-axis-color);\n\n /**\n * @prop --viewer-transform-widget-y-axis-arrow-color: A CSS color for the arrow\n * at the end of the Y axis on this widget. Defaults to `#4faf32`.\n */\n --viewer-transform-widget-y-axis-arrow-color: var(--y-axis-color);\n\n /**\n * @prop --viewer-transform-widget-z-axis-arrow-color: A CSS color for the arrow\n * at the end of the Z axis on this widget. Defaults to `#0000ff`.\n */\n --viewer-transform-widget-z-axis-arrow-color: var(--z-axis-color);\n\n /**\n * @prop --viewer-transform-widget-two-axes-square-color: A CSS color for the squares\n * to translate by two axes at a time. Defaults to `#e0e0e0`.\n */\n --viewer-transform-widget-two-axes-square-color: var(--two-axes-color);\n\n\n /**\n * @prop --viewer-transform-widget-hovered-arrow-color: A CSS color for the arrow\n * when it is hovered. Defaults to `#ffff00`.\n */\n --viewer-transform-widget-hovered-arrow-color: #ffff00;\n\n /**\n * @prop --viewer-transform-widget-input-width: A CSS length for the width of the\n * input displayed near the handles. Defaults to `8em`.\n */\n --viewer-transform-widget-input-width: 8em;\n}\n\n.widget {\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.widget.hovered {\n pointer-events: auto;\n}\n\n.widget-input.wrapper {\n position: absolute;\n pointer-events: auto;\n display: flex;\n align-items: center;\n border: 1px solid #444444;\n border-radius: 4px;\n width: var(--viewer-transform-widget-input-width);\n text-align: center;\n background-color: white;\n box-sizing: border-box;\n}\n\n.widget-input.units {\n position: relative;\n width: 25%;\n height: 100%;\n padding: 0 0.25rem;\n font-size: 0.8125rem;\n color: #444444;\n}\n\ninput.widget-input {\n position: relative;\n text-align: center;\n box-sizing: border-box;\n width: 75%;\n height: 100%;\n outline: none;\n border-width: 0 1px 0 0;\n border-color: #444444;\n border-radius: 2px 0 0 2px;\n font-size: 0.875rem;\n color: #444444;\n}\n\ninput.widget-input.x-translate,\ninput.widget-input.x-rotate {\n border-left: 5px solid var(--viewer-transform-widget-x-axis-arrow-color);\n}\n\ninput.widget-input.y-translate,\ninput.widget-input.y-rotate {\n border-left: 5px solid var(--viewer-transform-widget-y-axis-arrow-color);\n}\n\ninput.widget-input.z-translate,\ninput.widget-input.z-rotate {\n border-left: 5px solid var(--viewer-transform-widget-z-axis-arrow-color);\n}\n\ninput.widget-input:disabled {\n color: #888888;\n}\n\ninput.widget-input:focus {\n outline: none;\n}","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport {\n Angle,\n Euler,\n Matrix4,\n Point,\n Quaternion,\n Vector3,\n} from '@vertexvis/geometry';\nimport { Color, Disposable } from '@vertexvis/utils';\nimport classNames from 'classnames';\n\nimport { readDOM, writeDOM } from '../../lib/stencil';\nimport { TransformController } from '../../lib/transforms/controller';\nimport { Drawable } from '../../lib/transforms/drawable';\nimport {\n AngleUnits,\n AngleUnitType,\n DistanceUnits,\n DistanceUnitType,\n} from '../../lib/types';\nimport { ModifierKey } from '../../lib/types/keys';\nimport { focusInputElement } from './dom';\nimport {\n calculateNewRotationAngle,\n computeHandleDeltaTransform,\n computeInputDeltaTransform,\n computeInputDisplayValue,\n computeInputPosition,\n convertCanvasPointToWorld,\n convertPointToCanvas,\n PointAndPlacement,\n} from './util';\nimport {\n TransformWidgetInput,\n TransformWidgetInputWrapper,\n} from './viewer-transform-widget-components';\nimport { TransformWidget } from './widget';\n\n@Component({\n tag: 'vertex-viewer-transform-widget',\n styleUrl: 'viewer-transform-widget.css',\n shadow: true,\n})\nexport class ViewerTransformWidget {\n /**\n * An event that is emitted when the position of the widget changes.\n */\n @Event({ bubbles: true })\n public positionChanged!: EventEmitter<Vector3.Vector3 | undefined>;\n\n /**\n * An event that is emitted when the rotation of the widget changes.\n */\n @Event({ bubbles: true })\n public rotationChanged!: EventEmitter<Euler.Euler | undefined>;\n\n /**\n * An event that is emitted when the interaction has ended\n */\n @Event({ bubbles: true })\n public interactionEnded!: EventEmitter<Matrix4.Matrix4 | undefined>;\n\n /**\n * An event that is emitted an interaction with the widget has started\n */\n @Event({ bubbles: true })\n public interactionStarted!: EventEmitter<void>;\n\n /**\n * The viewer to connect to transforms. If nested within a <vertex-viewer>,\n * this property will be populated automatically.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The starting position of this transform widget. This position will be updated\n * as transforms occur. Setting this value to `undefined` will remove the widget.\n */\n @Prop({ mutable: true })\n public position?: Vector3.Vector3;\n\n /**\n * The starting angle for the transform widget. This rotation will be updated\n * as the rotations occur.\n */\n @Prop({ mutable: true })\n public rotation?: Euler.Euler;\n\n /**\n * The controller that is responsible for performing transforms.\n */\n @Prop({ mutable: true })\n public controller?: TransformController;\n\n /**\n * Determines whether the x-rotation is disabled on the widget\n */\n @Prop({ mutable: true })\n public xRotationDisabled = false;\n\n /**\n * Determines whether the y-rotation is disabled on the widget\n */\n @Prop({ mutable: true })\n public yRotationDisabled = false;\n\n /**\n * Determines whether the z-rotation is disabled on the widget\n */\n @Prop({ mutable: true })\n public zRotationDisabled = false;\n\n /**\n * Determines whether the x-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public xTranslationDisabled = false;\n\n /**\n * Determines whether the y-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public yTranslationDisabled = false;\n\n /**\n * Determines whether the z-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public zTranslationDisabled = false;\n\n /**\n * Determines whether the xy-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public xyTranslationDisabled = false;\n\n /**\n * Determines whether the xz-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public xzTranslationDisabled = false;\n\n /**\n * Determines whether the yz-translation is disabled on the widget\n */\n @Prop({ mutable: true })\n public yzTranslationDisabled = false;\n\n /**\n * Whether to show inputs beside the widget handles when they are interacted with.\n * Defaults to `true`.\n */\n @Prop()\n public showInputs = true;\n\n /**\n * The unit to show for translation inputs. Defaults to `millimeters`.\n *\n * @see DistanceUnitType\n */\n @Prop()\n public distanceUnit: DistanceUnitType = 'millimeters';\n\n /**\n * The unit to show for rotation inputs. Defaults to `degrees`.\n *\n * @see AngleUnitType\n */\n @Prop()\n public angleUnit: AngleUnitType = 'degrees';\n\n /**\n * The number of decimal places to show in the input. Defaults to `1`.\n */\n @Prop()\n public decimalPlaces = 1;\n\n /**\n * When defined, the widget will snap to the degree of the nearest multiple of\n * the given number when the user is rotating with the widget and holding the\n * key defined by rotationSnapKey. Defaults to undefined.\n */\n @Prop()\n public rotationSnapDegrees?: number;\n\n /**\n * When rotationSnapDegrees is defined, the widget will snap to the degree of the\n * nearest multiple of the given number when the user is rotating with the widget\n * and holding the key defined here. Defaults to the shift key.\n */\n @Prop()\n public rotationSnapKey: ModifierKey = 'shift';\n\n /**\n * Scalar to increase the size of the translation handles of this widget.\n * Values above zero and below three will result in the best visual representation\n * of the handles, and values above three may produce unexpected results.\n *\n * Defaults to `1`.\n */\n @Prop()\n public translationHandleScalar = 1;\n\n /**\n * Scalar to increase the size of the rotation handles of this widget.\n * Values above zero and below three will result in the best visual representation\n * of the handles, and values above three may produce unexpected results.\n *\n * Defaults to `1`.\n */\n @Prop()\n public rotationHandleScalar = 1;\n\n /**\n * Specifies the frequency, in milliseconds, to update the transform while interacting with the widget.\n *\n * This delay is used to group events happening in quick succession and results in smoother\n * widget movement.\n */\n @Prop()\n public interactionThrottle = 75;\n\n /**\n * **EXPERIMENTAL.**\n *\n * Enables Command+Z and Control+Z keybindings to perform an undo of\n * the previous delta transformation.\n *\n * @see `EXPERIMENTAL_undo`\n */\n @Prop()\n public EXPERIMENTAL_undoKeybindings = false;\n\n /**\n * @internal\n * @ignore\n *\n * Visible for testing.\n */\n @Prop({ mutable: true })\n public hovered?: Drawable;\n\n @State()\n protected inputPosition?: PointAndPlacement;\n\n @State()\n protected inputValue = 0;\n\n @State()\n protected isEndingTransform = false;\n\n @State()\n protected inputShouldFocus = false;\n\n @Element()\n private hostEl!: HTMLElement;\n\n private startingTransform?: Matrix4.Matrix4;\n private currentTransform?: Matrix4.Matrix4;\n private dragStartTransform?: Matrix4.Matrix4;\n\n private xArrowColor: Color.Color | string = '#ea3324';\n private yArrowColor: Color.Color | string = '#4faf32';\n private zArrowColor: Color.Color | string = '#0000ff';\n private twoAxesSquareColor: Color.Color | string = '#e0e0e0';\n private hoveredColor: Color.Color | string = '#ffff00';\n\n private widget?: TransformWidget;\n private lastDragged?: Drawable;\n private dragging?: Drawable;\n private lastAngle = 0;\n private lastWorldPosition?: Vector3.Vector3;\n private lastInputValue?: number;\n\n private canvasBounds?: DOMRect;\n private inputBounds?: DOMRect;\n private canvasResizeObserver?: ResizeObserver;\n private inputResizeObserver?: ResizeObserver;\n private hostStyleObserver?: MutationObserver;\n private canvasRef?: HTMLCanvasElement;\n private inputWrapperRef?: HTMLDivElement;\n private inputRef?: HTMLInputElement;\n\n private hoveredChangeDisposable?: Disposable;\n\n private interactionTimer?: number;\n private lastMouseEvent?: PointerEvent;\n\n protected componentDidLoad(): void {\n window.addEventListener('pointermove', this.handlePointerMove);\n\n this.canvasResizeObserver = new ResizeObserver(this.handleResize);\n this.inputResizeObserver = new ResizeObserver(this.handleInputResize);\n this.hostStyleObserver = new MutationObserver(this.handleStyleChange);\n\n if (this.canvasRef != null) {\n this.canvasResizeObserver.observe(this.canvasRef);\n\n this.setupTransformWidget(this.canvasRef);\n }\n\n this.hostStyleObserver.observe(this.hostEl, {\n attributes: true,\n attributeFilter: ['style'],\n });\n\n this.handleViewerChanged(this.viewer, undefined);\n this.handleStyleChange();\n }\n\n protected disconnectedCallback(): void {\n window.removeEventListener('pointermove', this.handlePointerMove);\n\n this.canvasResizeObserver?.disconnect();\n this.inputResizeObserver?.disconnect();\n this.hostStyleObserver?.disconnect();\n\n this.hoveredChangeDisposable?.dispose();\n this.widget?.dispose();\n }\n\n protected componentDidRender(): void {\n if (this.inputShouldFocus && this.inputRef != null) {\n focusInputElement(this.inputRef);\n this.inputShouldFocus = false;\n }\n }\n\n /**\n * **EXPERIMENTAL.**\n *\n * Performs an undo of the most recent set of transform manipulations,\n * categorized by the last pause in interactivity (pointerup on a handle,\n * Enter press on an input, keyup on an input).\n *\n * Note that this *does not* work repeatedly. I.e. only one undo can be\n * performed, and once another set of transform manipulations is performed,\n * the history is lost.\n */\n @Method()\n public async EXPERIMENTAL_undo(): Promise<void> {\n const undoDelta = await this.controller?.EXPERIMENTAL_undoTransform();\n\n if (this.currentTransform != null && undoDelta != null) {\n this.currentTransform = Matrix4.multiply(\n undoDelta,\n this.currentTransform\n );\n\n this.widget?.updateTransform(this.currentTransform);\n\n this.updateInputPosition();\n this.updateInputValue();\n this.lastInputValue = this.inputValue;\n\n this.position = Vector3.fromMatrixPosition(this.currentTransform);\n this.rotation = Euler.fromRotationMatrix(this.currentTransform);\n }\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(\n newViewer?: HTMLVertexViewerElement,\n oldViewer?: HTMLVertexViewerElement\n ): void {\n oldViewer?.removeEventListener('frameDrawn', this.handleViewerFrameDrawn);\n oldViewer?.removeEventListener(\n 'dimensionschange',\n this.handleViewerDimensionsChange\n );\n newViewer?.addEventListener('frameDrawn', this.handleViewerFrameDrawn);\n newViewer?.addEventListener(\n 'dimensionschange',\n this.handleViewerDimensionsChange\n );\n\n if (newViewer?.stream != null) {\n this.controller?.dispose();\n this.controller = new TransformController(newViewer.stream);\n }\n }\n\n /**\n * @ignore\n */\n @Watch('xTranslationDisabled')\n @Watch('yTranslationDisabled')\n @Watch('zTranslationDisabled')\n @Watch('xyTranslationDisabled')\n @Watch('xzTranslationDisabled')\n @Watch('yzTranslationDisabled')\n @Watch('xRotationDisabled')\n @Watch('yRotationDisabled')\n @Watch('zRotationDisabled')\n protected handleDisabledPropertyChanged(): void {\n this.widget?.updateDisabledAxis({\n xRotation: this.xRotationDisabled,\n yRotation: this.yRotationDisabled,\n zRotation: this.zRotationDisabled,\n\n xTranslation: this.xTranslationDisabled,\n yTranslation: this.yTranslationDisabled,\n zTranslation: this.zTranslationDisabled,\n\n xyTranslation: this.xyTranslationDisabled,\n xzTranslation: this.xzTranslationDisabled,\n yzTranslation: this.yzTranslationDisabled,\n });\n }\n\n /**\n * @ignore\n */\n @Watch('translationHandleScalar')\n @Watch('rotationHandleScalar')\n protected handleTransformHandleScalarChanged(): void {\n const effectiveArrowScalar = this.getTranslationScalar();\n const effectiveSquareScalar = this.getRotationScalar();\n\n this.widget?.updateScalars({\n xTranslation: effectiveArrowScalar,\n yTranslation: effectiveArrowScalar,\n zTranslation: effectiveArrowScalar,\n xyTranslation: effectiveSquareScalar,\n xzTranslation: effectiveSquareScalar,\n yzTranslation: effectiveSquareScalar,\n xRotation: effectiveSquareScalar,\n yRotation: effectiveSquareScalar,\n zRotation: effectiveSquareScalar,\n });\n }\n\n /**\n * @ignore\n */\n @Watch('rotation')\n protected handleRotationChanged(\n newRotation?: Euler.Euler,\n oldRotation?: Euler.Euler\n ): void {\n const rotationToApply = newRotation ?? Euler.create();\n\n this.currentTransform = this.getTransformForNewRotation(rotationToApply);\n this.startingTransform = this.currentTransform;\n\n // If the removal of the previous rotation above results in an identity matrix,\n // clear the transformation on the widget to prevent it from appearing at the origin.\n if (\n newRotation == null &&\n this.currentTransform != null &&\n Matrix4.isIdentity(this.currentTransform)\n ) {\n this.currentTransform = undefined;\n this.startingTransform = this.currentTransform;\n }\n\n this.widget?.updateTransform(this.currentTransform);\n\n console.debug(\n `Updating widget rotation [previous=${JSON.stringify(\n oldRotation\n )}, current=${JSON.stringify(newRotation)}]`\n );\n\n this.rotationChanged.emit(newRotation);\n }\n\n /**\n * @ignore\n */\n @Watch('position')\n protected handlePositionChanged(\n newPosition?: Vector3.Vector3,\n oldPosition?: Vector3.Vector3\n ): void {\n this.currentTransform = this.getTransformForNewPosition(newPosition);\n this.startingTransform = this.currentTransform;\n\n console.debug(\n `Updating widget position [previous=${JSON.stringify(\n oldPosition\n )}, current=${JSON.stringify(newPosition)}]`\n );\n this.widget?.updateTransform(this.currentTransform);\n\n if (newPosition == null) {\n this.lastDragged = undefined;\n this.inputPosition = undefined;\n this.controller?.clearTransform();\n }\n\n this.positionChanged.emit(newPosition);\n }\n\n /**\n * @ignore\n */\n @Watch('distanceUnit')\n @Watch('angleUnit')\n @Watch('decimalPlaces')\n protected handleInputFormattingChanged(): void {\n this.updateInputValue();\n this.lastInputValue = this.inputValue;\n }\n\n public render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <canvas\n ref={(el) => {\n this.canvasRef = el;\n }}\n class={classNames('widget', {\n hovered: this.hovered != null,\n })}\n tabindex=\"0\"\n width={this.viewer?.viewport.width}\n height={this.viewer?.viewport.height}\n onPointerDown={this.handleBeginDrag}\n onKeyDown={this.handleKeyDown}\n />\n\n {this.showInputs && this.inputPosition && this.viewer?.viewport && (\n <TransformWidgetInputWrapper\n ref={(el) => {\n if (el != null) {\n this.inputResizeObserver?.observe(el);\n } else if (this.inputRef != null) {\n this.inputResizeObserver?.unobserve(this.inputRef);\n }\n this.inputWrapperRef = el;\n }}\n bounds={this.inputBounds}\n viewport={this.viewer.viewport}\n point={this.inputPosition.point}\n placement={this.inputPosition.placement}\n displayUnit={this.getDisplayedUnits()}\n >\n <TransformWidgetInput\n ref={(el) => {\n this.inputRef = el;\n }}\n identifier={\n this.dragging?.identifier ?? this.lastDragged?.identifier\n }\n disabled={this.isEndingTransform}\n onChange={this.handleInputChange}\n onIncrement={() => this.handleInputStep(1)}\n onDecrement={() => this.handleInputStep(-1)}\n onBlur={() => {\n this.inputShouldFocus = false;\n }}\n onUndo={\n this.EXPERIMENTAL_undoKeybindings\n ? () => this.EXPERIMENTAL_undo()\n : undefined\n }\n />\n </TransformWidgetInputWrapper>\n )}\n </Host>\n );\n }\n\n private handleHoveredDrawableChanged = (drawable?: Drawable): void => {\n this.hovered = drawable;\n };\n\n private handleViewerFrameDrawn = (): void => {\n this.updatePropsFromViewer();\n };\n\n private handleViewerDimensionsChange = (): void => {\n writeDOM(() => {\n if (this.viewer != null && this.canvasRef != null) {\n this.canvasRef.width = this.viewer.viewport.width;\n this.canvasRef.height = this.viewer.viewport.height;\n\n this.updateCanvasBounds(this.canvasRef);\n }\n });\n };\n\n private handleResize = (): void => {\n if (this.canvasRef != null) {\n this.updateCanvasBounds(this.canvasRef);\n }\n };\n\n private handleInputResize = (): void => {\n if (this.inputWrapperRef != null) {\n const wrapperElement = this.inputWrapperRef;\n\n readDOM(() => {\n this.inputBounds = wrapperElement.getBoundingClientRect();\n });\n }\n };\n\n private handleStyleChange = (): void => {\n readDOM(() => {\n const hostStyles = window.getComputedStyle(this.hostEl);\n\n this.xArrowColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-x-axis-arrow-color')\n .trim();\n this.yArrowColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-y-axis-arrow-color')\n .trim();\n this.zArrowColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-z-axis-arrow-color')\n .trim();\n this.twoAxesSquareColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-two-axes-square-color')\n .trim();\n this.hoveredColor = hostStyles\n .getPropertyValue('--viewer-transform-widget-hovered-arrow-color')\n .trim();\n\n this.getTransformWidget().updateColors({\n xArrow: this.xArrowColor,\n yArrow: this.yArrowColor,\n zArrow: this.zArrowColor,\n twoAxesSquare: this.twoAxesSquareColor,\n hovered: this.hoveredColor,\n });\n });\n };\n\n private handlePointerMove = (event: PointerEvent): void => {\n if (this.dragging == null) {\n const canvasPoint = convertPointToCanvas(\n Point.create(event.clientX, event.clientY),\n this.getCanvasBounds()\n );\n const widget = this.getTransformWidget();\n\n if (canvasPoint != null && widget.boundsContainsPoint(canvasPoint)) {\n widget.updateCursor(canvasPoint);\n } else {\n widget.updateCursor(undefined);\n this.hovered = undefined;\n }\n }\n };\n\n private handleBeginDrag = async (event: PointerEvent): Promise<void> => {\n const canvasBounds = this.getCanvasBounds();\n\n if (\n this.hovered != null &&\n canvasBounds != null &&\n this.viewer != null &&\n this.position != null &&\n this.viewer.frame != null\n ) {\n this.dragging = this.hovered;\n\n if (this.dragging.identifier !== this.lastDragged?.identifier) {\n this.inputValue = 0;\n this.dragStartTransform = this.currentTransform;\n this.updateInputPosition();\n this.updateInputValue();\n }\n this.lastDragged = undefined;\n\n const currentCanvas = convertPointToCanvas(\n Point.create(event.clientX, event.clientY),\n canvasBounds\n );\n const widgetCenter = this.viewer.viewport.transformWorldToViewport(\n this.position,\n this.viewer.frame.scene.camera.projectionViewMatrix\n );\n\n this.lastAngle =\n currentCanvas != null\n ? Angle.fromPoints(widgetCenter, currentCanvas)\n : 0;\n\n this.lastWorldPosition = convertCanvasPointToWorld(\n currentCanvas,\n this.viewer?.frame,\n this.viewer?.viewport,\n this.currentTransform\n );\n\n this.interactionStarted.emit();\n\n window.removeEventListener('pointermove', this.handlePointerMove);\n window.addEventListener('pointermove', this.handleDragWithTimer);\n window.addEventListener('pointerup', this.handleEndTransform);\n }\n };\n\n private handleDragWithTimer = async (event: PointerEvent): Promise<void> => {\n if (event != null) {\n // Prevent selection of text and interaction with view cube while dragging the widget\n event.preventDefault();\n\n this.lastMouseEvent = event;\n }\n\n if (this.interactionTimer == null) {\n this.interactionTimer = window.setTimeout(async () => {\n this.interactionTimer = undefined;\n await this.handleDrag();\n this.lastMouseEvent = undefined;\n }, this.interactionThrottle);\n }\n };\n\n private handleDrag = async (): Promise<void> => {\n const canvasBounds = this.getCanvasBounds();\n\n if (\n this.dragging != null &&\n this.lastWorldPosition != null &&\n canvasBounds != null &&\n this.viewer != null &&\n this.viewer.frame != null &&\n this.position != null &&\n this.lastMouseEvent != null\n ) {\n // Begin the transform on the first `pointermove` event as opposed to the\n // `pointerdown` to prevent accidental no-op transforms (identity matrix).\n await this.controller?.beginTransform();\n\n const currentCanvas = convertPointToCanvas(\n Point.create(this.lastMouseEvent.clientX, this.lastMouseEvent.clientY),\n canvasBounds\n );\n const widgetCenter = this.viewer.viewport.transformWorldToViewport(\n this.position,\n this.viewer.frame.scene.camera.projectionViewMatrix\n );\n\n const currentWorld = convertCanvasPointToWorld(\n currentCanvas,\n this.viewer?.frame,\n this.viewer?.viewport,\n this.currentTransform\n );\n\n if (\n currentWorld != null &&\n currentCanvas != null &&\n widgetCenter != null\n ) {\n const angle = Angle.fromPoints(widgetCenter, currentCanvas);\n const angleToUse = calculateNewRotationAngle(\n this.lastMouseEvent,\n this.rotationSnapKey,\n angle,\n this.lastAngle,\n this.getDisplayedAngle(),\n this.rotationSnapDegrees\n );\n\n this.transform(\n this.lastWorldPosition,\n currentWorld,\n angleToUse - this.lastAngle\n );\n\n this.updateInputPosition();\n this.updateInputValue();\n\n this.lastWorldPosition = currentWorld;\n this.lastAngle = angleToUse;\n }\n }\n };\n\n private handleEndTransform = async (event: PointerEvent): Promise<void> => {\n const canvasPoint = convertPointToCanvas(\n Point.create(event.clientX, event.clientY),\n this.getCanvasBounds()\n );\n const widget = this.getTransformWidget();\n this.lastDragged = this.dragging;\n\n this.dragging = undefined;\n this.lastWorldPosition = undefined;\n this.lastAngle = 0;\n\n this.updateInputPosition();\n this.updateInputValue();\n\n widget.updateCursor(canvasPoint);\n widget.updateTransform(this.currentTransform);\n\n this.beginEndTransform();\n\n window.removeEventListener('pointermove', this.handleDragWithTimer);\n window.removeEventListener('pointerup', this.handleEndTransform);\n\n try {\n const delta = this.controller?.getCurrentDelta();\n\n await this.controller?.endTransform();\n\n this.interactionEnded.emit(delta);\n } catch (e) {\n console.error('Failed to end transform interaction', e);\n }\n\n window.addEventListener('pointermove', this.handlePointerMove);\n\n this.completeEndTransform();\n };\n\n private handleInputStep = async (step: number): Promise<void> => {\n if (this.inputValue != null && this.lastInputValue != null) {\n // If modifying angle units, we want to adjust the step to always\n // perform the equivalent of a 1 degree rotation.\n if (this.isModifyingAngleUnits()) {\n const angles = new AngleUnits(this.angleUnit);\n const previous = angles.convertFrom(this.lastInputValue);\n const next = Angle.normalizeRadians(previous + Angle.toRadians(step));\n\n this.inputValue = angles.convertTo(next);\n } else {\n this.inputValue = this.lastInputValue + step;\n }\n await this.updateTransformFromInput(this.inputValue);\n }\n };\n\n private handleInputChange = async (value: number): Promise<void> => {\n await this.updateTransformFromInput(value);\n };\n\n private handleKeyDown = async (event: KeyboardEvent): Promise<void> => {\n const commandOrControlModifier = event.ctrlKey || event.metaKey;\n\n if (\n event.key === 'z' &&\n commandOrControlModifier &&\n this.EXPERIMENTAL_undoKeybindings\n ) {\n event.stopPropagation();\n await this.EXPERIMENTAL_undo();\n }\n };\n\n private updateTransformFromInput = async (value: number): Promise<void> => {\n if (\n this.lastDragged != null &&\n this.currentTransform != null &&\n this.startingTransform != null &&\n this.lastInputValue != null\n ) {\n this.currentTransform = computeInputDeltaTransform(\n this.currentTransform,\n this.lastDragged.identifier,\n value,\n this.lastInputValue,\n this.distanceUnit,\n this.angleUnit\n );\n\n this.updateInputValue();\n this.lastInputValue = value;\n\n await this.controller?.beginTransform();\n this.getTransformWidget().updateTransform(this.currentTransform);\n await this.controller?.updateTransform(\n Matrix4.multiply(\n this.currentTransform,\n Matrix4.invert(this.startingTransform)\n )\n );\n this.updateInputPosition();\n await this.controller?.endTransformDebounced(\n this.beginEndTransform,\n this.completeEndTransform\n );\n }\n };\n\n private updatePropsFromViewer = (): void => {\n const { frame } = this.viewer || {};\n\n if (frame != null) {\n const widget = this.getTransformWidget();\n\n widget.updateFrame(frame, this.dragging == null);\n this.updateInputPosition();\n }\n };\n\n private transform(\n previous: Vector3.Vector3,\n next: Vector3.Vector3,\n angle: number\n ): void {\n if (\n this.position != null &&\n this.startingTransform != null &&\n this.currentTransform != null &&\n this.dragging != null &&\n this.viewer != null &&\n this.viewer.frame != null\n ) {\n this.currentTransform = computeHandleDeltaTransform(\n this.currentTransform,\n previous,\n next,\n this.viewer?.frame.scene.camera.viewVector,\n angle,\n this.dragging.identifier\n );\n\n this.getTransformWidget().updateTransform(this.currentTransform);\n this.controller?.updateTransform(\n Matrix4.multiply(\n this.currentTransform,\n Matrix4.invert(this.startingTransform)\n )\n );\n }\n }\n\n private handleSettingDisabledAxis(): void {\n if (this.widget) {\n this.widget.updateDisabledAxis({\n xRotation: this.xRotationDisabled,\n yRotation: this.yRotationDisabled,\n zRotation: this.zRotationDisabled,\n xTranslation: this.xTranslationDisabled,\n yTranslation: this.yTranslationDisabled,\n zTranslation: this.zTranslationDisabled,\n xyTranslation: this.xyTranslationDisabled,\n xzTranslation: this.xzTranslationDisabled,\n yzTranslation: this.yzTranslationDisabled,\n });\n } else {\n console.warn('Cannot set disabled values - no widget defined');\n }\n }\n\n private setupTransformWidget = (\n canvasRef: HTMLCanvasElement\n ): TransformWidget => {\n console.debug(\n `Initializing transform widget. [initial-position=${JSON.stringify(\n this.position\n )}, has-initial-frame=${this.viewer?.frame != null}]`\n );\n\n const effectiveArrowScalar = this.getTranslationScalar();\n const effectiveSquareScalar = this.getRotationScalar();\n\n this.widget = new TransformWidget(canvasRef, {\n colors: {\n xArrow: this.xArrowColor,\n yArrow: this.yArrowColor,\n zArrow: this.zArrowColor,\n twoAxesSquare: this.twoAxesSquareColor,\n hovered: this.hoveredColor,\n },\n scalars: {\n xTranslation: effectiveArrowScalar,\n yTranslation: effectiveArrowScalar,\n zTranslation: effectiveArrowScalar,\n xyTranslation: effectiveSquareScalar,\n xzTranslation: effectiveSquareScalar,\n yzTranslation: effectiveSquareScalar,\n xRotation: effectiveSquareScalar,\n yRotation: effectiveSquareScalar,\n zRotation: effectiveSquareScalar,\n },\n });\n\n if (this.rotation != null) {\n this.currentTransform = this.getTransformForNewRotation(this.rotation);\n this.startingTransform = this.currentTransform;\n this.widget.updateTransform(this.currentTransform);\n }\n\n if (this.position != null) {\n this.currentTransform = this.getTransformForNewPosition(this.position);\n this.startingTransform = this.currentTransform;\n this.widget.updateTransform(this.currentTransform);\n }\n if (this.viewer?.frame != null) {\n this.widget.updateFrame(this.viewer.frame, true);\n }\n\n this.handleSettingDisabledAxis();\n\n this.hoveredChangeDisposable = this.widget.onHoveredChanged(\n this.handleHoveredDrawableChanged\n );\n\n return this.widget;\n };\n\n private updateCanvasBounds = (canvasElement: HTMLCanvasElement): void => {\n readDOM(() => {\n this.canvasBounds = canvasElement.getBoundingClientRect();\n\n this.getTransformWidget().updateDimensions(canvasElement);\n });\n };\n\n private updateInputValue = (): void => {\n const dragging = this.dragging ?? this.lastDragged;\n const isDraggingTwoAxesTranslation =\n dragging?.identifier === 'xy-translate' ||\n dragging?.identifier === 'xz-translate' ||\n dragging?.identifier === 'yz-translate';\n\n if (\n dragging != null &&\n this.currentTransform != null &&\n this.dragStartTransform != null &&\n !isDraggingTwoAxesTranslation\n ) {\n this.lastInputValue = this.inputValue;\n\n this.inputValue = computeInputDisplayValue(\n dragging.identifier,\n this.currentTransform,\n this.dragStartTransform,\n this.distanceUnit,\n this.angleUnit\n );\n\n if (this.inputRef != null) {\n const definedValue =\n this.getDisplayedDistance() ?? this.getDisplayedAngle() ?? 0;\n const displayValue = `${parseFloat(\n definedValue.toFixed(this.decimalPlaces)\n )}`;\n\n this.inputRef.value = displayValue;\n }\n }\n };\n\n private updateInputPosition = (): void => {\n const dragging = this.dragging ?? this.lastDragged;\n\n const isDraggingTwoAxesTranslation =\n dragging?.identifier === 'xy-translate' ||\n dragging?.identifier === 'xz-translate' ||\n dragging?.identifier === 'yz-translate';\n\n if (\n this.showInputs &&\n this.viewer?.frame != null &&\n this.position != null &&\n dragging != null &&\n !isDraggingTwoAxesTranslation\n ) {\n const widget = this.getTransformWidget();\n const widgetBounds = widget.getFullBounds();\n\n this.inputPosition =\n widgetBounds != null\n ? computeInputPosition(\n this.viewer.viewport,\n widgetBounds,\n dragging.points.toArray()\n )\n : undefined;\n } else if (isDraggingTwoAxesTranslation) {\n this.inputPosition = undefined;\n }\n };\n\n private beginEndTransform = (): void => {\n const widget = this.getTransformWidget();\n\n widget.updateDisabledAxis({\n xRotation: true,\n yRotation: true,\n zRotation: true,\n xTranslation: true,\n yTranslation: true,\n zTranslation: true,\n xyTranslation: true,\n xzTranslation: true,\n yzTranslation: true,\n });\n\n this.isEndingTransform = true;\n };\n\n private completeEndTransform = (): void => {\n const widget = this.getTransformWidget();\n\n widget.updateDisabledAxis({\n xRotation: this.xRotationDisabled,\n yRotation: this.yRotationDisabled,\n zRotation: this.zRotationDisabled,\n\n xTranslation: this.xTranslationDisabled,\n yTranslation: this.yTranslationDisabled,\n zTranslation: this.zTranslationDisabled,\n\n xyTranslation: this.xyTranslationDisabled,\n xzTranslation: this.xzTranslationDisabled,\n yzTranslation: this.yzTranslationDisabled,\n });\n\n this.isEndingTransform = false;\n this.inputShouldFocus = true;\n\n if (this.currentTransform != null) {\n this.position = Vector3.fromMatrixPosition(this.currentTransform);\n this.rotation = Euler.fromRotationMatrix(this.currentTransform);\n }\n };\n\n private isModifyingAngleUnits = (): boolean => {\n const draggingIdentifier =\n this.dragging?.identifier ?? this.lastDragged?.identifier;\n\n return !!draggingIdentifier?.includes('rotate');\n };\n\n private getTranslationScalar = (): number => {\n if (this.translationHandleScalar > 0) {\n return this.translationHandleScalar;\n }\n console.warn(\n 'Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.'\n );\n return 1;\n };\n\n private getRotationScalar = (): number => {\n if (this.rotationHandleScalar > 0) {\n return this.rotationHandleScalar;\n }\n console.warn(\n 'Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.'\n );\n return 1;\n };\n\n private getDisplayedUnits = (): AngleUnits | DistanceUnits => {\n if (this.isModifyingAngleUnits()) {\n return new AngleUnits(this.angleUnit);\n }\n return new DistanceUnits(this.distanceUnit);\n };\n\n private getDisplayedAngle = (): number | undefined => {\n if (this.isModifyingAngleUnits()) {\n return this.inputValue;\n }\n };\n\n private getDisplayedDistance = (): number | undefined => {\n const draggingIdentifier =\n this.dragging?.identifier ?? this.lastDragged?.identifier;\n if (draggingIdentifier?.includes('translate')) {\n return this.inputValue;\n }\n };\n\n private getTransformForNewPosition = (\n newPosition?: Vector3.Vector3\n ): Matrix4.Matrix4 | undefined => {\n if (newPosition != null) {\n const c =\n this.currentTransform != null\n ? this.currentTransform\n : Matrix4.makeIdentity();\n\n const currentRotation = Matrix4.makeRotation(\n Quaternion.fromMatrixRotation(c)\n );\n const position = Matrix4.makeTranslation(newPosition);\n\n return Matrix4.multiply(position, currentRotation);\n }\n };\n\n private getTransformForNewRotation = (\n newRotationEuler: Euler.Euler\n ): Matrix4.Matrix4 | undefined => {\n const c =\n this.currentTransform != null\n ? this.currentTransform\n : Matrix4.makeIdentity();\n\n const oldRotation = Matrix4.invert(\n Matrix4.makeRotation(Quaternion.fromMatrixRotation(c))\n );\n\n const newRotation = Matrix4.makeRotation(\n Quaternion.fromEuler(newRotationEuler)\n );\n const oldTranslation = Matrix4.multiply(c, oldRotation);\n\n return Matrix4.multiply(oldTranslation, newRotation);\n };\n\n private getCanvasBounds = (): DOMRect | undefined => {\n if (this.canvasBounds != null) {\n return this.canvasBounds;\n } else if (this.canvasRef != null) {\n this.updateCanvasBounds(this.canvasRef);\n return this.canvasBounds;\n }\n };\n\n private getTransformWidget = (): TransformWidget => {\n if (this.widget == null && this.canvasRef != null) {\n return this.setupTransformWidget(this.canvasRef);\n } else if (this.widget != null) {\n return this.widget;\n } else {\n throw new Error(\n 'Transform widget was not initialized. The canvas element may not have been initialized.'\n );\n }\n };\n}\n"],"mappings":";;;ifAAM,SAAUA,EAAkBC,GAChC,GAAIC,OAAOC,SAASC,gBAAkBH,EAAS,CAC7CA,EAAQI,QACRJ,EAAQK,kBAAkBL,EAAQM,MAAMC,OAAQP,EAAQM,MAAMC,O,CAElE,CCuBM,SAAUC,EACdC,EACAC,GAEA,OAAOA,GAAU,KACbC,EAAMC,OAAOH,EAAMI,EAAIH,EAAOI,KAAML,EAAMM,EAAIL,EAAOM,KACrDC,SACN,CAEM,SAAUC,EACdT,EACAU,EACAC,EACAC,GAEA,MAAMC,EACJD,GAAa,KAAOE,EAAQC,mBAAmBH,GAAaJ,UAE9D,GAAIR,GAAS,MAAQU,GAAS,MAAQC,GAAY,MAAQE,GAAY,KAAM,CAC1E,MAAMG,EAAML,EAASM,oBACnBjB,EACAU,EAAMQ,MACNR,EAAMS,MAAMC,QAGd,GAAIV,EAAMS,MAAMC,OAAOC,iBAAkB,CAGvC,MAAMC,EAAcC,EAAIC,GACtBD,EAAIpB,OAAO,CACTsB,OAAQZ,EACRa,UAAWhB,EAAMS,MAAMC,OAAOM,YAEhCZ,EAAQa,UAAUjB,EAAMS,MAAMC,OAAOQ,YAAc,GAGrD,OAAOL,EAAIM,eACTb,EACAc,EAAMC,2BACJrB,EAAMS,MAAMC,OAAOM,UACnBJ,G,KAGC,CACL,OAAOC,EAAIM,eACTb,EACAc,EAAMC,2BAA2BrB,EAAMS,MAAMC,OAAOM,U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