@vertexvis/viewer 0.20.1-testing.0 → 0.20.1
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/index.cjs.js +3 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{controller-0155a10a.js → model-2105e63b.js} +85 -1
- package/dist/cjs/model-2105e63b.js.map +1 -0
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js +7 -87
- package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js.map +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +90 -24
- package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
- package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.js +23 -1
- package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.js.map +1 -1
- package/dist/collection/lib/interactions/multiPointerInteractionHandler.js +4 -2
- package/dist/collection/lib/interactions/multiPointerInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/multiTouchInteractionHandler.js +79 -17
- package/dist/collection/lib/interactions/multiTouchInteractionHandler.js.map +1 -1
- package/dist/collection/lib/interactions/touchInteractionHandler.js +4 -5
- package/dist/collection/lib/interactions/touchInteractionHandler.js.map +1 -1
- package/dist/collection/lib/volume-intersection/index.js +1 -0
- package/dist/collection/lib/volume-intersection/index.js.map +1 -1
- package/dist/collection/lib/window.js +7 -0
- package/dist/collection/lib/window.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/model2.js +165 -128
- package/dist/components/model2.js.map +1 -1
- package/dist/components/model3.js +157 -0
- package/dist/components/model3.js.map +1 -0
- package/dist/components/vertex-viewer-box-query-tool.js +4 -86
- package/dist/components/vertex-viewer-box-query-tool.js.map +1 -1
- package/dist/components/vertex-viewer-pin-tool.js +1 -1
- package/dist/components/vertex-viewer.js +91 -25
- package/dist/components/vertex-viewer.js.map +1 -1
- package/dist/components/viewer-pin-group.js +1 -1
- package/dist/components/viewer-pin-label-line.js +1 -1
- package/dist/components/viewer-pin-label.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/{controller-f0d7a836.js → model-4ba9fc30.js} +85 -2
- package/dist/esm/model-4ba9fc30.js.map +1 -0
- package/dist/esm/vertex-viewer-box-query-tool.entry.js +6 -86
- package/dist/esm/vertex-viewer-box-query-tool.entry.js.map +1 -1
- package/dist/esm/vertex-viewer.entry.js +91 -25
- package/dist/esm/vertex-viewer.entry.js.map +1 -1
- package/dist/types/components/viewer-box-query-tool/viewer-box-query-tool.d.ts +5 -1
- package/dist/types/components.d.ts +8 -0
- package/dist/types/lib/interactions/multiTouchInteractionHandler.d.ts +7 -2
- package/dist/types/lib/interactions/touchInteractionHandler.d.ts +1 -0
- package/dist/types/lib/volume-intersection/index.d.ts +1 -0
- package/dist/types/lib/window.d.ts +1 -0
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/index.esm.js.map +1 -1
- package/dist/viewer/p-12a301e0.entry.js +5 -0
- package/dist/viewer/p-12a301e0.entry.js.map +1 -0
- package/dist/viewer/p-4c4019b2.entry.js +5 -0
- package/dist/viewer/p-4c4019b2.entry.js.map +1 -0
- package/dist/viewer/p-ee0c9d33.js +5 -0
- package/dist/viewer/p-ee0c9d33.js.map +1 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/readme.md +4 -4
- package/dist/cjs/controller-0155a10a.js.map +0 -1
- package/dist/components/controller3.js +0 -111
- package/dist/components/controller3.js.map +0 -1
- package/dist/esm/controller-f0d7a836.js.map +0 -1
- package/dist/viewer/p-b50678f0.js +0 -5
- package/dist/viewer/p-b50678f0.js.map +0 -1
- package/dist/viewer/p-c6e12cf7.entry.js +0 -5
- package/dist/viewer/p-c6e12cf7.entry.js.map +0 -1
- package/dist/viewer/p-cfa05845.entry.js +0 -5
- package/dist/viewer/p-cfa05845.entry.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{r as i,c as e,h as t,H as s,g as o}from"./p-e4ea1075.js";import{a as l,V as r}from"./p-ee0c9d33.js";import{b as h}from"./p-fb478135.js";import{g as n}from"./p-930dafc6.js";import"./p-10bf891d.js";import"./p-a3a3abe7.js";import"./p-86a55f3b.js";class d{constructor(i){this.controller=i;this.handleDragBegin=this.handleDragBegin.bind(this);this.handleDrag=this.handleDrag.bind(this);this.handleDragEnd=this.handleDragEnd.bind(this);this.enabled=true}initialize(i,e){this.element=i;this.api=e;this.element.addEventListener("pointerdown",this.handleDragBegin);this.addCrosshairCursor()}dispose(){var i,e,t;(i=this.element)===null||i===void 0?void 0:i.removeEventListener("pointerdown",this.handleDragBegin);window.removeEventListener("pointermove",this.handleDrag);window.removeEventListener("pointerup",this.handleDragEnd);(e=this.crosshairCursorDisposable)===null||e===void 0?void 0:e.dispose();(t=this.waitCursorDisposable)===null||t===void 0?void 0:t.dispose();this.element=undefined;this.api=undefined;this.enabled=true}disable(){this.enabled=false}enable(){this.enabled=true}handleDragBegin(i){var e;if(this.enabled&&this.isPrimaryMouseButtonClick(i)&&!this.isInteracting){this.elementBounds=(e=this.element)===null||e===void 0?void 0:e.getBoundingClientRect();this.isInteracting=true;this.controller.setStartPoint(n(i,this.elementBounds));window.addEventListener("pointermove",this.handleDrag);window.addEventListener("pointerup",this.handleDragEnd)}}handleDrag(i){if(this.enabled){this.controller.setEndPoint(n(i,this.elementBounds))}}async handleDragEnd(){var i,e;this.isInteracting=false;window.removeEventListener("pointermove",this.handleDrag);window.removeEventListener("pointerup",this.handleDragEnd);(i=this.crosshairCursorDisposable)===null||i===void 0?void 0:i.dispose();if(this.enabled){this.addWaitCursor();try{await this.controller.execute()}finally{(e=this.waitCursorDisposable)===null||e===void 0?void 0:e.dispose();this.addCrosshairCursor()}}}isPrimaryMouseButtonClick(i){return i.buttons===1}addCrosshairCursor(){var i,e;(i=this.crosshairCursorDisposable)===null||i===void 0?void 0:i.dispose();this.crosshairCursorDisposable=(e=this.api)===null||e===void 0?void 0:e.addCursor(h)}addWaitCursor(){var i,e;(i=this.waitCursorDisposable)===null||i===void 0?void 0:i.dispose();this.waitCursorDisposable=(e=this.api)===null||e===void 0?void 0:e.addCursor("wait")}}const a=':host{--viewer-box-query-outline-exclusive-color:#0099cc;--viewer-box-query-outline-exclusive-border-style:solid;--viewer-box-query-outline-inclusive-color:#00cc00;--viewer-box-query-outline-inclusive-border-style:dashed;--viewer-box-query-outline-border-radius:0.25rem;--viewer-box-query-outline-fill-opacity:0.25}.bounds{position:absolute}.outline{position:absolute;top:0;left:0;width:100%;height:100%;box-sizing:border-box;border-radius:var(--viewer-box-query-outline-border-radius)}:host([exclusive="true"]) .outline{border:3px var(--viewer-box-query-outline-exclusive-border-style) var(--viewer-box-query-outline-exclusive-color)}:host([inclusive="true"]) .outline{border:3px var(--viewer-box-query-outline-inclusive-border-style) var(--viewer-box-query-outline-inclusive-color)}.fill{position:absolute;top:0;left:0;width:100%;height:100%;opacity:var(--viewer-box-query-outline-fill-opacity);border-radius:var(--viewer-box-query-outline-border-radius)}:host([exclusive="true"]) .fill{background-color:var(--viewer-box-query-outline-exclusive-color)}:host([inclusive="true"]) .fill{background-color:var(--viewer-box-query-outline-inclusive-color)}';const u=class{constructor(t){i(this,t);this.controllerChanged=e(this,"controllerChanged",7);this.operationType="clearAndSelect";this.handleScreenBoundsChanged=this.handleScreenBoundsChanged.bind(this);this.handleExecuteStarted=this.handleExecuteStarted.bind(this);this.handleExecuteComplete=this.handleExecuteComplete.bind(this)}componentWillLoad(){var i;this.model=(i=this.model)!==null&&i!==void 0?i:new l(this.mode);this.screenBoundsChangedDisposable=this.model.onScreenBoundsChanged(this.handleScreenBoundsChanged);this.handleViewerChanged(this.viewer);this.handleControllerChange(this.controller);this.handleDefaultOperationChange(this.operationType)}disconnectedCallback(){var i,e,t,s;(i=this.model)===null||i===void 0?void 0:i.reset();(e=this.screenBoundsChangedDisposable)===null||e===void 0?void 0:e.dispose();(t=this.operationStartedDisposable)===null||t===void 0?void 0:t.dispose();(s=this.operationCompleteDisposable)===null||s===void 0?void 0:s.dispose();this.deregisterInteractionHandler()}handleViewerChanged(i){this.deregisterInteractionHandler();if(this.model!=null&&i!=null){this.controller=new r(this.model,i);this.handleDefaultOperationChange(this.operationType);this.registerInteractionHandler(this.controller,i)}}handleDefaultOperationChange(i){switch(i){case"clearAndSelect":this.setDefaultClearAndSelectOperation();break;case"select":this.setDefaultSelectOperation();break;case"deselect":this.setDefaultDeselectOperation();break}}handleModeChange(i){var e;(e=this.model)===null||e===void 0?void 0:e.setMode(i)}handleControllerChange(i){var e,t;(e=this.operationStartedDisposable)===null||e===void 0?void 0:e.dispose();(t=this.operationCompleteDisposable)===null||t===void 0?void 0:t.dispose();this.operationStartedDisposable=i===null||i===void 0?void 0:i.onExecuteStarted(this.handleExecuteStarted);this.operationStartedDisposable=i===null||i===void 0?void 0:i.onExecuteComplete(this.handleExecuteComplete);this.controllerChanged.emit(this.controller)}render(){return t(s,null,t("vertex-viewer-layer",null,this.details!=null&&t("div",{class:"bounds",style:{left:`${this.details.screenBounds.x}px`,top:`${this.details.screenBounds.y}px`,width:`${this.details.screenBounds.width}px`,height:`${this.details.screenBounds.height}px`}},t("slot",{name:"bounds"},t("div",{class:"outline"}),t("div",{class:"fill"})))))}handleScreenBoundsChanged(i){this.details=i;this.updateTypeAttribute(i===null||i===void 0?void 0:i.type)}handleExecuteStarted(){var i;(i=this.interactionHandler)===null||i===void 0?void 0:i.disable()}handleExecuteComplete(){var i;(i=this.interactionHandler)===null||i===void 0?void 0:i.enable()}async registerInteractionHandler(i,e){this.interactionHandler=new d(i);this.interactionHandlerDisposable=await e.registerInteractionHandler(this.interactionHandler)}deregisterInteractionHandler(){var i,e;(i=this.interactionHandlerDisposable)===null||i===void 0?void 0:i.dispose();(e=this.interactionHandler)===null||e===void 0?void 0:e.dispose();this.interactionHandler=undefined}updateTypeAttribute(i){this.hostEl.setAttribute("inclusive",`${i==="inclusive"}`);this.hostEl.setAttribute("exclusive",`${i==="exclusive"}`)}setDefaultClearAndSelectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.select()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([i=>i.where((i=>i.withSelected())).deselect()])}setDefaultSelectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.select()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([])}setDefaultDeselectOperation(){var i,e;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.deselect()));(e=this.controller)===null||e===void 0?void 0:e.setAdditionalTransforms([])}get hostEl(){return o(this)}static get watchers(){return{viewer:["handleViewerChanged"],operationType:["handleDefaultOperationChange"],mode:["handleModeChange"],controller:["handleControllerChange"]}}};u.style=a;export{u as vertex_viewer_box_query_tool};
|
|
5
|
+
//# sourceMappingURL=p-4c4019b2.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["src/lib/volume-intersection/interactions.ts","src/components/viewer-box-query-tool/viewer-box-query-tool.css?tag=vertex-viewer-box-query-tool&encapsulation=shadow","src/components/viewer-box-query-tool/viewer-box-query-tool.tsx"],"names":["VolumeIntersectionQueryInteractionHandler","[object Object]","controller","this","handleDragBegin","bind","handleDrag","handleDragEnd","enabled","element","api","addEventListener","addCrosshairCursor","_a","removeEventListener","window","_b","crosshairCursorDisposable","dispose","_c","waitCursorDisposable","undefined","event","isPrimaryMouseButtonClick","isInteracting","elementBounds","getBoundingClientRect","setStartPoint","getMouseClientPosition","setEndPoint","addWaitCursor","execute","buttons","addCursor","boxQueryCursor","viewerBoxQueryToolCss","ViewerBoxQueryTool","hostRef","operationType","handleScreenBoundsChanged","handleExecuteStarted","handleExecuteComplete","model","VolumeIntersectionQueryModel","mode","screenBoundsChangedDisposable","onScreenBoundsChanged","handleViewerChanged","viewer","handleControllerChange","handleDefaultOperationChange","reset","operationStartedDisposable","_d","operationCompleteDisposable","deregisterInteractionHandler","newViewer","VolumeIntersectionQueryController","registerInteractionHandler","updatedOperationType","setDefaultClearAndSelectOperation","setDefaultSelectOperation","setDefaultDeselectOperation","updatedMode","setMode","onExecuteStarted","onExecuteComplete","controllerChanged","emit","h","Host","details","class","style","left","screenBounds","x","top","y","width","height","name","updateTypeAttribute","type","interactionHandler","disable","enable","interactionHandlerDisposable","hostEl","setAttribute","setOperationTransform","builder","select","setAdditionalTransforms","op","where","q","withSelected","deselect"],"mappings":";;;iQAQaA,EAWXC,YAA2BC,GAAAC,KAAAD,WAAAA,EACzBC,KAAKC,gBAAkBD,KAAKC,gBAAgBC,KAAKF,MACjDA,KAAKG,WAAaH,KAAKG,WAAWD,KAAKF,MACvCA,KAAKI,cAAgBJ,KAAKI,cAAcF,KAAKF,MAE7CA,KAAKK,QAAU,KAGVP,WAAWQ,EAAsBC,GACtCP,KAAKM,QAAUA,EACfN,KAAKO,IAAMA,EAEXP,KAAKM,QAAQE,iBAAiB,cAAeR,KAAKC,iBAClDD,KAAKS,qBAGAX,qBACLY,EAAAV,KAAKM,WAAO,MAAAI,SAAA,OAAA,EAAAA,EAAEC,oBAAoB,cAAeX,KAAKC,iBACtDW,OAAOD,oBAAoB,cAAeX,KAAKG,YAC/CS,OAAOD,oBAAoB,YAAaX,KAAKI,gBAC7CS,EAAAb,KAAKc,6BAAyB,MAAAD,SAAA,OAAA,EAAAA,EAAEE,WAChCC,EAAAhB,KAAKiB,wBAAoB,MAAAD,SAAA,OAAA,EAAAA,EAAED,UAE3Bf,KAAKM,QAAUY,UACflB,KAAKO,IAAMW,UACXlB,KAAKK,QAAU,KAGVP,UACLE,KAAKK,QAAU,MAGVP,SACLE,KAAKK,QAAU,KAGTP,gBAAgBqB,SACtB,GACEnB,KAAKK,SACLL,KAAKoB,0BAA0BD,KAC9BnB,KAAKqB,cACN,CACArB,KAAKsB,eAA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YAAa,GAAGN,IAAS,eAG5ClF,6CACNY,EAAAV,KAAKD,cAAU,MAAAW,SAAA,OAAA,EAAAA,EAAE6E,uBAAuBC,GAAYA,EAAQC,YAC5D5E,EAAAb,KAAKD,cAAU,MAAAc,SAAA,OAAA,EAAAA,EAAE6E,wBAAwB,CACtCC,GAAOA,EAAGC,OAAOC,GAAMA,EAAEC,iBAAgBC,aAItCjG,qCACNY,EAAAV,KAAKD,cAAU,MAAAW,SAAA,OAAA,EAAAA,EAAE6E,uBAAuBC,GAAYA,EAAQC,YAC5D5E,EAAAb,KAAKD,cAAU,MAAAc,SAAA,OAAA,EAAAA,EAAE6E,wBAAwB,IAGnC5F,uCACNY,EAAAV,KAAKD,cAAU,MAAAW,SAAA,OAAA,EAAAA,EAAE6E,uBAAuBC,GAAYA,EAAQO,cAC5DlF,EAAAb,KAAKD,cAAU,MAAAc,SAAA,OAAA,EAAAA,EAAE6E,wBAAwB","sourcesContent":["import { Disposable } from '@vertexvis/utils';\n\nimport { boxQueryCursor } from '../cursors';\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionApi } from '../interactions';\nimport { InteractionHandler } from '../interactions/interactionHandler';\nimport { VolumeIntersectionQueryController } from './controller';\n\nexport class VolumeIntersectionQueryInteractionHandler\n implements InteractionHandler\n{\n private element?: HTMLElement;\n private api?: InteractionApi;\n private isInteracting?: boolean;\n private enabled?: boolean;\n private elementBounds?: DOMRect;\n private crosshairCursorDisposable?: Disposable;\n private waitCursorDisposable?: Disposable;\n\n public constructor(private controller: VolumeIntersectionQueryController) {\n this.handleDragBegin = this.handleDragBegin.bind(this);\n this.handleDrag = this.handleDrag.bind(this);\n this.handleDragEnd = this.handleDragEnd.bind(this);\n\n this.enabled = true;\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.api = api;\n\n this.element.addEventListener('pointerdown', this.handleDragBegin);\n this.addCrosshairCursor();\n }\n\n public dispose(): void {\n this.element?.removeEventListener('pointerdown', this.handleDragBegin);\n window.removeEventListener('pointermove', this.handleDrag);\n window.removeEventListener('pointerup', this.handleDragEnd);\n this.crosshairCursorDisposable?.dispose();\n this.waitCursorDisposable?.dispose();\n\n this.element = undefined;\n this.api = undefined;\n this.enabled = true;\n }\n\n public disable(): void {\n this.enabled = false;\n }\n\n public enable(): void {\n this.enabled = true;\n }\n\n private handleDragBegin(event: PointerEvent): void {\n if (\n this.enabled &&\n this.isPrimaryMouseButtonClick(event) &&\n !this.isInteracting\n ) {\n this.elementBounds = this.element?.getBoundingClientRect();\n this.isInteracting = true;\n this.controller.setStartPoint(\n getMouseClientPosition(event, this.elementBounds)\n );\n\n window.addEventListener('pointermove', this.handleDrag);\n window.addEventListener('pointerup', this.handleDragEnd);\n }\n }\n\n private handleDrag(event: PointerEvent): void {\n if (this.enabled) {\n this.controller.setEndPoint(\n getMouseClientPosition(event, this.elementBounds)\n );\n }\n }\n\n private async handleDragEnd(): Promise<void> {\n this.isInteracting = false;\n\n window.removeEventListener('pointermove', this.handleDrag);\n window.removeEventListener('pointerup', this.handleDragEnd);\n\n this.crosshairCursorDisposable?.dispose();\n if (this.enabled) {\n this.addWaitCursor();\n try {\n await this.controller.execute();\n } finally {\n this.waitCursorDisposable?.dispose();\n this.addCrosshairCursor();\n }\n }\n }\n\n private isPrimaryMouseButtonClick(event: PointerEvent): boolean {\n return event.buttons === 1;\n }\n\n private addCrosshairCursor(): void {\n this.crosshairCursorDisposable?.dispose();\n this.crosshairCursorDisposable = this.api?.addCursor(boxQueryCursor);\n }\n\n private addWaitCursor(): void {\n this.waitCursorDisposable?.dispose();\n this.waitCursorDisposable = this.api?.addCursor('wait');\n }\n}\n",":host {\n /**\n * @prop --viewer-box-query-outline-exclusive-color: A CSS color that\n * specifies the color of box for an exclusive query. This will\n * be used in combination with `--viewer-box-query-outline-fill-opacity`\n * for the background color of the box. Defaults to `#0099cc`.\n */\n --viewer-box-query-outline-exclusive-color: #0099cc;\n /**\n * @prop --viewer-box-query-outline-exclusive-border-style: A border\n * style that specifies the type of border to display around the box for an\n * exclusive query. Defaults to `solid`.\n */\n --viewer-box-query-outline-exclusive-border-style: solid;\n /**\n * @prop --viewer-box-query-outline-inclusive-color: A CSS color that\n * specifies the color of box for an inclusive query. This will\n * be used in combination with `--viewer-box-query-outline-fill-opacity`\n * for the background color of the box. Defaults to `#00cc00`.\n */\n --viewer-box-query-outline-inclusive-color: #00cc00;\n /**\n * @prop --viewer-box-query-outline-inclusive-border-style: A border\n * style that specifies the type of border to display around the box for an\n * inclusive query. Defaults to `dashed`.\n */\n --viewer-box-query-outline-inclusive-border-style: dashed;\n /**\n * @prop --viewer-box-query-outline-border-radius: A CSS length that\n * specifies the border radius of the drawn box. Defaults to `0.25rem`.\n */\n --viewer-box-query-outline-border-radius: 0.25rem;\n /**\n * @prop--viewer-box-query-outline-fill-opacity: A number between \n * 0 and 1 that specifies the opacity of the background of the drawn box.\n * Defaults to `0.25`.\n */\n --viewer-box-query-outline-fill-opacity: 0.25;\n}\n\n.bounds {\n position: absolute;\n}\n\n.outline {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border-radius: var(--viewer-box-query-outline-border-radius);\n}\n\n:host([exclusive=\"true\"]) .outline {\n border: 3px var(--viewer-box-query-outline-exclusive-border-style) var(--viewer-box-query-outline-exclusive-color);\n}\n\n:host([inclusive=\"true\"]) .outline {\n border: 3px var(--viewer-box-query-outline-inclusive-border-style) var(--viewer-box-query-outline-inclusive-color);\n}\n\n.fill {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: var(--viewer-box-query-outline-fill-opacity);\n border-radius: var(--viewer-box-query-outline-border-radius);\n}\n\n:host([exclusive=\"true\"]) .fill {\n background-color: var(--viewer-box-query-outline-exclusive-color);\n}\n\n:host([inclusive=\"true\"]) .fill {\n background-color: var(--viewer-box-query-outline-inclusive-color);\n}","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { VolumeIntersectionQueryController } from '../../lib/volume-intersection/controller';\nimport { VolumeIntersectionQueryInteractionHandler } from '../../lib/volume-intersection/interactions';\nimport {\n QueryType,\n VolumeIntersectionQueryDetails,\n VolumeIntersectionQueryModel,\n} from '../../lib/volume-intersection/model';\nimport {\n VolumeIntersectionQueryMode,\n VolumeIntersectionQueryType,\n} from './types';\n\n/**\n * The `ViewerBoxQueryTool` allows for the drawing of a \"box\" on screen to represent\n * a query for items in a specific area of the viewer. This tool then allows for an\n * operation to be performed on the items contained (exclusive) by the box or both\n * contained by and intersecting with (inclusive) the box.\n */\n@Component({\n tag: 'vertex-viewer-box-query-tool',\n styleUrl: 'viewer-box-query-tool.css',\n shadow: true,\n})\nexport class ViewerBoxQueryTool {\n /**\n * The viewer that this component is bound to. This is automatically assigned\n * if added to the light-dom of a parent viewer element.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The controller that is responsible for performing operations using the\n * volume intersection query defined by the drawn box and updating the model.\n */\n @Prop({ mutable: true })\n public controller?: VolumeIntersectionQueryController;\n\n /**\n * The model that contains the points representing the corners of the box\n * displayed on screen, the type of the query to be performed, and methods\n * for setting these values.\n */\n @Prop({ mutable: true })\n public model?: VolumeIntersectionQueryModel;\n\n /**\n * The default operation to perform when a drag has completed and the intersection\n * query will be run. Defaults to `clearAndSelect`, and can be changed to `select` or `deselect`.\n *\n * `clearAndSelect` will clear all existing selection, and select the results of the query.\n * `select` will maintain existing selection, and select the results of the query.\n * `deselect` will maintain existing selection, and deselect the results of the query.\n *\n * The operation behavior for this intersection query tool can also be changed by\n * providing a custom implementation of the `VolumeIntersectionQueryController`, or\n * by using the `setOperationTransform` method of the default controller.\n */\n @Prop()\n public operationType: VolumeIntersectionQueryType = 'clearAndSelect';\n\n /**\n * An optional value to specify a singular mode of intersection query. This value\n * defaults to `undefined`, which will indicate that both `exclusive` and `inclusive`\n * queries should be made, with `inclusive` being represented by a left to right\n * drag behavior and `exclusive` being represented by a right to left drag.\n *\n * Setting this value to `inclusive` will cause dragging left to right and left to right\n * to result in an `inclusive` query, and the box will only be styled for `inclusive` queries.\n *\n * Setting this value to `exclusive` will cause dragging left to right and left to right\n * to result in an `exclusive` query, and the box will only be styled for `exclusive` queries.\n */\n @Prop()\n public mode?: VolumeIntersectionQueryMode;\n\n @State()\n private details?: VolumeIntersectionQueryDetails;\n\n /**\n * Event emitted when the `VolumeIntersectionQueryController` associated with this tool changes.\n */\n @Event()\n public controllerChanged!: EventEmitter<VolumeIntersectionQueryController>;\n\n @Element()\n private hostEl!: HTMLVertexViewerBoxQueryToolElement;\n\n private interactionHandler?: VolumeIntersectionQueryInteractionHandler;\n private interactionHandlerDisposable?: Disposable;\n\n private operationStartedDisposable?: Disposable;\n private operationCompleteDisposable?: Disposable;\n private screenBoundsChangedDisposable?: Disposable;\n\n public constructor() {\n this.handleScreenBoundsChanged = this.handleScreenBoundsChanged.bind(this);\n this.handleExecuteStarted = this.handleExecuteStarted.bind(this);\n this.handleExecuteComplete = this.handleExecuteComplete.bind(this);\n }\n\n public componentWillLoad(): void {\n this.model = this.model ?? new VolumeIntersectionQueryModel(this.mode);\n\n this.screenBoundsChangedDisposable = this.model.onScreenBoundsChanged(\n this.handleScreenBoundsChanged\n );\n\n this.handleViewerChanged(this.viewer);\n this.handleControllerChange(this.controller);\n this.handleDefaultOperationChange(this.operationType);\n }\n\n public disconnectedCallback(): void {\n this.model?.reset();\n this.screenBoundsChangedDisposable?.dispose();\n this.operationStartedDisposable?.dispose();\n this.operationCompleteDisposable?.dispose();\n this.deregisterInteractionHandler();\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(newViewer?: HTMLVertexViewerElement): void {\n this.deregisterInteractionHandler();\n\n if (this.model != null && newViewer != null) {\n this.controller = new VolumeIntersectionQueryController(\n this.model,\n newViewer\n );\n this.handleDefaultOperationChange(this.operationType);\n this.registerInteractionHandler(this.controller, newViewer);\n }\n }\n\n /**\n * @ignore\n */\n @Watch('operationType')\n protected handleDefaultOperationChange(\n updatedOperationType: VolumeIntersectionQueryType\n ): void {\n switch (updatedOperationType) {\n case 'clearAndSelect':\n this.setDefaultClearAndSelectOperation();\n break;\n case 'select':\n this.setDefaultSelectOperation();\n break;\n case 'deselect':\n this.setDefaultDeselectOperation();\n break;\n }\n }\n\n /**\n * @ignore\n */\n @Watch('mode')\n protected handleModeChange(updatedMode?: VolumeIntersectionQueryMode): void {\n this.model?.setMode(updatedMode);\n }\n\n /**\n * @ignore\n */\n @Watch('controller')\n protected handleControllerChange(\n controller?: VolumeIntersectionQueryController\n ): void {\n this.operationStartedDisposable?.dispose();\n this.operationCompleteDisposable?.dispose();\n\n this.operationStartedDisposable = controller?.onExecuteStarted(\n this.handleExecuteStarted\n );\n this.operationStartedDisposable = controller?.onExecuteComplete(\n this.handleExecuteComplete\n );\n\n this.controllerChanged.emit(this.controller);\n }\n\n /**\n * @ignore\n */\n protected render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <vertex-viewer-layer>\n {this.details != null && (\n <div\n class=\"bounds\"\n style={{\n left: `${this.details.screenBounds.x}px`,\n top: `${this.details.screenBounds.y}px`,\n width: `${this.details.screenBounds.width}px`,\n height: `${this.details.screenBounds.height}px`,\n }}\n >\n <slot name=\"bounds\">\n <div class=\"outline\"></div>\n <div class=\"fill\"></div>\n </slot>\n </div>\n )}\n </vertex-viewer-layer>\n </Host>\n );\n }\n\n private handleScreenBoundsChanged(\n details?: VolumeIntersectionQueryDetails\n ): void {\n this.details = details;\n\n this.updateTypeAttribute(details?.type);\n }\n\n private handleExecuteStarted(): void {\n this.interactionHandler?.disable();\n }\n\n private handleExecuteComplete(): void {\n this.interactionHandler?.enable();\n }\n\n private async registerInteractionHandler(\n controller: VolumeIntersectionQueryController,\n viewer: HTMLVertexViewerElement\n ): Promise<void> {\n this.interactionHandler = new VolumeIntersectionQueryInteractionHandler(\n controller\n );\n this.interactionHandlerDisposable = await viewer.registerInteractionHandler(\n this.interactionHandler\n );\n }\n\n private deregisterInteractionHandler(): void {\n this.interactionHandlerDisposable?.dispose();\n this.interactionHandler?.dispose();\n this.interactionHandler = undefined;\n }\n\n private updateTypeAttribute(type?: QueryType): void {\n this.hostEl.setAttribute('inclusive', `${type === 'inclusive'}`);\n this.hostEl.setAttribute('exclusive', `${type === 'exclusive'}`);\n }\n\n private setDefaultClearAndSelectOperation(): void {\n this.controller?.setOperationTransform((builder) => builder.select());\n this.controller?.setAdditionalTransforms([\n (op) => op.where((q) => q.withSelected()).deselect(),\n ]);\n }\n\n private setDefaultSelectOperation(): void {\n this.controller?.setOperationTransform((builder) => builder.select());\n this.controller?.setAdditionalTransforms([]);\n }\n\n private setDefaultDeselectOperation(): void {\n this.controller?.setOperationTransform((builder) => builder.deselect());\n this.controller?.setAdditionalTransforms([]);\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import{S as t}from"./p-10bf891d.js";import{E as s}from"./p-86a55f3b.js";import{p as i,e}from"./p-a3a3abe7.js";class n{constructor(t,i){this.model=t;this.viewer=i;this.additionalTransforms=[];this.operationInFlight=false;this.operationAborted=false;this.executeStarted=new s;this.executeComplete=new s;this.executeAborted=new s;this.additionalTransforms=[t=>t.where((t=>t.all())).deselect()];this.operationTransform=t=>t.select()}setStartPoint(t){this.previousViewerCameraControls=this.viewer.cameraControls;this.viewer.cameraControls=false;this.model.setStartPoint(t)}setEndPoint(t){this.model.setEndPoint(t)}setOperationTransform(t){this.operationTransform=t}setAdditionalTransforms(t){this.additionalTransforms=t}onExecuteStarted(t){return this.executeStarted.on(t)}onExecuteComplete(t){return this.executeComplete.on(t)}onExecuteAborted(t){return this.executeAborted.on(t)}async execute(){var s,i,e;const n=this.model.getScreenBounds();const h=this.model.getType();if(n!=null&&!this.operationInFlight){this.model.complete();try{this.operationInFlight=true;this.executeStarted.emit();const t=t=>this.additionalTransforms.map((s=>s(t))).flat();const s=t=>[this.operationTransform(t.where((t=>t.withVolumeIntersection(n,h==="exclusive"))))].flat();const e=await this.viewer.scene();await e.items((i=>[...t(i),...s(i)])).execute()}catch(i){if(i instanceof t&&((s=i.summary)===null||s===void 0?void 0:s.toLocaleLowerCase().includes("operation aborted"))){this.executeAborted.emit(i);this.operationAborted=true}else{console.error("Failed to perform volume intersection query",i);throw i}}finally{this.viewer.cameraControls=(i=this.previousViewerCameraControls)!==null&&i!==void 0?i:true;this.previousViewerCameraControls=undefined;this.operationInFlight=false;this.executeComplete.emit({aborted:this.operationAborted});this.operationAborted=false}}else if(this.operationInFlight){this.model.cancel();throw new Error(`Unable to perform volume intersection query as there is already one in-flight.`)}else{this.model.cancel();this.viewer.cameraControls=(e=this.previousViewerCameraControls)!==null&&e!==void 0?e:true}}}class h{constructor(t){this.mode=t;this.dragStarted=new s;this.dragComplete=new s;this.dragCancelled=new s;this.screenBoundsChanged=new s}setStartPoint(t){this.startPoint=t;this.dragStarted.emit()}setEndPoint(t){if(this.startPoint!=null&&i.distance(this.startPoint,t)>=2){this.endPoint=t;this.updateQueryType();this.screenBoundsChanged.emit(this.getQueryDetails())}}setMode(t){this.mode=t}complete(){if(this.startPoint!=null&&this.endPoint!=null){this.screenBoundsChanged.emit(undefined);this.dragComplete.emit(this.getQueryDetails());this.reset()}}cancel(){this.screenBoundsChanged.emit(undefined);this.dragCancelled.emit();this.reset()}reset(){this.startPoint=undefined;this.endPoint=undefined;this.type=undefined}getScreenBounds(){return this.startPoint!=null&&this.endPoint!=null?e.fromPoints(this.startPoint,this.endPoint):undefined}getType(){return this.type}onScreenBoundsChanged(t){return this.screenBoundsChanged.on(t)}onDragStarted(t){return this.dragStarted.on(t)}onDragComplete(t){return this.dragComplete.on(t)}onDragCancelled(t){return this.dragCancelled.on(t)}getQueryDetails(){if(this.startPoint!=null&&this.endPoint!=null&&this.type!=null){return{screenBounds:e.fromPoints(this.startPoint,this.endPoint),type:this.type}}else{throw new Error("Failed to create query details, the start and end points must be set.")}}updateQueryType(){var t;if(this.startPoint!=null&&this.endPoint!=null){const s=i.subtract(this.endPoint,this.startPoint).x>0?"exclusive":"inclusive";this.type=(t=this.mode)!==null&&t!==void 0?t:s}}}export{n as V,h as a};
|
|
5
|
+
//# sourceMappingURL=p-ee0c9d33.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["src/lib/volume-intersection/controller.ts","src/lib/volume-intersection/model.ts"],"names":["VolumeIntersectionQueryController","[object Object]","model","viewer","this","additionalTransforms","operationInFlight","operationAborted","executeStarted","EventDispatcher","executeComplete","executeAborted","op","where","q","all","deselect","operationTransform","builder","select","point","previousViewerCameraControls","cameraControls","setStartPoint","setEndPoint","listener","on","screenBounds","getScreenBounds","type","getType","complete","emit","map","t","flat","operationTransforms","withVolumeIntersection","scene","items","execute","e","StreamRequestError","_a","summary","toLocaleLowerCase","includes","console","error","_b","undefined","aborted","cancel","Error","_c","VolumeIntersectionQueryModel","mode","dragStarted","dragComplete","dragCancelled","screenBoundsChanged","startPoint","Point","distance","endPoint","updateQueryType","getQueryDetails","reset","Rectangle","fromPoints","directionalType","subtract","x"],"mappings":";;;oHAsBaA,EAWXC,YACUC,EACAC,GADAC,KAAAF,MAAAA,EACAE,KAAAD,OAAAA,EAVFC,KAAAC,qBAA8C,GAC9CD,KAAAE,kBAAoB,MACpBF,KAAAG,iBAAmB,MAEnBH,KAAAI,eAAiB,IAAIC,EACrBL,KAAAM,gBAAkB,IAAID,EACtBL,KAAAO,eAAiB,IAAIF,EAM3BL,KAAKC,qBAAuB,CAAEO,GAAOA,EAAGC,OAAOC,GAAMA,EAAEC,QAAOC,YAC9DZ,KAAKa,mBAAsBC,GAAYA,EAAQC,SAG1ClB,cAAcmB,GACnBhB,KAAKiB,6BAA+BjB,KAAKD,OAAOmB,eAChDlB,KAAKD,OAAOmB,eAAiB,MAE7BlB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9BxB,cAAcwB,GACnB,OAAOrB,KAAKqD,YAAY/B,GAAGD,GAGtBxB,eACLwB,GAEA,OAAOrB,KAAKsD,aAAahC,GAAGD,GAGvBxB,gBAAgBwB,GACrB,OAAOrB,KAAKuD,cAAcjC,GAAGD,GAGvBxB,kBACN,GAAIG,KAAKyD,YAAc,MAAQzD,KAAK4D,UAAY,MAAQ5D,KAAKyB,MAAQ,KAAM,CACzE,MAAO,CACLF,aAAcyC,EAAUC,WAAWjE,KAAKyD,WAAYzD,KAAK4D,UACzDnC,KAAMzB,KAAKyB,UAER,CACL,MAAM,IAAIwB,MACR,0EAKEpD,wBACN,GAAIG,KAAKyD,YAAc,MAAQzD,KAAK4D,UAAY,KAAM,CACpD,MAAMM,EACJR,EAAMS,SAASnE,KAAK4D,SAAU5D,KAAKyD,YAAYW,EAAI,EAC/C,YACA,YAENpE,KAAKyB,MAAOc,EAAAvC,KAAKoD,QAAI,MAAAb,SAAA,EAAAA,EAAI2B","sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { StreamRequestError } from '@vertexvis/stream-api';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport {\n SceneItemOperationsBuilder,\n TerminalItemOperationBuilder,\n} from '../scenes';\nimport { SceneItemQueryExecutor } from '../scenes/queries';\nimport { VolumeIntersectionQueryModel } from './model';\n\nexport type OperationTransform = (\n builder: SceneItemOperationsBuilder\n) => TerminalItemOperationBuilder;\nexport type AdditionalTransform = (\n executor: SceneItemQueryExecutor\n) => TerminalItemOperationBuilder;\n\nexport interface CompleteExecutionDetails {\n aborted: boolean;\n}\n\nexport class VolumeIntersectionQueryController {\n private previousViewerCameraControls?: boolean;\n private operationTransform: OperationTransform;\n private additionalTransforms: AdditionalTransform[] = [];\n private operationInFlight = false;\n private operationAborted = false;\n\n private executeStarted = new EventDispatcher<void>();\n private executeComplete = new EventDispatcher<CompleteExecutionDetails>();\n private executeAborted = new EventDispatcher<StreamRequestError>();\n\n public constructor(\n private model: VolumeIntersectionQueryModel,\n private viewer: HTMLVertexViewerElement\n ) {\n this.additionalTransforms = [(op) => op.where((q) => q.all()).deselect()];\n this.operationTransform = (builder) => builder.select();\n }\n\n public setStartPoint(point: Point.Point): void {\n this.previousViewerCameraControls = this.viewer.cameraControls;\n this.viewer.cameraControls = false;\n\n this.model.setStartPoint(point);\n }\n\n public setEndPoint(point: Point.Point): void {\n this.model.setEndPoint(point);\n }\n\n /**\n * Updates the operation that will be applied based on the volume intersection\n * query. Defaults to `(builder) => builder.select()`, which will select any\n * of the results of the query.\n */\n public setOperationTransform(operationTransform: OperationTransform): void {\n this.operationTransform = operationTransform;\n }\n\n /**\n * Updates any additional operations that should be performed independent of\n * the volume intersection query. This can be used to perform an operation on\n * the entirety of the scene prior to the operation on the result of the\n * volume intersection query.\n * Defaults to `[(op) => op.where((q) => q.all()).deselect()]`, which will\n * clear any prior selection before the default selection.\n */\n public setAdditionalTransforms(\n additionalTransforms: AdditionalTransform[]\n ): void {\n this.additionalTransforms = additionalTransforms;\n }\n\n public onExecuteStarted(listener: Listener<void>): Disposable {\n return this.executeStarted.on(listener);\n }\n\n public onExecuteComplete(\n listener: Listener<CompleteExecutionDetails>\n ): Disposable {\n return this.executeComplete.on(listener);\n }\n\n public onExecuteAborted(listener: Listener<StreamRequestError>): Disposable {\n return this.executeAborted.on(listener);\n }\n\n public async execute(): Promise<void> {\n const screenBounds = this.model.getScreenBounds();\n const type = this.model.getType();\n\n if (screenBounds != null && !this.operationInFlight) {\n this.model.complete();\n\n try {\n this.operationInFlight = true;\n this.executeStarted.emit();\n\n const additionalTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n this.additionalTransforms.map((t) => t(op)).flat();\n const operationTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n [\n this.operationTransform(\n op.where((q) =>\n q.withVolumeIntersection(screenBounds, type === 'exclusive')\n )\n ),\n ].flat();\n\n const scene = await this.viewer.scene();\n await scene\n .items((op) => [\n ...additionalTransforms(op),\n ...operationTransforms(op),\n ])\n .execute();\n } catch (e) {\n if (\n e instanceof StreamRequestError &&\n e.summary?.toLocaleLowerCase().includes('operation aborted')\n ) {\n this.executeAborted.emit(e);\n this.operationAborted = true;\n } else {\n console.error('Failed to perform volume intersection query', e);\n throw e;\n }\n } finally {\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n this.previousViewerCameraControls = undefined;\n this.operationInFlight = false;\n this.executeComplete.emit({\n aborted: this.operationAborted,\n });\n this.operationAborted = false;\n }\n } else if (this.operationInFlight) {\n this.model.cancel();\n\n throw new Error(\n `Unable to perform volume intersection query as there is already one in-flight.`\n );\n } else {\n this.model.cancel();\n\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n }\n }\n}\n","import { Point, Rectangle } from '@vertexvis/geometry';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { VolumeIntersectionQueryMode } from '../../components/viewer-box-query-tool/types';\n\nexport type QueryType = 'inclusive' | 'exclusive';\n\nexport interface VolumeIntersectionQueryDetails {\n screenBounds: Rectangle.Rectangle;\n type: QueryType;\n}\n\nexport class VolumeIntersectionQueryModel {\n private startPoint?: Point.Point;\n private endPoint?: Point.Point;\n private type?: QueryType;\n\n private dragStarted = new EventDispatcher<void>();\n private dragComplete = new EventDispatcher<VolumeIntersectionQueryDetails>();\n private dragCancelled = new EventDispatcher<void>();\n\n private screenBoundsChanged = new EventDispatcher<\n VolumeIntersectionQueryDetails | undefined\n >();\n\n public constructor(private mode?: VolumeIntersectionQueryMode) {}\n\n public setStartPoint(point: Point.Point): void {\n this.startPoint = point;\n\n this.dragStarted.emit();\n }\n\n public setEndPoint(point: Point.Point): void {\n if (\n this.startPoint != null &&\n Point.distance(this.startPoint, point) >= 2\n ) {\n this.endPoint = point;\n\n this.updateQueryType();\n this.screenBoundsChanged.emit(this.getQueryDetails());\n }\n }\n\n public setMode(mode?: VolumeIntersectionQueryMode): void {\n this.mode = mode;\n }\n\n public complete(): void {\n if (this.startPoint != null && this.endPoint != null) {\n this.screenBoundsChanged.emit(undefined);\n this.dragComplete.emit(this.getQueryDetails());\n this.reset();\n }\n }\n\n public cancel(): void {\n this.screenBoundsChanged.emit(undefined);\n this.dragCancelled.emit();\n this.reset();\n }\n\n public reset(): void {\n this.startPoint = undefined;\n this.endPoint = undefined;\n this.type = undefined;\n }\n\n public getScreenBounds(): Rectangle.Rectangle | undefined {\n return this.startPoint != null && this.endPoint != null\n ? Rectangle.fromPoints(this.startPoint, this.endPoint)\n : undefined;\n }\n\n public getType(): QueryType | undefined {\n return this.type;\n }\n\n public onScreenBoundsChanged(\n listener: Listener<VolumeIntersectionQueryDetails | undefined>\n ): Disposable {\n return this.screenBoundsChanged.on(listener);\n }\n\n public onDragStarted(listener: Listener<void>): Disposable {\n return this.dragStarted.on(listener);\n }\n\n public onDragComplete(\n listener: Listener<VolumeIntersectionQueryDetails>\n ): Disposable {\n return this.dragComplete.on(listener);\n }\n\n public onDragCancelled(listener: Listener<void>): Disposable {\n return this.dragCancelled.on(listener);\n }\n\n private getQueryDetails(): VolumeIntersectionQueryDetails {\n if (this.startPoint != null && this.endPoint != null && this.type != null) {\n return {\n screenBounds: Rectangle.fromPoints(this.startPoint, this.endPoint),\n type: this.type,\n };\n } else {\n throw new Error(\n 'Failed to create query details, the start and end points must be set.'\n );\n }\n }\n\n private updateQueryType(): void {\n if (this.startPoint != null && this.endPoint != null) {\n const directionalType =\n Point.subtract(this.endPoint, this.startPoint).x > 0\n ? 'exclusive'\n : 'inclusive';\n\n this.type = this.mode ?? directionalType;\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import{d as e,N as t,w as r,p as a,b as o}from"./p-e4ea1075.js";import{g as i}from"./p-446bdb50.js";import"./p-88c19f38.js";const n=e=>`__sc_import_${e.replace(/\s|-/g,"_")}`;const s=()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t));const i="";const n={};if(i!==""){n.resourcesUrl=new URL(".",i).href}else{n.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,r.location.href)).href;{l(n.resourcesUrl,o)}if(!r.customElements){return __sc_import_viewer("./p-093f9bdb.js").then((()=>n))}}return a(n)};const l=(a,o)=>{const i=n(t);try{r[i]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const n=new Map;r[i]=t=>{const s=new URL(t,a).href;let l=n.get(s);if(!l){const t=e.createElement("script");t.type="module";t.crossOrigin=o.crossOrigin;t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${i}.m = m;`],{type:"application/javascript"}));l=new Promise((e=>{t.onload=()=>{e(r[i].m);t.remove()}}));n.set(s,l);e.head.appendChild(t)}return l}}};s().then((e=>{i();return o(JSON.parse('[["p-99de8cd6",[[1,"vertex-viewer-pin-tool",{"pinController":[1040],"pinModel":[16],"viewer":[16],"tool":[1025],"mode":[1025],"primaryColor":[1025,"primary-color"],"accentColor":[1025,"accent-color"],"pins":[32],"selectedPinId":[32],"elementBounds":[32],"projectionViewMatrix":[32]}]]],["p-3556e68d",[[1,"vertex-scene-tree",{"overScanCount":[2,"over-scan-count"],"viewerSelector":[1,"viewer-selector"],"viewer":[1040],"rowData":[16],"config":[1],"configEnv":[1,"config-env"],"controller":[1040],"metadataSearchExactMatch":[1028,"metadata-search-exact-match"],"metadataSearchKeys":[1040],"metadataKeys":[16],"rows":[32],"totalRows":[32],"showLoader":[32],"showEmptyResults":[32],"stateMap":[32],"errorDetails":[32],"attemptingRetry":[32],"invalidateRows":[64],"scrollToIndex":[64],"scrollToItem":[64],"expandAll":[64],"collapseAll":[64],"expandItem":[64],"collapseItem":[64],"toggleExpandItem":[64],"toggleItemVisibility":[64],"hideItem":[64],"showItem":[64],"selectItem":[64],"deselectItem":[64],"getRowAtIndex":[64],"getRowForEvent":[64],"getRowAtClientY":[64],"filterItems":[64],"selectFilteredItems":[64],"fetchMetadataKeys":[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]]]]],["p-0669d984",[[1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]]],["p-3b53a9e5",[[1,"vertex-viewer-markup",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"selectedMarkupId":[1025,"selected-markup-id"],"selectNew":[4,"select-new"],"toSelectMarkupId":[32],"pointerDownPosition":[32],"addMarkup":[64],"removeMarkup":[64],"getMarkupElements":[64],"getMarkupElement":[64]},[[0,"markupEnd","handleMarkupEnd"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-710d16c2",[[1,"vertex-viewer-markup-tool",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"stateMap":[32],"reset":[64]}]]],["p-2a0a824e",[[1,"vertex-viewer-view-cube",{"xPositiveLabel":[1,"x-positive-label"],"xNegativeLabel":[1,"x-negative-label"],"yPositiveLabel":[1,"y-positive-label"],"yNegativeLabel":[1,"y-negative-label"],"zPositiveLabel":[1,"z-positive-label"],"zNegativeLabel":[1,"z-negative-label"],"standardViewsOff":[4,"standard-views-off"],"animationDuration":[2,"animation-duration"],"triadOff":[4,"triad-off"],"worldOrientation":[1040],"camera":[1040],"viewer":[16],"boxLength":[32],"triadPosition":[32]}]]],["p-c0c6db45",[[1,"vertex-viewer-measurement-distance",{"start":[1040],"startJson":[1,"start-json"],"end":[1040],"endJson":[1,"end-json"],"distance":[1026],"showAxisReferenceLines":[4,"show-axis-reference-lines"],"snapDistance":[2,"snap-distance"],"units":[1],"fractionalDigits":[2,"fractional-digits"],"labelFormatter":[16],"anchorLabelOffset":[2,"anchor-label-offset"],"lineCapLength":[2,"line-cap-length"],"mode":[513],"interactingAnchor":[1537,"interacting-anchor"],"invalid":[1540],"camera":[16],"hitProvider":[16],"indicatorPt":[1040],"viewer":[16],"measurementModel":[16],"viewport":[32],"elementBounds":[32],"interactionCount":[32],"internalCamera":[32],"invalidateStateCounter":[32],"stateMap":[32],"measurementUnits":[32],"computeElementMetrics":[64]}]]],["p-298aa35a",[[1,"vertex-viewer-measurement-precise",{"measurementModel":[16],"measurementOverlays":[16],"measurementController":[1040],"measurableEntityTypes":[16],"viewer":[16],"configEnv":[1,"config-env"],"config":[1]}]]],["p-c6e12cf7",[[1,"vertex-viewer-box-query-tool",{"viewer":[16],"controller":[1040],"model":[1040],"operationType":[1,"operation-type"],"mode":[1],"details":[32]}]]],["p-f1bf192d",[[1,"vertex-viewer-walk-mode-tool",{"viewer":[16],"controller":[1040],"model":[1040],"teleportMode":[1,"teleport-mode"],"enabled":[4]}]]],["p-1e66b389",[[1,"vertex-scene-tree-table-cell",{"node":[16],"tree":[16],"value":[1],"placeholder":[1],"hovered":[1028],"isScrolling":[4,"is-scrolling"],"expandToggle":[4,"expand-toggle"],"visibilityToggle":[4,"visibility-toggle"],"selectionHandler":[16],"visibilityHandler":[16],"expansionHandler":[16],"hoverController":[16]}]]],["p-9725f5fc",[[1,"vertex-scene-tree-table-column",{"initialWidth":[2,"initial-width"],"minWidth":[2,"min-width"],"maxWidth":[2,"max-width"]}]]],["p-097909a8",[[1,"vertex-scene-tree-table-header"]]],["p-97aed77f",[[1,"vertex-scene-tree-table-resize-divider",{"dragging":[32]}]]],["p-2e194668",[[1,"vertex-scene-tree-toolbar-group"]]],["p-cfa05845",[[1,"vertex-viewer",{"src":[1],"clientId":[1,"client-id"],"deviceId":[1025,"device-id"],"config":[1],"configEnv":[1,"config-env"],"resolvedConfig":[1040],"cameraControls":[4,"camera-controls"],"cameraType":[1537,"camera-type"],"keyboardControls":[4,"keyboard-controls"],"rotateAroundTapPoint":[4,"rotate-around-tap-point"],"token":[1025],"depthBuffers":[1,"depth-buffers"],"phantom":[16],"noDefaultLights":[4,"no-default-lights"],"enableTemporalRefinement":[4,"enable-temporal-refinement"],"experimentalRenderingOptions":[1,"experimental-rendering-options"],"featureLines":[16],"selectionHighlighting":[16],"featureHighlighting":[16],"featureMaps":[1,"feature-maps"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32],"dispatchFrameDrawn":[64],"registerInteractionHandler":[64],"registerTapKeyInteraction":[64],"getInteractionTarget_DEPRECATED":[64],"addCursor":[64],"getInteractionHandlers":[64],"getKeyInteractions":[64],"getBaseInteractionHandler":[64],"getJwt":[64],"load":[64],"unload":[64],"scene":[64],"isSceneReady":[64]},[[0,"tap","handleTapEvent"]]]]],["p-293d308a",[[1,"vertex-viewer-hit-result-indicator",{"viewer":[16],"position":[1040],"normal":[1040]}]]],["p-567d24fa",[[1,"vertex-viewer-measurement-details",{"measurementModel":[16],"measurementOverlays":[16],"measurementOutcome":[1040],"distanceUnits":[1,"distance-units"],"angleUnits":[1,"angle-units"],"fractionalDigits":[2,"fractional-digits"],"distanceFormatter":[16],"angleFormatter":[16],"areaFormatter":[16],"resultTypes":[16],"overlay":[32],"distanceMeasurementUnits":[32],"angleMeasurementUnits":[32],"areaMeasurementUnits":[32]}]]],["p-a6da475b",[[1,"vertex-viewer-transform-widget",{"viewer":[16],"position":[1040],"rotation":[1040],"controller":[1040],"xRotationDisabled":[1028,"x-rotation-disabled"],"yRotationDisabled":[1028,"y-rotation-disabled"],"zRotationDisabled":[1028,"z-rotation-disabled"],"xTranslationDisabled":[1028,"x-translation-disabled"],"yTranslationDisabled":[1028,"y-translation-disabled"],"zTranslationDisabled":[1028,"z-translation-disabled"],"hovered":[1040]}]]],["p-a700d0b7",[[1,"vertex-viewer-icon",{"name":[1],"size":[1]}]]],["p-a7e1ccf7",[[0,"vertex-viewer-pin-group",{"pin":[16],"matrix":[1040],"projectionViewMatrix":[16],"elementBounds":[1040],"pinModel":[16],"pinController":[16],"selected":[4],"invalidateStateCounter":[32]}]]],["p-a4979444",[[1,"vertex-viewer-dom-group",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040]}]]],["p-5e57d7bb",[[1,"vertex-viewer-teleport-tool",{"viewer":[16],"mode":[1025],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"],"controller":[1040],"model":[1040]}]]],["p-685355a4",[[1,"vertex-viewer-spinner",{"size":[1]}]]],["p-71b46981",[[1,"vertex-scene-tree-search",{"debounce":[2],"disabled":[4],"placeholder":[1],"controller":[16],"value":[1025],"focused":[32],"isSearching":[32],"setFocus":[64],"clear":[64]}],[1,"vertex-scene-tree-table-layout",{"tree":[16],"controller":[16],"rows":[16],"totalRows":[2,"total-rows"],"rowHeight":[1026,"row-height"],"overScanCount":[2,"over-scan-count"],"rowData":[16],"layoutOffset":[1026,"layout-offset"],"scrollOffset":[1026,"scroll-offset"],"layoutHeight":[1026,"layout-height"],"layoutWidth":[1026,"layout-width"],"viewportStartIndex":[1026,"viewport-start-index"],"viewportEndIndex":[1026,"viewport-end-index"],"columnGridLayout":[32],"columnGridFixedLayout":[32],"isComputingCellHeight":[32],"lastDividerPointerPosition":[32],"resizingColumnIndex":[32],"isScrolling":[32],"scrollTimer":[32],"stateMap":[32],"scrollToPosition":[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-1efa143f",[[1,"vertex-viewer-layer",{"stretchOff":[516,"stretch-off"]}]]],["p-c489590d",[[1,"vertex-viewer-toolbar",{"placement":[1],"direction":[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{"direction":[1]}]]],["p-bd4739c4",[[0,"vertex-viewer-pin-label",{"pin":[16],"elementBounds":[16],"value":[1025],"pinController":[16],"focused":[32],"computedScreenPosition":[32],"textareaRows":[32],"contentElBounds":[32],"setFocus":[64]}],[0,"vertex-viewer-pin-label-line",{"pinPoint":[16],"labelPoint":[16],"pin":[16]}]]],["p-024f0f95",[[1,"vertex-viewer-measurement-overlays",{"measurementOverlays":[16],"camera":[1040],"viewer":[16],"overlays":[32]}],[1,"vertex-viewer-measurement-line",{"start":[16],"end":[16],"capLength":[2,"cap-length"],"pointerEvents":[1,"pointer-events"]}]]],["p-0c71a2c0",[[1,"vertex-viewer-dom-renderer",{"drawMode":[1,"draw-mode"],"viewer":[16],"camera":[1040],"depthBuffer":[1040],"viewport":[32],"invalidateFrameCounter":[32]},[[0,"propertyChange","handlePropertyChange"]]],[1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]]],["p-6e8a6f8e",[[1,"vertex-viewer-markup-arrow",{"start":[1040],"startJson":[1,"start"],"end":[1040],"endJson":[1,"end"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-circle",{"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-freeform",{"points":[1040],"pointsJson":[1,"points"],"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"screenPoints":[32],"dispose":[64]}]]]]'),e)}));
|
|
4
|
+
import{d as e,N as t,w as r,p as a,b as o}from"./p-e4ea1075.js";import{g as i}from"./p-446bdb50.js";import"./p-88c19f38.js";const n=e=>`__sc_import_${e.replace(/\s|-/g,"_")}`;const s=()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t));const i="";const n={};if(i!==""){n.resourcesUrl=new URL(".",i).href}else{n.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,r.location.href)).href;{l(n.resourcesUrl,o)}if(!r.customElements){return __sc_import_viewer("./p-093f9bdb.js").then((()=>n))}}return a(n)};const l=(a,o)=>{const i=n(t);try{r[i]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const n=new Map;r[i]=t=>{const s=new URL(t,a).href;let l=n.get(s);if(!l){const t=e.createElement("script");t.type="module";t.crossOrigin=o.crossOrigin;t.src=URL.createObjectURL(new Blob([`import * as m from '${s}'; window.${i}.m = m;`],{type:"application/javascript"}));l=new Promise((e=>{t.onload=()=>{e(r[i].m);t.remove()}}));n.set(s,l);e.head.appendChild(t)}return l}}};s().then((e=>{i();return o(JSON.parse('[["p-99de8cd6",[[1,"vertex-viewer-pin-tool",{"pinController":[1040],"pinModel":[16],"viewer":[16],"tool":[1025],"mode":[1025],"primaryColor":[1025,"primary-color"],"accentColor":[1025,"accent-color"],"pins":[32],"selectedPinId":[32],"elementBounds":[32],"projectionViewMatrix":[32]}]]],["p-3556e68d",[[1,"vertex-scene-tree",{"overScanCount":[2,"over-scan-count"],"viewerSelector":[1,"viewer-selector"],"viewer":[1040],"rowData":[16],"config":[1],"configEnv":[1,"config-env"],"controller":[1040],"metadataSearchExactMatch":[1028,"metadata-search-exact-match"],"metadataSearchKeys":[1040],"metadataKeys":[16],"rows":[32],"totalRows":[32],"showLoader":[32],"showEmptyResults":[32],"stateMap":[32],"errorDetails":[32],"attemptingRetry":[32],"invalidateRows":[64],"scrollToIndex":[64],"scrollToItem":[64],"expandAll":[64],"collapseAll":[64],"expandItem":[64],"collapseItem":[64],"toggleExpandItem":[64],"toggleItemVisibility":[64],"hideItem":[64],"showItem":[64],"selectItem":[64],"deselectItem":[64],"getRowAtIndex":[64],"getRowForEvent":[64],"getRowAtClientY":[64],"filterItems":[64],"selectFilteredItems":[64],"fetchMetadataKeys":[64]},[[0,"search","handleSearch"],[0,"cellLoaded","handleCellLoaded"]]]]],["p-0669d984",[[1,"vertex-viewer-default-toolbar",{"viewer":[16],"placement":[1],"direction":[1],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"]}]]],["p-3b53a9e5",[[1,"vertex-viewer-markup",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"selectedMarkupId":[1025,"selected-markup-id"],"selectNew":[4,"select-new"],"toSelectMarkupId":[32],"pointerDownPosition":[32],"addMarkup":[64],"removeMarkup":[64],"getMarkupElements":[64],"getMarkupElement":[64]},[[0,"markupEnd","handleMarkupEnd"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-710d16c2",[[1,"vertex-viewer-markup-tool",{"arrowTemplateId":[1,"arrow-template-id"],"circleTemplateId":[1,"circle-template-id"],"freeformTemplateId":[1,"freeform-template-id"],"tool":[1],"disabled":[4],"viewer":[16],"stateMap":[32],"reset":[64]}]]],["p-2a0a824e",[[1,"vertex-viewer-view-cube",{"xPositiveLabel":[1,"x-positive-label"],"xNegativeLabel":[1,"x-negative-label"],"yPositiveLabel":[1,"y-positive-label"],"yNegativeLabel":[1,"y-negative-label"],"zPositiveLabel":[1,"z-positive-label"],"zNegativeLabel":[1,"z-negative-label"],"standardViewsOff":[4,"standard-views-off"],"animationDuration":[2,"animation-duration"],"triadOff":[4,"triad-off"],"worldOrientation":[1040],"camera":[1040],"viewer":[16],"boxLength":[32],"triadPosition":[32]}]]],["p-c0c6db45",[[1,"vertex-viewer-measurement-distance",{"start":[1040],"startJson":[1,"start-json"],"end":[1040],"endJson":[1,"end-json"],"distance":[1026],"showAxisReferenceLines":[4,"show-axis-reference-lines"],"snapDistance":[2,"snap-distance"],"units":[1],"fractionalDigits":[2,"fractional-digits"],"labelFormatter":[16],"anchorLabelOffset":[2,"anchor-label-offset"],"lineCapLength":[2,"line-cap-length"],"mode":[513],"interactingAnchor":[1537,"interacting-anchor"],"invalid":[1540],"camera":[16],"hitProvider":[16],"indicatorPt":[1040],"viewer":[16],"measurementModel":[16],"viewport":[32],"elementBounds":[32],"interactionCount":[32],"internalCamera":[32],"invalidateStateCounter":[32],"stateMap":[32],"measurementUnits":[32],"computeElementMetrics":[64]}]]],["p-298aa35a",[[1,"vertex-viewer-measurement-precise",{"measurementModel":[16],"measurementOverlays":[16],"measurementController":[1040],"measurableEntityTypes":[16],"viewer":[16],"configEnv":[1,"config-env"],"config":[1]}]]],["p-4c4019b2",[[1,"vertex-viewer-box-query-tool",{"viewer":[16],"controller":[1040],"model":[1040],"operationType":[1,"operation-type"],"mode":[1],"details":[32]}]]],["p-f1bf192d",[[1,"vertex-viewer-walk-mode-tool",{"viewer":[16],"controller":[1040],"model":[1040],"teleportMode":[1,"teleport-mode"],"enabled":[4]}]]],["p-1e66b389",[[1,"vertex-scene-tree-table-cell",{"node":[16],"tree":[16],"value":[1],"placeholder":[1],"hovered":[1028],"isScrolling":[4,"is-scrolling"],"expandToggle":[4,"expand-toggle"],"visibilityToggle":[4,"visibility-toggle"],"selectionHandler":[16],"visibilityHandler":[16],"expansionHandler":[16],"hoverController":[16]}]]],["p-9725f5fc",[[1,"vertex-scene-tree-table-column",{"initialWidth":[2,"initial-width"],"minWidth":[2,"min-width"],"maxWidth":[2,"max-width"]}]]],["p-097909a8",[[1,"vertex-scene-tree-table-header"]]],["p-97aed77f",[[1,"vertex-scene-tree-table-resize-divider",{"dragging":[32]}]]],["p-2e194668",[[1,"vertex-scene-tree-toolbar-group"]]],["p-12a301e0",[[1,"vertex-viewer",{"src":[1],"clientId":[1,"client-id"],"deviceId":[1025,"device-id"],"config":[1],"configEnv":[1,"config-env"],"resolvedConfig":[1040],"cameraControls":[4,"camera-controls"],"cameraType":[1537,"camera-type"],"keyboardControls":[4,"keyboard-controls"],"rotateAroundTapPoint":[4,"rotate-around-tap-point"],"token":[1025],"depthBuffers":[1,"depth-buffers"],"phantom":[16],"noDefaultLights":[4,"no-default-lights"],"enableTemporalRefinement":[4,"enable-temporal-refinement"],"experimentalRenderingOptions":[1,"experimental-rendering-options"],"featureLines":[16],"selectionHighlighting":[16],"featureHighlighting":[16],"featureMaps":[1,"feature-maps"],"resizeDebounce":[2,"resize-debounce"],"frame":[1040],"stream":[1040],"stencilBuffer":[1040],"viewport":[1040],"dimensions":[32],"hostDimensions":[32],"errorMessage":[32],"cursor":[32],"stateMap":[32],"dispatchFrameDrawn":[64],"registerInteractionHandler":[64],"registerTapKeyInteraction":[64],"getInteractionTarget_DEPRECATED":[64],"addCursor":[64],"getInteractionHandlers":[64],"getKeyInteractions":[64],"getBaseInteractionHandler":[64],"getJwt":[64],"load":[64],"unload":[64],"scene":[64],"isSceneReady":[64]},[[0,"tap","handleTapEvent"]]]]],["p-293d308a",[[1,"vertex-viewer-hit-result-indicator",{"viewer":[16],"position":[1040],"normal":[1040]}]]],["p-567d24fa",[[1,"vertex-viewer-measurement-details",{"measurementModel":[16],"measurementOverlays":[16],"measurementOutcome":[1040],"distanceUnits":[1,"distance-units"],"angleUnits":[1,"angle-units"],"fractionalDigits":[2,"fractional-digits"],"distanceFormatter":[16],"angleFormatter":[16],"areaFormatter":[16],"resultTypes":[16],"overlay":[32],"distanceMeasurementUnits":[32],"angleMeasurementUnits":[32],"areaMeasurementUnits":[32]}]]],["p-a6da475b",[[1,"vertex-viewer-transform-widget",{"viewer":[16],"position":[1040],"rotation":[1040],"controller":[1040],"xRotationDisabled":[1028,"x-rotation-disabled"],"yRotationDisabled":[1028,"y-rotation-disabled"],"zRotationDisabled":[1028,"z-rotation-disabled"],"xTranslationDisabled":[1028,"x-translation-disabled"],"yTranslationDisabled":[1028,"y-translation-disabled"],"zTranslationDisabled":[1028,"z-translation-disabled"],"hovered":[1040]}]]],["p-a700d0b7",[[1,"vertex-viewer-icon",{"name":[1],"size":[1]}]]],["p-a7e1ccf7",[[0,"vertex-viewer-pin-group",{"pin":[16],"matrix":[1040],"projectionViewMatrix":[16],"elementBounds":[1040],"pinModel":[16],"pinController":[16],"selected":[4],"invalidateStateCounter":[32]}]]],["p-a4979444",[[1,"vertex-viewer-dom-group",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040]}]]],["p-5e57d7bb",[[1,"vertex-viewer-teleport-tool",{"viewer":[16],"mode":[1025],"animationsDisabled":[4,"animations-disabled"],"animationMs":[2,"animation-ms"],"controller":[1040],"model":[1040]}]]],["p-685355a4",[[1,"vertex-viewer-spinner",{"size":[1]}]]],["p-71b46981",[[1,"vertex-scene-tree-search",{"debounce":[2],"disabled":[4],"placeholder":[1],"controller":[16],"value":[1025],"focused":[32],"isSearching":[32],"setFocus":[64],"clear":[64]}],[1,"vertex-scene-tree-table-layout",{"tree":[16],"controller":[16],"rows":[16],"totalRows":[2,"total-rows"],"rowHeight":[1026,"row-height"],"overScanCount":[2,"over-scan-count"],"rowData":[16],"layoutOffset":[1026,"layout-offset"],"scrollOffset":[1026,"scroll-offset"],"layoutHeight":[1026,"layout-height"],"layoutWidth":[1026,"layout-width"],"viewportStartIndex":[1026,"viewport-start-index"],"viewportEndIndex":[1026,"viewport-end-index"],"columnGridLayout":[32],"columnGridFixedLayout":[32],"isComputingCellHeight":[32],"lastDividerPointerPosition":[32],"resizingColumnIndex":[32],"isScrolling":[32],"scrollTimer":[32],"stateMap":[32],"scrollToPosition":[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-1efa143f",[[1,"vertex-viewer-layer",{"stretchOff":[516,"stretch-off"]}]]],["p-c489590d",[[1,"vertex-viewer-toolbar",{"placement":[1],"direction":[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{"direction":[1]}]]],["p-bd4739c4",[[0,"vertex-viewer-pin-label",{"pin":[16],"elementBounds":[16],"value":[1025],"pinController":[16],"focused":[32],"computedScreenPosition":[32],"textareaRows":[32],"contentElBounds":[32],"setFocus":[64]}],[0,"vertex-viewer-pin-label-line",{"pinPoint":[16],"labelPoint":[16],"pin":[16]}]]],["p-024f0f95",[[1,"vertex-viewer-measurement-overlays",{"measurementOverlays":[16],"camera":[1040],"viewer":[16],"overlays":[32]}],[1,"vertex-viewer-measurement-line",{"start":[16],"end":[16],"capLength":[2,"cap-length"],"pointerEvents":[1,"pointer-events"]}]]],["p-0c71a2c0",[[1,"vertex-viewer-dom-renderer",{"drawMode":[1,"draw-mode"],"viewer":[16],"camera":[1040],"depthBuffer":[1040],"viewport":[32],"invalidateFrameCounter":[32]},[[0,"propertyChange","handlePropertyChange"]]],[1,"vertex-viewer-dom-element",{"position":[1040],"positionJson":[1,"position"],"rotation":[1040],"rotationJson":[1,"rotation"],"quaternion":[1040],"quaternionJson":[1,"quaternion"],"scale":[1040],"scaleJson":[1,"scale"],"matrix":[1040],"occlusionOff":[4,"occlusion-off"],"occluded":[516],"billboardOff":[4,"billboard-off"],"interactionsOff":[516,"interactions-off"]}]]],["p-6e8a6f8e",[[1,"vertex-viewer-markup-arrow",{"start":[1040],"startJson":[1,"start"],"end":[1040],"endJson":[1,"end"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-circle",{"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"dispose":[64]}],[1,"vertex-viewer-markup-freeform",{"points":[1040],"pointsJson":[1,"points"],"bounds":[1040],"boundsJson":[1,"bounds"],"mode":[513],"viewer":[16],"elementBounds":[32],"screenPoints":[32],"dispose":[64]}]]]]'),e)}));
|
|
5
5
|
//# sourceMappingURL=viewer.esm.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertexvis/viewer",
|
|
3
|
-
"version": "0.20.1
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "The Vertex SDK for viewing models.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vertex Developers <support@vertexvis.com> (https://developer.vertexvis.com)",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"@stencil/core": "^2.16.1",
|
|
51
51
|
"@types/classnames": "^2.3.1",
|
|
52
52
|
"@vertexvis/frame-streaming-protos": "^0.13.0",
|
|
53
|
-
"@vertexvis/geometry": "0.20.
|
|
54
|
-
"@vertexvis/html-templates": "0.20.
|
|
53
|
+
"@vertexvis/geometry": "0.20.0",
|
|
54
|
+
"@vertexvis/html-templates": "0.20.0",
|
|
55
55
|
"@vertexvis/scene-tree-protos": "^0.1.18",
|
|
56
56
|
"@vertexvis/scene-view-protos": "^0.2.1",
|
|
57
|
-
"@vertexvis/stream-api": "0.20.
|
|
58
|
-
"@vertexvis/utils": "0.20.
|
|
57
|
+
"@vertexvis/stream-api": "0.20.0",
|
|
58
|
+
"@vertexvis/utils": "0.20.0",
|
|
59
59
|
"@vertexvis/web-workers": "^0.1.0",
|
|
60
60
|
"camel-case": "^4.1.2",
|
|
61
61
|
"classnames": "^2.3.1",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@vertexvis/eslint-config-vertexvis-typescript": "^0.5.0",
|
|
83
83
|
"@vertexvis/rollup-plugin-web-workers": "^0.1.0",
|
|
84
84
|
"@vertexvis/typescript-config-vertexvis": "1.1.0",
|
|
85
|
-
"@vertexwebsdk/build": "0.20.
|
|
85
|
+
"@vertexwebsdk/build": "0.20.0",
|
|
86
86
|
"abortcontroller-polyfill": "^1.7.3",
|
|
87
87
|
"chance": "^1.1.8",
|
|
88
88
|
"eslint": "^8.17.0",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"typedoc": "^0.22.17",
|
|
98
98
|
"typescript": "^4.5.4"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "cb2398ae2a568bdaa608da28d79310a2d08c0ea5"
|
|
101
101
|
}
|
package/readme.md
CHANGED
|
@@ -27,11 +27,11 @@ file that references our published JS bundles from a CDN.
|
|
|
27
27
|
<head>
|
|
28
28
|
<link
|
|
29
29
|
rel="stylesheet"
|
|
30
|
-
href="https://unpkg.com/@vertexvis/viewer@0.20.
|
|
30
|
+
href="https://unpkg.com/@vertexvis/viewer@0.20.1/dist/viewer/viewer.css"
|
|
31
31
|
/>
|
|
32
32
|
<script
|
|
33
33
|
type="module"
|
|
34
|
-
src="https://unpkg.com/@vertexvis/viewer@0.20.
|
|
34
|
+
src="https://unpkg.com/@vertexvis/viewer@0.20.1/dist/viewer/viewer.esm.js"
|
|
35
35
|
></script>
|
|
36
36
|
</head>
|
|
37
37
|
|
|
@@ -53,7 +53,7 @@ These utilities can be imported from a CDN as shown below:
|
|
|
53
53
|
</head>
|
|
54
54
|
<body>
|
|
55
55
|
<script type="module">
|
|
56
|
-
import { ColorMaterial } from 'https://unpkg.com/@vertexvis/viewer@0.20.
|
|
56
|
+
import { ColorMaterial } from 'https://unpkg.com/@vertexvis/viewer@0.20.1/dist/esm/index.mjs';
|
|
57
57
|
|
|
58
58
|
function main() {
|
|
59
59
|
const color = ColorMaterial.fromHex('#ff0000');
|
|
@@ -90,7 +90,7 @@ dependency to your `package.json`:
|
|
|
90
90
|
```json
|
|
91
91
|
{
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@vertexvis/viewer": "^0.20.
|
|
93
|
+
"@vertexvis/viewer": "^0.20.1"
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"controller-0155a10a.js","mappings":";;;;;;;;MAsBa,iCAAiC;EAW5C,YACU,KAAmC,EACnC,MAA+B;IAD/B,UAAK,GAAL,KAAK,CAA8B;IACnC,WA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5D;UACA,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;UAC5B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;SAC9B;aAAM;UACL,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,CAAC,CAAC,CAAC;UAChE,MAAM,CAAC,CAAC;SACT;OACF;cAAS;QACR,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,MAAA,IAAI,CAAC,4BAA4B,mCAAI,IAAI,CAAC;QACvE,IAAI,CAAC,4BAA4B,GAAG,SAAS,CAAC;QAC9C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;UACxB,OAAO,EAAE,IAAI,CAAC,gBAAgB;SAC/B,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;OAC/B;KACF;SAAM,IAAI,IAAI,CAAC,iBAAiB,EAAE;MACjC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;MAEpB,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;KACH;SAAM;MACL,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;MAEpB,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,MAAA,IAAI,CAAC,4BAA4B,mCAAI,IAAI,CAAC;KACxE;GACF;;;;;","names":["EventDispatcher","StreamRequestError"],"sources":["./src/lib/volume-intersection/controller.ts"],"sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { StreamRequestError } from '@vertexvis/stream-api';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport {\n SceneItemOperationsBuilder,\n TerminalItemOperationBuilder,\n} from '../scenes';\nimport { SceneItemQueryExecutor } from '../scenes/queries';\nimport { VolumeIntersectionQueryModel } from './model';\n\nexport type OperationTransform = (\n builder: SceneItemOperationsBuilder\n) => TerminalItemOperationBuilder;\nexport type AdditionalTransform = (\n executor: SceneItemQueryExecutor\n) => TerminalItemOperationBuilder;\n\nexport interface CompleteExecutionDetails {\n aborted: boolean;\n}\n\nexport class VolumeIntersectionQueryController {\n private previousViewerCameraControls?: boolean;\n private operationTransform: OperationTransform;\n private additionalTransforms: AdditionalTransform[] = [];\n private operationInFlight = false;\n private operationAborted = false;\n\n private executeStarted = new EventDispatcher<void>();\n private executeComplete = new EventDispatcher<CompleteExecutionDetails>();\n private executeAborted = new EventDispatcher<StreamRequestError>();\n\n public constructor(\n private model: VolumeIntersectionQueryModel,\n private viewer: HTMLVertexViewerElement\n ) {\n this.additionalTransforms = [(op) => op.where((q) => q.all()).deselect()];\n this.operationTransform = (builder) => builder.select();\n }\n\n public setStartPoint(point: Point.Point): void {\n this.previousViewerCameraControls = this.viewer.cameraControls;\n this.viewer.cameraControls = false;\n\n this.model.setStartPoint(point);\n }\n\n public setEndPoint(point: Point.Point): void {\n this.model.setEndPoint(point);\n }\n\n /**\n * Updates the operation that will be applied based on the volume intersection\n * query. Defaults to `(builder) => builder.select()`, which will select any\n * of the results of the query.\n */\n public setOperationTransform(operationTransform: OperationTransform): void {\n this.operationTransform = operationTransform;\n }\n\n /**\n * Updates any additional operations that should be performed independent of\n * the volume intersection query. This can be used to perform an operation on\n * the entirety of the scene prior to the operation on the result of the\n * volume intersection query.\n * Defaults to `[(op) => op.where((q) => q.all()).deselect()]`, which will\n * clear any prior selection before the default selection.\n */\n public setAdditionalTransforms(\n additionalTransforms: AdditionalTransform[]\n ): void {\n this.additionalTransforms = additionalTransforms;\n }\n\n public onExecuteStarted(listener: Listener<void>): Disposable {\n return this.executeStarted.on(listener);\n }\n\n public onExecuteComplete(\n listener: Listener<CompleteExecutionDetails>\n ): Disposable {\n return this.executeComplete.on(listener);\n }\n\n public onExecuteAborted(listener: Listener<StreamRequestError>): Disposable {\n return this.executeAborted.on(listener);\n }\n\n public async execute(): Promise<void> {\n const screenBounds = this.model.getScreenBounds();\n const type = this.model.getType();\n\n if (screenBounds != null && !this.operationInFlight) {\n this.model.complete();\n\n try {\n this.operationInFlight = true;\n this.executeStarted.emit();\n\n const additionalTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n this.additionalTransforms.map((t) => t(op)).flat();\n const operationTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n [\n this.operationTransform(\n op.where((q) =>\n q.withVolumeIntersection(screenBounds, type === 'exclusive')\n )\n ),\n ].flat();\n\n const scene = await this.viewer.scene();\n await scene\n .items((op) => [\n ...additionalTransforms(op),\n ...operationTransforms(op),\n ])\n .execute();\n } catch (e) {\n if (\n e instanceof StreamRequestError &&\n e.summary?.toLocaleLowerCase().includes('operation aborted')\n ) {\n this.executeAborted.emit(e);\n this.operationAborted = true;\n } else {\n console.error('Failed to perform volume intersection query', e);\n throw e;\n }\n } finally {\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n this.previousViewerCameraControls = undefined;\n this.operationInFlight = false;\n this.executeComplete.emit({\n aborted: this.operationAborted,\n });\n this.operationAborted = false;\n }\n } else if (this.operationInFlight) {\n this.model.cancel();\n\n throw new Error(\n `Unable to perform volume intersection query as there is already one in-flight.`\n );\n } else {\n this.model.cancel();\n\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n }\n }\n}\n"],"version":3}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { S as StreamRequestError } from './bundle.esm2.js';
|
|
5
|
-
import { E as EventDispatcher } from './browser.esm.js';
|
|
6
|
-
|
|
7
|
-
class VolumeIntersectionQueryController {
|
|
8
|
-
constructor(model, viewer) {
|
|
9
|
-
this.model = model;
|
|
10
|
-
this.viewer = viewer;
|
|
11
|
-
this.additionalTransforms = [];
|
|
12
|
-
this.operationInFlight = false;
|
|
13
|
-
this.operationAborted = false;
|
|
14
|
-
this.executeStarted = new EventDispatcher();
|
|
15
|
-
this.executeComplete = new EventDispatcher();
|
|
16
|
-
this.executeAborted = new EventDispatcher();
|
|
17
|
-
this.additionalTransforms = [(op) => op.where((q) => q.all()).deselect()];
|
|
18
|
-
this.operationTransform = (builder) => builder.select();
|
|
19
|
-
}
|
|
20
|
-
setStartPoint(point) {
|
|
21
|
-
this.previousViewerCameraControls = this.viewer.cameraControls;
|
|
22
|
-
this.viewer.cameraControls = false;
|
|
23
|
-
this.model.setStartPoint(point);
|
|
24
|
-
}
|
|
25
|
-
setEndPoint(point) {
|
|
26
|
-
this.model.setEndPoint(point);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Updates the operation that will be applied based on the volume intersection
|
|
30
|
-
* query. Defaults to `(builder) => builder.select()`, which will select any
|
|
31
|
-
* of the results of the query.
|
|
32
|
-
*/
|
|
33
|
-
setOperationTransform(operationTransform) {
|
|
34
|
-
this.operationTransform = operationTransform;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Updates any additional operations that should be performed independent of
|
|
38
|
-
* the volume intersection query. This can be used to perform an operation on
|
|
39
|
-
* the entirety of the scene prior to the operation on the result of the
|
|
40
|
-
* volume intersection query.
|
|
41
|
-
* Defaults to `[(op) => op.where((q) => q.all()).deselect()]`, which will
|
|
42
|
-
* clear any prior selection before the default selection.
|
|
43
|
-
*/
|
|
44
|
-
setAdditionalTransforms(additionalTransforms) {
|
|
45
|
-
this.additionalTransforms = additionalTransforms;
|
|
46
|
-
}
|
|
47
|
-
onExecuteStarted(listener) {
|
|
48
|
-
return this.executeStarted.on(listener);
|
|
49
|
-
}
|
|
50
|
-
onExecuteComplete(listener) {
|
|
51
|
-
return this.executeComplete.on(listener);
|
|
52
|
-
}
|
|
53
|
-
onExecuteAborted(listener) {
|
|
54
|
-
return this.executeAborted.on(listener);
|
|
55
|
-
}
|
|
56
|
-
async execute() {
|
|
57
|
-
var _a, _b, _c;
|
|
58
|
-
const screenBounds = this.model.getScreenBounds();
|
|
59
|
-
const type = this.model.getType();
|
|
60
|
-
if (screenBounds != null && !this.operationInFlight) {
|
|
61
|
-
this.model.complete();
|
|
62
|
-
try {
|
|
63
|
-
this.operationInFlight = true;
|
|
64
|
-
this.executeStarted.emit();
|
|
65
|
-
const additionalTransforms = (op) => this.additionalTransforms.map((t) => t(op)).flat();
|
|
66
|
-
const operationTransforms = (op) => [
|
|
67
|
-
this.operationTransform(op.where((q) => q.withVolumeIntersection(screenBounds, type === 'exclusive'))),
|
|
68
|
-
].flat();
|
|
69
|
-
const scene = await this.viewer.scene();
|
|
70
|
-
await scene
|
|
71
|
-
.items((op) => [
|
|
72
|
-
...additionalTransforms(op),
|
|
73
|
-
...operationTransforms(op),
|
|
74
|
-
])
|
|
75
|
-
.execute();
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
if (e instanceof StreamRequestError &&
|
|
79
|
-
((_a = e.summary) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase().includes('operation aborted'))) {
|
|
80
|
-
this.executeAborted.emit(e);
|
|
81
|
-
this.operationAborted = true;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
console.error('Failed to perform volume intersection query', e);
|
|
85
|
-
throw e;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
finally {
|
|
89
|
-
this.viewer.cameraControls = (_b = this.previousViewerCameraControls) !== null && _b !== void 0 ? _b : true;
|
|
90
|
-
this.previousViewerCameraControls = undefined;
|
|
91
|
-
this.operationInFlight = false;
|
|
92
|
-
this.executeComplete.emit({
|
|
93
|
-
aborted: this.operationAborted,
|
|
94
|
-
});
|
|
95
|
-
this.operationAborted = false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else if (this.operationInFlight) {
|
|
99
|
-
this.model.cancel();
|
|
100
|
-
throw new Error(`Unable to perform volume intersection query as there is already one in-flight.`);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
this.model.cancel();
|
|
104
|
-
this.viewer.cameraControls = (_c = this.previousViewerCameraControls) !== null && _c !== void 0 ? _c : true;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export { VolumeIntersectionQueryController as V };
|
|
110
|
-
|
|
111
|
-
//# sourceMappingURL=controller3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"controller3.js","mappings":";;;;;;MAsBa,iCAAiC;EAW5C,YACU,KAAmC,EACnC,MAA+B;IAD/B,UAAK,GAAL,KAAK,CAA8B;IACnC,WAAM,GAAN,MAAM,CAAyB;IAVjC,yBAAoB,GAA0B,EAAE,CAAC;IACjD,sBAAiB,GAAG,KAAK,CAAC;IAC1B,qBAAgB,GAAG,KAAK,CAAC;IAEzB,mBAAc,GAAG,IAAI,eAAe,EAAQ,CAAC;IAC7C,oBAAe,GAAG,IAAI,eAAe,EAA4B,CAAC;IAClE,mBAAc,GAAG,IAAI,eAAe,EAAsB,CAAC;IAMjE,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1E,IAAI,CAAC,kBAAkB,GAAG,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;GACzD;EAEM,aAAa,CAAC,KAAkB;IACrC,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;IAC/D,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,KAAK,CAAC;IAEnC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;GACjC;EAEM,WAAW,CAAC,KAAkB;IACnC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;GAC/B;;;;;;EAOM,qBAAqB,CAAC,kBAAsC;IACjE,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;GAC9C;;;;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geometry';\nimport { StreamRequestError } from '@vertexvis/stream-api';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport {\n SceneItemOperationsBuilder,\n TerminalItemOperationBuilder,\n} from '../scenes';\nimport { SceneItemQueryExecutor } from '../scenes/queries';\nimport { VolumeIntersectionQueryModel } from './model';\n\nexport type OperationTransform = (\n builder: SceneItemOperationsBuilder\n) => TerminalItemOperationBuilder;\nexport type AdditionalTransform = (\n executor: SceneItemQueryExecutor\n) => TerminalItemOperationBuilder;\n\nexport interface CompleteExecutionDetails {\n aborted: boolean;\n}\n\nexport class VolumeIntersectionQueryController {\n private previousViewerCameraControls?: boolean;\n private operationTransform: OperationTransform;\n private additionalTransforms: AdditionalTransform[] = [];\n private operationInFlight = false;\n private operationAborted = false;\n\n private executeStarted = new EventDispatcher<void>();\n private executeComplete = new EventDispatcher<CompleteExecutionDetails>();\n private executeAborted = new EventDispatcher<StreamRequestError>();\n\n public constructor(\n private model: VolumeIntersectionQueryModel,\n private viewer: HTMLVertexViewerElement\n ) {\n this.additionalTransforms = [(op) => op.where((q) => q.all()).deselect()];\n this.operationTransform = (builder) => builder.select();\n }\n\n public setStartPoint(point: Point.Point): void {\n this.previousViewerCameraControls = this.viewer.cameraControls;\n this.viewer.cameraControls = false;\n\n this.model.setStartPoint(point);\n }\n\n public setEndPoint(point: Point.Point): void {\n this.model.setEndPoint(point);\n }\n\n /**\n * Updates the operation that will be applied based on the volume intersection\n * query. Defaults to `(builder) => builder.select()`, which will select any\n * of the results of the query.\n */\n public setOperationTransform(operationTransform: OperationTransform): void {\n this.operationTransform = operationTransform;\n }\n\n /**\n * Updates any additional operations that should be performed independent of\n * the volume intersection query. This can be used to perform an operation on\n * the entirety of the scene prior to the operation on the result of the\n * volume intersection query.\n * Defaults to `[(op) => op.where((q) => q.all()).deselect()]`, which will\n * clear any prior selection before the default selection.\n */\n public setAdditionalTransforms(\n additionalTransforms: AdditionalTransform[]\n ): void {\n this.additionalTransforms = additionalTransforms;\n }\n\n public onExecuteStarted(listener: Listener<void>): Disposable {\n return this.executeStarted.on(listener);\n }\n\n public onExecuteComplete(\n listener: Listener<CompleteExecutionDetails>\n ): Disposable {\n return this.executeComplete.on(listener);\n }\n\n public onExecuteAborted(listener: Listener<StreamRequestError>): Disposable {\n return this.executeAborted.on(listener);\n }\n\n public async execute(): Promise<void> {\n const screenBounds = this.model.getScreenBounds();\n const type = this.model.getType();\n\n if (screenBounds != null && !this.operationInFlight) {\n this.model.complete();\n\n try {\n this.operationInFlight = true;\n this.executeStarted.emit();\n\n const additionalTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n this.additionalTransforms.map((t) => t(op)).flat();\n const operationTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n [\n this.operationTransform(\n op.where((q) =>\n q.withVolumeIntersection(screenBounds, type === 'exclusive')\n )\n ),\n ].flat();\n\n const scene = await this.viewer.scene();\n await scene\n .items((op) => [\n ...additionalTransforms(op),\n ...operationTransforms(op),\n ])\n .execute();\n } catch (e) {\n if (\n e instanceof StreamRequestError &&\n e.summary?.toLocaleLowerCase().includes('operation aborted')\n ) {\n this.executeAborted.emit(e);\n this.operationAborted = true;\n } else {\n console.error('Failed to perform volume intersection query', e);\n throw e;\n }\n } finally {\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n this.previousViewerCameraControls = undefined;\n this.operationInFlight = false;\n this.executeComplete.emit({\n aborted: this.operationAborted,\n });\n this.operationAborted = false;\n }\n } else if (this.operationInFlight) {\n this.model.cancel();\n\n throw new Error(\n `Unable to perform volume intersection query as there is already one in-flight.`\n );\n } else {\n this.model.cancel();\n\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n }\n }\n}\n"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"controller-f0d7a836.js","mappings":";;;;;;MAsBa,iCAAiC;EAW5C,YACU,KAAmC,EACnC,MAA+B;IAD/B,UAAK,GA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,CAAC,CAAA,EAC5D;UACA,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;UAC5B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;SAC9B;aAAM;UACL,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,CAAC,CAAC,CAAC;UAChE,MAAM,CAAC,CAAC;SACT;OACF;cAAS;QACR,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,MAAA,IAAI,CAAC,4BAA4B,mCAAI,IAAI,CAAC;QACvE,IAAI,CAAC,4BAA4B,GAAG,SAAS,CAAC;QAC9C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;UACxB,OAAO,EAAE,IAAI,CAAC,gBAAgB;SAC/B,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;OAC/B;KACF;SAAM,IAAI,IAAI,CAAC,iBAAiB,EAAE;MACjC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;MAEpB,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;KACH;SAAM;MACL,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;MAEpB,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,MAAA,IAAI,CAAC,4BAA4B,mCAAI,IAAI,CAAC;KACxE;GACF;;;;;","names":[],"sources":["./src/lib/volume-intersection/controller.ts"],"sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { StreamRequestError } from '@vertexvis/stream-api';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport {\n SceneItemOperationsBuilder,\n TerminalItemOperationBuilder,\n} from '../scenes';\nimport { SceneItemQueryExecutor } from '../scenes/queries';\nimport { VolumeIntersectionQueryModel } from './model';\n\nexport type OperationTransform = (\n builder: SceneItemOperationsBuilder\n) => TerminalItemOperationBuilder;\nexport type AdditionalTransform = (\n executor: SceneItemQueryExecutor\n) => TerminalItemOperationBuilder;\n\nexport interface CompleteExecutionDetails {\n aborted: boolean;\n}\n\nexport class VolumeIntersectionQueryController {\n private previousViewerCameraControls?: boolean;\n private operationTransform: OperationTransform;\n private additionalTransforms: AdditionalTransform[] = [];\n private operationInFlight = false;\n private operationAborted = false;\n\n private executeStarted = new EventDispatcher<void>();\n private executeComplete = new EventDispatcher<CompleteExecutionDetails>();\n private executeAborted = new EventDispatcher<StreamRequestError>();\n\n public constructor(\n private model: VolumeIntersectionQueryModel,\n private viewer: HTMLVertexViewerElement\n ) {\n this.additionalTransforms = [(op) => op.where((q) => q.all()).deselect()];\n this.operationTransform = (builder) => builder.select();\n }\n\n public setStartPoint(point: Point.Point): void {\n this.previousViewerCameraControls = this.viewer.cameraControls;\n this.viewer.cameraControls = false;\n\n this.model.setStartPoint(point);\n }\n\n public setEndPoint(point: Point.Point): void {\n this.model.setEndPoint(point);\n }\n\n /**\n * Updates the operation that will be applied based on the volume intersection\n * query. Defaults to `(builder) => builder.select()`, which will select any\n * of the results of the query.\n */\n public setOperationTransform(operationTransform: OperationTransform): void {\n this.operationTransform = operationTransform;\n }\n\n /**\n * Updates any additional operations that should be performed independent of\n * the volume intersection query. This can be used to perform an operation on\n * the entirety of the scene prior to the operation on the result of the\n * volume intersection query.\n * Defaults to `[(op) => op.where((q) => q.all()).deselect()]`, which will\n * clear any prior selection before the default selection.\n */\n public setAdditionalTransforms(\n additionalTransforms: AdditionalTransform[]\n ): void {\n this.additionalTransforms = additionalTransforms;\n }\n\n public onExecuteStarted(listener: Listener<void>): Disposable {\n return this.executeStarted.on(listener);\n }\n\n public onExecuteComplete(\n listener: Listener<CompleteExecutionDetails>\n ): Disposable {\n return this.executeComplete.on(listener);\n }\n\n public onExecuteAborted(listener: Listener<StreamRequestError>): Disposable {\n return this.executeAborted.on(listener);\n }\n\n public async execute(): Promise<void> {\n const screenBounds = this.model.getScreenBounds();\n const type = this.model.getType();\n\n if (screenBounds != null && !this.operationInFlight) {\n this.model.complete();\n\n try {\n this.operationInFlight = true;\n this.executeStarted.emit();\n\n const additionalTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n this.additionalTransforms.map((t) => t(op)).flat();\n const operationTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n [\n this.operationTransform(\n op.where((q) =>\n q.withVolumeIntersection(screenBounds, type === 'exclusive')\n )\n ),\n ].flat();\n\n const scene = await this.viewer.scene();\n await scene\n .items((op) => [\n ...additionalTransforms(op),\n ...operationTransforms(op),\n ])\n .execute();\n } catch (e) {\n if (\n e instanceof StreamRequestError &&\n e.summary?.toLocaleLowerCase().includes('operation aborted')\n ) {\n this.executeAborted.emit(e);\n this.operationAborted = true;\n } else {\n console.error('Failed to perform volume intersection query', e);\n throw e;\n }\n } finally {\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n this.previousViewerCameraControls = undefined;\n this.operationInFlight = false;\n this.executeComplete.emit({\n aborted: this.operationAborted,\n });\n this.operationAborted = false;\n }\n } else if (this.operationInFlight) {\n this.model.cancel();\n\n throw new Error(\n `Unable to perform volume intersection query as there is already one in-flight.`\n );\n } else {\n this.model.cancel();\n\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n }\n }\n}\n"],"version":3}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import{S as t}from"./p-10bf891d.js";import{E as s}from"./p-86a55f3b.js";class i{constructor(t,i){this.model=t;this.viewer=i;this.additionalTransforms=[];this.operationInFlight=false;this.operationAborted=false;this.executeStarted=new s;this.executeComplete=new s;this.executeAborted=new s;this.additionalTransforms=[t=>t.where((t=>t.all())).deselect()];this.operationTransform=t=>t.select()}setStartPoint(t){this.previousViewerCameraControls=this.viewer.cameraControls;this.viewer.cameraControls=false;this.model.setStartPoint(t)}setEndPoint(t){this.model.setEndPoint(t)}setOperationTransform(t){this.operationTransform=t}setAdditionalTransforms(t){this.additionalTransforms=t}onExecuteStarted(t){return this.executeStarted.on(t)}onExecuteComplete(t){return this.executeComplete.on(t)}onExecuteAborted(t){return this.executeAborted.on(t)}async execute(){var s,i,e;const h=this.model.getScreenBounds();const o=this.model.getType();if(h!=null&&!this.operationInFlight){this.model.complete();try{this.operationInFlight=true;this.executeStarted.emit();const t=t=>this.additionalTransforms.map((s=>s(t))).flat();const s=t=>[this.operationTransform(t.where((t=>t.withVolumeIntersection(h,o==="exclusive"))))].flat();const e=await this.viewer.scene();await e.items((i=>[...t(i),...s(i)])).execute()}catch(i){if(i instanceof t&&((s=i.summary)===null||s===void 0?void 0:s.toLocaleLowerCase().includes("operation aborted"))){this.executeAborted.emit(i);this.operationAborted=true}else{console.error("Failed to perform volume intersection query",i);throw i}}finally{this.viewer.cameraControls=(i=this.previousViewerCameraControls)!==null&&i!==void 0?i:true;this.previousViewerCameraControls=undefined;this.operationInFlight=false;this.executeComplete.emit({aborted:this.operationAborted});this.operationAborted=false}}else if(this.operationInFlight){this.model.cancel();throw new Error(`Unable to perform volume intersection query as there is already one in-flight.`)}else{this.model.cancel();this.viewer.cameraControls=(e=this.previousViewerCameraControls)!==null&&e!==void 0?e:true}}}export{i as V};
|
|
5
|
-
//# sourceMappingURL=p-b50678f0.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["src/lib/volume-intersection/controller.ts"],"names":["VolumeIntersectionQueryController","[object Object]","model","viewer","this","additionalTransforms","operationInFlight","operationAborted","executeStarted","EventDispatcher","executeComplete","executeAborted","op","where","q","all","deselect","operationTransform","builder","select","point","previousViewerCameraControls","cameraControls","setStartPoint","setEndPoint","listener","on","screenBounds","getScreenBounds","type","getType","complete","emit","map","t","flat","operationTransforms","withVolumeIntersection","scene","items","execute","e","StreamRequestError","_a","summary","toLocaleLowerCase","includes","console","error","_b","undefined","aborted","cancel","Error","_c"],"mappings":";;;8EAsBaA,E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O,MACrBwB,EAAoBxB,MAExB4B,UACH,MAAOC,GACP,GACEA,aAAaC,KACbC,EAAAF,EAAEG,WAAO,MAAAD,SAAA,OAAA,EAAAA,EAAEE,oBAAoBC,SAAS,sBACxC,CACA1C,KAAKO,eAAeqB,KAAKS,GACzBrC,KAAKG,iBAAmB,SACnB,CACLwC,QAAQC,MAAM,8CAA+CP,GAC7D,MAAMA,WAGRrC,KAAKD,OAAOmB,gBAAiB2B,EAAA7C,KAAKiB,gCAA4B,MAAA4B,SAAA,EAAAA,EAAI,KAClE7C,KAAKiB,6BAA+B6B,UACpC9C,KAAKE,kBAAoB,MACzBF,KAAKM,gBAAgBsB,KAAK,CACxBmB,QAAS/C,KAAKG,mBAEhBH,KAAKG,iBAAmB,YAErB,GAAIH,KAAKE,kBAAmB,CACjCF,KAAKF,MAAMkD,SAEX,MAAM,IAAIC,MACR,sFAEG,CACLjD,KAAKF,MAAMkD,SAEXhD,KAAKD,OAAOmB,gBAAiBgC,EAAAlD,KAAKiB,gCAA4B,MAAAiC,SAAA,EAAAA,EAAI","sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { StreamRequestError } from '@vertexvis/stream-api';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport {\n SceneItemOperationsBuilder,\n TerminalItemOperationBuilder,\n} from '../scenes';\nimport { SceneItemQueryExecutor } from '../scenes/queries';\nimport { VolumeIntersectionQueryModel } from './model';\n\nexport type OperationTransform = (\n builder: SceneItemOperationsBuilder\n) => TerminalItemOperationBuilder;\nexport type AdditionalTransform = (\n executor: SceneItemQueryExecutor\n) => TerminalItemOperationBuilder;\n\nexport interface CompleteExecutionDetails {\n aborted: boolean;\n}\n\nexport class VolumeIntersectionQueryController {\n private previousViewerCameraControls?: boolean;\n private operationTransform: OperationTransform;\n private additionalTransforms: AdditionalTransform[] = [];\n private operationInFlight = false;\n private operationAborted = false;\n\n private executeStarted = new EventDispatcher<void>();\n private executeComplete = new EventDispatcher<CompleteExecutionDetails>();\n private executeAborted = new EventDispatcher<StreamRequestError>();\n\n public constructor(\n private model: VolumeIntersectionQueryModel,\n private viewer: HTMLVertexViewerElement\n ) {\n this.additionalTransforms = [(op) => op.where((q) => q.all()).deselect()];\n this.operationTransform = (builder) => builder.select();\n }\n\n public setStartPoint(point: Point.Point): void {\n this.previousViewerCameraControls = this.viewer.cameraControls;\n this.viewer.cameraControls = false;\n\n this.model.setStartPoint(point);\n }\n\n public setEndPoint(point: Point.Point): void {\n this.model.setEndPoint(point);\n }\n\n /**\n * Updates the operation that will be applied based on the volume intersection\n * query. Defaults to `(builder) => builder.select()`, which will select any\n * of the results of the query.\n */\n public setOperationTransform(operationTransform: OperationTransform): void {\n this.operationTransform = operationTransform;\n }\n\n /**\n * Updates any additional operations that should be performed independent of\n * the volume intersection query. This can be used to perform an operation on\n * the entirety of the scene prior to the operation on the result of the\n * volume intersection query.\n * Defaults to `[(op) => op.where((q) => q.all()).deselect()]`, which will\n * clear any prior selection before the default selection.\n */\n public setAdditionalTransforms(\n additionalTransforms: AdditionalTransform[]\n ): void {\n this.additionalTransforms = additionalTransforms;\n }\n\n public onExecuteStarted(listener: Listener<void>): Disposable {\n return this.executeStarted.on(listener);\n }\n\n public onExecuteComplete(\n listener: Listener<CompleteExecutionDetails>\n ): Disposable {\n return this.executeComplete.on(listener);\n }\n\n public onExecuteAborted(listener: Listener<StreamRequestError>): Disposable {\n return this.executeAborted.on(listener);\n }\n\n public async execute(): Promise<void> {\n const screenBounds = this.model.getScreenBounds();\n const type = this.model.getType();\n\n if (screenBounds != null && !this.operationInFlight) {\n this.model.complete();\n\n try {\n this.operationInFlight = true;\n this.executeStarted.emit();\n\n const additionalTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n this.additionalTransforms.map((t) => t(op)).flat();\n const operationTransforms = (\n op: SceneItemQueryExecutor\n ): SceneItemOperationsBuilder[] =>\n [\n this.operationTransform(\n op.where((q) =>\n q.withVolumeIntersection(screenBounds, type === 'exclusive')\n )\n ),\n ].flat();\n\n const scene = await this.viewer.scene();\n await scene\n .items((op) => [\n ...additionalTransforms(op),\n ...operationTransforms(op),\n ])\n .execute();\n } catch (e) {\n if (\n e instanceof StreamRequestError &&\n e.summary?.toLocaleLowerCase().includes('operation aborted')\n ) {\n this.executeAborted.emit(e);\n this.operationAborted = true;\n } else {\n console.error('Failed to perform volume intersection query', e);\n throw e;\n }\n } finally {\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n this.previousViewerCameraControls = undefined;\n this.operationInFlight = false;\n this.executeComplete.emit({\n aborted: this.operationAborted,\n });\n this.operationAborted = false;\n }\n } else if (this.operationInFlight) {\n this.model.cancel();\n\n throw new Error(\n `Unable to perform volume intersection query as there is already one in-flight.`\n );\n } else {\n this.model.cancel();\n\n this.viewer.cameraControls = this.previousViewerCameraControls ?? true;\n }\n }\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2024 Vertex Software LLC. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import{r as i,h as t,H as e,g as s}from"./p-e4ea1075.js";import{V as o}from"./p-b50678f0.js";import{b as l}from"./p-fb478135.js";import{g as r}from"./p-930dafc6.js";import{p as n,e as h}from"./p-a3a3abe7.js";import{E as d}from"./p-86a55f3b.js";import"./p-10bf891d.js";class u{constructor(i){this.controller=i;this.handleDragBegin=this.handleDragBegin.bind(this);this.handleDrag=this.handleDrag.bind(this);this.handleDragEnd=this.handleDragEnd.bind(this);this.enabled=true}initialize(i,t){this.element=i;this.api=t;this.element.addEventListener("pointerdown",this.handleDragBegin);this.addCrosshairCursor()}dispose(){var i,t,e;(i=this.element)===null||i===void 0?void 0:i.removeEventListener("pointerdown",this.handleDragBegin);window.removeEventListener("pointermove",this.handleDrag);window.removeEventListener("pointerup",this.handleDragEnd);(t=this.crosshairCursorDisposable)===null||t===void 0?void 0:t.dispose();(e=this.waitCursorDisposable)===null||e===void 0?void 0:e.dispose();this.element=undefined;this.api=undefined;this.enabled=true}disable(){this.enabled=false}enable(){this.enabled=true}handleDragBegin(i){var t;if(this.enabled&&this.isPrimaryMouseButtonClick(i)&&!this.isInteracting){this.elementBounds=(t=this.element)===null||t===void 0?void 0:t.getBoundingClientRect();this.isInteracting=true;this.controller.setStartPoint(r(i,this.elementBounds));window.addEventListener("pointermove",this.handleDrag);window.addEventListener("pointerup",this.handleDragEnd)}}handleDrag(i){if(this.enabled){this.controller.setEndPoint(r(i,this.elementBounds))}}async handleDragEnd(){var i,t;this.isInteracting=false;window.removeEventListener("pointermove",this.handleDrag);window.removeEventListener("pointerup",this.handleDragEnd);(i=this.crosshairCursorDisposable)===null||i===void 0?void 0:i.dispose();if(this.enabled){this.addWaitCursor();try{await this.controller.execute()}finally{(t=this.waitCursorDisposable)===null||t===void 0?void 0:t.dispose();this.addCrosshairCursor()}}}isPrimaryMouseButtonClick(i){return i.buttons===1}addCrosshairCursor(){var i,t;(i=this.crosshairCursorDisposable)===null||i===void 0?void 0:i.dispose();this.crosshairCursorDisposable=(t=this.api)===null||t===void 0?void 0:t.addCursor(l)}addWaitCursor(){var i,t;(i=this.waitCursorDisposable)===null||i===void 0?void 0:i.dispose();this.waitCursorDisposable=(t=this.api)===null||t===void 0?void 0:t.addCursor("wait")}}class a{constructor(i){this.mode=i;this.dragStarted=new d;this.dragComplete=new d;this.dragCancelled=new d;this.screenBoundsChanged=new d}setStartPoint(i){this.startPoint=i;this.dragStarted.emit()}setEndPoint(i){if(this.startPoint!=null&&n.distance(this.startPoint,i)>=2){this.endPoint=i;this.updateQueryType();this.screenBoundsChanged.emit(this.getQueryDetails())}}setMode(i){this.mode=i}complete(){if(this.startPoint!=null&&this.endPoint!=null){this.screenBoundsChanged.emit(undefined);this.dragComplete.emit(this.getQueryDetails());this.reset()}}cancel(){this.screenBoundsChanged.emit(undefined);this.dragCancelled.emit();this.reset()}reset(){this.startPoint=undefined;this.endPoint=undefined;this.type=undefined}getScreenBounds(){return this.startPoint!=null&&this.endPoint!=null?h.fromPoints(this.startPoint,this.endPoint):undefined}getType(){return this.type}onScreenBoundsChanged(i){return this.screenBoundsChanged.on(i)}onDragStarted(i){return this.dragStarted.on(i)}onDragComplete(i){return this.dragComplete.on(i)}onDragCancelled(i){return this.dragCancelled.on(i)}getQueryDetails(){if(this.startPoint!=null&&this.endPoint!=null&&this.type!=null){return{screenBounds:h.fromPoints(this.startPoint,this.endPoint),type:this.type}}else{throw new Error("Failed to create query details, the start and end points must be set.")}}updateQueryType(){var i;if(this.startPoint!=null&&this.endPoint!=null){const t=n.subtract(this.endPoint,this.startPoint).x>0?"exclusive":"inclusive";this.type=(i=this.mode)!==null&&i!==void 0?i:t}}}const v=':host{--viewer-box-query-outline-exclusive-color:#0099cc;--viewer-box-query-outline-exclusive-border-style:solid;--viewer-box-query-outline-inclusive-color:#00cc00;--viewer-box-query-outline-inclusive-border-style:dashed;--viewer-box-query-outline-border-radius:0.25rem;--viewer-box-query-outline-fill-opacity:0.25}.bounds{position:absolute}.outline{position:absolute;top:0;left:0;width:100%;height:100%;box-sizing:border-box;border-radius:var(--viewer-box-query-outline-border-radius)}:host([exclusive="true"]) .outline{border:3px var(--viewer-box-query-outline-exclusive-border-style) var(--viewer-box-query-outline-exclusive-color)}:host([inclusive="true"]) .outline{border:3px var(--viewer-box-query-outline-inclusive-border-style) var(--viewer-box-query-outline-inclusive-color)}.fill{position:absolute;top:0;left:0;width:100%;height:100%;opacity:var(--viewer-box-query-outline-fill-opacity);border-radius:var(--viewer-box-query-outline-border-radius)}:host([exclusive="true"]) .fill{background-color:var(--viewer-box-query-outline-exclusive-color)}:host([inclusive="true"]) .fill{background-color:var(--viewer-box-query-outline-inclusive-color)}';const c=class{constructor(t){i(this,t);this.operationType="clearAndSelect";this.handleScreenBoundsChanged=this.handleScreenBoundsChanged.bind(this);this.handleExecuteStarted=this.handleExecuteStarted.bind(this);this.handleExecuteComplete=this.handleExecuteComplete.bind(this)}componentWillLoad(){var i;this.model=(i=this.model)!==null&&i!==void 0?i:new a(this.mode);this.screenBoundsChangedDisposable=this.model.onScreenBoundsChanged(this.handleScreenBoundsChanged);this.handleViewerChanged(this.viewer);this.handleControllerChange(this.controller);this.handleDefaultOperationChange(this.operationType)}disconnectedCallback(){var i,t,e,s;(i=this.model)===null||i===void 0?void 0:i.reset();(t=this.screenBoundsChangedDisposable)===null||t===void 0?void 0:t.dispose();(e=this.operationStartedDisposable)===null||e===void 0?void 0:e.dispose();(s=this.operationCompleteDisposable)===null||s===void 0?void 0:s.dispose();this.deregisterInteractionHandler()}handleViewerChanged(i){this.deregisterInteractionHandler();if(this.model!=null&&i!=null){this.controller=new o(this.model,i);this.handleDefaultOperationChange(this.operationType);this.registerInteractionHandler(this.controller,i)}}handleDefaultOperationChange(i){switch(i){case"clearAndSelect":this.setDefaultClearAndSelectOperation();break;case"select":this.setDefaultSelectOperation();break;case"deselect":this.setDefaultDeselectOperation();break}}handleModeChange(i){var t;(t=this.model)===null||t===void 0?void 0:t.setMode(i)}handleControllerChange(i){var t,e;(t=this.operationStartedDisposable)===null||t===void 0?void 0:t.dispose();(e=this.operationCompleteDisposable)===null||e===void 0?void 0:e.dispose();this.operationStartedDisposable=i===null||i===void 0?void 0:i.onExecuteStarted(this.handleExecuteStarted);this.operationStartedDisposable=i===null||i===void 0?void 0:i.onExecuteComplete(this.handleExecuteComplete)}render(){return t(e,null,t("vertex-viewer-layer",null,this.details!=null&&t("div",{class:"bounds",style:{left:`${this.details.screenBounds.x}px`,top:`${this.details.screenBounds.y}px`,width:`${this.details.screenBounds.width}px`,height:`${this.details.screenBounds.height}px`}},t("slot",{name:"bounds"},t("div",{class:"outline"}),t("div",{class:"fill"})))))}handleScreenBoundsChanged(i){this.details=i;this.updateTypeAttribute(i===null||i===void 0?void 0:i.type)}handleExecuteStarted(){var i;(i=this.interactionHandler)===null||i===void 0?void 0:i.disable()}handleExecuteComplete(){var i;(i=this.interactionHandler)===null||i===void 0?void 0:i.enable()}async registerInteractionHandler(i,t){this.interactionHandler=new u(i);this.interactionHandlerDisposable=await t.registerInteractionHandler(this.interactionHandler)}deregisterInteractionHandler(){var i,t;(i=this.interactionHandlerDisposable)===null||i===void 0?void 0:i.dispose();(t=this.interactionHandler)===null||t===void 0?void 0:t.dispose();this.interactionHandler=undefined}updateTypeAttribute(i){this.hostEl.setAttribute("inclusive",`${i==="inclusive"}`);this.hostEl.setAttribute("exclusive",`${i==="exclusive"}`)}setDefaultClearAndSelectOperation(){var i,t;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.select()));(t=this.controller)===null||t===void 0?void 0:t.setAdditionalTransforms([i=>i.where((i=>i.withSelected())).deselect()])}setDefaultSelectOperation(){var i,t;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.select()));(t=this.controller)===null||t===void 0?void 0:t.setAdditionalTransforms([])}setDefaultDeselectOperation(){var i,t;(i=this.controller)===null||i===void 0?void 0:i.setOperationTransform((i=>i.deselect()));(t=this.controller)===null||t===void 0?void 0:t.setAdditionalTransforms([])}get hostEl(){return s(this)}static get watchers(){return{viewer:["handleViewerChanged"],operationType:["handleDefaultOperationChange"],mode:["handleModeChange"],controller:["handleControllerChange"]}}};c.style=v;export{c as vertex_viewer_box_query_tool};
|
|
5
|
-
//# sourceMappingURL=p-c6e12cf7.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["src/lib/volume-intersection/interactions.ts","src/lib/volume-intersection/model.ts","src/components/viewer-box-query-tool/viewer-box-query-tool.css?tag=vertex-viewer-box-query-tool&encapsulation=shadow","src/components/viewer-box-query-tool/viewer-box-query-tool.tsx"],"names":["VolumeIntersectionQueryInteractionHandler","[object Object]","controller","this","handleDragBegin","bind","handleDrag","handleDragEnd","enabled","element","api","addEventListener","addCrosshairCursor","_a","removeEventListener","window","_b","crosshairCursorDisposable","dispose","_c","waitCursorDisposable","undefined","event","isPrimaryMouseButtonClick","isInteracting","elementBounds","getBoundingClientRect","setStartPoint","getMouseClientPosition","setEndPoint","addWaitCursor","execute","buttons","addCursor","boxQueryCursor","VolumeIntersectionQueryModel","mode","dragStarted","EventDispatcher","dragComplete","dragCancelled","screenBoundsChanged","point","startPoint","emit","Point","distance","endPoint","updateQueryType","getQueryDetails","reset","type","Rectangle","fromPoints","listener","on","screenBounds","Error","directionalType","subtract","x","viewerBoxQueryToolCss","ViewerBoxQueryTool","hostRef","operationType","handleScreenBoundsChanged","handleExecuteStarted","handleExecuteComplete","model","screenBoundsChangedDisposable","onScreenBoundsChanged","handleViewerChanged","viewer","handleControllerChange","handleDefaultOperationChange","operationStartedDisposable","_d","operationCompleteDisposable","deregisterInteractionHandler","newViewer","VolumeIntersectionQueryController","registerInteractionHandler","updatedOperationType","setDefaultClearAndSelectOperation","setDefaultSelectOperation","setDefaultDeselectOperation","updatedMode","setMode","onExecuteStarted","onExecuteComplete","h","Host","details","class","style","left","top","y","width","height","name","updateTypeAttribute","interactionHandler","disable","enable","interactionHandlerDisposable","hostEl","setAttribute","setOperationTransform","builder","select","setAdditionalTransforms","op","where","q","withSelected","deselect"],"mappings":";;;kRAQaA,EAWXC,YAA2BC,GAAAC,KAAAD,WAAAA,EACzBC,KAAKC,gBAAkBD,KAAKC,gBAAgBC,KAAKF,MACjDA,KAAKG,WAAaH,KAAKG,WAAWD,KAAKF,MACvCA,KAAKI,cAAgBJ,KAAKI,cAAcF,KAAKF,MAE7CA,KAAKK,QAAU,KAGVP,WAAWQ,EAAsBC,GACtCP,KAAKM,QAAUA,EACfN,KAAKO,IAAMA,EAEXP,KAAKM,QAAQE,iBAAiB,cAAeR,KAAKC,iBAClDD,KAAKS,qBAGAX,qBACLY,EAAAV,KAAKM,WAAO,MAAAI,SAAA,OAAA,EAAAA,EAAEC,oBAAoB,cAAeX,KAAKC,iBACtDW,OAAOD,oBAAoB,cAAeX,KAAKG,YAC/CS,OAAOD,oBAAoB,YAAaX,KAAKI,gBAC7CS,EAAAb,KAAKc,6BAAyB,MAAAD,SA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posable } from '@vertexvis/utils';\n\nimport { boxQueryCursor } from '../cursors';\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionApi } from '../interactions';\nimport { InteractionHandler } from '../interactions/interactionHandler';\nimport { VolumeIntersectionQueryController } from './controller';\n\nexport class VolumeIntersectionQueryInteractionHandler\n implements InteractionHandler\n{\n private element?: HTMLElement;\n private api?: InteractionApi;\n private isInteracting?: boolean;\n private enabled?: boolean;\n private elementBounds?: DOMRect;\n private crosshairCursorDisposable?: Disposable;\n private waitCursorDisposable?: Disposable;\n\n public constructor(private controller: VolumeIntersectionQueryController) {\n this.handleDragBegin = this.handleDragBegin.bind(this);\n this.handleDrag = this.handleDrag.bind(this);\n this.handleDragEnd = this.handleDragEnd.bind(this);\n\n this.enabled = true;\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.api = api;\n\n this.element.addEventListener('pointerdown', this.handleDragBegin);\n this.addCrosshairCursor();\n }\n\n public dispose(): void {\n this.element?.removeEventListener('pointerdown', this.handleDragBegin);\n window.removeEventListener('pointermove', this.handleDrag);\n window.removeEventListener('pointerup', this.handleDragEnd);\n this.crosshairCursorDisposable?.dispose();\n this.waitCursorDisposable?.dispose();\n\n this.element = undefined;\n this.api = undefined;\n this.enabled = true;\n }\n\n public disable(): void {\n this.enabled = false;\n }\n\n public enable(): void {\n this.enabled = true;\n }\n\n private handleDragBegin(event: PointerEvent): void {\n if (\n this.enabled &&\n this.isPrimaryMouseButtonClick(event) &&\n !this.isInteracting\n ) {\n this.elementBounds = this.element?.getBoundingClientRect();\n this.isInteracting = true;\n this.controller.setStartPoint(\n getMouseClientPosition(event, this.elementBounds)\n );\n\n window.addEventListener('pointermove', this.handleDrag);\n window.addEventListener('pointerup', this.handleDragEnd);\n }\n }\n\n private handleDrag(event: PointerEvent): void {\n if (this.enabled) {\n this.controller.setEndPoint(\n getMouseClientPosition(event, this.elementBounds)\n );\n }\n }\n\n private async handleDragEnd(): Promise<void> {\n this.isInteracting = false;\n\n window.removeEventListener('pointermove', this.handleDrag);\n window.removeEventListener('pointerup', this.handleDragEnd);\n\n this.crosshairCursorDisposable?.dispose();\n if (this.enabled) {\n this.addWaitCursor();\n try {\n await this.controller.execute();\n } finally {\n this.waitCursorDisposable?.dispose();\n this.addCrosshairCursor();\n }\n }\n }\n\n private isPrimaryMouseButtonClick(event: PointerEvent): boolean {\n return event.buttons === 1;\n }\n\n private addCrosshairCursor(): void {\n this.crosshairCursorDisposable?.dispose();\n this.crosshairCursorDisposable = this.api?.addCursor(boxQueryCursor);\n }\n\n private addWaitCursor(): void {\n this.waitCursorDisposable?.dispose();\n this.waitCursorDisposable = this.api?.addCursor('wait');\n }\n}\n","import { Point, Rectangle } from '@vertexvis/geometry';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { VolumeIntersectionQueryMode } from '../../components/viewer-box-query-tool/types';\n\nexport type QueryType = 'inclusive' | 'exclusive';\n\nexport interface VolumeIntersectionQueryDetails {\n screenBounds: Rectangle.Rectangle;\n type: QueryType;\n}\n\nexport class VolumeIntersectionQueryModel {\n private startPoint?: Point.Point;\n private endPoint?: Point.Point;\n private type?: QueryType;\n\n private dragStarted = new EventDispatcher<void>();\n private dragComplete = new EventDispatcher<VolumeIntersectionQueryDetails>();\n private dragCancelled = new EventDispatcher<void>();\n\n private screenBoundsChanged = new EventDispatcher<\n VolumeIntersectionQueryDetails | undefined\n >();\n\n public constructor(private mode?: VolumeIntersectionQueryMode) {}\n\n public setStartPoint(point: Point.Point): void {\n this.startPoint = point;\n\n this.dragStarted.emit();\n }\n\n public setEndPoint(point: Point.Point): void {\n if (\n this.startPoint != null &&\n Point.distance(this.startPoint, point) >= 2\n ) {\n this.endPoint = point;\n\n this.updateQueryType();\n this.screenBoundsChanged.emit(this.getQueryDetails());\n }\n }\n\n public setMode(mode?: VolumeIntersectionQueryMode): void {\n this.mode = mode;\n }\n\n public complete(): void {\n if (this.startPoint != null && this.endPoint != null) {\n this.screenBoundsChanged.emit(undefined);\n this.dragComplete.emit(this.getQueryDetails());\n this.reset();\n }\n }\n\n public cancel(): void {\n this.screenBoundsChanged.emit(undefined);\n this.dragCancelled.emit();\n this.reset();\n }\n\n public reset(): void {\n this.startPoint = undefined;\n this.endPoint = undefined;\n this.type = undefined;\n }\n\n public getScreenBounds(): Rectangle.Rectangle | undefined {\n return this.startPoint != null && this.endPoint != null\n ? Rectangle.fromPoints(this.startPoint, this.endPoint)\n : undefined;\n }\n\n public getType(): QueryType | undefined {\n return this.type;\n }\n\n public onScreenBoundsChanged(\n listener: Listener<VolumeIntersectionQueryDetails | undefined>\n ): Disposable {\n return this.screenBoundsChanged.on(listener);\n }\n\n public onDragStarted(listener: Listener<void>): Disposable {\n return this.dragStarted.on(listener);\n }\n\n public onDragComplete(\n listener: Listener<VolumeIntersectionQueryDetails>\n ): Disposable {\n return this.dragComplete.on(listener);\n }\n\n public onDragCancelled(listener: Listener<void>): Disposable {\n return this.dragCancelled.on(listener);\n }\n\n private getQueryDetails(): VolumeIntersectionQueryDetails {\n if (this.startPoint != null && this.endPoint != null && this.type != null) {\n return {\n screenBounds: Rectangle.fromPoints(this.startPoint, this.endPoint),\n type: this.type,\n };\n } else {\n throw new Error(\n 'Failed to create query details, the start and end points must be set.'\n );\n }\n }\n\n private updateQueryType(): void {\n if (this.startPoint != null && this.endPoint != null) {\n const directionalType =\n Point.subtract(this.endPoint, this.startPoint).x > 0\n ? 'exclusive'\n : 'inclusive';\n\n this.type = this.mode ?? directionalType;\n }\n }\n}\n",":host {\n /**\n * @prop --viewer-box-query-outline-exclusive-color: A CSS color that\n * specifies the color of box for an exclusive query. This will\n * be used in combination with `--viewer-box-query-outline-fill-opacity`\n * for the background color of the box. Defaults to `#0099cc`.\n */\n --viewer-box-query-outline-exclusive-color: #0099cc;\n /**\n * @prop --viewer-box-query-outline-exclusive-border-style: A border\n * style that specifies the type of border to display around the box for an\n * exclusive query. Defaults to `solid`.\n */\n --viewer-box-query-outline-exclusive-border-style: solid;\n /**\n * @prop --viewer-box-query-outline-inclusive-color: A CSS color that\n * specifies the color of box for an inclusive query. This will\n * be used in combination with `--viewer-box-query-outline-fill-opacity`\n * for the background color of the box. Defaults to `#00cc00`.\n */\n --viewer-box-query-outline-inclusive-color: #00cc00;\n /**\n * @prop --viewer-box-query-outline-inclusive-border-style: A border\n * style that specifies the type of border to display around the box for an\n * inclusive query. Defaults to `dashed`.\n */\n --viewer-box-query-outline-inclusive-border-style: dashed;\n /**\n * @prop --viewer-box-query-outline-border-radius: A CSS length that\n * specifies the border radius of the drawn box. Defaults to `0.25rem`.\n */\n --viewer-box-query-outline-border-radius: 0.25rem;\n /**\n * @prop--viewer-box-query-outline-fill-opacity: A number between \n * 0 and 1 that specifies the opacity of the background of the drawn box.\n * Defaults to `0.25`.\n */\n --viewer-box-query-outline-fill-opacity: 0.25;\n}\n\n.bounds {\n position: absolute;\n}\n\n.outline {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border-radius: var(--viewer-box-query-outline-border-radius);\n}\n\n:host([exclusive=\"true\"]) .outline {\n border: 3px var(--viewer-box-query-outline-exclusive-border-style) var(--viewer-box-query-outline-exclusive-color);\n}\n\n:host([inclusive=\"true\"]) .outline {\n border: 3px var(--viewer-box-query-outline-inclusive-border-style) var(--viewer-box-query-outline-inclusive-color);\n}\n\n.fill {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n opacity: var(--viewer-box-query-outline-fill-opacity);\n border-radius: var(--viewer-box-query-outline-border-radius);\n}\n\n:host([exclusive=\"true\"]) .fill {\n background-color: var(--viewer-box-query-outline-exclusive-color);\n}\n\n:host([inclusive=\"true\"]) .fill {\n background-color: var(--viewer-box-query-outline-inclusive-color);\n}","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { VolumeIntersectionQueryController } from '../../lib/volume-intersection/controller';\nimport { VolumeIntersectionQueryInteractionHandler } from '../../lib/volume-intersection/interactions';\nimport {\n QueryType,\n VolumeIntersectionQueryDetails,\n VolumeIntersectionQueryModel,\n} from '../../lib/volume-intersection/model';\nimport {\n VolumeIntersectionQueryMode,\n VolumeIntersectionQueryType,\n} from './types';\n\n/**\n * The `ViewerBoxQueryTool` allows for the drawing of a \"box\" on screen to represent\n * a query for items in a specific area of the viewer. This tool then allows for an\n * operation to be performed on the items contained (exclusive) by the box or both\n * contained by and intersecting with (inclusive) the box.\n */\n@Component({\n tag: 'vertex-viewer-box-query-tool',\n styleUrl: 'viewer-box-query-tool.css',\n shadow: true,\n})\nexport class ViewerBoxQueryTool {\n /**\n * The viewer that this component is bound to. This is automatically assigned\n * if added to the light-dom of a parent viewer element.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The controller that is responsible for performing operations using the\n * volume intersection query defined by the drawn box and updating the model.\n */\n @Prop({ mutable: true })\n public controller?: VolumeIntersectionQueryController;\n\n /**\n * The model that contains the points representing the corners of the box\n * displayed on screen, the type of the query to be performed, and methods\n * for setting these values.\n */\n @Prop({ mutable: true })\n public model?: VolumeIntersectionQueryModel;\n\n /**\n * The default operation to perform when a drag has completed and the intersection\n * query will be run. Defaults to `clearAndSelect`, and can be changed to `select` or `deselect`.\n *\n * `clearAndSelect` will clear all existing selection, and select the results of the query.\n * `select` will maintain existing selection, and select the results of the query.\n * `deselect` will maintain existing selection, and deselect the results of the query.\n *\n * The operation behavior for this intersection query tool can also be changed by\n * providing a custom implementation of the `VolumeIntersectionQueryController`, or\n * by using the `setOperationTransform` method of the default controller.\n */\n @Prop()\n public operationType: VolumeIntersectionQueryType = 'clearAndSelect';\n\n /**\n * An optional value to specify a singular mode of intersection query. This value\n * defaults to `undefined`, which will indicate that both `exclusive` and `inclusive`\n * queries should be made, with `inclusive` being represented by a left to right\n * drag behavior and `exclusive` being represented by a right to left drag.\n *\n * Setting this value to `inclusive` will cause dragging left to right and left to right\n * to result in an `inclusive` query, and the box will only be styled for `inclusive` queries.\n *\n * Setting this value to `exclusive` will cause dragging left to right and left to right\n * to result in an `exclusive` query, and the box will only be styled for `exclusive` queries.\n */\n @Prop()\n public mode?: VolumeIntersectionQueryMode;\n\n @State()\n private details?: VolumeIntersectionQueryDetails;\n\n @Element()\n private hostEl!: HTMLVertexViewerBoxQueryToolElement;\n\n private interactionHandler?: VolumeIntersectionQueryInteractionHandler;\n private interactionHandlerDisposable?: Disposable;\n\n private operationStartedDisposable?: Disposable;\n private operationCompleteDisposable?: Disposable;\n private screenBoundsChangedDisposable?: Disposable;\n\n public constructor() {\n this.handleScreenBoundsChanged = this.handleScreenBoundsChanged.bind(this);\n this.handleExecuteStarted = this.handleExecuteStarted.bind(this);\n this.handleExecuteComplete = this.handleExecuteComplete.bind(this);\n }\n\n public componentWillLoad(): void {\n this.model = this.model ?? new VolumeIntersectionQueryModel(this.mode);\n\n this.screenBoundsChangedDisposable = this.model.onScreenBoundsChanged(\n this.handleScreenBoundsChanged\n );\n\n this.handleViewerChanged(this.viewer);\n this.handleControllerChange(this.controller);\n this.handleDefaultOperationChange(this.operationType);\n }\n\n public disconnectedCallback(): void {\n this.model?.reset();\n this.screenBoundsChangedDisposable?.dispose();\n this.operationStartedDisposable?.dispose();\n this.operationCompleteDisposable?.dispose();\n this.deregisterInteractionHandler();\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(newViewer?: HTMLVertexViewerElement): void {\n this.deregisterInteractionHandler();\n\n if (this.model != null && newViewer != null) {\n this.controller = new VolumeIntersectionQueryController(\n this.model,\n newViewer\n );\n this.handleDefaultOperationChange(this.operationType);\n this.registerInteractionHandler(this.controller, newViewer);\n }\n }\n\n /**\n * @ignore\n */\n @Watch('operationType')\n protected handleDefaultOperationChange(\n updatedOperationType: VolumeIntersectionQueryType\n ): void {\n switch (updatedOperationType) {\n case 'clearAndSelect':\n this.setDefaultClearAndSelectOperation();\n break;\n case 'select':\n this.setDefaultSelectOperation();\n break;\n case 'deselect':\n this.setDefaultDeselectOperation();\n break;\n }\n }\n\n /**\n * @ignore\n */\n @Watch('mode')\n protected handleModeChange(updatedMode?: VolumeIntersectionQueryMode): void {\n this.model?.setMode(updatedMode);\n }\n\n /**\n * @ignore\n */\n @Watch('controller')\n protected handleControllerChange(\n controller?: VolumeIntersectionQueryController\n ): void {\n this.operationStartedDisposable?.dispose();\n this.operationCompleteDisposable?.dispose();\n\n this.operationStartedDisposable = controller?.onExecuteStarted(\n this.handleExecuteStarted\n );\n this.operationStartedDisposable = controller?.onExecuteComplete(\n this.handleExecuteComplete\n );\n }\n\n /**\n * @ignore\n */\n protected render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <vertex-viewer-layer>\n {this.details != null && (\n <div\n class=\"bounds\"\n style={{\n left: `${this.details.screenBounds.x}px`,\n top: `${this.details.screenBounds.y}px`,\n width: `${this.details.screenBounds.width}px`,\n height: `${this.details.screenBounds.height}px`,\n }}\n >\n <slot name=\"bounds\">\n <div class=\"outline\"></div>\n <div class=\"fill\"></div>\n </slot>\n </div>\n )}\n </vertex-viewer-layer>\n </Host>\n );\n }\n\n private handleScreenBoundsChanged(\n details?: VolumeIntersectionQueryDetails\n ): void {\n this.details = details;\n\n this.updateTypeAttribute(details?.type);\n }\n\n private handleExecuteStarted(): void {\n this.interactionHandler?.disable();\n }\n\n private handleExecuteComplete(): void {\n this.interactionHandler?.enable();\n }\n\n private async registerInteractionHandler(\n controller: VolumeIntersectionQueryController,\n viewer: HTMLVertexViewerElement\n ): Promise<void> {\n this.interactionHandler = new VolumeIntersectionQueryInteractionHandler(\n controller\n );\n this.interactionHandlerDisposable = await viewer.registerInteractionHandler(\n this.interactionHandler\n );\n }\n\n private deregisterInteractionHandler(): void {\n this.interactionHandlerDisposable?.dispose();\n this.interactionHandler?.dispose();\n this.interactionHandler = undefined;\n }\n\n private updateTypeAttribute(type?: QueryType): void {\n this.hostEl.setAttribute('inclusive', `${type === 'inclusive'}`);\n this.hostEl.setAttribute('exclusive', `${type === 'exclusive'}`);\n }\n\n private setDefaultClearAndSelectOperation(): void {\n this.controller?.setOperationTransform((builder) => builder.select());\n this.controller?.setAdditionalTransforms([\n (op) => op.where((q) => q.withSelected()).deselect(),\n ]);\n }\n\n private setDefaultSelectOperation(): void {\n this.controller?.setOperationTransform((builder) => builder.select());\n this.controller?.setAdditionalTransforms([]);\n }\n\n private setDefaultDeselectOperation(): void {\n this.controller?.setOperationTransform((builder) => builder.deselect());\n this.controller?.setAdditionalTransforms([]);\n }\n}\n"]}
|