@vertexvis/viewer 1.0.1-canary.9 → 1.0.1-testing.0
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/loader.cjs.js +1 -1
- package/dist/cjs/{multiElementInteractionHandler-CV_R_zWs.js → multiElementInteractionHandler-DFzC3VJQ.js} +14 -11
- package/dist/cjs/multiElementInteractionHandler-DFzC3VJQ.js.map +1 -0
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js +20 -11
- package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +18 -5
- package/dist/cjs/vertex-scene-tree.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +7 -5
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js +6 -6
- package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +5 -5
- package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +18 -12
- package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
- package/dist/cjs/viewer.cjs.js +1 -1
- package/dist/collection/components/scene-tree/scene-tree.js +18 -5
- package/dist/collection/components/scene-tree/scene-tree.js.map +1 -1
- package/dist/collection/components/scene-tree-table-layout/scene-tree-table-layout.js +20 -11
- package/dist/collection/components/scene-tree-table-layout/scene-tree-table-layout.js.map +1 -1
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.js +8 -6
- package/dist/collection/components/viewer-pin-group/viewer-pin-group.js.map +1 -1
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js +7 -7
- package/dist/collection/components/viewer-pin-label/viewer-pin-label.js.map +1 -1
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js +6 -7
- package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js.map +1 -1
- package/dist/collection/lib/interactions/baseInteractionHandler.js +12 -9
- package/dist/collection/lib/interactions/baseInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/mouseInteractions.js +17 -11
- package/dist/collection/lib/interactions/mouseInteractions.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-COS1Inc5.js → p-BQV-PVa_.js} +2 -2
- package/dist/components/p-BQV-PVa_.js.map +1 -0
- package/dist/components/p-CAQf9dsL.js +5 -0
- package/dist/components/p-CAQf9dsL.js.map +1 -0
- package/dist/components/{p-CEXF82El.js → p-CKQId0I1.js} +2 -2
- package/dist/components/p-CKQId0I1.js.map +1 -0
- package/dist/components/{p-CEHeeaoZ.js → p-CUGGgEIf.js} +2 -2
- package/dist/components/{p-CWieLCfP.js → p-CoCastpC.js} +2 -2
- package/dist/components/{p-BNHniQXm.js → p-ae0Zapzr.js} +2 -2
- package/dist/components/p-ae0Zapzr.js.map +1 -0
- package/dist/components/vertex-scene-tree-table-layout.js +1 -1
- package/dist/components/vertex-scene-tree.js +1 -1
- package/dist/components/vertex-scene-tree.js.map +1 -1
- package/dist/components/vertex-viewer-dom-renderer.js +1 -1
- package/dist/components/vertex-viewer-pin-group.js +1 -1
- package/dist/components/vertex-viewer-pin-label.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/{controller-zACO6f4n.js → controller-DCFz4xj6.js} +3 -3
- package/dist/esm/{controller-zACO6f4n.js.map → controller-DCFz4xj6.js.map} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/loader.mjs +1 -1
- package/dist/esm/{multiElementInteractionHandler-CJhrgviV.js → multiElementInteractionHandler-DjlrKVbu.js} +14 -11
- package/dist/esm/multiElementInteractionHandler-DjlrKVbu.js.map +1 -0
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js +20 -11
- package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js.map +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +19 -6
- package/dist/esm/vertex-scene-tree.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
- package/dist/esm/vertex-viewer-pin-group.entry.js +8 -6
- package/dist/esm/vertex-viewer-pin-group.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-pin-label_2.entry.js +6 -6
- package/dist/esm/vertex-viewer-pin-label_2.entry.js.map +1 -1
- package/dist/esm/vertex-viewer-transform-widget.entry.js +5 -5
- package/dist/esm/vertex-viewer-transform-widget.entry.js.map +1 -1
- package/dist/esm/vertex-viewer.entry.js +18 -12
- package/dist/esm/vertex-viewer.entry.js.map +1 -1
- package/dist/esm/viewer.js +1 -1
- package/dist/types/components/scene-tree/scene-tree.d.ts +2 -0
- package/dist/types/components/scene-tree-table-layout/scene-tree-table-layout.d.ts +2 -0
- package/dist/types/components/viewer-pin-group/viewer-pin-group.d.ts +1 -0
- package/dist/types/components/viewer-transform-widget/viewer-transform-widget.d.ts +1 -1
- package/dist/types/lib/interactions/baseInteractionHandler.d.ts +1 -1
- package/dist/types/lib/interactions/mouseInteractions.d.ts +8 -2
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/p-07214ba9.entry.js +5 -0
- package/dist/viewer/p-07214ba9.entry.js.map +1 -0
- package/dist/viewer/p-1a463ace.entry.js +5 -0
- package/dist/viewer/p-1a463ace.entry.js.map +1 -0
- package/dist/viewer/p-9c18d87a.entry.js +5 -0
- package/dist/viewer/p-9c18d87a.entry.js.map +1 -0
- package/dist/viewer/{p-D4lmv56q.js → p-Dg5Yw3qK.js} +2 -2
- package/dist/viewer/{p-D4lmv56q.js.map → p-Dg5Yw3qK.js.map} +1 -1
- package/dist/viewer/{p-DkLznn4v.js → p-DwjktKp5.js} +2 -2
- package/dist/viewer/p-DwjktKp5.js.map +1 -0
- package/dist/viewer/{p-dcaf1cb9.entry.js → p-b8d8d308.entry.js} +2 -2
- package/dist/viewer/p-d26d4b99.entry.js +5 -0
- package/dist/viewer/{p-76cf5c2a.entry.js.map → p-d26d4b99.entry.js.map} +1 -1
- package/dist/viewer/{p-d4d044fc.entry.js → p-daecf887.entry.js} +2 -2
- package/dist/viewer/p-daecf887.entry.js.map +1 -0
- package/dist/viewer/{p-0cbadaa8.entry.js → p-fe2fdc83.entry.js} +2 -2
- package/dist/viewer/p-fe2fdc83.entry.js.map +1 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/dist/cjs/multiElementInteractionHandler-CV_R_zWs.js.map +0 -1
- package/dist/components/p-BNHniQXm.js.map +0 -1
- package/dist/components/p-BzhmEGZ5.js +0 -5
- package/dist/components/p-BzhmEGZ5.js.map +0 -1
- package/dist/components/p-CEXF82El.js.map +0 -1
- package/dist/components/p-COS1Inc5.js.map +0 -1
- package/dist/esm/multiElementInteractionHandler-CJhrgviV.js.map +0 -1
- package/dist/viewer/p-0cbadaa8.entry.js.map +0 -1
- package/dist/viewer/p-19c5eeaf.entry.js +0 -5
- package/dist/viewer/p-19c5eeaf.entry.js.map +0 -1
- package/dist/viewer/p-1a82245e.entry.js +0 -5
- package/dist/viewer/p-1a82245e.entry.js.map +0 -1
- package/dist/viewer/p-5ccf054e.entry.js +0 -5
- package/dist/viewer/p-5ccf054e.entry.js.map +0 -1
- package/dist/viewer/p-76cf5c2a.entry.js +0 -5
- package/dist/viewer/p-DkLznn4v.js.map +0 -1
- package/dist/viewer/p-d4d044fc.entry.js.map +0 -1
- /package/dist/components/{p-CEHeeaoZ.js.map → p-CUGGgEIf.js.map} +0 -0
- /package/dist/components/{p-CWieLCfP.js.map → p-CoCastpC.js.map} +0 -0
- /package/dist/viewer/{p-dcaf1cb9.entry.js.map → p-b8d8d308.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{E as i,b as t}from"./p-BuOEMGyM.js";import{p as s}from"./p-DfdVaPrt.js";import{g as h}from"./p-p0obU98x.js";const e=16;const n=1.2;class l{constructor(t,s,h,e,n,l,o,a,r,d){this.downEvent=t;this.upEvent=s;this.moveEvent=h;this.rotateInteraction=e;this.rotatePointInteraction=n;this.zoomInteraction=l;this.panInteraction=o;this.twistInteraction=a;this.pivotInteraction=r;this.getConfig=d;this.isDragging=false;this.keyboardControls=false;this.disableIndividualInteractions=false;this.primaryInteractionTypeChange=new i;this.primaryInteraction=e;this.handleDownEvent=this.handleDownEvent.bind(this);this.handleMouseWheel=this.handleMouseWheel.bind(this);this.handleWindowMove=this.handleWindowMove.bind(this);this.handleWindowUp=this.handleWindowUp.bind(this);this.handleDoubleClick=this.handleDoubleClick.bind(this)}initialize(i,t){this.element=i;this.interactionApi=t;i.addEventListener(this.downEvent,this.handleDownEvent);i.addEventListener("mousedown",this.handleDoubleClick);i.addEventListener("wheel",this.handleMouseWheel,{passive:false})}dispose(){var i,t,s;(i=this.element)===null||i===void 0?void 0:i.removeEventListener(this.downEvent,this.handleDownEvent);(t=this.element)===null||t===void 0?void 0:t.removeEventListener("mousedown",this.handleDoubleClick);(s=this.element)===null||s===void 0?void 0:s.removeEventListener("wheel",this.handleMouseWheel);this.element=undefined}onPrimaryInteractionTypeChange(i){return this.primaryInteractionTypeChange.on(i)}setCurrentInteractionType(i){var t;switch(i){case"rotate":this.currentInteraction=this.rotateInteraction;break;case"zoom":this.currentInteraction=this.zoomInteraction;break;case"pan":this.currentInteraction=this.panInteraction;break;case"twist":this.currentInteraction=this.twistInteraction;break;case"rotate-point":this.currentInteraction=this.rotatePointInteraction;break;case"pivot":this.currentInteraction=this.pivotInteraction;break;default:this.currentInteraction=undefined}if(this.draggingInteraction){const i=this.draggingInteraction.getPosition();this.draggingInteraction=this.currentInteraction||this.primaryInteraction;(t=this.interactionApi)===null||t===void 0?void 0:t.resetLastAngle();this.draggingInteraction.setPosition(i)}}getPrimaryInteractionType(){return this.primaryInteraction.getType()}getCurrentInteractionType(){return(this.currentInteraction||this.primaryInteraction).getType()}setPrimaryInteractionType(i){switch(i){case"rotate":this.primaryInteraction=this.rotateInteraction;this.lastPrimaryRotateInteraction=this.rotateInteraction;break;case"rotate-point":this.primaryInteraction=this.rotatePointInteraction;this.lastPrimaryRotateInteraction=this.rotatePointInteraction;break;case"zoom":this.primaryInteraction=this.zoomInteraction;break;case"pan":this.primaryInteraction=this.panInteraction;break;case"pivot":this.primaryInteraction=this.pivotInteraction;break}this.primaryInteractionTypeChange.emit()}setDefaultKeyboardControls(i){this.keyboardControls=i}handleDownEvent(i){i.preventDefault();this.interactionTimer=window.setTimeout((()=>{this.downPosition=s.create(i.screenX,i.screenY);this.downPositionCanvas=this.getCanvasPosition(i);this.interactionTimer=undefined;if(this.lastMoveEvent!=null){this.handleWindowMove(this.lastMoveEvent)}}),this.getConfig().interactions.interactionDelay);window.addEventListener(this.moveEvent,this.handleWindowMove);window.addEventListener(this.upEvent,this.handleWindowUp)}handleWindowMove(i){if(this.interactionTimer==null){if(this.disableIndividualInteractions){return}const t=s.create(i.screenX,i.screenY);const h=this.interactionApi!=null?this.interactionApi.pixelThreshold(this.isTouch(i)):2;if(this.downPosition!=null&&s.distance(t,this.downPosition)>=h&&!this.isDragging){this.beginDrag(i);this.isDragging=true}if(this.isDragging){this.drag(i)}}this.lastMoveEvent=i}async handleWindowUp(i){if(this.isDragging){this.endDrag(i);this.isDragging=false}if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}window.removeEventListener(this.moveEvent,this.handleWindowMove);window.removeEventListener(this.upEvent,this.handleWindowUp);this.lastMoveEvent=undefined}async handleDoubleClick(i){if(i.detail===2&&i.buttons===4&&this.interactionApi!=null){await this.interactionApi.viewAll()}}beginDrag(i){var t;if(this.keyboardControls&&i.metaKey&&i.shiftKey){this.currentInteraction=this.rotatePointInteraction}else if(this.keyboardControls&&i.shiftKey&&i.altKey){this.currentInteraction=this.twistInteraction}else if(this.keyboardControls&&i.shiftKey){this.currentInteraction=this.zoomInteraction}else if(this.keyboardControls&&(i.metaKey||i.ctrlKey)){this.currentInteraction=this.panInteraction}else if(this.keyboardControls&&i.altKey){this.currentInteraction=this.rotateInteraction}if(i.buttons===1){this.draggingInteraction=this.currentInteraction||this.primaryInteraction}else if(i.buttons===2){this.draggingInteraction=this.panInteraction}else if(i.buttons===4){this.draggingInteraction=(t=this.lastPrimaryRotateInteraction)!==null&&t!==void 0?t:this.rotateInteraction}if(this.draggingInteraction!=null&&this.interactionApi!=null&&this.element!=null){this.zoomInteraction.endDrag(i,this.interactionApi);this.draggingInteraction.beginDrag(i,this.downPositionCanvas||s.create(i.clientX,i.clientY),this.interactionApi,this.element)}}drag(i){if(this.keyboardControls&&i.altKey&&i.shiftKey){this.currentInteraction=this.twistInteraction}else{this.currentInteraction=undefined}this.draggingInteraction=this.currentInteraction||this.draggingInteraction||this.primaryInteraction;if(this.draggingInteraction!=null&&this.interactionApi!=null){this.draggingInteraction.drag(i,this.interactionApi)}}endDrag(i){if(this.keyboardControls&&this.currentInteraction===this.twistInteraction){this.currentInteraction=undefined}if(this.draggingInteraction!=null&&this.interactionApi!=null){this.draggingInteraction.endDrag(i,this.interactionApi);this.draggingInteraction=undefined}}
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{E as i,b as t}from"./p-BuOEMGyM.js";import{p as s}from"./p-DfdVaPrt.js";import{g as h}from"./p-p0obU98x.js";const e=16;const n=1.2;class l{constructor(t,s,h,e,n,l,o,a,r,d){this.downEvent=t;this.upEvent=s;this.moveEvent=h;this.rotateInteraction=e;this.rotatePointInteraction=n;this.zoomInteraction=l;this.panInteraction=o;this.twistInteraction=a;this.pivotInteraction=r;this.getConfig=d;this.isDragging=false;this.keyboardControls=false;this.disableIndividualInteractions=false;this.primaryInteractionTypeChange=new i;this.primaryInteraction=e;this.handleDownEvent=this.handleDownEvent.bind(this);this.handleMouseWheel=this.handleMouseWheel.bind(this);this.handleWindowMove=this.handleWindowMove.bind(this);this.handleWindowUp=this.handleWindowUp.bind(this);this.handleDoubleClick=this.handleDoubleClick.bind(this)}initialize(i,t){this.element=i;this.interactionApi=t;i.addEventListener(this.downEvent,this.handleDownEvent);i.addEventListener("mousedown",this.handleDoubleClick);i.addEventListener("wheel",this.handleMouseWheel,{passive:false})}dispose(){var i,t,s;(i=this.element)===null||i===void 0?void 0:i.removeEventListener(this.downEvent,this.handleDownEvent);(t=this.element)===null||t===void 0?void 0:t.removeEventListener("mousedown",this.handleDoubleClick);(s=this.element)===null||s===void 0?void 0:s.removeEventListener("wheel",this.handleMouseWheel);this.element=undefined}onPrimaryInteractionTypeChange(i){return this.primaryInteractionTypeChange.on(i)}setCurrentInteractionType(i){var t;switch(i){case"rotate":this.currentInteraction=this.rotateInteraction;break;case"zoom":this.currentInteraction=this.zoomInteraction;break;case"pan":this.currentInteraction=this.panInteraction;break;case"twist":this.currentInteraction=this.twistInteraction;break;case"rotate-point":this.currentInteraction=this.rotatePointInteraction;break;case"pivot":this.currentInteraction=this.pivotInteraction;break;default:this.currentInteraction=undefined}if(this.draggingInteraction){const i=this.draggingInteraction.getPosition();this.draggingInteraction=this.currentInteraction||this.primaryInteraction;(t=this.interactionApi)===null||t===void 0?void 0:t.resetLastAngle();this.draggingInteraction.setPosition(i)}}getPrimaryInteractionType(){return this.primaryInteraction.getType()}getCurrentInteractionType(){return(this.currentInteraction||this.primaryInteraction).getType()}setPrimaryInteractionType(i){switch(i){case"rotate":this.primaryInteraction=this.rotateInteraction;this.lastPrimaryRotateInteraction=this.rotateInteraction;break;case"rotate-point":this.primaryInteraction=this.rotatePointInteraction;this.lastPrimaryRotateInteraction=this.rotatePointInteraction;break;case"zoom":this.primaryInteraction=this.zoomInteraction;break;case"pan":this.primaryInteraction=this.panInteraction;break;case"pivot":this.primaryInteraction=this.pivotInteraction;break}this.primaryInteractionTypeChange.emit()}setDefaultKeyboardControls(i){this.keyboardControls=i}handleDownEvent(i){i.preventDefault();this.interactionTimer=window.setTimeout((()=>{this.downPosition=s.create(i.screenX,i.screenY);this.downPositionCanvas=this.getCanvasPosition(i);this.interactionTimer=undefined;if(this.lastMoveEvent!=null){this.handleWindowMove(this.lastMoveEvent)}}),this.getConfig().interactions.interactionDelay);window.addEventListener(this.moveEvent,this.handleWindowMove);window.addEventListener(this.upEvent,this.handleWindowUp)}handleWindowMove(i){if(this.interactionTimer==null){if(this.disableIndividualInteractions){return}const t=s.create(i.screenX,i.screenY);const h=this.interactionApi!=null?this.interactionApi.pixelThreshold(this.isTouch(i)):2;if(this.downPosition!=null&&s.distance(t,this.downPosition)>=h&&!this.isDragging){this.beginDrag(i);this.isDragging=true}if(this.isDragging){this.drag(i)}}this.lastMoveEvent=i}async handleWindowUp(i){if(this.isDragging){this.endDrag(i);this.isDragging=false}if(this.interactionTimer!=null){window.clearTimeout(this.interactionTimer);this.interactionTimer=undefined}window.removeEventListener(this.moveEvent,this.handleWindowMove);window.removeEventListener(this.upEvent,this.handleWindowUp);this.lastMoveEvent=undefined}async handleDoubleClick(i){if(i.detail===2&&i.buttons===4&&this.interactionApi!=null){await this.interactionApi.viewAll()}}beginDrag(i){var t;if(this.keyboardControls&&i.metaKey&&i.shiftKey){this.currentInteraction=this.rotatePointInteraction}else if(this.keyboardControls&&i.shiftKey&&i.altKey){this.currentInteraction=this.twistInteraction}else if(this.keyboardControls&&i.shiftKey){this.currentInteraction=this.zoomInteraction}else if(this.keyboardControls&&(i.metaKey||i.ctrlKey)){this.currentInteraction=this.panInteraction}else if(this.keyboardControls&&i.altKey){this.currentInteraction=this.rotateInteraction}if(i.buttons===1){this.draggingInteraction=this.currentInteraction||this.primaryInteraction}else if(i.buttons===2){this.draggingInteraction=this.panInteraction}else if(i.buttons===4){this.draggingInteraction=(t=this.lastPrimaryRotateInteraction)!==null&&t!==void 0?t:this.rotateInteraction}if(this.draggingInteraction!=null&&this.interactionApi!=null&&this.element!=null){this.zoomInteraction.endDrag(i,this.interactionApi);this.draggingInteraction.beginDrag(i,this.downPositionCanvas||s.create(i.clientX,i.clientY),this.interactionApi,this.element)}}drag(i){if(this.keyboardControls&&i.altKey&&i.shiftKey){this.currentInteraction=this.twistInteraction}else{this.currentInteraction=undefined}this.draggingInteraction=this.currentInteraction||this.draggingInteraction||this.primaryInteraction;if(this.draggingInteraction!=null&&this.interactionApi!=null){this.draggingInteraction.drag(i,this.interactionApi)}}endDrag(i){if(this.keyboardControls&&this.currentInteraction===this.twistInteraction){this.currentInteraction=undefined}if(this.draggingInteraction!=null&&this.interactionApi!=null){this.draggingInteraction.endDrag(i,this.interactionApi);this.draggingInteraction=undefined}}handleMouseWheel(i){i.preventDefault();if(this.element!=null&&this.interactionApi!=null&&i.buttons!==4){const t=-this.wheelDeltaToPixels(i.deltaY,i.deltaMode)/10;const s=this.element.getBoundingClientRect();const e=h(i,s);const n=Math.abs(i.deltaY);if(n<12){void this.zoomInteraction.zoomToPoint(e,t,this.interactionApi)}else{const i=Math.min(10,Math.ceil(n/12));const s=t/i;for(let t=1;t<=i;t++){const i=t*5;window.setTimeout((()=>{if(this.interactionApi!=null){this.zoomInteraction.zoomToPoint(e,s,this.interactionApi,i)}}),i)}}}}wheelDeltaToPixels(i,t){if(this.computedBodyStyle==null){this.computedBodyStyle=window.getComputedStyle(document.body)}const s=this.computedBodyStyle.getPropertyValue("fontSize")!=null&&this.computedBodyStyle.getPropertyValue("fontSize")!==""&&!isNaN(parseFloat(this.computedBodyStyle.getPropertyValue("fontSize")))?parseFloat(this.computedBodyStyle.getPropertyValue("fontSize"))*n:e*n;if(t===1){return this.computedBodyStyle.getPropertyValue("lineHeight")!=null&&this.computedBodyStyle.getPropertyValue("lineHeight")!==""&&!isNaN(parseFloat(this.computedBodyStyle.getPropertyValue("lineHeight")))?i*parseFloat(this.computedBodyStyle.getPropertyValue("lineHeight")):i*s}else if(t===2){return this.computedBodyStyle.getPropertyValue("height")!=null&&this.computedBodyStyle.getPropertyValue("height")!==""&&!isNaN(parseFloat(this.computedBodyStyle.getPropertyValue("height")))?i*parseFloat(this.computedBodyStyle.getPropertyValue("height")):i*window.innerHeight}return i}getCanvasPosition(i){var t;const h=(t=this.element)===null||t===void 0?void 0:t.getBoundingClientRect();const e=h!=null?s.create(h.left,h.top):undefined;return e!=null?s.subtract(s.create(i.clientX,i.clientY),e):undefined}isTouch(i){return window.PointerEvent!=null&&i instanceof PointerEvent?i.pointerType==="touch":false}}class o extends l{constructor(){super(...arguments);this.registeredExternalElements={}}registerAdditionalElement(i){const s=t.create();const h=this.addEventListenersToElement(i);this.registeredExternalElements[s]=h;return h}deregisterAdditionalElementById(i){const t=this.registeredExternalElements[i];t.dispose();this.registeredExternalElements=Object.fromEntries(Object.entries(this.registeredExternalElements).filter((([t])=>t!==i)))}deregisterAllListeners(){Object.keys(this.registeredExternalElements).forEach((i=>this.deregisterAdditionalElementById(i)))}}export{l as B,o as M};
|
|
5
|
+
//# sourceMappingURL=p-DwjktKp5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p-DwjktKp5.js","sources":["src/lib/interactions/baseInteractionHandler.ts","src/lib/interactions/multiElementInteractionHandler.ts"],"sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { ConfigProvider } from '../config';\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionApi } from './interactionApi';\nimport { BaseEvent } from './interactionEvent';\nimport { InteractionHandler } from './interactionHandler';\nimport {\n MouseInteraction,\n PanInteraction,\n PivotInteraction,\n RotateInteraction,\n RotatePointInteraction,\n TwistInteraction,\n ZoomInteraction,\n} from './mouseInteractions';\n\nexport type InteractionType =\n | 'rotate'\n | 'zoom'\n | 'pan'\n | 'twist'\n | 'rotate-point'\n | 'pivot';\n\nconst DEFAULT_FONT_SIZE = 16;\nconst DEFAULT_LINE_HEIGHT = 1.2;\n\nexport abstract class BaseInteractionHandler implements InteractionHandler {\n protected interactionApi?: InteractionApi;\n protected element?: HTMLElement;\n protected downPosition?: Point.Point;\n private downPositionCanvas?: Point.Point;\n private primaryInteraction: MouseInteraction;\n private currentInteraction?: MouseInteraction;\n private draggingInteraction: MouseInteraction | undefined;\n private lastPrimaryRotateInteraction?: MouseInteraction;\n private isDragging = false;\n private lastMoveEvent?: BaseEvent;\n private interactionTimer?: number;\n private keyboardControls = false;\n\n protected disableIndividualInteractions = false;\n\n private computedBodyStyle?: CSSStyleDeclaration;\n\n private primaryInteractionTypeChange = new EventDispatcher<void>();\n\n public constructor(\n protected downEvent: 'mousedown' | 'pointerdown',\n protected upEvent: 'mouseup' | 'pointerup',\n protected moveEvent: 'mousemove' | 'pointermove',\n private rotateInteraction: RotateInteraction,\n private rotatePointInteraction: RotatePointInteraction,\n private zoomInteraction: ZoomInteraction,\n private panInteraction: PanInteraction,\n private twistInteraction: TwistInteraction,\n private pivotInteraction: PivotInteraction,\n private getConfig: ConfigProvider\n ) {\n this.primaryInteraction = rotateInteraction;\n this.handleDownEvent = this.handleDownEvent.bind(this);\n this.handleMouseWheel = this.handleMouseWheel.bind(this);\n this.handleWindowMove = this.handleWindowMove.bind(this);\n this.handleWindowUp = this.handleWindowUp.bind(this);\n this.handleDoubleClick = this.handleDoubleClick.bind(this);\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.interactionApi = api;\n element.addEventListener(this.downEvent, this.handleDownEvent);\n element.addEventListener('mousedown', this.handleDoubleClick);\n element.addEventListener('wheel', this.handleMouseWheel, {\n passive: false,\n });\n }\n\n public dispose(): void {\n this.element?.removeEventListener(this.downEvent, this.handleDownEvent);\n this.element?.removeEventListener('mousedown', this.handleDoubleClick);\n this.element?.removeEventListener('wheel', this.handleMouseWheel);\n this.element = undefined;\n }\n\n public onPrimaryInteractionTypeChange(listener: Listener<void>): Disposable {\n return this.primaryInteractionTypeChange.on(listener);\n }\n\n public setCurrentInteractionType(type?: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.currentInteraction = this.rotateInteraction;\n break;\n case 'zoom':\n this.currentInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.currentInteraction = this.panInteraction;\n break;\n case 'twist':\n this.currentInteraction = this.twistInteraction;\n break;\n case 'rotate-point':\n this.currentInteraction = this.rotatePointInteraction;\n break;\n case 'pivot':\n this.currentInteraction = this.pivotInteraction;\n break;\n default:\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction) {\n const point = this.draggingInteraction.getPosition();\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n this.interactionApi?.resetLastAngle();\n this.draggingInteraction.setPosition(point);\n }\n }\n\n public getPrimaryInteractionType(): InteractionType {\n return this.primaryInteraction.getType();\n }\n\n public getCurrentInteractionType(): InteractionType {\n return (this.currentInteraction || this.primaryInteraction).getType();\n }\n\n public setPrimaryInteractionType(type: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.primaryInteraction = this.rotateInteraction;\n this.lastPrimaryRotateInteraction = this.rotateInteraction;\n break;\n case 'rotate-point':\n this.primaryInteraction = this.rotatePointInteraction;\n this.lastPrimaryRotateInteraction = this.rotatePointInteraction;\n break;\n case 'zoom':\n this.primaryInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.primaryInteraction = this.panInteraction;\n break;\n case 'pivot':\n this.primaryInteraction = this.pivotInteraction;\n break;\n }\n this.primaryInteractionTypeChange.emit();\n }\n\n public setDefaultKeyboardControls(keyboardControls: boolean): void {\n this.keyboardControls = keyboardControls;\n }\n\n protected handleDownEvent(event: BaseEvent): void {\n // Prevent selection of any text while interacting with the model.\n event.preventDefault();\n\n this.interactionTimer = window.setTimeout(() => {\n this.downPosition = Point.create(event.screenX, event.screenY);\n this.downPositionCanvas = this.getCanvasPosition(event);\n this.interactionTimer = undefined;\n\n // Perform the current movement in the case that the interaction timer elapses\n if (this.lastMoveEvent != null) {\n this.handleWindowMove(this.lastMoveEvent);\n }\n }, this.getConfig().interactions.interactionDelay);\n\n window.addEventListener(this.moveEvent, this.handleWindowMove);\n window.addEventListener(this.upEvent, this.handleWindowUp);\n }\n\n protected handleWindowMove(event: BaseEvent): void {\n if (this.interactionTimer == null) {\n if (this.disableIndividualInteractions) {\n return;\n }\n\n const position = Point.create(event.screenX, event.screenY);\n const pixelThreshold =\n this.interactionApi != null\n ? this.interactionApi.pixelThreshold(this.isTouch(event))\n : 2;\n if (\n this.downPosition != null &&\n Point.distance(position, this.downPosition) >= pixelThreshold &&\n !this.isDragging\n ) {\n this.beginDrag(event);\n this.isDragging = true;\n }\n\n if (this.isDragging) {\n this.drag(event);\n }\n }\n\n this.lastMoveEvent = event;\n }\n\n protected async handleWindowUp(event: BaseEvent): Promise<void> {\n if (this.isDragging) {\n this.endDrag(event);\n this.isDragging = false;\n }\n\n if (this.interactionTimer != null) {\n window.clearTimeout(this.interactionTimer);\n this.interactionTimer = undefined;\n }\n\n window.removeEventListener(this.moveEvent, this.handleWindowMove);\n window.removeEventListener(this.upEvent, this.handleWindowUp);\n this.lastMoveEvent = undefined;\n }\n\n protected async handleDoubleClick(event: BaseEvent): Promise<void> {\n // event.detail is the number of clicks that have happened recently. If the number is 2, then the user double clicked.\n if (\n event.detail === 2 &&\n event.buttons === 4 &&\n this.interactionApi != null\n ) {\n await this.interactionApi.viewAll();\n }\n }\n\n protected beginDrag(event: BaseEvent): void {\n if (this.keyboardControls && event.metaKey && event.shiftKey) {\n this.currentInteraction = this.rotatePointInteraction;\n } else if (this.keyboardControls && event.shiftKey && event.altKey) {\n this.currentInteraction = this.twistInteraction;\n } else if (this.keyboardControls && event.shiftKey) {\n this.currentInteraction = this.zoomInteraction;\n } else if (this.keyboardControls && (event.metaKey || event.ctrlKey)) {\n this.currentInteraction = this.panInteraction;\n } else if (this.keyboardControls && event.altKey) {\n this.currentInteraction = this.rotateInteraction;\n }\n\n if (event.buttons === 1) {\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n } else if (event.buttons === 2) {\n this.draggingInteraction = this.panInteraction;\n } else if (event.buttons === 4) {\n this.draggingInteraction =\n this.lastPrimaryRotateInteraction ?? this.rotateInteraction;\n }\n\n if (\n this.draggingInteraction != null &&\n this.interactionApi != null &&\n this.element != null\n ) {\n // Ensure any scroll wheel interactions have been ended prior to beginning\n // another interaction to prevent the interaction from being ended early.\n this.zoomInteraction.endDrag(event, this.interactionApi);\n\n this.draggingInteraction.beginDrag(\n event,\n this.downPositionCanvas || Point.create(event.clientX, event.clientY),\n this.interactionApi,\n this.element\n );\n }\n }\n\n protected drag(event: BaseEvent): void {\n if (this.keyboardControls && event.altKey && event.shiftKey) {\n this.currentInteraction = this.twistInteraction;\n } else {\n this.currentInteraction = undefined;\n }\n this.draggingInteraction =\n this.currentInteraction ||\n this.draggingInteraction ||\n this.primaryInteraction;\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.drag(event, this.interactionApi);\n }\n }\n\n protected endDrag(event: BaseEvent): void {\n if (\n this.keyboardControls &&\n this.currentInteraction === this.twistInteraction\n ) {\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.endDrag(event, this.interactionApi);\n this.draggingInteraction = undefined;\n }\n }\n\n protected handleMouseWheel(event: WheelEvent): void {\n event.preventDefault();\n\n if (\n this.element != null &&\n this.interactionApi != null &&\n event.buttons !== 4\n ) {\n const delta =\n -this.wheelDeltaToPixels(event.deltaY, event.deltaMode) / 10;\n const rect = this.element.getBoundingClientRect();\n const point = getMouseClientPosition(event, rect);\n const scrollSize = Math.abs(event.deltaY);\n\n if (scrollSize < 12) {\n // For small wheel movements, send a single zoom event.\n void this.zoomInteraction.zoomToPoint(\n point,\n delta,\n this.interactionApi\n );\n } else {\n const divisions = Math.min(10, Math.ceil(scrollSize / 12));\n const zoomDelta = delta / divisions;\n // For larger wheel movements, divide the delta into multiple zoom events with increasing delay\n // which approximates a smooth zoom deceleration curve for the end user.\n for (let i = 1; i <= divisions; i++) {\n const delayMs = i * 5;\n window.setTimeout(() => {\n if (this.interactionApi != null) {\n this.zoomInteraction.zoomToPoint(\n point,\n zoomDelta,\n this.interactionApi,\n delayMs\n );\n }\n }, delayMs);\n }\n }\n }\n }\n\n protected wheelDeltaToPixels(deltaY: number, deltaMode: number): number {\n if (this.computedBodyStyle == null) {\n this.computedBodyStyle = window.getComputedStyle(document.body);\n }\n\n const defaultLineHeight =\n this.computedBodyStyle.getPropertyValue('fontSize') != null &&\n this.computedBodyStyle.getPropertyValue('fontSize') !== '' &&\n !isNaN(parseFloat(this.computedBodyStyle.getPropertyValue('fontSize')))\n ? parseFloat(this.computedBodyStyle.getPropertyValue('fontSize')) *\n DEFAULT_LINE_HEIGHT\n : DEFAULT_FONT_SIZE * DEFAULT_LINE_HEIGHT;\n\n if (deltaMode === 1) {\n // deltaMode 1 corresponds to DOM_DELTA_LINE, which computes deltas in lines\n return this.computedBodyStyle.getPropertyValue('lineHeight') != null &&\n this.computedBodyStyle.getPropertyValue('lineHeight') !== '' &&\n !isNaN(\n parseFloat(this.computedBodyStyle.getPropertyValue('lineHeight'))\n )\n ? deltaY *\n parseFloat(this.computedBodyStyle.getPropertyValue('lineHeight'))\n : deltaY * defaultLineHeight;\n } else if (deltaMode === 2) {\n // deltaMode 2 corresponds to DOM_DELTA_PAGE, which computes deltas in pages\n return this.computedBodyStyle.getPropertyValue('height') != null &&\n this.computedBodyStyle.getPropertyValue('height') !== '' &&\n !isNaN(parseFloat(this.computedBodyStyle.getPropertyValue('height')))\n ? deltaY * parseFloat(this.computedBodyStyle.getPropertyValue('height'))\n : deltaY * window.innerHeight;\n }\n // deltaMode 0 corresponds to DOM_DELTA_PIXEL, which computes deltas in pixels\n return deltaY;\n }\n\n protected getCanvasPosition(event: BaseEvent): Point.Point | undefined {\n const canvasBounds = this.element?.getBoundingClientRect();\n const canvasOffset =\n canvasBounds != null\n ? Point.create(canvasBounds.left, canvasBounds.top)\n : undefined;\n\n return canvasOffset != null\n ? Point.subtract(Point.create(event.clientX, event.clientY), canvasOffset)\n : undefined;\n }\n\n protected isTouch(event: BaseEvent): boolean {\n return window.PointerEvent != null && event instanceof PointerEvent\n ? event.pointerType === 'touch'\n : false;\n }\n}\n","import { Disposable, UUID } from '@vertexvis/utils';\n\nimport { BaseInteractionHandler } from './baseInteractionHandler';\n\nexport abstract class MultiElementInteractionHandler extends BaseInteractionHandler {\n protected registeredExternalElements: Record<UUID.UUID, Disposable> = {};\n\n public registerAdditionalElement(external: HTMLElement): Disposable {\n const id = UUID.create();\n const disposable = this.addEventListenersToElement(external);\n\n this.registeredExternalElements[id] = disposable;\n return disposable;\n }\n\n public deregisterAdditionalElementById(id: UUID.UUID): void {\n const externalElement = this.registeredExternalElements[id];\n\n externalElement.dispose();\n\n this.registeredExternalElements = Object.fromEntries(\n Object.entries(this.registeredExternalElements).filter(\n ([key]) => key !== id\n )\n );\n }\n\n protected deregisterAllListeners(): void {\n Object.keys(this.registeredExternalElements).forEach((id) =>\n this.deregisterAdditionalElementById(id)\n );\n }\n\n public abstract addEventListenersToElement(element?: HTMLElement): Disposable;\n}\n"],"names":["Point","UUID"],"mappings":";;;;;;;AA0BA,MAAM,iBAAiB,GAAG,EAAE;AAC5B,MAAM,mBAAmB,GAAG,GAAG;MAET,sBAAsB,CAAA;AAoB1C,IAAA,WAAA,CACY,SAAsC,EACtC,OAAgC,EAChC,SAAsC,EACxC,iBAAoC,EACpC,sBAA8C,EAC9C,eAAgC,EAChC,cAA8B,EAC9B,gBAAkC,EAClC,gBAAkC,EAClC,SAAyB,EAAA;AATvB,QAAA,IAAA,CAAA,SAAS,GAAT,SAAS;AACT,QAAA,IAAA,CA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AEZ;;ACzYK,MAAgB,8BAA+B,SAAQ,sBAAsB,CAAA;AAAnF,IAAA,WAAA,GAAA;;AACY,QAAA,IAAA,CAAA,0BAA0B,GAAkC,EAAE;;AAEjE,IAAA,yBAAyB,CAAC,QAAqB,EAAA;AACpD,QAAA,MAAM,EAAE,GAAGC,IAAI,CAAC,MAAM,EAAE;QACxB,MAAM,UAAU,GAAG,IAAI,CAAC,0BAA0B,CAAC,QAAQ,CAAC;AAE5D,QAAA,IAAI,CAAC,0BAA0B,CAAC,EAAE,CAAC,GAAG,UAAU;AAChD,QAAA,OAAO,UAAU;;AAGZ,IAAA,+BAA+B,CAAC,EAAa,EAAA;QAClD,MAAM,eAAe,GAAG,IAAI,CAAC,0BAA0B,CAAC,EAAE,CAAC;QAE3D,eAAe,CAAC,OAAO,EAAE;AAEzB,QAAA,IAAI,CAAC,0BAA0B,GAAG,MAAM,CAAC,WAAW,CAClD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,MAAM,CACpD,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,EAAE,CACtB,CACF;;IAGO,sBAAsB,GAAA;QAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,KACtD,IAAI,CAAC,+BAA+B,CAAC,EAAE,CAAC,CACzC;;AAIJ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as n,h as e,H as s,a as i}from"./p-CCVkga9Q.js";import{v as o,q as h,m as a,h as r}from"./p-DfdVaPrt.js";import{o as l}from"./p-BuOEMGyM.js";import{M as d}from"./p-
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
import{r as t,c as n,h as e,H as s,a as i}from"./p-CCVkga9Q.js";import{v as o,q as h,m as a,h as r}from"./p-DfdVaPrt.js";import{o as l}from"./p-BuOEMGyM.js";import{M as d}from"./p-DwjktKp5.js";import"./p-Bl7Tdbc9.js";import"./p-BAhfr1Nx.js";import{V as c}from"./p-Dn7vK758.js";import"./p-CG9AChtV.js";import"./p-p0obU98x.js";import"./p-BYfDquz2.js";const u=()=>`:host{position:absolute;pointer-events:none;visibility:hidden}:host([hydrated]){visibility:hidden}:host(.ready){visibility:inherit}:host(:not([interactions-off]))>*{pointer-events:auto}`;const f=class{constructor(e){t(this,e);this.occlusionStateChanged=n(this,"occlusionStateChanged");this.detachedStateChanged=n(this,"detachedStateChanged");this.propertyChange=n(this,"propertyChange");this.position=o.origin();this.positionJson="";this.quaternion=h.create();this.quaternionJson="";this.scale=o.create(1,1,1);this.scaleJson="";this.matrix=a.makeIdentity();this.occlusionOff=false;this.occluded=false;this.detachedOff=true;this.detached=false;this.billboardOff=false;this.interactionsOff=false}handlePositionChange(){this.syncMatrix()}handlePositionJsonChanged(){this.syncPosition()}handleRotationChanged(){this.syncQuaternionWithRotation()}handleRotationJsonChanged(){this.syncRotation()}handleQuaternionChange(){this.syncMatrix()}handleQuaternionJsonChanged(){this.syncQuaternion()}handleScaleChange(){this.syncMatrix()}handleScaleJsonChanged(){this.syncScale()}handleMatrixChanged(t,n){if(!l.isEqual(t,n)){this.propertyChange.emit()}}connectedCallback(){this.syncProperties()}componentShouldUpdate(t,n,e){return e==="occluded"}handleOcclusionStateChanged(){this.occlusionStateChanged.emit(this.occluded)}handleDetachedStateChanged(){this.detachedStateChanged.emit(this.detached)}syncProperties(){this.syncPosition();this.syncRotation();this.syncQuaternion();this.syncScale();this.syncMatrix()}syncPosition(){this.position=this.positionJson.length>0?this.parseJson("positionJson",this.positionJson,o.fromJson):this.position}syncRotation(){this.rotation=this.rotationJson!=null&&this.rotationJson.length>0?this.parseJson("rotationJson",this.rotationJson,r.fromJson):this.rotation;this.syncQuaternionWithRotation()}syncQuaternionWithRotation(){this.quaternion=this.rotation!=null?h.fromEuler(this.rotation):this.quaternion}syncQuaternion(){this.quaternion=this.quaternionJson.length>0?this.parseJson("quaternionJson",this.quaternionJson,h.fromJson):this.quaternion}syncScale(){this.scale=this.scaleJson.length>0?this.parseJson("scaleJson",this.scaleJson,o.fromJson):this.scale}syncMatrix(){if(this.position!=null&&this.quaternion!=null&&this.scale!=null){this.matrix=a.makeTRS(this.position,this.quaternion,this.scale)}}parseJson(t,n,e){try{return e(n)}catch(n){console.warn(`Could not parse \`${t}\`. Invalid JSON.`);throw n}}render(){return e(s,{key:"bf50fa97cdf5d144f262f721d3adc778340dc913"},e("slot",{key:"46d2e88b7d3ec6daae905d8c509cbe1a2b0d0a12"}))}static get watchers(){return{position:[{handlePositionChange:1}],positionJson:[{handlePositionJsonChanged:1}],rotation:[{handleRotationChanged:1}],rotationJson:[{handleRotationJsonChanged:1}],quaternion:[{handleQuaternionChange:1}],quaternionJson:[{handleQuaternionJsonChanged:1}],scale:[{handleScaleChange:1}],scaleJson:[{handleScaleJsonChanged:1}],matrix:[{handleMatrixChanged:0}],occluded:[{handleOcclusionStateChanged:0}],detached:[{handleDetachedStateChanged:0}]}}};f.style=u();function p(t){return t instanceof HTMLElement&&t.nodeName==="VERTEX-VIEWER-DOM-ELEMENT"&&t.matrix!=null}function v(t){return(t instanceof HTMLElement&&t.nodeName==="VERTEX-VIEWER-DOM-GROUP"||t instanceof HTMLElement&&t.dataset.isDomGroupElement!=null)&&t.matrix!=null}const m=(t,n)=>e("div",{class:"root-2d"},n);function g(t,n,e,s,i){const o=C(t,n,s).sort(((t,n)=>t.distanceToCamera-n.distanceToCamera));for(let t=0;t<o.length;t++){const{element:n,worldMatrix:h,worldPosition:a}=o[t];const r=i==null;const l=r||!n.occlusionOff&&(i===null||i===void 0?void 0:i.isOccluded(a,e));const d=r||!n.detachedOff&&(i===null||i===void 0?void 0:i.isDetached(a,e));const c=x(a,s.projectionViewMatrix,e);w(n,c);y(n,t,o.length);g(n,h,e,s,i);n.occluded=l!==null&&l!==void 0?l:false;n.detached=d!==null&&d!==void 0?d:false;n.classList.add("ready")}}function C(t,n,e){const s=[];for(let i=0;i<t.children.length;i++){const h=t.children[i];if(v(h)){const t=a.multiply(n,h.matrix);s.push(...C(h,t,e))}else if(p(h)){const t=a.multiply(n,h.matrix);const i=o.fromMatrixPosition(t);const r=o.distanceSquared(e.position,i);s.push({element:h,worldMatrix:t,worldPosition:i,distanceToCamera:r})}else{s.push(...C(h,n,e))}}return s}function w(t,n){t.style.transform=[`translate(-50%, -50%)`,`translate(${n.x}px, ${n.y}px)`].join(" ")}function y(t,n,e){t.style.zIndex=`${e-n}`}function x(t,n,e){const s=o.transformMatrix(t,n);return e.transformVectorToViewport(s)}const E=({camera:t,viewport:n},s)=>{const i=a.toObject(t.projectionMatrix);const o=t.isOrthographic()?t.far*2/(t.fovHeight*2)*(n.height/2):i.m22*(n.height/2);const h=[`translateZ(${o}px)`,R(t.viewMatrix),`translate(${n.width/2}px, ${n.height/2}px)`].join(" ");return e("div",{class:"root-3d",style:{perspective:`${o}px`}},e("div",{class:"camera",style:{transform:h}},s))};function J(t,n,e,s,i){for(let o=0;o<t.children.length;o++){const h=t.children[o];if(p(h)){M(h,n,e,s,i)}else if(v(h)){b(h,n,e,s,i)}else{J(h,n,e,s,i)}}}function M(t,n,e,s,i){const h=a.multiply(n,t.matrix);const r=o.fromMatrixPosition(h);const l=i==null;const d=l||!t.occlusionOff&&(i===null||i===void 0?void 0:i.isOccluded(r,e));t.occluded=d!==null&&d!==void 0?d:false;const c=l||!t.detachedOff&&(i===null||i===void 0?void 0:i.isDetached(r,e));t.detached=c!==null&&c!==void 0?c:false;t.classList.add("ready");if(t.billboardOff){t.style.transform=P(h)}else{let n=s.viewMatrix;n=a.transpose(n);n=a.position(n,h);n=a.scale(n,t.scale);n[3]=0;n[7]=0;n[11]=0;n[15]=1;t.style.transform=P(n)}J(t,h,e,s,i)}function b(t,n,e,s,i){const o=a.multiply(n,t.matrix);J(t,o,e,s,i)}function R(t){const n=[S(t[0]),S(-t[1]),S(t[2]),S(t[3]),S(t[4]),S(-t[5]),S(t[6]),S(t[7]),S(t[8]),S(-t[9]),S(t[10]),S(t[11]),S(t[12]),S(-t[13]),S(t[14]),S(t[15])].join(", ");return`matrix3d(${n})`}function P(t){const n=[S(t[0]),S(t[1]),S(t[2]),S(t[3]),S(-t[4]),S(-t[5]),S(-t[6]),S(-t[7]),S(t[8]),S(t[9]),S(t[10]),S(t[11]),S(t[12]),S(t[13]),S(t[14]),S(t[15])].join(", ");return[`translate(-50%, -50%)`,`matrix3d(${n})`].join(" ")}function S(t){return Math.abs(t)<1e-10?0:t}const V=()=>`.sc-vertex-viewer-dom-renderer-h{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none}.root-3d.sc-vertex-viewer-dom-renderer{width:100%;height:100%;pointer-events:inherit}.camera.sc-vertex-viewer-dom-renderer{transform-style:preserve-3d;pointer-events:inherit;width:100%;height:100%}`;const j=class{constructor(n){t(this,n);this.drawMode="3d";this.propagateEventsToViewer=true;this.viewport=new c(0,0);this.invalidateFrameCounter=0;this.interactionDisposables=[];this.handleViewerFrameDrawn=async()=>{this.updatePropsFromViewer()}}componentWillLoad(){var t;const n=new ResizeObserver((()=>this.handleResize()));n.observe(this.hostEl);const e=new MutationObserver((()=>this.handleChildrenChange()));e.observe(this.hostEl,{childList:true});this.handleViewerChange(this.viewer,undefined);if(((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null){this.handleViewerFrameDrawn()}}render(){if(this.camera!=null){if(this.drawMode==="2d"){return e(s,null,e(m,null,e("slot",null)))}else{return e(s,null,e(E,{camera:this.camera,viewport:this.viewport},e("slot",null)))}}else{return e(s,null)}}componentWillRender(){this.updateElements()}handleViewerChange(t,n){n===null||n===void 0?void 0:n.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.addEventListener("frameDrawn",this.handleViewerFrameDrawn);if(this.propagateEventsToViewer&&t!=null){this.handleEventPropagationToViewer(t)}}handlePropertyChange(){this.invalidateFrame()}invalidateFrame(){this.invalidateFrameCounter=this.invalidateFrameCounter+1}handleEventPropagationToViewer(t){this.interactionDisposables.forEach((t=>{t.dispose()}));this.interactionDisposables=[];t.getInteractionHandlers().then((t=>{t.forEach((t=>{if(t instanceof d){const n=t.registerAdditionalElement(this.hostEl);this.interactionDisposables=[...this.interactionDisposables,n]}}))}))}async updateElements(){const{viewport:t,camera:n}=this;const e=a.makeIdentity();if(n!=null){if(this.drawMode==="3d"){J(this.hostEl,e,t,n,this.depthBuffer)}else{g(this.hostEl,e,t,n,this.depthBuffer)}}}handleResize(){const t=this.hostEl.getBoundingClientRect();this.viewport=new c(t.width,t.height)}handleChildrenChange(){this.invalidateFrame()}async updatePropsFromViewer(){const{frame:t}=this.viewer||{};this.depthBuffer=await(t===null||t===void 0?void 0:t.depthBuffer());this.camera=t===null||t===void 0?void 0:t.scene.camera}get hostEl(){return i(this)}static get watchers(){return{viewer:[{handleViewerChange:0}]}}};j.style=V();export{f as vertex_viewer_dom_element,j as vertex_viewer_dom_renderer};
|
|
5
|
+
//# sourceMappingURL=p-b8d8d308.entry.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{h as i,r as t,c as s,H as n,a as o}from"./p-CCVkga9Q.js";import{p as l,v as h,r as e,b as a,a as r,m as d,h as u,g as v,q as c,e as f,c as w}from"./p-DfdVaPrt.js";import{c as p}from"./p-Dw4-tG-V.js";import{w as x,r as g}from"./p-BxtKMwBH.js";import{T as y}from"./p-pCKv_O44.js";import{A as m,D as z}from"./p-Bl7Tdbc9.js";import"./p-BAhfr1Nx.js";import{E as b}from"./p-BuOEMGyM.js";import{d as T,T as C,R as D,e as R,r as A,s as P,x as S,A as j,b as E,y as O,z as N,f as B,g as F,h as H,i as U,j as I}from"./p-BWXhzjLo.js";import"./p-CG9AChtV.js";import"./p-BYfDquz2.js";import"./p-D8gGTVmc.js";import"./p-Dn7vK758.js";function M(i){if(window.document.activeElement!==i){i.focus();i.setSelectionRange(i.value.length,i.value.length)}}function $(i,t){return t!=null?l.create(i.x-t.left,i.y-t.top):undefined}function k(i,t,s,n){const o=n!=null?h.fromMatrixPosition(n):undefined;if(i!=null&&t!=null&&s!=null&&o!=null){const n=s.transformPointToRay(i,t.image,t.scene.camera);if(t.scene.camera.isOrthographic()){const i=e.at(e.create({origin:o,direction:t.scene.camera.direction}),h.magnitude(t.scene.camera.viewVector)*2);return e.intersectPlane(n,a.fromNormalAndCoplanarPoint(t.scene.camera.direction,i))}else{return e.intersectPlane(n,a.fromNormalAndCoplanarPoint(t.scene.camera.direction,o))}}return undefined}function V(i,t,s,n,o,l){return d.multiply(i,_(t,s,n,o,l))}function _(i,t,s,n,o){const l=new z(n);const e=new m(o);const a=()=>e.convertFrom(t-s);const r=()=>l.convertRealValueToWorld(t-s);switch(i){case"x-translate":return d.makeTranslation(h.create(r(),0,0));case"y-translate":return d.makeTranslation(h.create(0,r(),0));case"z-translate":return d.makeTranslation(h.create(0,0,r()));case"x-rotate":return d.makeRotation(c.fromAxisAngle(h.left(),a()));case"y-rotate":return d.makeRotation(c.fromAxisAngle(h.down(),a()));case"z-rotate":return d.makeRotation(c.fromAxisAngle(h.forward(),a()));default:return d.makeIdentity()}}function q(i){switch(i){case"x-rotate":return"xyz";case"y-rotate":return"yzx";case"z-rotate":return"zxy";default:return"xyz"}}function J(i,t,s,n,o){const l=new z(n);const e=new m(o);const a=()=>d.makeRotation(c.fromMatrixRotation(t));const v=()=>d.multiply(t,d.invert(s));const f=()=>h.transformMatrix(h.fromMatrixPosition(v()),d.invert(a()));const w=()=>u.fromRotationMatrix(d.multiply(d.invert(a()),s),q(i));switch(i){case"x-translate":return l.convertWorldValueToReal(f().x);case"y-translate":return l.convertWorldValueToReal(f().y);case"z-translate":return l.convertWorldValueToReal(f().z);case"x-rotate":return e.convertTo(r.normalizeRadians(w().x));case"y-rotate":return e.convertTo(r.normalizeRadians(w().y));case"z-rotate":return e.convertTo(r.normalizeRadians(w().z));default:return 0}}function K(i,t,s,n,o,l){return G(i,h.subtract(s,t),n,o,l)}function G(i,t,s,n,o){switch(o){case"x-translate":return Y(i,t,h.right());case"y-translate":return Y(i,t,h.up());case"z-translate":return Y(i,t,h.back());case"xy-translate":return Z(i,t,h.create(0,0,1));case"xz-translate":return Z(i,t,h.create(0,1,0));case"yz-translate":return Z(i,t,h.create(1,0,0));case"x-rotate":return L(i,s,h.right(),n);case"y-rotate":return L(i,s,h.up(),n);case"z-rotate":return L(i,s,h.forward(),n);default:return i}}function L(i,t,s,n){const o=X(i,t,s);const l=c.fromAxisAngle(o,n);const h=d.makeRotation(l);return d.multiply(i,h)}function X(i,t,s){const n=d.makeRotation(c.fromMatrixRotation(i));const o=h.transformMatrix(s,n);const l=h.transformMatrix(h.negate(s),n);return h.dot(t,o)>h.dot(t,l)?s:h.negate(s)}function Y(i,t,s){const n=h.normalize(s);const o=d.makeRotation(c.fromMatrixRotation(i));const l=h.transformMatrix(n,o);const e=h.project(t,l);const a=d.makeTranslation(e);return d.multiply(a,i)}function Z(i,t,s){const n=h.normalize(s);const o=d.makeRotation(c.fromMatrixRotation(i));const l=h.transformMatrix(n,o);const e=h.fromMatrixPosition(i);const r=a.fromNormalAndCoplanarPoint(l,e);const u=a.projectPoint(r,t);const v=h.add(u,h.scale(r.constant,r.normal));const f=d.makeTranslation(v);return d.multiply(f,i)}function Q(i,t,s){if(s.length===0){throw new Error("Unable to compute input position. At least one shape point must be provided.")}const n=v.pad(t,5);const o=s.map((t=>i.transformNdcPointToViewport(t)));const h=v.topLeft(n);const e=l.add(h,l.create(n.width,0));const a=v.bottomRight(n);const r=l.subtract(a,l.create(n.width,0));const d=l.scale(o.reduce(((i,t)=>l.add(i,t)),l.create()),1/o.length,1/o.length);const u=[e,r,a].reduce(((i,t)=>l.distance(d,t)<l.distance(d,i)?t:i),h);switch(u){case h:return{point:u,placement:"top-left"};case e:return{point:u,placement:"top-right"};case r:return{point:u,placement:"bottom-left"};default:return{point:u,placement:"bottom-right"}}}function W(i,t,s,n,o,l){const h=t==="alt"&&i.altKey||t==="ctrl"&&i.ctrlKey||t==="meta"&&i.metaKey||t==="shift"&&i.shiftKey;if(h&&l!=null&&l>0&&Number.isInteger(l)){const i=s-n;const t=r.toDegrees(i);const h=Math.round(t/l)*l;if(o!=null){const i=Math.round(o/l)*l;const t=o-i;const s=h-t;const e=r.toRadians(s);return e+n}else{const i=r.toRadians(h);return i+n}}else{return s}}const ii=({ref:t,bounds:s,viewport:n,point:o,placement:l,displayUnit:h},e)=>{const a=ni(n,s!==null&&s!==void 0?s:f.create(0,0),o,l);return i("div",{ref:t,class:"widget-input wrapper",style:{...a,height:(s===null||s===void 0?void 0:s.height)!=null?`${s.height}px`:undefined}},e,i("div",{class:"widget-input units"},h.unit.abbreviatedName))};const ti=({ref:t,identifier:s,disabled:n,onChange:o,onIncrement:l,onDecrement:h,onBlur:e,onUndo:a})=>{const r=i=>{if(i.target!=null){const t=parseFloat(i.target.value);if(!isNaN(t)){o===null||o===void 0?void 0:o(parseFloat(i.target.value))}}};const d=i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="ArrowUp"){l===null||l===void 0?void 0:l()}else if(i.key==="ArrowDown"){h===null||h===void 0?void 0:h()}else if(i.key==="z"&&t&&a){i.preventDefault();a()}};return i("input",{ref:t,disabled:n,class:`widget-input ${s}`,type:"text",onChange:r,onKeyDown:d,onBlur:e})};function si(i,t){return Math.min(i,Math.max(0,t))}function ni(i,t,s,n,o=5){const{width:l,height:h}=i.dimensions;const e=t.width+o;const a=t.height+o;function r(i){return`${i}px`}switch(n){case"top-left":return{right:r(si(l-e,l-s.x)),bottom:r(si(h-a,h-s.y))};case"top-right":return{left:r(si(l-e,s.x)),bottom:r(si(h-a,h-s.y))};case"bottom-left":return{right:r(si(l-e,l-s.x)),top:r(si(h-a,s.y))};case"bottom-right":default:return{left:r(si(l-e,s.x)),top:r(si(h-a,s.y))}}}function oi(i,t,s=3,n=1,o=1){return ei(i,t,h.back(),h.up(),s,n,o)}function li(i,t,s=3,n=1,o=1){return ei(i,t,h.right(),h.back(),s,n,o)}function hi(i,t,s=3,n=1,o=1){return ei(i,t,h.right(),h.up(),s,n,o)}function ei(i,t,s,n,o,l=1,a=1){const u=h.transformMatrix(h.add(s,n),d.makeRotation(c.fromMatrixRotation(i)));const v=h.transformMatrix(s,d.makeRotation(c.fromMatrixRotation(i)));const f=h.transformMatrix(n,d.makeRotation(c.fromMatrixRotation(i)));const w=10*a**.25;const p=h.fromMatrixPosition(i);const x=h.add(p,h.scale(o*w,u));const g=e.create({origin:x,direction:v});const y=e.create({origin:x,direction:f});const m=h.cross(v,f);const z=h.rotateAboutAxis(r.toRadians(45),e.at(y,-(o*l)),m,x);const b=h.rotateAboutAxis(r.toRadians(45),e.at(g,o*l),m,x);const C=h.rotateAboutAxis(r.toRadians(45),e.at(y,o*l),m,x);const D=h.rotateAboutAxis(r.toRadians(45),e.at(g,-(o*l)),m,x);return new T(h.dot(v,t.direction)!==-1&&h.dot(f,t.direction)!==-1,z,D,b,C,h.transformMatrix(z,t.projectionViewMatrix),h.transformMatrix(D,t.projectionViewMatrix),h.transformMatrix(b,t.projectionViewMatrix),h.transformMatrix(C,t.projectionViewMatrix))}function ai(i,t,s,n){if(i instanceof C){return ri(i,t,s,n)}return false}function ri(i,t,s,n){return di([i.points.worldLeft,i.points.worldRight,i.points.worldTip],t,s,n)||di([i.points.worldLeft,i.points.worldRight,i.points.worldBase],t,s,n)}function di(i,t,s,n){var o;if(i.length===3){const l=s.transformPointToRay(n,t.image,t.scene.camera);const e=h.subtract(i[1],i[0]);const a=h.subtract(i[2],i[0]);const r=w.epsilon((o=w.fromVectors([l.direction,l.origin,e,a]))!==null&&o!==void 0?o:w.create(e,a));const d=h.cross(l.direction,a);const u=h.dot(e,d);if(!(Math.abs(u)>=r)){return false}const v=h.subtract(l.origin,i[0]);const c=h.dot(v,d)/u;if(c<0||c>1){return false}const f=h.cross(v,e);const p=h.dot(l.direction,f)/u;if(p<0||c+p>1){return false}const x=h.dot(a,f)/u;return!isNaN(x)&&(x>0||t.scene.camera.isOrthographic())}return false}class ui extends D{constructor(i,t={},s={}){var n,o,l,h,e,a,r,d,u,v,c,f,w,p;super(i);this.customization=t;this.disabledAxis={xTranslation:false,yTranslation:false,zTranslation:false,xyTranslation:false,xzTranslation:false,yzTranslation:false,xRotation:false,yRotation:false,zRotation:false};this.axisLines=[];this.rotationLines=[];this.translationMeshes=[];this.rotationMeshes=[];this.hoveredChanged=new b;this.xArrowFillColor=(n=t.colors)===null||n===void 0?void 0:n.xArrow;this.yArrowFillColor=(o=t.colors)===null||o===void 0?void 0:o.yArrow;this.zArrowFillColor=(l=t.colors)===null||l===void 0?void 0:l.zArrow;this.hoveredArrowFillColor=(h=t.colors)===null||h===void 0?void 0:h.hovered;this.outlineColor=(e=t.colors)===null||e===void 0?void 0:e.outline;this.disabledAxis.xTranslation=(a=s.xTranslation)!==null&&a!==void 0?a:false;this.disabledAxis.yTranslation=(r=s.yTranslation)!==null&&r!==void 0?r:false;this.disabledAxis.zTranslation=(d=s.zTranslation)!==null&&d!==void 0?d:false;this.disabledAxis.xyTranslation=(u=s.xyTranslation)!==null&&u!==void 0?u:false;this.disabledAxis.xzTranslation=(v=s.xzTranslation)!==null&&v!==void 0?v:false;this.disabledAxis.yzTranslation=(c=s.yzTranslation)!==null&&c!==void 0?c:false;this.disabledAxis.xRotation=(f=s.xRotation)!==null&&f!==void 0?f:false;this.disabledAxis.yRotation=(w=s.yRotation)!==null&&w!==void 0?w:false;this.disabledAxis.zRotation=(p=s.zRotation)!==null&&p!==void 0?p:false}dispose(){var i;(i=this.reglFrameDisposable)===null||i===void 0?void 0:i.cancel()}getDrawableElements(){return this.drawableElements}getFullBounds(){return this.fullBounds}boundsContainsPoint(i){return this.interactiveBounds!=null&&this.frame!=null&&v.containsPoints(this.interactiveBounds,i)}updateDisabledAxis(i){this.disabledAxis={...this.disabledAxis,...i};this.updateDisabledOnDrawables()}updateCursor(i){this.cursor=i;if(i!=null&&this.frame!=null){this.updateHovered()}else{this.clearHovered()}}updateTransform(i){var t;this.transform=i;if(i!=null&&this.frame!=null){this.updateAndDraw()}else{this.clear();(t=this.reglFrameDisposable)===null||t===void 0?void 0:t.cancel();this.reglFrameDisposable=undefined}}updateColors(i={}){var t,s,n,o,l,h,e,a,r,d,u,v,c,f,w,p;this.xArrowFillColor=(t=i.xArrow)!==null&&t!==void 0?t:this.xArrowFillColor;this.yArrowFillColor=(s=i.yArrow)!==null&&s!==void 0?s:this.yArrowFillColor;this.zArrowFillColor=(n=i.zArrow)!==null&&n!==void 0?n:this.zArrowFillColor;this.twoAxesSquareFillColor=(o=i.twoAxesSquare)!==null&&o!==void 0?o:this.twoAxesSquareFillColor;this.hoveredArrowFillColor=(l=i.hovered)!==null&&l!==void 0?l:this.hoveredArrowFillColor;this.outlineColor=(h=i.outline)!==null&&h!==void 0?h:this.outlineColor;(e=this.xArrow)===null||e===void 0?void 0:e.updateFillColor(this.getXTranslationColor(),true);(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor(this.getYTranslationColor(),true);(r=this.zArrow)===null||r===void 0?void 0:r.updateFillColor(this.getZTranslationColor(),true);(d=this.xRotation)===null||d===void 0?void 0:d.updateFillColor(this.getXRotationColor(),true);(u=this.yRotation)===null||u===void 0?void 0:u.updateFillColor(this.getYRotationColor(),true);(v=this.zRotation)===null||v===void 0?void 0:v.updateFillColor(this.getZRotationColor(),true);(c=this.xyTranslation)===null||c===void 0?void 0:c.updateFillColor(this.getTwoAxesTranslationColor(),true);(f=this.xzTranslation)===null||f===void 0?void 0:f.updateFillColor(this.getTwoAxesTranslationColor(),true);(w=this.yzTranslation)===null||w===void 0?void 0:w.updateFillColor(this.getTwoAxesTranslationColor(),true);(p=this.hoveredElement)===null||p===void 0?void 0:p.updateFillColor(this.hoveredArrowFillColor)}updateScalars(i){this.customization={...this.customization,scalars:i};if(this.transform!=null&&this.frame!=null){this.updateElements(this.transform,this.frame)}}onHoveredChanged(i){return this.hoveredChanged.on(i)}updateDisabledOnDrawables(){var i,t,s,n,o,l,h,e,a,r,d,u,v,c,f;(i=this.xRotation)===null||i===void 0?void 0:i.setDisabled(this.disabledAxis.xRotation);(t=this.xyRotationLine)===null||t===void 0?void 0:t.setDisabled(this.disabledAxis.xRotation);(s=this.xzRotationLine)===null||s===void 0?void 0:s.setDisabled(this.disabledAxis.xRotation);(n=this.yRotation)===null||n===void 0?void 0:n.setDisabled(this.disabledAxis.yRotation);(o=this.yzRotationLine)===null||o===void 0?void 0:o.setDisabled(this.disabledAxis.yRotation);(l=this.yxRotationLine)===null||l===void 0?void 0:l.setDisabled(this.disabledAxis.yRotation);(h=this.zRotation)===null||h===void 0?void 0:h.setDisabled(this.disabledAxis.zRotation);(e=this.zxRotationLine)===null||e===void 0?void 0:e.setDisabled(this.disabledAxis.zRotation);(a=this.zyRotationLine)===null||a===void 0?void 0:a.setDisabled(this.disabledAxis.zRotation);(r=this.xArrow)===null||r===void 0?void 0:r.setDisabled(this.disabledAxis.xTranslation);(d=this.yArrow)===null||d===void 0?void 0:d.setDisabled(this.disabledAxis.yTranslation);(u=this.zArrow)===null||u===void 0?void 0:u.setDisabled(this.disabledAxis.zTranslation);(v=this.xyTranslation)===null||v===void 0?void 0:v.setDisabled(this.disabledAxis.xyTranslation);(c=this.xzTranslation)===null||c===void 0?void 0:c.setDisabled(this.disabledAxis.xzTranslation);(f=this.yzTranslation)===null||f===void 0?void 0:f.setDisabled(this.disabledAxis.yzTranslation);this.updateColors()}updateHovered(){var i,t,s,n,o,l,h,e,a,r;const d=this.hoveredElement;const u=this.frame;if(u!=null){this.hoveredElement=[...this.translationMeshes,...this.rotationMeshes].filter((i=>i.points.valid&&!i.isDisabled())).find((i=>this.cursor!=null?ai(i,u,this.viewport,this.cursor):false));if(this.hoveredElement!==d){this.hoveredChanged.emit(this.hoveredElement);(i=this.hoveredElement)===null||i===void 0?void 0:i.updateFillColor(this.hoveredArrowFillColor);this.clearFillColorOfPreviouslyHovered(d);if(((t=this.hoveredElement)===null||t===void 0?void 0:t.identifier)==="xy-translate"){(s=this.xArrow)===null||s===void 0?void 0:s.updateFillColor(this.hoveredArrowFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor(this.hoveredArrowFillColor)}else if(((o=this.hoveredElement)===null||o===void 0?void 0:o.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor(this.hoveredArrowFillColor);(h=this.zArrow)===null||h===void 0?void 0:h.updateFillColor(this.hoveredArrowFillColor)}else if(((e=this.hoveredElement)===null||e===void 0?void 0:e.identifier)==="yz-translate"){(a=this.yArrow)===null||a===void 0?void 0:a.updateFillColor(this.hoveredArrowFillColor);(r=this.zArrow)===null||r===void 0?void 0:r.updateFillColor(this.hoveredArrowFillColor)}}}}clearHovered(){const i=this.hoveredElement;this.hoveredElement=undefined;if(this.hoveredElement!==i){this.hoveredChanged.emit(this.hoveredElement);this.clearFillColorOfPreviouslyHovered(i)}}clearFillColorOfPreviouslyHovered(i){var t,s,n,o,l,h,e,a,r,d,u,v;i===null||i===void 0?void 0:i.updateFillColor(i===null||i===void 0?void 0:i.initialFillColor);if((i===null||i===void 0?void 0:i.identifier)==="xy-translate"){(t=this.xArrow)===null||t===void 0?void 0:t.updateFillColor((s=this.xArrow)===null||s===void 0?void 0:s.initialFillColor);(n=this.yArrow)===null||n===void 0?void 0:n.updateFillColor((o=this.yArrow)===null||o===void 0?void 0:o.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="xz-translate"){(l=this.xArrow)===null||l===void 0?void 0:l.updateFillColor((h=this.xArrow)===null||h===void 0?void 0:h.initialFillColor);(e=this.zArrow)===null||e===void 0?void 0:e.updateFillColor((a=this.zArrow)===null||a===void 0?void 0:a.initialFillColor)}else if((i===null||i===void 0?void 0:i.identifier)==="yz-translate"){(r=this.yArrow)===null||r===void 0?void 0:r.updateFillColor((d=this.yArrow)===null||d===void 0?void 0:d.initialFillColor);(u=this.zArrow)===null||u===void 0?void 0:u.updateFillColor((v=this.zArrow)===null||v===void 0?void 0:v.initialFillColor)}}hasData(){return this.transform!=null}createOrUpdateElements(){if(this.transform!=null&&this.frame!=null){if(this.xArrow==null||this.yArrow==null||this.zArrow==null){this.createElements(this.transform,this.frame)}else{this.updateElements(this.transform,this.frame)}this.interactiveBounds=R(this.viewport,...this.rotationMeshes,...this.translationMeshes);this.fullBounds=R(this.viewport,...this.rotationMeshes,...this.translationMeshes,...this.axisLines)}}createElements(i,t){var s,n,o,l,e,a,r,d,u,v,c,f;this.reglCommand=A({canvas:this.canvasElement,extensions:"angle_instanced_arrays"});const{createShape:w}=P(this.reglCommand);const p=this.computeTriangleSize(h.fromMatrixPosition(i),t);this.xArrow=new C(w,"x-translate",S(i,t.scene.camera,p,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation),this.outlineColor,this.getXTranslationColor());this.xRotation=new C(w,"x-rotate",oi(i,t.scene.camera,p,(n=this.customization.scalars)===null||n===void 0?void 0:n.xRotation,(o=this.customization.scalars)===null||o===void 0?void 0:o.xTranslation),this.outlineColor,this.getXRotationColor());this.xAxis=new j(w,"x-axis",E(i,t.scene.camera,this.xArrow),this.outlineColor,this.getXTranslationColor());this.yArrow=new C(w,"y-translate",O(i,t.scene.camera,p,(l=this.customization.scalars)===null||l===void 0?void 0:l.yTranslation),this.outlineColor,this.getYTranslationColor());this.yRotation=new C(w,"y-rotate",li(i,t.scene.camera,p,(e=this.customization.scalars)===null||e===void 0?void 0:e.yRotation,(a=this.customization.scalars)===null||a===void 0?void 0:a.yTranslation),this.outlineColor,this.getYRotationColor());this.yAxis=new j(w,"y-axis",E(i,t.scene.camera,this.yArrow),this.outlineColor,this.getYTranslationColor());this.zArrow=new C(w,"z-translate",N(i,t.scene.camera,p,(r=this.customization.scalars)===null||r===void 0?void 0:r.zTranslation),this.outlineColor,this.getZTranslationColor());this.zAxis=new j(w,"z-axis",E(i,t.scene.camera,this.zArrow),this.outlineColor,this.getZTranslationColor());this.zRotation=new C(w,"z-rotate",hi(i,t.scene.camera,p,(d=this.customization.scalars)===null||d===void 0?void 0:d.zRotation,(u=this.customization.scalars)===null||u===void 0?void 0:u.zTranslation),this.outlineColor,this.getZRotationColor());this.xyTranslation=new C(w,"xy-translate",B(i,t.scene.camera,p,(v=this.customization.scalars)===null||v===void 0?void 0:v.xyTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.xzTranslation=new C(w,"xz-translate",F(i,t.scene.camera,p,(c=this.customization.scalars)===null||c===void 0?void 0:c.xzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.yzTranslation=new C(w,"yz-translate",H(i,t.scene.camera,p,(f=this.customization.scalars)===null||f===void 0?void 0:f.yzTranslation),this.outlineColor,this.getTwoAxesTranslationColor());this.createRotationLines(w,i,t);this.axisLines=[this.xAxis,this.yAxis,this.zAxis];this.translationMeshes=[this.xArrow,this.yArrow,this.zArrow,this.xyTranslation,this.xzTranslation,this.yzTranslation];this.rotationMeshes=[this.xRotation,this.yRotation,this.zRotation];this.updateDisabledOnDrawables();this.availableElements=[...this.axisLines,...this.rotationLines,...this.translationMeshes,...this.rotationMeshes]}getXRotationColor(){return this.xArrowFillColor}getYRotationColor(){return this.yArrowFillColor}getZRotationColor(){return this.zArrowFillColor}getXTranslationColor(){return this.xArrowFillColor}getYTranslationColor(){return this.yArrowFillColor}getZTranslationColor(){return this.zArrowFillColor}getTwoAxesTranslationColor(){return this.twoAxesSquareFillColor}createRotationLines(i,t,s){var n,o,l,e,a,r;const d=this.computeTriangleSize(h.fromMatrixPosition(t),s);const u=U(s.scene.camera,this.xRotation,(n=this.yArrow)===null||n===void 0?void 0:n.points.worldTip,d);const v=U(s.scene.camera,this.xRotation,(o=this.zArrow)===null||o===void 0?void 0:o.points.worldTip,d);const c=U(s.scene.camera,this.yRotation,(l=this.xArrow)===null||l===void 0?void 0:l.points.worldTip,d);const f=U(s.scene.camera,this.yRotation,(e=this.zArrow)===null||e===void 0?void 0:e.points.worldTip,d);const w=U(s.scene.camera,this.zRotation,(a=this.xArrow)===null||a===void 0?void 0:a.points.worldTip,d);const p=U(s.scene.camera,this.zRotation,(r=this.yArrow)===null||r===void 0?void 0:r.points.worldTip,d);if(u!=null){this.xyRotationLine=new I(i,"xy-rotation-line",u,this.outlineColor)}if(v!=null){this.xzRotationLine=new I(i,"xz-rotation-line",v,this.outlineColor)}if(c!=null){this.yxRotationLine=new I(i,"yx-rotation-line",c,this.outlineColor)}if(f!=null){this.yzRotationLine=new I(i,"yz-rotation-line",f,this.outlineColor)}if(w!=null){this.zxRotationLine=new I(i,"zx-rotation-line",w,this.outlineColor)}if(p!=null){this.zyRotationLine=new I(i,"zy-rotation-line",p,this.outlineColor)}this.rotationLines=[this.xyRotationLine,this.xzRotationLine,this.yxRotationLine,this.yzRotationLine,this.zxRotationLine,this.zyRotationLine].filter((i=>i!=null))}updateElements(i,t){var s,n,o,l,e,a,r,d,u,v,c,f,w,p,x,g,y,m,z,b,T,C,D,R,A,P,j,I,M,$;const k=this.computeTriangleSize(h.fromMatrixPosition(i),t);if(this.xArrow!=null){this.xArrow.updatePoints(S(i,t.scene.camera,k,(s=this.customization.scalars)===null||s===void 0?void 0:s.xTranslation));(n=this.xAxis)===null||n===void 0?void 0:n.updatePoints(E(i,t.scene.camera,this.xArrow))}(o=this.xRotation)===null||o===void 0?void 0:o.updatePoints(oi(i,t.scene.camera,k,(l=this.customization.scalars)===null||l===void 0?void 0:l.xRotation,(e=this.customization.scalars)===null||e===void 0?void 0:e.xTranslation));if(this.yArrow!=null){this.yArrow.updatePoints(O(i,t.scene.camera,k,(a=this.customization.scalars)===null||a===void 0?void 0:a.yTranslation));(r=this.yAxis)===null||r===void 0?void 0:r.updatePoints(E(i,t.scene.camera,this.yArrow))}(d=this.yRotation)===null||d===void 0?void 0:d.updatePoints(li(i,t.scene.camera,k,(u=this.customization.scalars)===null||u===void 0?void 0:u.yRotation,(v=this.customization.scalars)===null||v===void 0?void 0:v.yTranslation));if(this.zArrow!=null){this.zArrow.updatePoints(N(i,t.scene.camera,k,(c=this.customization.scalars)===null||c===void 0?void 0:c.zTranslation));(f=this.zAxis)===null||f===void 0?void 0:f.updatePoints(E(i,t.scene.camera,this.zArrow))}(w=this.zRotation)===null||w===void 0?void 0:w.updatePoints(hi(i,t.scene.camera,k,(p=this.customization.scalars)===null||p===void 0?void 0:p.zRotation,(x=this.customization.scalars)===null||x===void 0?void 0:x.zTranslation));(g=this.xyRotationLine)===null||g===void 0?void 0:g.updatePoints(U(t.scene.camera,this.xRotation,(y=this.yArrow)===null||y===void 0?void 0:y.points.worldTip,k));(m=this.xzRotationLine)===null||m===void 0?void 0:m.updatePoints(U(t.scene.camera,this.xRotation,(z=this.zArrow)===null||z===void 0?void 0:z.points.worldTip,k));(b=this.yxRotationLine)===null||b===void 0?void 0:b.updatePoints(U(t.scene.camera,this.yRotation,(T=this.xArrow)===null||T===void 0?void 0:T.points.worldTip,k));(C=this.yzRotationLine)===null||C===void 0?void 0:C.updatePoints(U(t.scene.camera,this.yRotation,(D=this.zArrow)===null||D===void 0?void 0:D.points.worldTip,k));(R=this.zxRotationLine)===null||R===void 0?void 0:R.updatePoints(U(t.scene.camera,this.zRotation,(A=this.xArrow)===null||A===void 0?void 0:A.points.worldTip,k));(P=this.zyRotationLine)===null||P===void 0?void 0:P.updatePoints(U(t.scene.camera,this.zRotation,(j=this.yArrow)===null||j===void 0?void 0:j.points.worldTip,k));if(this.xyTranslation!=null){this.xyTranslation.updatePoints(B(i,t.scene.camera,k,(I=this.customization.scalars)===null||I===void 0?void 0:I.xyTranslation))}if(this.xzTranslation!=null){this.xzTranslation.updatePoints(F(i,t.scene.camera,k,(M=this.customization.scalars)===null||M===void 0?void 0:M.xzTranslation))}if(this.yzTranslation!=null){this.yzTranslation.updatePoints(H(i,t.scene.camera,k,($=this.customization.scalars)===null||$===void 0?void 0:$.yzTranslation))}}}const vi=()=>`:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;--viewer-transform-widget-x-axis-arrow-color:var(--x-axis-color);--viewer-transform-widget-y-axis-arrow-color:var(--y-axis-color);--viewer-transform-widget-z-axis-arrow-color:var(--z-axis-color);--viewer-transform-widget-two-axes-square-color:var(--two-axes-color);--viewer-transform-widget-hovered-arrow-color:#ffff00;--viewer-transform-widget-input-width:8em}.widget{position:absolute;top:0;left:0}.widget.hovered{pointer-events:auto}.widget-input.wrapper{position:absolute;pointer-events:auto;display:flex;align-items:center;border:1px solid #444444;border-radius:4px;width:var(--viewer-transform-widget-input-width);text-align:center;background-color:white;box-sizing:border-box}.widget-input.units{position:relative;width:25%;height:100%;padding:0 0.25rem;font-size:0.8125rem;color:#444444}input.widget-input{position:relative;text-align:center;box-sizing:border-box;width:75%;height:100%;outline:none;border-width:0 1px 0 0;border-color:#444444;border-radius:2px 0 0 2px;font-size:0.875rem;color:#444444}input.widget-input.x-translate,input.widget-input.x-rotate{border-left:5px solid var(--viewer-transform-widget-x-axis-arrow-color)}input.widget-input.y-translate,input.widget-input.y-rotate{border-left:5px solid var(--viewer-transform-widget-y-axis-arrow-color)}input.widget-input.z-translate,input.widget-input.z-rotate{border-left:5px solid var(--viewer-transform-widget-z-axis-arrow-color)}input.widget-input:disabled{color:#888888}input.widget-input:focus{outline:none}`;const ci=class{constructor(i){t(this,i);this.positionChanged=s(this,"positionChanged");this.rotationChanged=s(this,"rotationChanged");this.interactionEnded=s(this,"interactionEnded");this.interactionStarted=s(this,"interactionStarted");this.xRotationDisabled=false;this.yRotationDisabled=false;this.zRotationDisabled=false;this.xTranslationDisabled=false;this.yTranslationDisabled=false;this.zTranslationDisabled=false;this.xyTranslationDisabled=false;this.xzTranslationDisabled=false;this.yzTranslationDisabled=false;this.showInputs=true;this.distanceUnit="millimeters";this.angleUnit="degrees";this.decimalPlaces=1;this.rotationSnapKey="shift";this.translationHandleScalar=1;this.rotationHandleScalar=1;this.interactionThrottle=75;this.EXPERIMENTAL_undoKeybindings=false;this.inputValue=0;this.isEndingTransform=false;this.xArrowColor="#ea3324";this.yArrowColor="#4faf32";this.zArrowColor="#0000ff";this.twoAxesSquareColor="#e0e0e0";this.hoveredColor="#ffff00";this.lastAngle=0;this.inputShouldFocus=false;this.handleHoveredDrawableChanged=i=>{this.hovered=i};this.handleViewerFrameDrawn=()=>{this.updatePropsFromViewer()};this.handleViewerDimensionsChange=()=>{x((()=>{if(this.viewer!=null&&this.canvasRef!=null){this.canvasRef.width=this.viewer.viewport.width;this.canvasRef.height=this.viewer.viewport.height;this.updateCanvasBounds(this.canvasRef)}}))};this.handleResize=()=>{if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef)}};this.handleInputResize=()=>{if(this.inputWrapperRef!=null){const i=this.inputWrapperRef;g((()=>{this.inputBounds=i.getBoundingClientRect()}))}};this.handleStyleChange=()=>{g((()=>{const i=window.getComputedStyle(this.hostEl);this.xArrowColor=i.getPropertyValue("--viewer-transform-widget-x-axis-arrow-color").trim();this.yArrowColor=i.getPropertyValue("--viewer-transform-widget-y-axis-arrow-color").trim();this.zArrowColor=i.getPropertyValue("--viewer-transform-widget-z-axis-arrow-color").trim();this.twoAxesSquareColor=i.getPropertyValue("--viewer-transform-widget-two-axes-square-color").trim();this.hoveredColor=i.getPropertyValue("--viewer-transform-widget-hovered-arrow-color").trim();this.getTransformWidget().updateColors({xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor})}))};this.handlePointerMove=i=>{if(this.dragging==null){const t=$(l.create(i.clientX,i.clientY),this.getCanvasBounds());const s=this.getTransformWidget();if(t!=null&&s.boundsContainsPoint(t)){s.updateCursor(t)}else{s.updateCursor(undefined);this.hovered=undefined}}};this.handleBeginDrag=async i=>{var t,s,n;const o=this.getCanvasBounds();if(this.hovered!=null&&o!=null&&this.viewer!=null&&this.position!=null&&this.viewer.frame!=null){this.dragging=this.hovered;if(this.dragging.identifier!==((t=this.lastDragged)===null||t===void 0?void 0:t.identifier)){this.inputValue=0;this.dragStartTransform=this.currentTransform;this.updateInputPosition();this.updateInputValue()}this.lastDragged=undefined;const h=$(l.create(i.clientX,i.clientY),o);const e=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);this.lastAngle=h!=null?r.fromPoints(e,h):0;this.lastWorldPosition=k(h,(s=this.viewer)===null||s===void 0?void 0:s.frame,(n=this.viewer)===null||n===void 0?void 0:n.viewport,this.currentTransform);this.interactionStarted.emit();window.removeEventListener("pointermove",this.handlePointerMove);window.addEventListener("pointermove",this.handleDragWithTimer);window.addEventListener("pointerup",this.handleEndTransform)}};this.handleDragWithTimer=async i=>{if(i!=null){i.preventDefault();this.lastMouseEvent=i}if(this.interactionTimer==null){this.interactionTimer=window.setTimeout((async()=>{this.interactionTimer=undefined;await this.handleDrag();this.lastMouseEvent=undefined}),this.interactionThrottle)}};this.handleDrag=async()=>{var i,t,s;const n=this.getCanvasBounds();if(this.dragging!=null&&this.lastWorldPosition!=null&&n!=null&&this.viewer!=null&&this.viewer.frame!=null&&this.position!=null&&this.lastMouseEvent!=null){await((i=this.controller)===null||i===void 0?void 0:i.beginTransform());const o=$(l.create(this.lastMouseEvent.clientX,this.lastMouseEvent.clientY),n);const h=this.viewer.viewport.transformWorldToViewport(this.position,this.viewer.frame.scene.camera.projectionViewMatrix);const e=k(o,(t=this.viewer)===null||t===void 0?void 0:t.frame,(s=this.viewer)===null||s===void 0?void 0:s.viewport,this.currentTransform);if(e!=null&&o!=null&&h!=null){const i=r.fromPoints(h,o);const t=W(this.lastMouseEvent,this.rotationSnapKey,i,this.lastAngle,this.getDisplayedAngle(),this.rotationSnapDegrees);this.transform(this.lastWorldPosition,e,t-this.lastAngle);this.updateInputPosition();this.updateInputValue();this.lastWorldPosition=e;this.lastAngle=t}}};this.handleEndTransform=async i=>{var t,s;const n=$(l.create(i.clientX,i.clientY),this.getCanvasBounds());const o=this.getTransformWidget();this.lastDragged=this.dragging;this.dragging=undefined;this.lastWorldPosition=undefined;this.lastAngle=0;this.updateInputPosition();this.updateInputValue();o.updateCursor(n);o.updateTransform(this.currentTransform);this.beginEndTransform();window.removeEventListener("pointermove",this.handleDragWithTimer);window.removeEventListener("pointerup",this.handleEndTransform);try{const i=(t=this.controller)===null||t===void 0?void 0:t.getCurrentDelta();await((s=this.controller)===null||s===void 0?void 0:s.endTransform());this.interactionEnded.emit(i)}catch(i){console.error("Failed to end transform interaction",i)}window.addEventListener("pointermove",this.handlePointerMove);this.completeEndTransform()};this.handleInputStep=async i=>{if(this.inputValue!=null&&this.lastInputValue!=null){if(this.isModifyingAngleUnits()){const t=new m(this.angleUnit);const s=t.convertFrom(this.lastInputValue);const n=r.normalizeRadians(s+r.toRadians(i));this.inputValue=t.convertTo(n)}else{this.inputValue=this.lastInputValue+i}await this.updateTransformFromInput(this.inputValue)}};this.handleInputChange=async i=>{await this.updateTransformFromInput(i)};this.handleKeyDown=async i=>{const t=i.ctrlKey||i.metaKey;if(i.key==="z"&&t&&this.EXPERIMENTAL_undoKeybindings){i.stopPropagation();await this.EXPERIMENTAL_undo()}};this.updateTransformFromInput=async i=>{var t,s,n;if(this.lastDragged!=null&&this.currentTransform!=null&&this.startingTransform!=null&&this.lastInputValue!=null){this.currentTransform=V(this.currentTransform,this.lastDragged.identifier,i,this.lastInputValue,this.distanceUnit,this.angleUnit);this.updateInputValue();this.lastInputValue=i;await((t=this.controller)===null||t===void 0?void 0:t.beginTransform());this.getTransformWidget().updateTransform(this.currentTransform);await((s=this.controller)===null||s===void 0?void 0:s.updateTransform(d.multiply(this.currentTransform,d.invert(this.startingTransform))));this.updateInputPosition();await((n=this.controller)===null||n===void 0?void 0:n.endTransformDebounced(this.beginEndTransform,this.completeEndTransform))}};this.updatePropsFromViewer=()=>{const{frame:i}=this.viewer||{};if(i!=null){const t=this.getTransformWidget();t.updateFrame(i,this.dragging==null);this.updateInputPosition()}};this.setupTransformWidget=i=>{var t,s;console.debug(`Initializing transform widget. [initial-position=${JSON.stringify(this.position)}, has-initial-frame=${((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null}]`);const n=this.getTranslationScalar();const o=this.getRotationScalar();this.widget=new ui(i,{colors:{xArrow:this.xArrowColor,yArrow:this.yArrowColor,zArrow:this.zArrowColor,twoAxesSquare:this.twoAxesSquareColor,hovered:this.hoveredColor},scalars:{xTranslation:n,yTranslation:n,zTranslation:n,xyTranslation:o,xzTranslation:o,yzTranslation:o,xRotation:o,yRotation:o,zRotation:o}});if(this.rotation!=null){this.currentTransform=this.getTransformForNewRotation(this.rotation);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(this.position!=null){this.currentTransform=this.getTransformForNewPosition(this.position);this.startingTransform=this.currentTransform;this.widget.updateTransform(this.currentTransform)}if(((s=this.viewer)===null||s===void 0?void 0:s.frame)!=null){this.widget.updateFrame(this.viewer.frame,true)}this.handleSettingDisabledAxis();this.hoveredChangeDisposable=this.widget.onHoveredChanged(this.handleHoveredDrawableChanged);return this.widget};this.updateCanvasBounds=i=>{g((()=>{this.canvasBounds=i.getBoundingClientRect();this.getTransformWidget().updateDimensions(i)}))};this.updateInputValue=()=>{var i,t,s;const n=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const o=(n===null||n===void 0?void 0:n.identifier)==="xy-translate"||(n===null||n===void 0?void 0:n.identifier)==="xz-translate"||(n===null||n===void 0?void 0:n.identifier)==="yz-translate";if(n!=null&&this.currentTransform!=null&&this.dragStartTransform!=null&&!o){this.lastInputValue=this.inputValue;this.inputValue=J(n.identifier,this.currentTransform,this.dragStartTransform,this.distanceUnit,this.angleUnit);if(this.inputRef!=null){const i=(s=(t=this.getDisplayedDistance())!==null&&t!==void 0?t:this.getDisplayedAngle())!==null&&s!==void 0?s:0;const n=`${parseFloat(i.toFixed(this.decimalPlaces))}`;this.inputRef.value=n}}};this.updateInputPosition=()=>{var i,t;const s=(i=this.dragging)!==null&&i!==void 0?i:this.lastDragged;const n=(s===null||s===void 0?void 0:s.identifier)==="xy-translate"||(s===null||s===void 0?void 0:s.identifier)==="xz-translate"||(s===null||s===void 0?void 0:s.identifier)==="yz-translate";if(this.showInputs&&((t=this.viewer)===null||t===void 0?void 0:t.frame)!=null&&this.position!=null&&s!=null&&!n){const i=this.getTransformWidget();const t=i.getFullBounds();this.inputPosition=t!=null?Q(this.viewer.viewport,t,s.points.toArray()):undefined}else if(n){this.inputPosition=undefined}};this.beginEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:true,yRotation:true,zRotation:true,xTranslation:true,yTranslation:true,zTranslation:true,xyTranslation:true,xzTranslation:true,yzTranslation:true});this.isEndingTransform=true};this.completeEndTransform=()=>{const i=this.getTransformWidget();i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled});this.isEndingTransform=false;this.inputShouldFocus=true;if(this.currentTransform!=null){this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=u.fromRotationMatrix(this.currentTransform)}};this.isModifyingAngleUnits=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;return!!(n===null||n===void 0?void 0:n.includes("rotate"))};this.getTranslationScalar=()=>{if(this.translationHandleScalar>0){return this.translationHandleScalar}console.warn("Invalid value provided for translation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getRotationScalar=()=>{if(this.rotationHandleScalar>0){return this.rotationHandleScalar}console.warn("Invalid value provided for rotation-handle-scalar. Expected a positive value greater than zero.");return 1};this.getDisplayedUnits=()=>{if(this.isModifyingAngleUnits()){return new m(this.angleUnit)}return new z(this.distanceUnit)};this.getDisplayedAngle=()=>{if(this.isModifyingAngleUnits()){return this.inputValue}};this.getDisplayedDistance=()=>{var i,t,s;const n=(t=(i=this.dragging)===null||i===void 0?void 0:i.identifier)!==null&&t!==void 0?t:(s=this.lastDragged)===null||s===void 0?void 0:s.identifier;if(n===null||n===void 0?void 0:n.includes("translate")){return this.inputValue}};this.getTransformForNewPosition=i=>{if(i!=null){const t=this.currentTransform!=null?this.currentTransform:d.makeIdentity();const s=d.makeRotation(c.fromMatrixRotation(t));const n=d.makeTranslation(i);return d.multiply(n,s)}};this.getTransformForNewRotation=i=>{const t=this.currentTransform!=null?this.currentTransform:d.makeIdentity();const s=d.invert(d.makeRotation(c.fromMatrixRotation(t)));const n=d.makeRotation(c.fromEuler(i));const o=d.multiply(t,s);return d.multiply(o,n)};this.getCanvasBounds=()=>{if(this.canvasBounds!=null){return this.canvasBounds}else if(this.canvasRef!=null){this.updateCanvasBounds(this.canvasRef);return this.canvasBounds}};this.getTransformWidget=()=>{if(this.widget==null&&this.canvasRef!=null){return this.setupTransformWidget(this.canvasRef)}else if(this.widget!=null){return this.widget}else{throw new Error("Transform widget was not initialized. The canvas element may not have been initialized.")}}}componentDidLoad(){window.addEventListener("pointermove",this.handlePointerMove);this.canvasResizeObserver=new ResizeObserver(this.handleResize);this.inputResizeObserver=new ResizeObserver(this.handleInputResize);this.hostStyleObserver=new MutationObserver(this.handleStyleChange);if(this.canvasRef!=null){this.canvasResizeObserver.observe(this.canvasRef);this.setupTransformWidget(this.canvasRef)}this.hostStyleObserver.observe(this.hostEl,{attributes:true,attributeFilter:["style"]});this.handleViewerChanged(this.viewer,undefined);this.handleStyleChange()}disconnectedCallback(){var i,t,s,n,o;window.removeEventListener("pointermove",this.handlePointerMove);(i=this.canvasResizeObserver)===null||i===void 0?void 0:i.disconnect();(t=this.inputResizeObserver)===null||t===void 0?void 0:t.disconnect();(s=this.hostStyleObserver)===null||s===void 0?void 0:s.disconnect();(n=this.hoveredChangeDisposable)===null||n===void 0?void 0:n.dispose();(o=this.widget)===null||o===void 0?void 0:o.dispose()}componentDidRender(){if(this.inputShouldFocus&&this.inputRef!=null){M(this.inputRef);this.inputShouldFocus=false}}async EXPERIMENTAL_undo(){var i,t;const s=await((i=this.controller)===null||i===void 0?void 0:i.EXPERIMENTAL_undoTransform());if(this.currentTransform!=null&&s!=null){this.currentTransform=d.multiply(s,this.currentTransform);(t=this.widget)===null||t===void 0?void 0:t.updateTransform(this.currentTransform);this.updateInputPosition();this.updateInputValue();this.lastInputValue=this.inputValue;this.position=h.fromMatrixPosition(this.currentTransform);this.rotation=u.fromRotationMatrix(this.currentTransform)}}handleViewerChanged(i,t){var s;t===null||t===void 0?void 0:t.removeEventListener("frameDrawn",this.handleViewerFrameDrawn);t===null||t===void 0?void 0:t.removeEventListener("dimensionschange",this.handleViewerDimensionsChange);i===null||i===void 0?void 0:i.addEventListener("frameDrawn",this.handleViewerFrameDrawn);i===null||i===void 0?void 0:i.addEventListener("dimensionschange",this.handleViewerDimensionsChange);if((i===null||i===void 0?void 0:i.stream)!=null){(s=this.controller)===null||s===void 0?void 0:s.dispose();this.controller=new y(i.stream)}}handleDisabledPropertyChanged(){var i;(i=this.widget)===null||i===void 0?void 0:i.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}handleTransformHandleScalarChanged(){var i;const t=this.getTranslationScalar();const s=this.getRotationScalar();(i=this.widget)===null||i===void 0?void 0:i.updateScalars({xTranslation:t,yTranslation:t,zTranslation:t,xyTranslation:s,xzTranslation:s,yzTranslation:s,xRotation:s,yRotation:s,zRotation:s})}handleRotationChanged(i,t){var s;const n=i!==null&&i!==void 0?i:u.create();this.currentTransform=this.getTransformForNewRotation(n);this.startingTransform=this.currentTransform;if(i==null&&this.currentTransform!=null&&d.isIdentity(this.currentTransform)){this.currentTransform=undefined;this.startingTransform=this.currentTransform}(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);console.debug(`Updating widget rotation [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);this.rotationChanged.emit(i)}handlePositionChanged(i,t){var s,n;this.currentTransform=this.getTransformForNewPosition(i);this.startingTransform=this.currentTransform;console.debug(`Updating widget position [previous=${JSON.stringify(t)}, current=${JSON.stringify(i)}]`);(s=this.widget)===null||s===void 0?void 0:s.updateTransform(this.currentTransform);if(i==null){this.lastDragged=undefined;this.inputPosition=undefined;(n=this.controller)===null||n===void 0?void 0:n.clearTransform()}this.positionChanged.emit(i)}handleInputFormattingChanged(){this.updateInputValue();this.lastInputValue=this.inputValue}render(){var t,s,o,l,h,e;return i(n,{key:"aa99b642f46da67635bdfb1e22a61f3962446684"},i("canvas",{key:"3ea5a08ee3e8ae427b4010857a2ef9d126197bd6",ref:i=>{this.canvasRef=i},class:p("widget",{hovered:this.hovered!=null}),tabindex:"0",width:(t=this.viewer)===null||t===void 0?void 0:t.viewport.width,height:(s=this.viewer)===null||s===void 0?void 0:s.viewport.height,onPointerDown:this.handleBeginDrag,onKeyDown:this.handleKeyDown}),this.showInputs&&this.inputPosition&&((o=this.viewer)===null||o===void 0?void 0:o.viewport)&&i(ii,{key:"148947fe2816804ec05d3b04e7c45bd722f479f1",ref:i=>{var t,s;if(i!=null){(t=this.inputResizeObserver)===null||t===void 0?void 0:t.observe(i)}else if(this.inputWrapperRef!=null){(s=this.inputResizeObserver)===null||s===void 0?void 0:s.unobserve(this.inputWrapperRef)}this.inputWrapperRef=i},bounds:this.inputBounds,viewport:this.viewer.viewport,point:this.inputPosition.point,placement:this.inputPosition.placement,displayUnit:this.getDisplayedUnits()},i(ti,{key:"db03509252b8e72fb975337274e693cc4d0bebf1",ref:i=>{this.inputRef=i},identifier:(h=(l=this.dragging)===null||l===void 0?void 0:l.identifier)!==null&&h!==void 0?h:(e=this.lastDragged)===null||e===void 0?void 0:e.identifier,disabled:this.isEndingTransform,onChange:this.handleInputChange,onIncrement:()=>this.handleInputStep(1),onDecrement:()=>this.handleInputStep(-1),onBlur:()=>{this.inputShouldFocus=false},onUndo:this.EXPERIMENTAL_undoKeybindings?()=>this.EXPERIMENTAL_undo():undefined})))}transform(i,t,s){var n,o;if(this.position!=null&&this.startingTransform!=null&&this.currentTransform!=null&&this.dragging!=null&&this.viewer!=null&&this.viewer.frame!=null){this.currentTransform=K(this.currentTransform,i,t,(n=this.viewer)===null||n===void 0?void 0:n.frame.scene.camera.viewVector,s,this.dragging.identifier);this.getTransformWidget().updateTransform(this.currentTransform);(o=this.controller)===null||o===void 0?void 0:o.updateTransform(d.multiply(this.currentTransform,d.invert(this.startingTransform)))}}handleSettingDisabledAxis(){if(this.widget){this.widget.updateDisabledAxis({xRotation:this.xRotationDisabled,yRotation:this.yRotationDisabled,zRotation:this.zRotationDisabled,xTranslation:this.xTranslationDisabled,yTranslation:this.yTranslationDisabled,zTranslation:this.zTranslationDisabled,xyTranslation:this.xyTranslationDisabled,xzTranslation:this.xzTranslationDisabled,yzTranslation:this.yzTranslationDisabled})}else{console.warn("Cannot set disabled values - no widget defined")}}get hostEl(){return o(this)}static get watchers(){return{viewer:[{handleViewerChanged:0}],xTranslationDisabled:[{handleDisabledPropertyChanged:0}],yTranslationDisabled:[{handleDisabledPropertyChanged:0}],zTranslationDisabled:[{handleDisabledPropertyChanged:0}],xyTranslationDisabled:[{handleDisabledPropertyChanged:0}],xzTranslationDisabled:[{handleDisabledPropertyChanged:0}],yzTranslationDisabled:[{handleDisabledPropertyChanged:0}],xRotationDisabled:[{handleDisabledPropertyChanged:0}],yRotationDisabled:[{handleDisabledPropertyChanged:0}],zRotationDisabled:[{handleDisabledPropertyChanged:0}],translationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotationHandleScalar:[{handleTransformHandleScalarChanged:0}],rotation:[{handleRotationChanged:0}],position:[{handlePositionChanged:0}],distanceUnit:[{handleInputFormattingChanged:0}],angleUnit:[{handleInputFormattingChanged:0}],decimalPlaces:[{handleInputFormattingChanged:0}]}}};ci.style=vi();export{ci as vertex_viewer_transform_widget};
|
|
5
|
+
//# sourceMappingURL=p-d26d4b99.entry.js.map
|