@vertexvis/viewer 0.10.2-canary.7 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/cjs/{browser.esm-ae55f058.js → browser.esm-17419694.js} +25 -25
  2. package/dist/cjs/{bundle.esm-c457ad4d.js → bundle.esm-b79513ef.js} +231 -207
  3. package/dist/cjs/{constants-4277684a.js → constants-1d65ed39.js} +1 -1
  4. package/dist/cjs/{cursors-b93b43ef.js → cursors-8aaf500f.js} +1 -1
  5. package/dist/cjs/{dom-cdb50ebc.js → dom-40804039.js} +1 -1
  6. package/dist/cjs/index.cjs.js +8 -7
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{markup-3dac4cef.js → markup-e84a143f.js} +11 -2
  9. package/dist/cjs/{measurement-b494bf55.js → measurement-4579193b.js} +2 -2
  10. package/dist/cjs/{orientation-42cc9e8d.js → orientation-09d0f3ef.js} +14 -7
  11. package/dist/cjs/{png-decoder-2add73dd.js → png-decoder-97ea96ba.js} +3 -3
  12. package/dist/cjs/{scene-23a0a330.js → scene-4397373a.js} +28524 -2446
  13. package/dist/cjs/{utils-6933381f.js → utils-414e6cfe.js} +2 -2
  14. package/dist/cjs/utils-440f0f7d.js +61 -0
  15. package/dist/cjs/vertex-scene-tree.cjs.entry.js +6 -5
  16. package/dist/cjs/vertex-viewer-dom-element_3.cjs.entry.js +4 -4
  17. package/dist/cjs/{vertex-viewer-markup-arrow_2.cjs.entry.js → vertex-viewer-markup-arrow_3.cjs.entry.js} +267 -4
  18. package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js +43 -9
  19. package/dist/cjs/vertex-viewer-markup.cjs.entry.js +25 -5
  20. package/dist/cjs/vertex-viewer-measurement-distance_2.cjs.entry.js +8 -8
  21. package/dist/cjs/vertex-viewer-measurement-tool.cjs.entry.js +5 -5
  22. package/dist/cjs/vertex-viewer-measurements.cjs.entry.js +5 -5
  23. package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +3 -3
  24. package/dist/cjs/vertex-viewer.cjs.entry.js +141 -48
  25. package/dist/cjs/viewer.cjs.js +1 -1
  26. package/dist/cjs/{viewport-e69f8223.js → viewport-fc405a48.js} +31 -7
  27. package/dist/collection/collection-manifest.json +1 -0
  28. package/dist/collection/components/scene-tree/scene-tree.js +3 -2
  29. package/dist/collection/components/viewer/viewer.js +28 -3
  30. package/dist/collection/components/viewer-markup/utils.js +65 -1
  31. package/dist/collection/components/viewer-markup/viewer-markup.js +72 -16
  32. package/dist/collection/components/viewer-markup-circle/utils.js +2 -55
  33. package/dist/collection/components/viewer-markup-circle/viewer-markup-circle.js +4 -4
  34. package/dist/collection/components/viewer-markup-freeform.tsx/utils.js +10 -0
  35. package/dist/collection/components/viewer-markup-freeform.tsx/viewer-markup-freeform.css +157 -0
  36. package/dist/collection/components/viewer-markup-freeform.tsx/viewer-markup-freeform.js +413 -0
  37. package/dist/collection/components/viewer-markup-tool/viewer-markup-tool.js +63 -9
  38. package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance-components.js +1 -1
  39. package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance.js +2 -2
  40. package/dist/collection/lib/cursors.js +1 -1
  41. package/dist/collection/lib/interactions/baseInteractionHandler.js +5 -4
  42. package/dist/collection/lib/interactions/flyToPartKeyInteraction.js +1 -1
  43. package/dist/collection/lib/interactions/interactionApi.js +101 -22
  44. package/dist/collection/lib/interactions/mouseInteractions.js +17 -15
  45. package/dist/collection/lib/interactions/multiTouchInteractionHandler.js +2 -2
  46. package/dist/collection/lib/mappers.js +4 -3
  47. package/dist/collection/lib/scenes/camera.js +8 -2
  48. package/dist/collection/lib/scenes/operations.js +1 -1
  49. package/dist/collection/lib/scenes/scene.js +5 -2
  50. package/dist/collection/lib/types/frame.js +8 -2
  51. package/dist/collection/lib/types/markup.js +9 -1
  52. package/dist/collection/lib/types/stencilBuffer.js +2 -2
  53. package/dist/collection/lib/types/viewport.js +32 -8
  54. package/dist/collection/testing/fixtures.js +2 -1
  55. package/dist/esm/{browser.esm-7dbdf78a.js → browser.esm-e4fb17dc.js} +25 -25
  56. package/dist/esm/{bundle.esm-590d2273.js → bundle.esm-d891316f.js} +232 -208
  57. package/dist/esm/{constants-083f6b2c.js → constants-037e417f.js} +1 -1
  58. package/dist/esm/{cursors-39294365.js → cursors-00835249.js} +1 -1
  59. package/dist/esm/{dom-43682375.js → dom-d0877f90.js} +1 -1
  60. package/dist/esm/index.js +7 -7
  61. package/dist/esm/index.mjs +7 -7
  62. package/dist/esm/loader.js +1 -1
  63. package/dist/esm/loader.mjs +1 -1
  64. package/dist/esm/{markup-3ce3dccd.js → markup-9b29aa94.js} +11 -3
  65. package/dist/esm/{measurement-78bd27fc.js → measurement-8430d5d6.js} +2 -2
  66. package/dist/esm/{orientation-c3e2af18.js → orientation-bb34b652.js} +14 -7
  67. package/dist/esm/{png-decoder-dfb97536.js → png-decoder-c4745070.js} +3 -3
  68. package/dist/esm/{scene-30ac6229.js → scene-72760305.js} +28532 -2454
  69. package/dist/esm/utils-5fe43b8a.js +52 -0
  70. package/dist/esm/{utils-b857bd7c.js → utils-f8e0baf7.js} +2 -2
  71. package/dist/esm/vertex-scene-tree.entry.js +6 -5
  72. package/dist/esm/vertex-viewer-dom-element_3.entry.js +4 -4
  73. package/dist/esm/{vertex-viewer-markup-arrow_2.entry.js → vertex-viewer-markup-arrow_3.entry.js} +267 -5
  74. package/dist/esm/vertex-viewer-markup-tool.entry.js +43 -9
  75. package/dist/esm/vertex-viewer-markup.entry.js +25 -5
  76. package/dist/esm/vertex-viewer-measurement-distance_2.entry.js +8 -8
  77. package/dist/esm/vertex-viewer-measurement-tool.entry.js +5 -5
  78. package/dist/esm/vertex-viewer-measurements.entry.js +5 -5
  79. package/dist/esm/vertex-viewer-view-cube.entry.js +3 -3
  80. package/dist/esm/vertex-viewer.entry.js +141 -48
  81. package/dist/esm/viewer.js +1 -1
  82. package/dist/esm/{viewport-8fea0743.js → viewport-d6f5cd7b.js} +31 -7
  83. package/dist/types/components/viewer/viewer.d.ts +4 -0
  84. package/dist/types/components/viewer-markup/utils.d.ts +8 -0
  85. package/dist/types/components/viewer-markup/viewer-markup.d.ts +13 -6
  86. package/dist/types/components/viewer-markup-circle/utils.d.ts +1 -4
  87. package/dist/types/components/viewer-markup-freeform.tsx/utils.d.ts +3 -0
  88. package/dist/types/components/viewer-markup-freeform.tsx/viewer-markup-freeform.d.ts +116 -0
  89. package/dist/types/components/viewer-markup-tool/viewer-markup-tool.d.ts +13 -1
  90. package/dist/types/components.d.ts +107 -10
  91. package/dist/types/lib/interactions/interactionApi.d.ts +22 -6
  92. package/dist/types/lib/interactions/mouseInteractions.d.ts +7 -6
  93. package/dist/types/lib/scenes/camera.d.ts +5 -1
  94. package/dist/types/lib/scenes/scene.d.ts +1 -1
  95. package/dist/types/lib/types/frame.d.ts +4 -1
  96. package/dist/types/lib/types/markup.d.ts +12 -1
  97. package/dist/types/lib/types/viewport.d.ts +17 -0
  98. package/dist/viewer/index.esm.js +1 -1
  99. package/dist/viewer/p-012fb54f.js +4 -0
  100. package/dist/viewer/{p-3dc15d99.entry.js → p-117324c0.entry.js} +1 -1
  101. package/dist/viewer/{p-1ee75110.entry.js → p-1c772ec1.entry.js} +1 -1
  102. package/dist/viewer/p-1f8a238b.js +4 -0
  103. package/dist/viewer/p-21e8510d.js +4 -0
  104. package/dist/viewer/{p-e3105f9a.entry.js → p-3c2aff67.entry.js} +1 -1
  105. package/dist/viewer/p-5389e9d4.js +4 -0
  106. package/dist/viewer/p-59d075d4.js +17 -0
  107. package/dist/viewer/{p-5b078339.js → p-62c6f482.js} +1 -1
  108. package/dist/viewer/p-640cb5f8.js +18 -0
  109. package/dist/viewer/p-68aaf1f8.entry.js +4 -0
  110. package/dist/viewer/{p-05b2444e.js → p-75682963.js} +1 -1
  111. package/dist/viewer/{p-4183c421.entry.js → p-79c45c02.entry.js} +1 -1
  112. package/dist/viewer/p-835e158e.js +4 -0
  113. package/dist/viewer/p-8c255868.entry.js +4 -0
  114. package/dist/viewer/{p-f4a492e1.js → p-9faabd97.js} +1 -1
  115. package/dist/viewer/p-b122ee39.js +4 -0
  116. package/dist/viewer/p-b36b3d1a.js +4 -0
  117. package/dist/viewer/{p-7c71db57.entry.js → p-bc9e6919.entry.js} +1 -1
  118. package/dist/viewer/{p-f090a3f3.entry.js → p-c818c80e.entry.js} +1 -1
  119. package/dist/viewer/{p-e96bc9a2.js → p-d42a482c.js} +1 -1
  120. package/dist/viewer/p-f43e8cc2.entry.js +4 -0
  121. package/dist/viewer/p-f75436be.entry.js +4 -0
  122. package/dist/viewer/viewer.esm.js +1 -1
  123. package/package.json +18 -16
  124. package/readme.md +6 -6
  125. package/dist/cjs/utils-96f244e1.js +0 -104
  126. package/dist/esm/utils-a550c58f.js +0 -96
  127. package/dist/viewer/p-11bdd2c4.js +0 -4
  128. package/dist/viewer/p-14182324.entry.js +0 -4
  129. package/dist/viewer/p-2768474e.js +0 -4
  130. package/dist/viewer/p-2e11803d.js +0 -4
  131. package/dist/viewer/p-6d4ab5fc.js +0 -17
  132. package/dist/viewer/p-964642c6.js +0 -4
  133. package/dist/viewer/p-9e856d0a.entry.js +0 -4
  134. package/dist/viewer/p-a717d9ff.js +0 -4
  135. package/dist/viewer/p-a9434d8e.entry.js +0 -4
  136. package/dist/viewer/p-af806858.js +0 -4
  137. package/dist/viewer/p-b5c350a7.js +0 -4
  138. package/dist/viewer/p-d912dd24.js +0 -18
  139. package/dist/viewer/p-f6d75616.entry.js +0 -4
@@ -0,0 +1,4 @@
1
+ /**!
2
+ * Copyright (c) 2021 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import{f as t,v as r,h as n,p as s,r as o,g as i}from"./p-640cb5f8.js";class e{constructor(r,n){this.width=r,this.height=n,this.center=t.center(this.dimensions)}static fromDimensions(t){return new e(t.width,t.height)}plane(t){const s=t.direction,o=r.distance(t.position,t.lookAt);return n.create({normal:s,constant:o-t.near})}transformVectorToViewport(t){return s.create(t.x*this.center.x+this.center.x,-t.y*this.center.y+this.center.y)}transformPointToViewport(t,r){const{x:n,y:o}=this.calculateFrameScale(r);return s.scale(t,1*n,1*o)}transformPointToFrame(t,r){const{x:n,y:o}=this.calculateFrameScale(r);return s.scale(t,1/n,1/o)}transformPointToWorldSpace(t,r,n){const s=this.transformPointToFrame(t,r),o=this.transformPointToRay(t,r,r.camera);return r.getWorldPoint(s,o,n)}transformPointToRay(t,n,s){const i=this.transformScreenPointToNdc(t,n),e=r.fromMatrixPosition(s.worldMatrix),a=r.transformNdcToWorldSpace(r.create(i.x,i.y,.5),s.worldMatrix,s.projectionMatrixInverse),c=r.normalize(r.subtract(a,e));return o.create({origin:e,direction:c})}transformScreenPointToNdc(t,r){const n=this.transformPointToFrame(t,r);return s.create(n.x/r.frameDimensions.width*2-1,-n.y/r.frameDimensions.height*2+1)}transformPointToScreenWorld(t,r,s){const{direction:i,near:e}=s,a=this.transformPointToRay(t,r,s),c=n.create({normal:i,constant:e});return o.intersectPlane(a,c)}calculateDrawRect(t){const{x:r,y:n}=this.calculateFrameScale(t);return i.scale(t.imageRect,r,n)}calculateFrameScale(t){const{frameDimensions:r}=t,n=i.fromDimensions(r),o=i.fromDimensions(this.dimensions),e=i.containFit(o,n);return s.create(e.width/n.width,e.height/n.height)}get dimensions(){return t.create(this.width,this.height)}}export{e as V}
@@ -1,4 +1,4 @@
1
1
  /**!
2
2
  * Copyright (c) 2021 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{r as t,h as n,H as s,g as i}from"./p-c9d8a379.js";import{v as e,q as o,m as h,s as a}from"./p-d912dd24.js";import"./p-b5c350a7.js";import{V as r}from"./p-11bdd2c4.js";import"./p-6d4ab5fc.js";const l=class{constructor(n){t(this,n),this.position=e.origin(),this.positionJson="",this.quaternion=o.create(),this.quaternionJson="",this.scale=e.create(1,1,1),this.scaleJson="",this.matrix=h.makeIdentity(),this.occlusionOff=!1,this.occluded=!1,this.billboardOff=!1,this.interactionsOff=!1}handlePositionChange(){this.syncMatrix()}handlePositionJsonChanged(){this.syncPosition()}handleRotationChanged(){this.syncQuaternionWithRotation()}handleRotationJsonChanged(){this.syncRotation()}handleQuaternionChange(){this.syncMatrix()}handleQuaternionJsonChanged(){this.syncQuaternion()}handleScaleChange(){this.syncMatrix()}handleScaleJsonChanged(){this.syncScale()}componentWillLoad(){this.syncProperties()}componentShouldUpdate(){return!1}syncProperties(){this.syncPosition(),this.syncRotation(),this.syncQuaternion(),this.syncScale(),this.syncMatrix()}syncPosition(){this.position=this.positionJson.length>0?this.parseJson("positionJson",this.positionJson,e.fromJson):this.position}syncRotation(){this.rotation=null!=this.rotationJson&&this.rotationJson.length>0?this.parseJson("rotationJson",this.rotationJson,a.fromJson):this.rotation,this.syncQuaternionWithRotation()}syncQuaternionWithRotation(){this.quaternion=null!=this.rotation?o.fromEuler(this.rotation):this.quaternion}syncQuaternion(){this.quaternion=this.quaternionJson.length>0?this.parseJson("quaternionJson",this.quaternionJson,o.fromJson):this.quaternion}syncScale(){this.scale=this.scaleJson.length>0?this.parseJson("scaleJson",this.scaleJson,e.fromJson):this.scale}syncMatrix(){this.matrix=h.makeTRS(this.position,this.quaternion,this.scale)}parseJson(t,n,s){try{return s(n)}catch(n){throw console.warn(`Could not parse \`${t}\`. Invalid JSON.`),n}}render(){return n(s,null,n("slot",null))}static get watchers(){return{position:["handlePositionChange"],positionJson:["handlePositionJsonChanged"],rotation:["handleRotationChanged"],rotationJson:["handleRotationJsonChanged"],quaternion:["handleQuaternionChange"],quaternionJson:["handleQuaternionJsonChanged"],scale:["handleScaleChange"],scaleJson:["handleScaleJsonChanged"]}}};l.style=":host{position:absolute;pointer-events:none}:host(:not([interactions-off]))>*{pointer-events:auto}";const d=class{constructor(n){t(this,n),this.position=e.origin(),this.positionJson="",this.quaternion=o.create(),this.quaternionJson="",this.scale=e.create(1,1,1),this.scaleJson="",this.matrix=h.makeIdentity()}handlePositionChange(){this.syncMatrix()}handlePositionJsonChanged(){this.syncPosition()}handleRotationChanged(){this.syncQuaternionWithRotation()}handleRotationJsonChanged(){this.syncRotation()}handleQuaternionChange(){this.syncMatrix()}handleQuaternionJsonChanged(){this.syncQuaternion()}handleScaleChange(){this.syncMatrix()}handleScaleJsonChanged(){this.syncScale()}componentWillLoad(){this.syncProperties()}componentShouldUpdate(){return!1}syncProperties(){this.syncPosition(),this.syncRotation(),this.syncQuaternion(),this.syncScale(),this.syncMatrix()}syncPosition(){this.position=this.positionJson.length>0?this.parseJson("positionJson",this.positionJson,e.fromJson):this.position}syncRotation(){this.rotation=null!=this.rotationJson&&this.rotationJson.length>0?this.parseJson("rotationJson",this.rotationJson,a.fromJson):this.rotation,this.syncQuaternionWithRotation()}syncQuaternionWithRotation(){this.quaternion=null!=this.rotation?o.fromEuler(this.rotation):this.quaternion}syncQuaternion(){this.quaternion=this.quaternionJson.length>0?this.parseJson("quaternionJson",this.quaternionJson,o.fromJson):this.quaternion}syncScale(){this.scale=this.scaleJson.length>0?this.parseJson("scaleJson",this.scaleJson,e.fromJson):this.scale}syncMatrix(){this.matrix=h.makeTRS(this.position,this.quaternion,this.scale)}parseJson(t,n,s){try{return s(n)}catch(n){throw console.warn(`Could not parse \`${t}\`. Invalid JSON.`),n}}render(){return n(s,null,n("slot",null))}static get watchers(){return{position:["handlePositionChange"],positionJson:["handlePositionJsonChanged"],rotation:["handleRotationChanged"],rotationJson:["handleRotationJsonChanged"],quaternion:["handleQuaternionChange"],quaternionJson:["handleQuaternionJsonChanged"],scale:["handleScaleChange"],scaleJson:["handleScaleJsonChanged"]}}};function c(t){return t instanceof HTMLElement&&"VERTEX-VIEWER-DOM-GROUP"===t.nodeName}function u(t){return t instanceof HTMLElement&&"VERTEX-VIEWER-DOM-ELEMENT"===t.nodeName}d.style=":host{display:block;transform-style:preserve-3d}";const p=({camera:t,viewport:s},i)=>{const e=h.toObject(t.projectionMatrix).m22*(s.height/2),o=[`translateZ(${e}px)`,(a=t.viewMatrix,`matrix3d(${[J(a[0]),J(-a[1]),J(a[2]),J(a[3]),J(a[4]),J(-a[5]),J(a[6]),J(a[7]),J(a[8]),J(-a[9]),J(a[10]),J(a[11]),J(a[12]),J(-a[13]),J(a[14]),J(a[15])].join(", ")})`),`translate(${s.width/2}px, ${s.height/2}px)`].join(" ");var a;return n("div",{class:"root-3d",style:{perspective:`${e}px`}},n("div",{class:"camera",style:{transform:o}},i))};function g(t,n,s,i,e){for(let o=0;o<t.children.length;o++){const h=t.children[o];u(h)?m(h,n,s,i,e):c(h)&&v(h,n,s,i,e)}}function m(t,n,s,i,o){const a=h.multiply(n,t.matrix),r=e.fromMatrixPosition(a),l=!t.occlusionOff&&(null==o?void 0:o.isOccluded(r,s));if(t.occluded=null!=l&&l,t.billboardOff)t.style.transform=C(a);else{let n=i.viewMatrix;n=h.transpose(n),n=h.position(n,a),n=h.scale(n,t.scale),n[3]=0,n[7]=0,n[11]=0,n[15]=1,t.style.transform=C(n)}g(t,a,s,i,o)}function v(t,n,s,i,e){g(t,h.multiply(n,t.matrix),s,i,e)}function C(t){return["translate(-50%, -50%)",`matrix3d(${[J(t[0]),J(t[1]),J(t[2]),J(t[3]),J(-t[4]),J(-t[5]),J(-t[6]),J(-t[7]),J(t[8]),J(t[9]),J(t[10]),J(t[11]),J(t[12]),J(t[13]),J(t[14]),J(t[15])].join(", ")})`].join(" ")}function J(t){return Math.abs(t)<1e-10?0:t}const f=(t,s)=>n("div",{class:"root-2d"},s);function w(t,n,s,i,e){const o=y(t,n,i).sort(((t,n)=>t.distanceToCamera-n.distanceToCamera));for(let t=0;t<o.length;t++){const{element:n,worldMatrix:h,worldPosition:a}=o[t],r=!n.occlusionOff&&(null==e?void 0:e.isOccluded(a,s));n.occluded=null!=r&&r,R(n,x(a,i.projectionViewMatrix,s)),P(n,t,o.length),w(n,h,s,i,e)}}function y(t,n,s){const i=[];for(let o=0;o<t.children.length;o++){const a=t.children[o];if(c(a)){const t=h.multiply(n,a.matrix);i.push(...y(a,t,s))}else if(u(a)){const t=h.multiply(n,a.matrix),o=e.fromMatrixPosition(t),r=e.distanceSquared(s.position,o);i.push({element:a,worldMatrix:t,worldPosition:o,distanceToCamera:r})}}return i}function R(t,n){t.style.transform=["translate(-50%, -50%)",`translate(${n.x}px, ${n.y}px)`].join(" ")}function P(t,n,s){t.style.zIndex=""+(s-n)}function x(t,n,s){const i=e.transformMatrix(t,n);return s.transformVectorToViewport(i)}const E=class{constructor(n){t(this,n),this.drawMode="3d",this.viewport=new r(0,0),this.invalidateFrameCounter=0,this.handleViewerFrameDrawn=async()=>{this.updatePropsFromViewer()}}componentWillLoad(){new ResizeObserver((()=>this.handleResize())).observe(this.hostEl),new MutationObserver((()=>this.handleChildrenChange())).observe(this.hostEl,{childList:!0})}render(){return null!=this.camera?n(s,null,"2d"===this.drawMode?n(f,null,n("slot",null)):n(p,{camera:this.camera,viewport:this.viewport},n("slot",null))):n(s,null)}componentWillRender(){this.updateElements()}handleViewerChange(t,n){null==n||n.removeEventListener("frameDrawn",this.handleViewerFrameDrawn),null==t||t.addEventListener("frameDrawn",this.handleViewerFrameDrawn)}handlePropertyChange(){this.invalidateFrame()}invalidateFrame(){this.invalidateFrameCounter=this.invalidateFrameCounter+1}async updateElements(){const{viewport:t,camera:n}=this,s=h.makeIdentity();null!=n&&("3d"===this.drawMode?g(this.hostEl,s,t,n,this.depthBuffer):w(this.hostEl,s,t,n,this.depthBuffer))}handleResize(){const t=this.hostEl.getBoundingClientRect();this.viewport=new r(t.width,t.height)}handleChildrenChange(){this.invalidateFrame()}async updatePropsFromViewer(){var t,n;const{frame:s,streamAttributes:i}=this.viewer||{};this.depthBuffer=(null===(t=null==i?void 0:i.depthBuffers)||void 0===t?void 0:t.enabled)&&"all"===i.depthBuffers.frameType?await(null==s?void 0:s.depthBuffer()):void 0,this.camera=null===(n=null==s?void 0:s.scene)||void 0===n?void 0:n.camera}get hostEl(){return i(this)}static get watchers(){return{viewer:["handleViewerChange"]}}};E.style=":host{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none}.root-3d{width:100%;height:100%;pointer-events:inherit}.camera{transform-style:preserve-3d;pointer-events:inherit;width:100%;height:100%}";export{l as vertex_viewer_dom_element,d as vertex_viewer_dom_group,E as vertex_viewer_dom_renderer}
4
+ import{r as t,h as n,H as s,g as i}from"./p-c9d8a379.js";import{v as e,q as o,m as h,s as a}from"./p-640cb5f8.js";import"./p-21e8510d.js";import{V as r}from"./p-b36b3d1a.js";import"./p-59d075d4.js";const l=class{constructor(n){t(this,n),this.position=e.origin(),this.positionJson="",this.quaternion=o.create(),this.quaternionJson="",this.scale=e.create(1,1,1),this.scaleJson="",this.matrix=h.makeIdentity(),this.occlusionOff=!1,this.occluded=!1,this.billboardOff=!1,this.interactionsOff=!1}handlePositionChange(){this.syncMatrix()}handlePositionJsonChanged(){this.syncPosition()}handleRotationChanged(){this.syncQuaternionWithRotation()}handleRotationJsonChanged(){this.syncRotation()}handleQuaternionChange(){this.syncMatrix()}handleQuaternionJsonChanged(){this.syncQuaternion()}handleScaleChange(){this.syncMatrix()}handleScaleJsonChanged(){this.syncScale()}componentWillLoad(){this.syncProperties()}componentShouldUpdate(){return!1}syncProperties(){this.syncPosition(),this.syncRotation(),this.syncQuaternion(),this.syncScale(),this.syncMatrix()}syncPosition(){this.position=this.positionJson.length>0?this.parseJson("positionJson",this.positionJson,e.fromJson):this.position}syncRotation(){this.rotation=null!=this.rotationJson&&this.rotationJson.length>0?this.parseJson("rotationJson",this.rotationJson,a.fromJson):this.rotation,this.syncQuaternionWithRotation()}syncQuaternionWithRotation(){this.quaternion=null!=this.rotation?o.fromEuler(this.rotation):this.quaternion}syncQuaternion(){this.quaternion=this.quaternionJson.length>0?this.parseJson("quaternionJson",this.quaternionJson,o.fromJson):this.quaternion}syncScale(){this.scale=this.scaleJson.length>0?this.parseJson("scaleJson",this.scaleJson,e.fromJson):this.scale}syncMatrix(){this.matrix=h.makeTRS(this.position,this.quaternion,this.scale)}parseJson(t,n,s){try{return s(n)}catch(n){throw console.warn(`Could not parse \`${t}\`. Invalid JSON.`),n}}render(){return n(s,null,n("slot",null))}static get watchers(){return{position:["handlePositionChange"],positionJson:["handlePositionJsonChanged"],rotation:["handleRotationChanged"],rotationJson:["handleRotationJsonChanged"],quaternion:["handleQuaternionChange"],quaternionJson:["handleQuaternionJsonChanged"],scale:["handleScaleChange"],scaleJson:["handleScaleJsonChanged"]}}};l.style=":host{position:absolute;pointer-events:none}:host(:not([interactions-off]))>*{pointer-events:auto}";const d=class{constructor(n){t(this,n),this.position=e.origin(),this.positionJson="",this.quaternion=o.create(),this.quaternionJson="",this.scale=e.create(1,1,1),this.scaleJson="",this.matrix=h.makeIdentity()}handlePositionChange(){this.syncMatrix()}handlePositionJsonChanged(){this.syncPosition()}handleRotationChanged(){this.syncQuaternionWithRotation()}handleRotationJsonChanged(){this.syncRotation()}handleQuaternionChange(){this.syncMatrix()}handleQuaternionJsonChanged(){this.syncQuaternion()}handleScaleChange(){this.syncMatrix()}handleScaleJsonChanged(){this.syncScale()}componentWillLoad(){this.syncProperties()}componentShouldUpdate(){return!1}syncProperties(){this.syncPosition(),this.syncRotation(),this.syncQuaternion(),this.syncScale(),this.syncMatrix()}syncPosition(){this.position=this.positionJson.length>0?this.parseJson("positionJson",this.positionJson,e.fromJson):this.position}syncRotation(){this.rotation=null!=this.rotationJson&&this.rotationJson.length>0?this.parseJson("rotationJson",this.rotationJson,a.fromJson):this.rotation,this.syncQuaternionWithRotation()}syncQuaternionWithRotation(){this.quaternion=null!=this.rotation?o.fromEuler(this.rotation):this.quaternion}syncQuaternion(){this.quaternion=this.quaternionJson.length>0?this.parseJson("quaternionJson",this.quaternionJson,o.fromJson):this.quaternion}syncScale(){this.scale=this.scaleJson.length>0?this.parseJson("scaleJson",this.scaleJson,e.fromJson):this.scale}syncMatrix(){this.matrix=h.makeTRS(this.position,this.quaternion,this.scale)}parseJson(t,n,s){try{return s(n)}catch(n){throw console.warn(`Could not parse \`${t}\`. Invalid JSON.`),n}}render(){return n(s,null,n("slot",null))}static get watchers(){return{position:["handlePositionChange"],positionJson:["handlePositionJsonChanged"],rotation:["handleRotationChanged"],rotationJson:["handleRotationJsonChanged"],quaternion:["handleQuaternionChange"],quaternionJson:["handleQuaternionJsonChanged"],scale:["handleScaleChange"],scaleJson:["handleScaleJsonChanged"]}}};function c(t){return t instanceof HTMLElement&&"VERTEX-VIEWER-DOM-GROUP"===t.nodeName}function u(t){return t instanceof HTMLElement&&"VERTEX-VIEWER-DOM-ELEMENT"===t.nodeName}d.style=":host{display:block;transform-style:preserve-3d}";const p=({camera:t,viewport:s},i)=>{const e=h.toObject(t.projectionMatrix).m22*(s.height/2),o=[`translateZ(${e}px)`,(a=t.viewMatrix,`matrix3d(${[J(a[0]),J(-a[1]),J(a[2]),J(a[3]),J(a[4]),J(-a[5]),J(a[6]),J(a[7]),J(a[8]),J(-a[9]),J(a[10]),J(a[11]),J(a[12]),J(-a[13]),J(a[14]),J(a[15])].join(", ")})`),`translate(${s.width/2}px, ${s.height/2}px)`].join(" ");var a;return n("div",{class:"root-3d",style:{perspective:`${e}px`}},n("div",{class:"camera",style:{transform:o}},i))};function g(t,n,s,i,e){for(let o=0;o<t.children.length;o++){const h=t.children[o];u(h)?m(h,n,s,i,e):c(h)&&v(h,n,s,i,e)}}function m(t,n,s,i,o){const a=h.multiply(n,t.matrix),r=e.fromMatrixPosition(a),l=!t.occlusionOff&&(null==o?void 0:o.isOccluded(r,s));if(t.occluded=null!=l&&l,t.billboardOff)t.style.transform=C(a);else{let n=i.viewMatrix;n=h.transpose(n),n=h.position(n,a),n=h.scale(n,t.scale),n[3]=0,n[7]=0,n[11]=0,n[15]=1,t.style.transform=C(n)}g(t,a,s,i,o)}function v(t,n,s,i,e){g(t,h.multiply(n,t.matrix),s,i,e)}function C(t){return["translate(-50%, -50%)",`matrix3d(${[J(t[0]),J(t[1]),J(t[2]),J(t[3]),J(-t[4]),J(-t[5]),J(-t[6]),J(-t[7]),J(t[8]),J(t[9]),J(t[10]),J(t[11]),J(t[12]),J(t[13]),J(t[14]),J(t[15])].join(", ")})`].join(" ")}function J(t){return Math.abs(t)<1e-10?0:t}const f=(t,s)=>n("div",{class:"root-2d"},s);function w(t,n,s,i,e){const o=y(t,n,i).sort(((t,n)=>t.distanceToCamera-n.distanceToCamera));for(let t=0;t<o.length;t++){const{element:n,worldMatrix:h,worldPosition:a}=o[t],r=!n.occlusionOff&&(null==e?void 0:e.isOccluded(a,s));n.occluded=null!=r&&r,R(n,x(a,i.projectionViewMatrix,s)),P(n,t,o.length),w(n,h,s,i,e)}}function y(t,n,s){const i=[];for(let o=0;o<t.children.length;o++){const a=t.children[o];if(c(a)){const t=h.multiply(n,a.matrix);i.push(...y(a,t,s))}else if(u(a)){const t=h.multiply(n,a.matrix),o=e.fromMatrixPosition(t),r=e.distanceSquared(s.position,o);i.push({element:a,worldMatrix:t,worldPosition:o,distanceToCamera:r})}}return i}function R(t,n){t.style.transform=["translate(-50%, -50%)",`translate(${n.x}px, ${n.y}px)`].join(" ")}function P(t,n,s){t.style.zIndex=""+(s-n)}function x(t,n,s){const i=e.transformMatrix(t,n);return s.transformVectorToViewport(i)}const E=class{constructor(n){t(this,n),this.drawMode="3d",this.viewport=new r(0,0),this.invalidateFrameCounter=0,this.handleViewerFrameDrawn=async()=>{this.updatePropsFromViewer()}}componentWillLoad(){new ResizeObserver((()=>this.handleResize())).observe(this.hostEl),new MutationObserver((()=>this.handleChildrenChange())).observe(this.hostEl,{childList:!0})}render(){return null!=this.camera?n(s,null,"2d"===this.drawMode?n(f,null,n("slot",null)):n(p,{camera:this.camera,viewport:this.viewport},n("slot",null))):n(s,null)}componentWillRender(){this.updateElements()}handleViewerChange(t,n){null==n||n.removeEventListener("frameDrawn",this.handleViewerFrameDrawn),null==t||t.addEventListener("frameDrawn",this.handleViewerFrameDrawn)}handlePropertyChange(){this.invalidateFrame()}invalidateFrame(){this.invalidateFrameCounter=this.invalidateFrameCounter+1}async updateElements(){const{viewport:t,camera:n}=this,s=h.makeIdentity();null!=n&&("3d"===this.drawMode?g(this.hostEl,s,t,n,this.depthBuffer):w(this.hostEl,s,t,n,this.depthBuffer))}handleResize(){const t=this.hostEl.getBoundingClientRect();this.viewport=new r(t.width,t.height)}handleChildrenChange(){this.invalidateFrame()}async updatePropsFromViewer(){var t,n;const{frame:s,streamAttributes:i}=this.viewer||{};this.depthBuffer=(null===(t=null==i?void 0:i.depthBuffers)||void 0===t?void 0:t.enabled)&&"all"===i.depthBuffers.frameType?await(null==s?void 0:s.depthBuffer()):void 0,this.camera=null===(n=null==s?void 0:s.scene)||void 0===n?void 0:n.camera}get hostEl(){return i(this)}static get watchers(){return{viewer:["handleViewerChange"]}}};E.style=":host{position:absolute;top:0;bottom:0;left:0;right:0;overflow:hidden;pointer-events:none}.root-3d{width:100%;height:100%;pointer-events:inherit}.camera{transform-style:preserve-3d;pointer-events:inherit;width:100%;height:100%}";export{l as vertex_viewer_dom_element,d as vertex_viewer_dom_group,E as vertex_viewer_dom_renderer}
@@ -1,4 +1,4 @@
1
1
  /**!
2
2
  * Copyright (c) 2021 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{h as t,r as e,c as i,H as n,g as s}from"./p-c9d8a379.js";import{i as r,p as a,v as o,o as h}from"./p-d912dd24.js";import{M as l}from"./p-b5c350a7.js";import{V as d}from"./p-11bdd2c4.js";import{M as c,a as u,t as m,b as v,g as p}from"./p-5b078339.js";import{a as w,g as b}from"./p-05b2444e.js";import{c as f}from"./p-f482325b.js";import{m as g}from"./p-f4a492e1.js";import"./p-6d4ab5fc.js";import"./p-112455b1.js";const y=({startPt:e,endPt:i,centerPt:n,indicatorPt:s,distance:o,anchorLabelOffset:h,lineCapLength:l,linePointerEvents:d,hideStartAnchor:c,hideEndAnchor:u,onStartAnchorPointerDown:m,onEndAnchorPointerDown:v})=>{const p=null!=e&&null!=i?r.fromPoints(e,i):void 0,b=null!=p&&null!=e&&null!=h?a.add(e,a.polar(-h,p)):void 0,g=null!=p&&null!=i&&null!=h?a.add(i,a.polar(h,p)):void 0;return t("div",null,null!=e&&null!=i&&t("vertex-viewer-measurement-line",{class:f("line",{"hide-start-line-cap":c,"hide-end-line-cap":u}),start:e,end:i,capLength:l,pointerEvents:d}),!c&&null!=e&&t("div",{id:"start-anchor",class:"anchor anchor-start",style:{transform:w(e)},onPointerDown:m},t("slot",{name:"start-anchor"},t("div",{class:"anchor-placeholder"}))),!c&&b&&t("div",{class:"anchor-label anchor-label-start",style:{transform:w(b)}},t("slot",{name:"start-label"})),!u&&null!=i&&t("div",{id:"end-anchor",class:"anchor anchor-end",style:{transform:w(i)},onPointerDown:v},t("slot",{name:"end-anchor"},t("div",{class:"anchor-placeholder"}))),!u&&g&&t("div",{class:"anchor-label anchor-label-end",style:{transform:w(g)}},t("slot",{name:"end-label"})),null!=n&&t("div",{id:"label",class:"distance-label",style:{transform:w(n)}},o),null!=s&&t("div",{class:"indicator",style:{transform:w(s)}},t("slot",{name:"indicator"},t("div",{class:"indicator-placeholder"}))))},P=class{constructor(t){e(this,t),this.editBegin=i(this,"editBegin",7),this.editEnd=i(this,"editEnd",7),this.snapDistance=c,this.units="millimeters",this.fractionalDigits=2,this.anchorLabelOffset=20,this.lineCapLength=u,this.mode="",this.interactingAnchor="none",this.invalid=!1,this.viewport=new d(0,0),this.interactionCount=0,this.invalidateStateCounter=0,this.stateMap={},this.measurementUnits=new l(this.units),this.isUserInteractingWithModel=!1,this.handleFrameDrawn=()=>{this.invalidateState()},this.updateStartAnchor=async t=>{if(0===this.interactionCount){const e=b(t,this.elementBounds),i=this.snapPoint(e,t);this.getStencilBuffer(),this.interactiveStartPoint=i}},this.resetStartAnchor=()=>{0===this.interactionCount&&(this.start=void 0,this.interactiveStartPoint=void 0)},this.startMeasurement=t=>{if(0===this.interactionCount&&null!=this.start&&0===t.button){const t=t=>{const e=()=>t(),i=()=>(window.removeEventListener("pointermove",e),void window.removeEventListener("pointerup",i)),n=()=>{window.addEventListener("pointermove",e),window.addEventListener("pointerup",i)};return window.addEventListener("pointerdown",n),{dispose:()=>window.removeEventListener("pointerdown",n)}};(t=>{const e=()=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointermove",n)},i=async()=>{e(),t()},n=t=>{t.buttons>0&&e()};window.addEventListener("pointermove",n),window.addEventListener("pointerup",i)})((()=>{const e=t((()=>{var t;this.isUserInteractingWithModel=!0,null===(t=this.stateMap.hoverCursor)||void 0===t||t.dispose()})),i=this.createAnchorPointerMoveHandler("end"),n=t=>{0===t.button&&(this.isUserInteractingWithModel?this.isUserInteractingWithModel=!1:(window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",n),e.dispose(),this.endEditing()))};this.beginEditing("end"),window.addEventListener("pointermove",i),window.addEventListener("pointerup",n)}))}}}async computeElementMetrics(){var t,e,i;const n=null===(t=this.hostEl.shadowRoot)||void 0===t?void 0:t.getElementById("start-anchor"),s=null===(e=this.hostEl.shadowRoot)||void 0===e?void 0:e.getElementById("end-anchor"),r=null===(i=this.hostEl.shadowRoot)||void 0===i?void 0:i.getElementById("label");return null!=n&&null!=s&&null!=r?{startAnchor:n.getBoundingClientRect(),endAnchor:s.getBoundingClientRect(),label:r.getBoundingClientRect()}:void 0}componentWillLoad(){this.updateViewport(),this.handleViewerChanged(this.viewer),this.handleModeChanged(),this.computePropsAndState()}componentDidLoad(){new ResizeObserver((()=>this.updateViewport())).observe(this.hostEl)}componentWillUpdate(){this.computePropsAndState()}render(){const e=this.computeElementPositions(),{startPt:i,endPt:s,labelPt:r,indicatorPt:a,hideStart:o,hideEnd:h}=e,l=this.formatDistance(this.distance);return t(n,null,t("div",{class:"measurement"},t(y,"edit"===this.mode?{startPt:i,endPt:s,centerPt:r,indicatorPt:a,distance:l,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength,hideStartAnchor:o,hideEndAnchor:h,onStartAnchorPointerDown:this.handleEditAnchor("start"),onEndAnchorPointerDown:this.handleEditAnchor("end")}:"replace"===this.mode?{startPt:i,endPt:s,centerPt:r,indicatorPt:a,distance:l,hideStartAnchor:o,hideEndAnchor:h,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength}:{startPt:i,endPt:s,centerPt:r,indicatorPt:a,distance:l,hideStartAnchor:o,hideEndAnchor:h,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength,linePointerEvents:"painted"})))}handleViewerChanged(t,e){null!=e&&(e.removeEventListener("frameDrawn",this.handleFrameDrawn),this.removeInteractionListeners(e)),null!=t&&(t.addEventListener("frameDrawn",this.handleFrameDrawn),this.addInteractionListeners(t))}handleUnitsChanged(){this.measurementUnits=new l(this.units)}handleCameraChanged(){this.updateCamera()}handleModeChanged(){this.warnIfDepthBuffersDisabled()}computePropsAndState(){this.updateCamera(),this.updateDepthBuffer(),this.updateLineFromProps(),this.updateDistance(),this.updateInteraction()}updateInteraction(){"replace"===this.mode?this.updateReplaceInteraction():"edit"===this.mode&&this.updateEditInteraction(),this.interactionCount>0&&(this.updateLineFromProps(),this.updateInvalid())}updateReplaceInteraction(){var t;null===(t=this.stateMap.hoverCursor)||void 0===t||t.dispose(),null!=this.interactiveStartPoint&&(this.start=m(this.interactiveStartPoint,this.internalDepthBuffer,this.viewport)),null!=this.interactiveEndPoint&&null!=this.internalDepthBuffer&&(this.end=m(this.interactiveEndPoint,this.internalDepthBuffer,this.viewport,{ignoreDepthTest:!0})),this.interactiveStartPoint=void 0,this.interactiveEndPoint=void 0,null!=this.start&&this.setCursor(g)}updateEditInteraction(){var t;null===(t=this.stateMap.hoverCursor)||void 0===t||t.dispose(),this.interactionCount>0&&(null!=this.interactiveStartPoint&&(this.start=m(this.interactiveStartPoint,this.internalDepthBuffer,this.viewport,{ignoreDepthTest:!0})),null!=this.interactiveEndPoint&&(this.end=m(this.interactiveEndPoint,this.internalDepthBuffer,this.viewport,{ignoreDepthTest:!0})),this.interactiveStartPoint=void 0,this.interactiveEndPoint=void 0,this.setCursor(g))}async setCursor(t){var e,i;null===(e=this.stateMap.hoverCursor)||void 0===e||e.dispose(),this.isUserInteractingWithModel||(this.stateMap.hoverCursor=await(null===(i=this.viewer)||void 0===i?void 0:i.addCursor(t)))}computeElementPositions(){return"replace"===this.mode?this.computeReplaceElementPositions():this.computeEditOrViewElementPositions()}computeEditOrViewElementPositions(){return null!=this.internalCamera&&null!=this.line?this.computeLineElementPositions(this.internalCamera.projectionViewMatrix,this.line):{}}computeReplaceElementPositions(){if(null!=this.internalCamera){if(null!=this.line)return this.computeLineElementPositions(this.internalCamera.projectionViewMatrix,this.line);if(null!=this.start)return{indicatorPt:v(this.start,this.internalCamera.projectionViewMatrix,this.viewport)}}return{}}computeLineElementPositions(t,e){return null!=this.internalCamera?p(e,this.interactingAnchor,{projectionViewMatrix:t,viewport:this.viewport,camera:this.internalCamera}):{}}updateCamera(){var t,e;this.internalCamera=this.camera||(null===(e=null===(t=this.viewer)||void 0===t?void 0:t.frame)||void 0===e?void 0:e.scene.camera)}async updateDepthBuffer(){var t,e;this.internalDepthBuffer=this.depthBuffer||await(null===(e=null===(t=this.viewer)||void 0===t?void 0:t.frame)||void 0===e?void 0:e.depthBuffer())}updateLineFromProps(){const t=this.start||x(this.startJson),e=this.end||x(this.endJson);this.line=null!=t&&null!=e?h.create({start:t,end:e}):void 0}updateViewport(){const t=this.hostEl.getBoundingClientRect();this.viewport=new d(t.width,t.height),this.elementBounds=t}updateInvalid(){if(null!=this.internalDepthBuffer&&null!=this.line&&null!=this.internalCamera){const t=h.transformMatrix(this.line,this.internalCamera.projectionViewMatrix),e=this.viewport.transformPointToFrame(this.viewport.transformVectorToViewport(t.start),this.internalDepthBuffer),i=this.viewport.transformPointToFrame(this.viewport.transformVectorToViewport(t.end),this.internalDepthBuffer),n="start"===this.interactingAnchor&&!this.internalDepthBuffer.isDepthAtFarPlane(e),s="end"===this.interactingAnchor&&!this.internalDepthBuffer.isDepthAtFarPlane(i);this.invalid=n||s}}updateDistance(){const t=null==this.line||this.invalid?void 0:h.distance(this.line);this.distance=null!=t?this.measurementUnits.translateWorldValueToReal(t):void 0}invalidateState(){this.invalidateStateCounter=this.invalidateStateCounter+1}async addInteractionListeners(t){const e=await t.getInteractionTarget();"replace"===this.mode&&(e.addEventListener("pointermove",this.updateStartAnchor),e.addEventListener("pointerdown",this.startMeasurement),e.addEventListener("pointerleave",this.resetStartAnchor))}async removeInteractionListeners(t){const e=await t.getInteractionTarget();e.removeEventListener("pointermove",this.updateStartAnchor),e.removeEventListener("pointerdown",this.startMeasurement),e.removeEventListener("pointerleave",this.resetStartAnchor)}handleEditAnchor(t){if("edit"===this.mode&&null!=this.internalDepthBuffer){const e=this.createAnchorPointerMoveHandler(t),i=this.createAnchorPointerUpHandler(t,e);return n=>{0===n.button&&(this.beginEditing(t),this.getStencilBuffer(),window.addEventListener("pointermove",e),window.addEventListener("pointerup",i))}}}createAnchorPointerMoveHandler(t){return e=>{if(null!=this.elementBounds){e.preventDefault(),this.getStencilBuffer();const i=b(e,this.elementBounds),n=this.snapPoint(i,e);"start"===t?this.interactiveStartPoint=n:this.interactiveEndPoint=n}}}createAnchorPointerUpHandler(t,e){const i=()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",i),this.endEditing()};return i}async getStencilBuffer(){var t;const e=await(null===(t=this.viewer)||void 0===t?void 0:t.stencilBuffer.latestAfterInteraction());this.stateMap.stencil=e}snapPoint(t,e){const{stencil:i}=this.stateMap;if(null!=i&&!e.shiftKey){const e=this.viewport.transformPointToFrame(t,i),n=Math.max(0,this.snapDistance),s=i.getNearestPixel(e,n);if(null!=s)return this.viewport.transformPointToViewport(s,i)}return t}formatDistance(t){if(null!=this.labelFormatter)return this.labelFormatter(t);{const e=this.measurementUnits.unit.abbreviatedName;return null==t?"---":`~${t.toFixed(this.fractionalDigits)} ${e}`}}beginEditing(t){0===this.interactionCount&&(this.interactingAnchor=t,this.editBegin.emit()),this.interactionCount=this.interactionCount+1}endEditing(){1===this.interactionCount&&(this.interactingAnchor="none",this.editEnd.emit()),this.interactionCount=this.interactionCount-1}warnIfDepthBuffersDisabled(){null!=this.viewer&&null==this.viewer.depthBuffers&&console.warn("Measurement editing is disabled. <vertex-viewer> must have its `depth-buffers` attribute set.")}get hostEl(){return s(this)}static get watchers(){return{viewer:["handleViewerChanged"],units:["handleUnitsChanged"],camera:["handleCameraChanged"],mode:["handleModeChanged"]}}};function x(t){return"string"==typeof t?o.fromJson(t):t}P.style=":host{--viewer-measurement-distance-accent-color:var(--neutral-900);--viewer-measurement-distance-contrast-color:var(--white);--viewer-measurement-distance-invalid-accent-color:var(--red-600);--viewer-measurement-distance-invalid-contrast-color:var(--white);--viewer-measurement-distance-line-stroke-width:1.25px;--viewer-measurement-distance-line-fill-width:2px;--viewer-measurement-distance-distance-border:1px solid\n var(--viewer-measurement-distance-accent-color);--viewer-measurement-distance-distance-border-radius:0.25rem;--viewer-measurement-distance-distance-padding:0.375rem 0.5rem;color:var(--viewer-measurement-distance-accent-color);font-size:0.75rem;position:absolute;width:100%;height:100%;overflow:hidden}:host([invalid]){--viewer-measurement-distance-accent-color:var(\n --viewer-measurement-distance-invalid-accent-color\n ) !important;--viewer-measurement-distance-contrast-color:var(\n --viewer-measurement-distance-invalid-contrast-color\n ) !important}.measurement{position:absolute;width:100%;height:100%;pointer-events:none}.line{--viewer-measurement-line-stroke:var(\n --viewer-measurement-distance-contrast-color\n );--viewer-measurement-line-stroke-opacity:0.75;--viewer-measurement-line-stroke-width:var(\n --viewer-measurement-distance-line-stroke-width\n );--viewer-measurement-line-fill:var(\n --viewer-measurement-distance-accent-color\n );--viewer-measurement-line-fill-width:var(\n --viewer-measurement-distance-line-fill-width\n );position:absolute;width:100%;height:100%}.anchor{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block}:host(:not([mode='replace'])) .anchor,:host(:not([mode='replace'])) .anchor-label,:host(:not([mode='replace'])) .distance-label{pointer-events:auto}:host([interacting-anchor='start']) .anchor-start,:host([interacting-anchor='start']) .anchor-label-start{visibility:hidden}.hide-start-line-cap,:host([interacting-anchor='start']) .line{--viewer-measurement-line-start-cap-visibility:hidden}:host([interacting-anchor='end']) .anchor-end,:host([interacting-anchor='end']) .anchor-label-end{visibility:hidden}.hide-end-line-cap,:host([interacting-anchor='end']) .line{--viewer-measurement-line-end-cap-visibility:hidden}.anchor-label{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block}:host([mode='edit']){cursor:inherit}:host([mode='edit']) .anchor{cursor:move}:host(:not([mode='edit'])) .anchor{visibility:hidden}.anchor-placeholder{background:var(--viewer-measurement-distance-contrast-color);width:12px;height:12px;border-radius:50%;box-sizing:border-box}:host([mode='edit']) .anchor-placeholder{border:2px solid var(--viewer-measurement-distance-accent-color);background:var(--viewer-measurement-distance-contrast-color)}:host([mode='']) .distance-label{color:var(--viewer-measurement-distance-contrast-color);background:var(--viewer-measurement-distance-accent-color)}.distance-label{position:absolute;background:var(--viewer-measurement-distance-contrast-color);border:var(--viewer-measurement-distance-distance-border);border-radius:var(--viewer-measurement-distance-distance-border-radius);padding:var(--viewer-measurement-distance-distance-padding)}.indicator{position:absolute}.indicator-placeholder{background:var(--viewer-measurement-distance-accent-color);border:1px solid var(--viewer-measurement-distance-contrast-color);width:6px;height:6px;border-radius:50%;box-sizing:border-box}";const k=class{constructor(t){e(this,t),this.start=a.create(),this.end=a.create(),this.capLength=0,this.pointerEvents="none"}render(){const e=r.fromPoints(this.start,this.end),i=E(this.start,this.end,e,this.capLength),n=E(this.start,this.end,e,this.capLength+1);return t("svg",null,t("g",{class:"line-stroke","pointer-events":this.pointerEvents},t("line",{class:"line",x1:this.start.x,y1:this.start.y,x2:this.end.x,y2:this.end.y}),t("line",{class:"start-cap",x1:n.startEndCap.start.x,y1:n.startEndCap.start.y,x2:n.startEndCap.end.x,y2:n.startEndCap.end.y}),t("line",{class:"end-cap",x1:n.endEndCap.start.x,y1:n.endEndCap.start.y,x2:n.endEndCap.end.x,y2:n.endEndCap.end.y})),t("g",{class:"line-fill","pointer-events":this.pointerEvents},t("line",{class:"line",x1:this.start.x,y1:this.start.y,x2:this.end.x,y2:this.end.y}),t("line",{class:"start-cap",x1:i.startEndCap.start.x,y1:i.startEndCap.start.y,x2:i.startEndCap.end.x,y2:i.startEndCap.end.y}),t("line",{class:"end-cap",x1:i.endEndCap.start.x,y1:i.endEndCap.start.y,x2:i.endEndCap.end.x,y2:i.endEndCap.end.y})))}};function E(t,e,i,n){return{startEndCap:A(t,i,n),endEndCap:A(e,i,n)}}function A(t,e,i){const n=e+Math.PI/2;return{start:a.add(t,a.polar(i/2,n)),end:a.add(t,a.polar(i/2,n+Math.PI))}}k.style=":host{display:block;--viewer-measurement-line-stroke:var(--white);--viewer-measurement-line-stroke-opacity:0.75;--viewer-measurement-line-stroke-width:1.25px;--viewer-measurement-line-fill:var(--neutral-900);--viewer-measurement-line-fill-width:2px;--viewer-measurement-line-start-cap-visibility:initial;--viewer-measurement-line-end-cap-visibility:initial}svg{width:100%;height:100%}.line-stroke{stroke-width:calc(\n var(--viewer-measurement-line-fill-width) +\n var(--viewer-measurement-line-stroke-width)\n );stroke:var(--viewer-measurement-line-stroke);opacity:var(--viewer-measurement-line-stroke-opacity)}.line-fill{stroke-width:var(--viewer-measurement-line-fill-width);stroke:var(--viewer-measurement-line-fill)}.start-cap{visibility:var(--viewer-measurement-line-start-cap-visibility)}.end-cap{visibility:var(--viewer-measurement-line-end-cap-visibility)}";export{P as vertex_viewer_measurement_distance,k as vertex_viewer_measurement_line}
4
+ import{h as t,r as e,c as i,H as n,g as s}from"./p-c9d8a379.js";import{k as r,p as a,v as o,o as h}from"./p-640cb5f8.js";import{M as l}from"./p-21e8510d.js";import{V as d}from"./p-b36b3d1a.js";import{M as c,a as u,t as m,b as v,g as p}from"./p-62c6f482.js";import{a as w,g as b}from"./p-75682963.js";import{c as f}from"./p-f482325b.js";import{m as g}from"./p-9faabd97.js";import"./p-59d075d4.js";import"./p-112455b1.js";const y=({startPt:e,endPt:i,centerPt:n,indicatorPt:s,distance:o,anchorLabelOffset:h,lineCapLength:l,linePointerEvents:d,hideStartAnchor:c,hideEndAnchor:u,onStartAnchorPointerDown:m,onEndAnchorPointerDown:v})=>{const p=null!=e&&null!=i?r.fromPoints(e,i):void 0,b=null!=p&&null!=e&&null!=h?a.add(e,a.polar(-h,p)):void 0,g=null!=p&&null!=i&&null!=h?a.add(i,a.polar(h,p)):void 0;return t("div",null,null!=e&&null!=i&&t("vertex-viewer-measurement-line",{class:f("line",{"hide-start-line-cap":c,"hide-end-line-cap":u}),start:e,end:i,capLength:l,pointerEvents:d}),!c&&null!=e&&t("div",{id:"start-anchor",class:"anchor anchor-start",style:{transform:w(e)},onPointerDown:m},t("slot",{name:"start-anchor"},t("div",{class:"anchor-placeholder"}))),!c&&b&&t("div",{class:"anchor-label anchor-label-start",style:{transform:w(b)}},t("slot",{name:"start-label"})),!u&&null!=i&&t("div",{id:"end-anchor",class:"anchor anchor-end",style:{transform:w(i)},onPointerDown:v},t("slot",{name:"end-anchor"},t("div",{class:"anchor-placeholder"}))),!u&&g&&t("div",{class:"anchor-label anchor-label-end",style:{transform:w(g)}},t("slot",{name:"end-label"})),null!=n&&t("div",{id:"label",class:"distance-label",style:{transform:w(n)}},o),null!=s&&t("div",{class:"indicator",style:{transform:w(s)}},t("slot",{name:"indicator"},t("div",{class:"indicator-placeholder"}))))},P=class{constructor(t){e(this,t),this.editBegin=i(this,"editBegin",7),this.editEnd=i(this,"editEnd",7),this.snapDistance=c,this.units="millimeters",this.fractionalDigits=2,this.anchorLabelOffset=20,this.lineCapLength=u,this.mode="",this.interactingAnchor="none",this.invalid=!1,this.viewport=new d(0,0),this.interactionCount=0,this.invalidateStateCounter=0,this.stateMap={},this.measurementUnits=new l(this.units),this.isUserInteractingWithModel=!1,this.handleFrameDrawn=()=>{this.invalidateState()},this.updateStartAnchor=async t=>{if(0===this.interactionCount){const e=b(t,this.elementBounds),i=this.snapPoint(e,t);this.getStencilBuffer(),this.interactiveStartPoint=i}},this.resetStartAnchor=()=>{0===this.interactionCount&&(this.start=void 0,this.interactiveStartPoint=void 0)},this.startMeasurement=t=>{if(0===this.interactionCount&&null!=this.start&&0===t.button){const t=t=>{const e=()=>t(),i=()=>(window.removeEventListener("pointermove",e),void window.removeEventListener("pointerup",i)),n=()=>{window.addEventListener("pointermove",e),window.addEventListener("pointerup",i)};return window.addEventListener("pointerdown",n),{dispose:()=>window.removeEventListener("pointerdown",n)}};(t=>{const e=()=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointermove",n)},i=async()=>{e(),t()},n=t=>{t.buttons>0&&e()};window.addEventListener("pointermove",n),window.addEventListener("pointerup",i)})((()=>{const e=t((()=>{var t;this.isUserInteractingWithModel=!0,null===(t=this.stateMap.hoverCursor)||void 0===t||t.dispose()})),i=this.createAnchorPointerMoveHandler("end"),n=t=>{0===t.button&&(this.isUserInteractingWithModel?this.isUserInteractingWithModel=!1:(window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",n),e.dispose(),this.endEditing()))};this.beginEditing("end"),window.addEventListener("pointermove",i),window.addEventListener("pointerup",n)}))}}}async computeElementMetrics(){var t,e,i;const n=null===(t=this.hostEl.shadowRoot)||void 0===t?void 0:t.getElementById("start-anchor"),s=null===(e=this.hostEl.shadowRoot)||void 0===e?void 0:e.getElementById("end-anchor"),r=null===(i=this.hostEl.shadowRoot)||void 0===i?void 0:i.getElementById("label");return null!=n&&null!=s&&null!=r?{startAnchor:n.getBoundingClientRect(),endAnchor:s.getBoundingClientRect(),label:r.getBoundingClientRect()}:void 0}componentWillLoad(){this.updateViewport(),this.handleViewerChanged(this.viewer),this.handleModeChanged(),this.computePropsAndState()}componentDidLoad(){new ResizeObserver((()=>this.updateViewport())).observe(this.hostEl)}componentWillUpdate(){this.computePropsAndState()}render(){const e=this.computeElementPositions(),{startPt:i,endPt:s,labelPt:r,indicatorPt:a,hideStart:o,hideEnd:h}=e,l=this.formatDistance(this.distance);return t(n,null,t("div",{class:"measurement"},t(y,"edit"===this.mode?{startPt:i,endPt:s,centerPt:r,indicatorPt:a,distance:l,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength,hideStartAnchor:o,hideEndAnchor:h,onStartAnchorPointerDown:this.handleEditAnchor("start"),onEndAnchorPointerDown:this.handleEditAnchor("end")}:"replace"===this.mode?{startPt:i,endPt:s,centerPt:r,indicatorPt:a,distance:l,hideStartAnchor:o,hideEndAnchor:h,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength}:{startPt:i,endPt:s,centerPt:r,indicatorPt:a,distance:l,hideStartAnchor:o,hideEndAnchor:h,anchorLabelOffset:this.anchorLabelOffset,lineCapLength:this.lineCapLength,linePointerEvents:"painted"})))}handleViewerChanged(t,e){null!=e&&(e.removeEventListener("frameDrawn",this.handleFrameDrawn),this.removeInteractionListeners(e)),null!=t&&(t.addEventListener("frameDrawn",this.handleFrameDrawn),this.addInteractionListeners(t))}handleUnitsChanged(){this.measurementUnits=new l(this.units)}handleCameraChanged(){this.updateCamera()}handleModeChanged(){this.warnIfDepthBuffersDisabled()}computePropsAndState(){this.updateCamera(),this.updateDepthBuffer(),this.updateLineFromProps(),this.updateDistance(),this.updateInteraction()}updateInteraction(){"replace"===this.mode?this.updateReplaceInteraction():"edit"===this.mode&&this.updateEditInteraction(),this.interactionCount>0&&(this.updateLineFromProps(),this.updateInvalid())}updateReplaceInteraction(){var t;null===(t=this.stateMap.hoverCursor)||void 0===t||t.dispose(),null!=this.interactiveStartPoint&&(this.start=m(this.interactiveStartPoint,this.internalDepthBuffer,this.viewport)),null!=this.interactiveEndPoint&&null!=this.internalDepthBuffer&&(this.end=m(this.interactiveEndPoint,this.internalDepthBuffer,this.viewport,{ignoreDepthTest:!0})),this.interactiveStartPoint=void 0,this.interactiveEndPoint=void 0,null!=this.start&&this.setCursor(g)}updateEditInteraction(){var t;null===(t=this.stateMap.hoverCursor)||void 0===t||t.dispose(),this.interactionCount>0&&(null!=this.interactiveStartPoint&&(this.start=m(this.interactiveStartPoint,this.internalDepthBuffer,this.viewport,{ignoreDepthTest:!0})),null!=this.interactiveEndPoint&&(this.end=m(this.interactiveEndPoint,this.internalDepthBuffer,this.viewport,{ignoreDepthTest:!0})),this.interactiveStartPoint=void 0,this.interactiveEndPoint=void 0,this.setCursor(g))}async setCursor(t){var e,i;null===(e=this.stateMap.hoverCursor)||void 0===e||e.dispose(),this.isUserInteractingWithModel||(this.stateMap.hoverCursor=await(null===(i=this.viewer)||void 0===i?void 0:i.addCursor(t)))}computeElementPositions(){return"replace"===this.mode?this.computeReplaceElementPositions():this.computeEditOrViewElementPositions()}computeEditOrViewElementPositions(){return null!=this.internalCamera&&null!=this.line?this.computeLineElementPositions(this.internalCamera.projectionViewMatrix,this.line):{}}computeReplaceElementPositions(){if(null!=this.internalCamera){if(null!=this.line)return this.computeLineElementPositions(this.internalCamera.projectionViewMatrix,this.line);if(null!=this.start)return{indicatorPt:v(this.start,this.internalCamera.projectionViewMatrix,this.viewport)}}return{}}computeLineElementPositions(t,e){return null!=this.internalCamera?p(e,this.interactingAnchor,{projectionViewMatrix:t,viewport:this.viewport,camera:this.internalCamera}):{}}updateCamera(){var t,e;this.internalCamera=this.camera||(null===(e=null===(t=this.viewer)||void 0===t?void 0:t.frame)||void 0===e?void 0:e.scene.camera)}async updateDepthBuffer(){var t,e;this.internalDepthBuffer=this.depthBuffer||await(null===(e=null===(t=this.viewer)||void 0===t?void 0:t.frame)||void 0===e?void 0:e.depthBuffer())}updateLineFromProps(){const t=this.start||x(this.startJson),e=this.end||x(this.endJson);this.line=null!=t&&null!=e?h.create({start:t,end:e}):void 0}updateViewport(){const t=this.hostEl.getBoundingClientRect();this.viewport=new d(t.width,t.height),this.elementBounds=t}updateInvalid(){if(null!=this.internalDepthBuffer&&null!=this.line&&null!=this.internalCamera){const t=h.transformMatrix(this.line,this.internalCamera.projectionViewMatrix),e=this.viewport.transformPointToFrame(this.viewport.transformVectorToViewport(t.start),this.internalDepthBuffer),i=this.viewport.transformPointToFrame(this.viewport.transformVectorToViewport(t.end),this.internalDepthBuffer),n="start"===this.interactingAnchor&&!this.internalDepthBuffer.isDepthAtFarPlane(e),s="end"===this.interactingAnchor&&!this.internalDepthBuffer.isDepthAtFarPlane(i);this.invalid=n||s}}updateDistance(){const t=null==this.line||this.invalid?void 0:h.distance(this.line);this.distance=null!=t?this.measurementUnits.translateWorldValueToReal(t):void 0}invalidateState(){this.invalidateStateCounter=this.invalidateStateCounter+1}async addInteractionListeners(t){const e=await t.getInteractionTarget();"replace"===this.mode&&(e.addEventListener("pointermove",this.updateStartAnchor),e.addEventListener("pointerdown",this.startMeasurement),e.addEventListener("pointerleave",this.resetStartAnchor))}async removeInteractionListeners(t){const e=await t.getInteractionTarget();e.removeEventListener("pointermove",this.updateStartAnchor),e.removeEventListener("pointerdown",this.startMeasurement),e.removeEventListener("pointerleave",this.resetStartAnchor)}handleEditAnchor(t){if("edit"===this.mode&&null!=this.internalDepthBuffer){const e=this.createAnchorPointerMoveHandler(t),i=this.createAnchorPointerUpHandler(t,e);return n=>{0===n.button&&(this.beginEditing(t),this.getStencilBuffer(),window.addEventListener("pointermove",e),window.addEventListener("pointerup",i))}}}createAnchorPointerMoveHandler(t){return e=>{if(null!=this.elementBounds){e.preventDefault(),this.getStencilBuffer();const i=b(e,this.elementBounds),n=this.snapPoint(i,e);"start"===t?this.interactiveStartPoint=n:this.interactiveEndPoint=n}}}createAnchorPointerUpHandler(t,e){const i=()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",i),this.endEditing()};return i}async getStencilBuffer(){var t;const e=await(null===(t=this.viewer)||void 0===t?void 0:t.stencilBuffer.latestAfterInteraction());this.stateMap.stencil=e}snapPoint(t,e){const{stencil:i}=this.stateMap;if(null!=i&&!e.shiftKey){const e=this.viewport.transformPointToFrame(t,i),n=Math.max(0,this.snapDistance),s=i.getNearestPixel(e,n);if(null!=s)return this.viewport.transformPointToViewport(s,i)}return t}formatDistance(t){if(null!=this.labelFormatter)return this.labelFormatter(t);{const e=this.measurementUnits.unit.abbreviatedName;return null==t?"---":`~${t.toFixed(this.fractionalDigits)} ${e}`}}beginEditing(t){0===this.interactionCount&&(this.interactingAnchor=t,this.editBegin.emit()),this.interactionCount=this.interactionCount+1}endEditing(){1===this.interactionCount&&(this.interactingAnchor="none",this.editEnd.emit()),this.interactionCount=this.interactionCount-1}warnIfDepthBuffersDisabled(){null!=this.viewer&&null==this.viewer.depthBuffers&&console.warn("Measurement editing is disabled. <vertex-viewer> must have its `depth-buffers` attribute set.")}get hostEl(){return s(this)}static get watchers(){return{viewer:["handleViewerChanged"],units:["handleUnitsChanged"],camera:["handleCameraChanged"],mode:["handleModeChanged"]}}};function x(t){return"string"==typeof t?o.fromJson(t):t}P.style=":host{--viewer-measurement-distance-accent-color:var(--neutral-900);--viewer-measurement-distance-contrast-color:var(--white);--viewer-measurement-distance-invalid-accent-color:var(--red-600);--viewer-measurement-distance-invalid-contrast-color:var(--white);--viewer-measurement-distance-line-stroke-width:1.25px;--viewer-measurement-distance-line-fill-width:2px;--viewer-measurement-distance-distance-border:1px solid\n var(--viewer-measurement-distance-accent-color);--viewer-measurement-distance-distance-border-radius:0.25rem;--viewer-measurement-distance-distance-padding:0.375rem 0.5rem;color:var(--viewer-measurement-distance-accent-color);font-size:0.75rem;position:absolute;width:100%;height:100%;overflow:hidden}:host([invalid]){--viewer-measurement-distance-accent-color:var(\n --viewer-measurement-distance-invalid-accent-color\n ) !important;--viewer-measurement-distance-contrast-color:var(\n --viewer-measurement-distance-invalid-contrast-color\n ) !important}.measurement{position:absolute;width:100%;height:100%;pointer-events:none}.line{--viewer-measurement-line-stroke:var(\n --viewer-measurement-distance-contrast-color\n );--viewer-measurement-line-stroke-opacity:0.75;--viewer-measurement-line-stroke-width:var(\n --viewer-measurement-distance-line-stroke-width\n );--viewer-measurement-line-fill:var(\n --viewer-measurement-distance-accent-color\n );--viewer-measurement-line-fill-width:var(\n --viewer-measurement-distance-line-fill-width\n );position:absolute;width:100%;height:100%}.anchor{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block}:host(:not([mode='replace'])) .anchor,:host(:not([mode='replace'])) .anchor-label,:host(:not([mode='replace'])) .distance-label{pointer-events:auto}:host([interacting-anchor='start']) .anchor-start,:host([interacting-anchor='start']) .anchor-label-start{visibility:hidden}.hide-start-line-cap,:host([interacting-anchor='start']) .line{--viewer-measurement-line-start-cap-visibility:hidden}:host([interacting-anchor='end']) .anchor-end,:host([interacting-anchor='end']) .anchor-label-end{visibility:hidden}.hide-end-line-cap,:host([interacting-anchor='end']) .line{--viewer-measurement-line-end-cap-visibility:hidden}.anchor-label{position:absolute;border-radius:50%;transform:translate(-50%, -50%);display:block}:host([mode='edit']){cursor:inherit}:host([mode='edit']) .anchor{cursor:move}:host(:not([mode='edit'])) .anchor{visibility:hidden}.anchor-placeholder{background:var(--viewer-measurement-distance-contrast-color);width:12px;height:12px;border-radius:50%;box-sizing:border-box}:host([mode='edit']) .anchor-placeholder{border:2px solid var(--viewer-measurement-distance-accent-color);background:var(--viewer-measurement-distance-contrast-color)}:host([mode='']) .distance-label{color:var(--viewer-measurement-distance-contrast-color);background:var(--viewer-measurement-distance-accent-color)}.distance-label{position:absolute;background:var(--viewer-measurement-distance-contrast-color);border:var(--viewer-measurement-distance-distance-border);border-radius:var(--viewer-measurement-distance-distance-border-radius);padding:var(--viewer-measurement-distance-distance-padding)}.indicator{position:absolute}.indicator-placeholder{background:var(--viewer-measurement-distance-accent-color);border:1px solid var(--viewer-measurement-distance-contrast-color);width:6px;height:6px;border-radius:50%;box-sizing:border-box}";const k=class{constructor(t){e(this,t),this.start=a.create(),this.end=a.create(),this.capLength=0,this.pointerEvents="none"}render(){const e=r.fromPoints(this.start,this.end),i=E(this.start,this.end,e,this.capLength),n=E(this.start,this.end,e,this.capLength+1);return t("svg",null,t("g",{class:"line-stroke","pointer-events":this.pointerEvents},t("line",{class:"line",x1:this.start.x,y1:this.start.y,x2:this.end.x,y2:this.end.y}),t("line",{class:"start-cap",x1:n.startEndCap.start.x,y1:n.startEndCap.start.y,x2:n.startEndCap.end.x,y2:n.startEndCap.end.y}),t("line",{class:"end-cap",x1:n.endEndCap.start.x,y1:n.endEndCap.start.y,x2:n.endEndCap.end.x,y2:n.endEndCap.end.y})),t("g",{class:"line-fill","pointer-events":this.pointerEvents},t("line",{class:"line",x1:this.start.x,y1:this.start.y,x2:this.end.x,y2:this.end.y}),t("line",{class:"start-cap",x1:i.startEndCap.start.x,y1:i.startEndCap.start.y,x2:i.startEndCap.end.x,y2:i.startEndCap.end.y}),t("line",{class:"end-cap",x1:i.endEndCap.start.x,y1:i.endEndCap.start.y,x2:i.endEndCap.end.x,y2:i.endEndCap.end.y})))}};function E(t,e,i,n){return{startEndCap:A(t,i,n),endEndCap:A(e,i,n)}}function A(t,e,i){const n=e+Math.PI/2;return{start:a.add(t,a.polar(i/2,n)),end:a.add(t,a.polar(i/2,n+Math.PI))}}k.style=":host{display:block;--viewer-measurement-line-stroke:var(--white);--viewer-measurement-line-stroke-opacity:0.75;--viewer-measurement-line-stroke-width:1.25px;--viewer-measurement-line-fill:var(--neutral-900);--viewer-measurement-line-fill-width:2px;--viewer-measurement-line-start-cap-visibility:initial;--viewer-measurement-line-end-cap-visibility:initial}svg{width:100%;height:100%}.line-stroke{stroke-width:calc(\n var(--viewer-measurement-line-fill-width) +\n var(--viewer-measurement-line-stroke-width)\n );stroke:var(--viewer-measurement-line-stroke);opacity:var(--viewer-measurement-line-stroke-opacity)}.line-fill{stroke-width:var(--viewer-measurement-line-fill-width);stroke:var(--viewer-measurement-line-fill)}.start-cap{visibility:var(--viewer-measurement-line-start-cap-visibility)}.end-cap{visibility:var(--viewer-measurement-line-end-cap-visibility)}";export{P as vertex_viewer_measurement_distance,k as vertex_viewer_measurement_line}
@@ -1,4 +1,4 @@
1
1
  /**!
2
2
  * Copyright (c) 2021 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{o as e,c as t}from"./p-6d4ab5fc.js";import"./p-b5c350a7.js";const s={network:{apiHost:"https://platform.platprod.vertexvis.io",renderingHost:"wss://stream.platprod.vertexvis.io",sceneTreeHost:"https://scene-trees.platprod.vertexvis.io"},flags:{throttleFrameDelivery:!0,adaptiveRendering:!0,logWsMessages:!1,logFrameRate:!1,letterboxFrames:!1},events:{doubleTapThreshold:500,longPressThreshold:500},animation:{durationMs:500},interactions:{finePointerThreshold:1,coarsePointerThreshold:3,interactionDelay:75},EXPERIMENTAL_frameDelivery:{},EXPERIMENTAL_adaptiveRendering:{},EXPERIMENTAL_qualityOfService:{}},r=Object.assign(Object.assign({},s),{network:{apiHost:"https://platform.platdev.vertexvis.io",renderingHost:"wss://stream.platdev.vertexvis.io",sceneTreeHost:"https://scene-trees.platdev.vertexvis.io"}}),o=Object.assign(Object.assign({},s),{network:{apiHost:"https://platform.platstaging.vertexvis.io",renderingHost:"wss://stream.platstaging.vertexvis.io",sceneTreeHost:"https://scene-trees.platstaging.vertexvis.io"}});function a(e){switch(e){case"platdev":return r;case"platstaging":return o;default:return s}}function i(t="platprod",s){"string"==typeof s&&(s=JSON.parse(s));const r=a(t);return null==s?r:e.defaults(Object.assign({},s),r)}function n(e){const s=window.getComputedStyle(e);return t.fromCss(s.backgroundColor)}function p(e){return e.getBoundingClientRect()}export{n as a,p as g,i as p}
4
+ import{o as e,c as t}from"./p-59d075d4.js";import"./p-21e8510d.js";const s={network:{apiHost:"https://platform.platprod.vertexvis.io",renderingHost:"wss://stream.platprod.vertexvis.io",sceneTreeHost:"https://scene-trees.platprod.vertexvis.io"},flags:{throttleFrameDelivery:!0,adaptiveRendering:!0,logWsMessages:!1,logFrameRate:!1,letterboxFrames:!1},events:{doubleTapThreshold:500,longPressThreshold:500},animation:{durationMs:500},interactions:{finePointerThreshold:1,coarsePointerThreshold:3,interactionDelay:75},EXPERIMENTAL_frameDelivery:{},EXPERIMENTAL_adaptiveRendering:{},EXPERIMENTAL_qualityOfService:{}},r=Object.assign(Object.assign({},s),{network:{apiHost:"https://platform.platdev.vertexvis.io",renderingHost:"wss://stream.platdev.vertexvis.io",sceneTreeHost:"https://scene-trees.platdev.vertexvis.io"}}),o=Object.assign(Object.assign({},s),{network:{apiHost:"https://platform.platstaging.vertexvis.io",renderingHost:"wss://stream.platstaging.vertexvis.io",sceneTreeHost:"https://scene-trees.platstaging.vertexvis.io"}});function i(e){switch(e){case"platdev":return r;case"platstaging":return o;default:return s}}function n(t="platprod",s){"string"==typeof s&&(s=JSON.parse(s));const r=i(t);return null==s?r:e.defaults(Object.assign({},s),r)}function a(e){const s=window.getComputedStyle(e);return t.fromCss(s.backgroundColor)}function p(e){return e.getBoundingClientRect()}export{a,p as g,n as p}
@@ -0,0 +1,4 @@
1
+ /**!
2
+ * Copyright (c) 2021 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import{r as t,c as i,h as s,H as n,g as e}from"./p-c9d8a379.js";import{a as h,g as o,p as r}from"./p-d42a482c.js";import{v as a,k as l,p as u,h as c,r as d,e as v,l as f,f as w}from"./p-640cb5f8.js";import{c as m}from"./p-f482325b.js";import{u as p,E as g,o as b,b as y}from"./p-59d075d4.js";import{I as C,t as T,b as P,p as x,d as E,W as I,v as S,e as D,f as k,V as O,C as z,g as M,h as R,a as j,i as F,j as A,k as B,m as L,S as K}from"./p-b122ee39.js";import{S as $,m as N,d as W}from"./p-21e8510d.js";import{V as U}from"./p-b36b3d1a.js";import{g as V,c as q}from"./p-75682963.js";import{C as G}from"./p-9faabd97.js";import"./p-112455b1.js";var J,H=[],_="ResizeObserver loop completed with undelivered notifications.";!function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(J||(J={}));var X,Y=function(t){return Object.freeze(t)},Q=function(t,i){this.inlineSize=t,this.blockSize=i,Y(this)},Z=function(){function t(t,i,s,n){return this.x=t,this.y=i,this.width=s,this.height=n,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Y(this)}return t.prototype.toJSON=function(){var t=this;return{x:t.x,y:t.y,top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}},t.fromRect=function(i){return new t(i.x,i.y,i.width,i.height)},t}(),tt=function(t){return t instanceof SVGElement&&"getBBox"in t},it=function(t){if(tt(t)){var i=t.getBBox();return!i.width&&!i.height}return!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},st=function(t){var i,s;if(t instanceof Element)return!0;var n=null===(s=null===(i=t)||void 0===i?void 0:i.ownerDocument)||void 0===s?void 0:s.defaultView;return!!(n&&t instanceof n.Element)},nt="undefined"!=typeof window?window:{},et=new WeakMap,ht=/auto|scroll/,ot=/^tb|vertical/,rt=/msie|trident/i.test(nt.navigator&&nt.navigator.userAgent),at=function(t){return parseFloat(t||"0")},lt=function(t,i,s){return void 0===t&&(t=0),void 0===i&&(i=0),void 0===s&&(s=!1),new Q((s?i:t)||0,(s?t:i)||0)},ut=Y({devicePixelContentBoxSize:lt(),borderBoxSize:lt(),contentBoxSize:lt(),contentRect:new Z(0,0,0,0)}),ct=function(t,i){if(void 0===i&&(i=!1),et.has(t)&&!i)return et.get(t);if(it(t))return et.set(t,ut),ut;var s=getComputedStyle(t),n=tt(t)&&t.ownerSVGElement&&t.getBBox(),e=!rt&&"border-box"===s.boxSizing,h=ot.test(s.writingMode||""),o=!n&&ht.test(s.overflowY||""),r=!n&&ht.test(s.overflowX||""),a=n?0:at(s.paddingTop),l=n?0:at(s.paddingRight),u=n?0:at(s.paddingBottom),c=n?0:at(s.paddingLeft),d=n?0:at(s.borderTopWidth),v=n?0:at(s.borderRightWidth),f=n?0:at(s.borderBottomWidth),w=c+l,m=a+u,p=(n?0:at(s.borderLeftWidth))+v,g=d+f,b=r?t.offsetHeight-g-t.clientHeight:0,y=o?t.offsetWidth-p-t.clientWidth:0,C=e?w+p:0,T=e?m+g:0,P=n?n.width:at(s.width)-C-y,x=n?n.height:at(s.height)-T-b,E=P+w+y+p,I=x+m+b+g,S=Y({devicePixelContentBoxSize:lt(Math.round(P*devicePixelRatio),Math.round(x*devicePixelRatio),h),borderBoxSize:lt(E,I,h),contentBoxSize:lt(P,x,h),contentRect:new Z(c,a,P,x)});return et.set(t,S),S},dt=function(t,i,s){var n=ct(t,s),e=n.borderBoxSize,h=n.contentBoxSize,o=n.devicePixelContentBoxSize;switch(i){case J.DEVICE_PIXEL_CONTENT_BOX:return o;case J.BORDER_BOX:return e;default:return h}},vt=function(t){var i=ct(t);this.target=t,this.contentRect=i.contentRect,this.borderBoxSize=Y([i.borderBoxSize]),this.contentBoxSize=Y([i.contentBoxSize]),this.devicePixelContentBoxSize=Y([i.devicePixelContentBoxSize])},ft=function(t){if(it(t))return 1/0;for(var i=0,s=t.parentNode;s;)i+=1,s=s.parentNode;return i},wt=function(){var t=1/0,i=[];H.forEach((function(s){if(0!==s.activeTargets.length){var n=[];s.activeTargets.forEach((function(i){var s=new vt(i.target),e=ft(i.target);n.push(s),i.lastReportedSize=dt(i.target,i.observedBox),e<t&&(t=e)})),i.push((function(){s.callback.call(s.observer,n,s.observer)})),s.activeTargets.splice(0,s.activeTargets.length)}}));for(var s=0,n=i;s<n.length;s++)(0,n[s])();return t},mt=function(t){H.forEach((function(i){i.activeTargets.splice(0,i.activeTargets.length),i.skippedTargets.splice(0,i.skippedTargets.length),i.observationTargets.forEach((function(s){s.isActive()&&(ft(s.target)>t?i.activeTargets.push(s):i.skippedTargets.push(s))}))}))},pt=[],gt=0,bt={attributes:!0,characterData:!0,childList:!0,subtree:!0},yt=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ct=function(t){return void 0===t&&(t=0),Date.now()+t},Tt=!1,Pt=new(function(){function t(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return t.prototype.run=function(t){var i=this;if(void 0===t&&(t=250),!Tt){Tt=!0;var s,n=Ct(t);s=function(){var s=!1;try{s=function(){var t,i=0;for(mt(i);H.some((function(t){return t.activeTargets.length>0}));)i=wt(),mt(i);return H.some((function(t){return t.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?t=new ErrorEvent("error",{message:_}):((t=document.createEvent("Event")).initEvent("error",!1,!1),t.message=_),window.dispatchEvent(t)),i>0}()}finally{if(Tt=!1,t=n-Ct(),!gt)return;s?i.run(1e3):t>0?i.run(t):i.start()}},function(t){if(!X){var i=0,s=document.createTextNode("");new MutationObserver((function(){return pt.splice(0).forEach((function(t){return t()}))})).observe(s,{characterData:!0}),X=function(){s.textContent=""+(i?i--:i++)}}pt.push(t),X()}((function(){requestAnimationFrame(s)}))}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var t=this,i=function(){return t.observer&&t.observer.observe(document.body,bt)};document.body?i():nt.addEventListener("DOMContentLoaded",i)},t.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),yt.forEach((function(i){return nt.addEventListener(i,t.listener,!0)})))},t.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),yt.forEach((function(i){return nt.removeEventListener(i,t.listener,!0)})),this.stopped=!0)},t}()),xt=function(t){!gt&&t>0&&Pt.start(),!(gt+=t)&&Pt.stop()},Et=function(){function t(t,i){this.target=t,this.observedBox=i||J.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var t,i=dt(this.target,this.observedBox,!0);return tt(t=this.target)||function(t){switch(t.tagName){case"INPUT":if("image"!==t.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(t)||"inline"!==getComputedStyle(t).display||(this.lastReportedSize=i),this.lastReportedSize.inlineSize!==i.inlineSize||this.lastReportedSize.blockSize!==i.blockSize},t}(),It=function(t,i){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=i},St=new WeakMap,Dt=function(t,i){for(var s=0;s<t.length;s+=1)if(t[s].target===i)return s;return-1},kt=function(){function t(){}return t.connect=function(t,i){var s=new It(t,i);St.set(t,s)},t.observe=function(t,i,s){var n=St.get(t),e=0===n.observationTargets.length;Dt(n.observationTargets,i)<0&&(e&&H.push(n),n.observationTargets.push(new Et(i,s&&s.box)),xt(1),Pt.schedule())},t.unobserve=function(t,i){var s=St.get(t),n=Dt(s.observationTargets,i);n>=0&&(1===s.observationTargets.length&&H.splice(H.indexOf(s),1),s.observationTargets.splice(n,1),xt(-1))},t.disconnect=function(t){var i=this,s=St.get(t);s.observationTargets.slice().forEach((function(s){return i.unobserve(t,s.target)})),s.activeTargets.splice(0,s.activeTargets.length)},t}(),Ot=function(){function t(t){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof t)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");kt.connect(this,t)}return t.prototype.observe=function(t,i){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!st(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");kt.observe(this,t,i)},t.prototype.unobserve=function(t){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!st(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");kt.unobserve(this,t)},t.prototype.disconnect=function(){kt.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}();class zt{constructor(t,i){this.stream=t,this.configProvider=i,this.commands={}}register(t,i,s){return this.commands[t]={factory:i,thisArg:s},{dispose:()=>delete this.commands[t]}}execute(t,...i){const s=this.getCommandDefinition(t);if(null!=s){const t=s.factory.apply(s.thisArg,i);return new Promise((i=>{i(t({stream:this.stream,config:this.configProvider()}))}))}throw new Error(`Command not registered for \`${t}\``)}getCommandDefinition(t){return this.commands[t]}}class Mt{constructor(t,i,s,n,e,h,o,r,a,l){this.stream=t,this.getConfig=i,this.getScene=s,this.getFrame=n,this.getViewport=e,this.tapEmitter=h,this.doubleTapEmitter=o,this.longPressEmitter=r,this.interactionStartedEmitter=a,this.interactionFinishedEmitter=l,this.tap=this.tap.bind(this),this.doubleTap=this.doubleTap.bind(this),this.longPress=this.longPress.bind(this),this.emitTapEvent=this.emitTapEvent.bind(this)}getRayFromPoint(t){const i=this.getViewport(),s=this.getFrame();if(null!=s)return i.transformPointToRay(t,s.image,s.scene.camera);throw new Error("Cannot get camera. Frame is undefined.")}async tap(t,i={},s=0){this.emitTapEvent(this.tapEmitter.emit,t,i,s)}async doubleTap(t,i={},s=0){this.emitTapEvent(this.doubleTapEmitter.emit,t,i,s)}async longPress(t,i={},s=0){this.emitTapEvent(this.longPressEmitter.emit,t,i,s)}async beginInteraction(){this.isInteracting()||(this.interactionStartedEmitter.emit(),this.currentCamera=this.getScene().camera(),await this.stream.beginInteraction())}async transformCamera(t){var i;if(this.isInteracting()){const s=this.getScene(),n=this.getViewport(),e=this.getFrame(),h=await(null==e?void 0:e.depthBuffer());this.currentCamera=null!=this.currentCamera&&null!=n&&null!=e?t({camera:this.currentCamera,viewport:n,scale:s.scale(),boundingBox:s.boundingBox(),frame:e,depthBuffer:h}):void 0,await(null===(i=this.currentCamera)||void 0===i?void 0:i.render())}}async twistCamera(...t){return this.transformCamera((({camera:i,viewport:s})=>{const n=a.normalize(a.subtract(i.lookAt,i.position));if(1===t.length&&"number"==typeof t[0]){const s=l.toRadians(-t[0]);return i.rotateAroundAxis(s,n)}if(1===t.length){const n=u.create(s.width/2,s.height/2),e=l.fromPointsInDegrees(n,t[0]),h=null!=this.lastAngle?e-this.lastAngle:0;this.lastAngle=e;const o=a.normalize(a.subtract(i.lookAt,i.position)),r=l.toRadians(-h);return i.rotateAroundAxis(r,o)}return i}))}async panCameraToScreenPoint(t){return this.transformCamera((({camera:i,frame:s,viewport:n,depthBuffer:e})=>{if(null==this.panData){const h=i.toFrameCamera(),o=h.direction,r=n.transformPointToRay(t,s.image,h),a=c.fromNormalAndCoplanarPoint(o,i.lookAt),l=d.intersectPlane(r,a);if(null==l)return console.warn("Cannot determine fallback for pan. Ray does not intersect plane."),i;const u=null!=e?this.getWorldPoint(t,e,l):l,v=c.fromNormalAndCoplanarPoint(o,u);this.panData={hitPt:u,hitPlane:v,startingCamera:h}}if(null!=this.panData){const{hitPt:e,hitPlane:h,startingCamera:o}=this.panData,r=n.transformPointToRay(t,s.image,o),l=d.intersectPlane(r,h);if(null!=l){const t=a.subtract(e,l);return i.update(o).moveBy(t)}}return i}))}async panCameraByDelta(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=i.viewVector(),e=a.normalize(i.up),h=a.normalize(n),o=a.magnitude(n)*Math.tan(i.fovY),r=t.x*o/s.width,l=t.y/s.width*o,u=a.cross(e,h),c=a.cross(h,u),d=a.add(a.scale(r,u),a.scale(l,c));return i.moveBy(d)}))}async rotateCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=a.normalize(i.up),e=a.normalize(a.subtract(i.lookAt,i.position)),h=a.cross(n,e),o=a.cross(e,h),r=a.normalize({x:t.x*h.x+t.y*o.x,y:t.x*h.y+t.y*o.y,z:t.x*h.z+t.y*o.z}),l=a.cross(r,e),u=3*Math.PI*t.x/s.width,c=3*Math.PI*t.y/s.height,d=Math.abs(u)+Math.abs(c);return i.rotateAroundAxis(d,l)}))}async rotateCameraAtPoint(t,i){return this.transformCamera((({camera:s,viewport:n,boundingBox:e,depthBuffer:h})=>{if(null==this.worldRotationPoint){const t=v.center(e);this.worldRotationPoint=null!=h?this.getWorldPoint(i,h,t):s.lookAt}const o=a.normalize(s.up),r=a.normalize(a.subtract(s.lookAt,s.position)),l=a.cross(o,r),u=a.cross(r,l),c=a.normalize({x:t.x*l.x+t.y*u.x,y:t.x*l.y+t.y*u.y,z:t.x*l.z+t.y*u.z}),d=a.cross(c,r),f=3*Math.PI*t.x/n.width,w=3*Math.PI*t.y/n.height,m=Math.abs(f)+Math.abs(w),p=s.rotateAroundAxisAtPoint(m,this.worldRotationPoint,d);return p.update({lookAt:a.add(a.scale(s.distanceToBoundingBoxCenter()/a.magnitude(p.viewVector()),p.viewVector()),p.position)})}))}async zoomCamera(t){return this.transformCamera((({camera:i,viewport:s})=>{const n=i.viewVector(),e=a.normalize(n),h=a.magnitude(n),o=a.add(i.position,a.scale(3*h*t/s.height,e));return i.update({position:o})}))}async zoomCameraToPoint(t,i){return this.transformCamera((({camera:s,viewport:n,frame:e,depthBuffer:h})=>{const o=e.scene.camera,r=o.direction,l=s.toFrameCamera(),u=n.transformPointToRay(t,e.image,l);if(null==this.zoomData){const i=c.fromNormalAndCoplanarPoint(r,o.lookAt),n=d.intersectPlane(u,i);if(null==n)return console.warn("Cannot determine fallback point for zoom. Ray does not intersect plane."),s;const e=null!=h?this.getWorldPoint(t,h,n):n,a=c.fromNormalAndCoplanarPoint(r,e);this.zoomData={hitPt:e,hitPlane:a}}if(null!=this.zoomData){const{hitPt:t,hitPlane:e}=this.zoomData,h=a.distance(s.position,t),o=d.at(u,6*h*i/n.height),r=c.projectPoint(e,o),l=s.update({position:o,lookAt:r});if(a.distance(o,r)>=l.near)return l}return s}))}async endInteraction(){this.isInteracting()&&(this.currentCamera=void 0,this.worldRotationPoint=void 0,this.panData=void 0,this.zoomData=void 0,this.resetLastAngle(),this.interactionFinishedEmitter.emit(),await this.stream.endInteraction())}resetLastAngle(){this.lastAngle=void 0}isInteracting(){return null!=this.currentCamera}pixelThreshold(t){return(this.isCoarseInputDevice(t)?this.getConfig().coarsePointerThreshold:this.getConfig().finePointerThreshold)*window.devicePixelRatio}emitTapEvent(t,i,s={},n=0){const{altKey:e=!1,ctrlKey:h=!1,metaKey:o=!1,shiftKey:r=!1}=s;t({position:i,altKey:e,ctrlKey:h,metaKey:o,shiftKey:r,buttons:n})}isCoarseInputDevice(t){return t||window.matchMedia("(pointer: coarse)").matches}getWorldPoint(t,i,s){const n=this.getViewport(),e=n.transformPointToFrame(t,i);return i.isDepthAtFarPlane(e)?n.transformPointToWorldSpace(t,i):s}}const Rt=[.2,.15,.25,.25,.15];class jt{constructor(t,i,s,n,e,h,o,r,a){this.downEvent=t,this.upEvent=i,this.moveEvent=s,this.rotateInteraction=n,this.rotatePointInteraction=e,this.zoomInteraction=h,this.panInteraction=o,this.twistInteraction=r,this.getConfig=a,this.primaryInteraction=this.rotateInteraction,this.isDragging=!1,this.keyboardControls=!1,this.disableIndividualInteractions=!1,this.primaryInteractionTypeChange=new g,this.handleDownEvent=this.handleDownEvent.bind(this),this.handleMouseWheel=this.handleMouseWheel.bind(this),this.handleWindowMove=this.handleWindowMove.bind(this),this.handleWindowUp=this.handleWindowUp.bind(this)}initialize(t,i){this.element=t,this.interactionApi=i,t.addEventListener(this.downEvent,this.handleDownEvent),t.addEventListener("wheel",this.handleMouseWheel)}dispose(){var t,i;null===(t=this.element)||void 0===t||t.removeEventListener(this.downEvent,this.handleDownEvent),null===(i=this.element)||void 0===i||i.removeEventListener("wheel",this.handleMouseWheel),this.element=void 0}onPrimaryInteractionTypeChange(t){return this.primaryInteractionTypeChange.on(t)}setCurrentInteractionType(t){var i;switch(t){case"rotate":this.currentInteraction=this.rotateInteraction;break;case"zoom":this.currentInteraction=this.zoomInteraction;break;case"pan":this.currentInteraction=this.panInteraction;break;case"twist":this.currentInteraction=this.twistInteraction;break;case"rotate-point":this.currentInteraction=this.rotatePointInteraction;break;default:this.currentInteraction=void 0}if(this.draggingInteraction){const t=this.draggingInteraction.getPosition();this.draggingInteraction=this.currentInteraction||this.primaryInteraction,null===(i=this.interactionApi)||void 0===i||i.resetLastAngle(),this.draggingInteraction.setPosition(t)}}getPrimaryInteractionType(){return this.primaryInteraction.getType()}getCurrentInteractionType(){return(this.currentInteraction||this.primaryInteraction).getType()}setPrimaryInteractionType(t){switch(t){case"rotate":this.primaryInteraction=this.rotateInteraction;break;case"rotate-point":this.primaryInteraction=this.rotatePointInteraction;break;case"zoom":this.primaryInteraction=this.zoomInteraction;break;case"pan":this.primaryInteraction=this.panInteraction}this.primaryInteractionTypeChange.emit()}setDefaultKeyboardControls(t){this.keyboardControls=t}handleDownEvent(t){this.interactionTimer=window.setTimeout((()=>{this.downPosition=u.create(t.screenX,t.screenY),this.downPositionCanvas=this.getCanvasPosition(t),this.interactionTimer=void 0,null!=this.lastMoveEvent&&this.handleWindowMove(this.lastMoveEvent)}),this.getConfig().interactions.interactionDelay),window.addEventListener(this.moveEvent,this.handleWindowMove),window.addEventListener(this.upEvent,this.handleWindowUp)}handleWindowMove(t){if(null==this.interactionTimer){if(this.disableIndividualInteractions)return;const i=u.create(t.screenX,t.screenY),s=null!=this.interactionApi?this.interactionApi.pixelThreshold(this.isTouch(t)):2;null!=this.downPosition&&u.distance(i,this.downPosition)>=s&&!this.isDragging&&(this.beginDrag(t),this.isDragging=!0),this.isDragging&&this.drag(t)}this.lastMoveEvent=t}async handleWindowUp(t){this.isDragging&&(this.endDrag(t),this.isDragging=!1),null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0),window.removeEventListener(this.moveEvent,this.handleWindowMove),window.removeEventListener(this.upEvent,this.handleWindowUp),this.lastMoveEvent=void 0}beginDrag(t){this.keyboardControls&&t.metaKey&&t.shiftKey&&(this.currentInteraction=this.rotatePointInteraction),1===t.buttons?this.draggingInteraction=this.currentInteraction||this.primaryInteraction:2===t.buttons&&(this.draggingInteraction=this.panInteraction),null!=this.draggingInteraction&&null!=this.interactionApi&&null!=this.element&&(this.zoomInteraction.endDrag(t,this.interactionApi),this.draggingInteraction.beginDrag(t,this.downPositionCanvas||u.create(t.clientX,t.clientY),this.interactionApi,this.element))}drag(t){this.currentInteraction=this.keyboardControls&&t.altKey&&t.shiftKey?this.twistInteraction:void 0,this.draggingInteraction=this.currentInteraction||this.draggingInteraction||this.primaryInteraction,null!=this.draggingInteraction&&null!=this.interactionApi&&this.draggingInteraction.drag(t,this.interactionApi)}endDrag(t){null!=this.draggingInteraction&&null!=this.interactionApi&&(this.draggingInteraction.endDrag(t,this.interactionApi),this.draggingInteraction=void 0)}handleMouseWheel(t){if(t.preventDefault(),null!=this.element&&null!=this.interactionApi){const i=-this.wheelDeltaToPixels(t.deltaY,t.deltaMode)/10,s=this.element.getBoundingClientRect(),n=V(t,s);Rt.forEach(((t,s)=>{window.setTimeout((()=>{null!=this.interactionApi&&this.zoomInteraction.zoomToPoint(n,i*t,this.interactionApi)}),2*s)}))}}wheelDeltaToPixels(t,i){null==this.computedBodyStyle&&(this.computedBodyStyle=window.getComputedStyle(document.body));const s=null==this.computedBodyStyle.fontSize||""===this.computedBodyStyle.fontSize||isNaN(parseFloat(this.computedBodyStyle.fontSize))?19.2:1.2*parseFloat(this.computedBodyStyle.fontSize);return 1===i?null==this.computedBodyStyle.lineHeight||""===this.computedBodyStyle.lineHeight||isNaN(parseFloat(this.computedBodyStyle.lineHeight))?t*s:t*parseFloat(this.computedBodyStyle.lineHeight):2===i?null==this.computedBodyStyle.height||""===this.computedBodyStyle.height||isNaN(parseFloat(this.computedBodyStyle.height))?t*window.innerHeight:t*parseFloat(this.computedBodyStyle.height):t}getCanvasPosition(t){var i;const s=null===(i=this.element)||void 0===i?void 0:i.getBoundingClientRect(),n=null!=s?u.create(s.left,s.top):void 0;return null!=n?u.subtract(u.create(t.clientX,t.clientY),n):void 0}isTouch(t){return null!=window.PointerEvent&&t instanceof PointerEvent&&"touch"===t.pointerType}}class Ft{setPosition(t){this.currentPosition=t}getPosition(){return this.currentPosition}getType(){return this.type}beginDrag(t,i,s,n){}drag(t,i){}endDrag(t,i){null!=this.currentPosition&&(i.endInteraction(),this.currentPosition=void 0)}zoom(t,i){}}class At extends Ft{constructor(){super(...arguments),this.type="rotate"}beginDrag(t,i,s){null==this.currentPosition&&(this.currentPosition=u.create(t.screenX,t.screenY),s.beginInteraction())}drag(t,i){if(null!=this.currentPosition){const s=u.create(t.screenX,t.screenY),n=u.subtract(s,this.currentPosition);i.rotateCamera(n),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class Bt extends Ft{constructor(){super(...arguments),this.type="rotate-point"}beginDrag(t,i,s){null==this.currentPosition&&(this.currentPosition=u.create(t.screenX,t.screenY),this.startingPosition=i,s.beginInteraction())}drag(t,i){if(null!=this.currentPosition&&null!=this.startingPosition){const s=u.create(t.screenX,t.screenY),n=u.subtract(s,this.currentPosition);i.rotateCameraAtPoint(n,this.startingPosition),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class Lt extends Ft{constructor(t=1e3){super(),this.interactionTimeout=t,this.type="zoom",this.didTransformBegin=!1}beginDrag(t,i,s,n){if(null==this.currentPosition){this.currentPosition=u.create(t.clientX,t.clientY);const i=n.getBoundingClientRect(),e=V(t,i);this.startPt=e,s.beginInteraction()}}drag(t,i){if(null!=this.currentPosition){const s=u.create(t.clientX,t.clientY),n=u.subtract(s,this.currentPosition);null!=this.startPt&&(i.zoomCameraToPoint(this.startPt,n.y),this.currentPosition=s)}}endDrag(t,i){super.endDrag(t,i),this.stopInteractionTimer(),this.didTransformBegin=!1,this.startPt=void 0}zoom(t,i){this.operateWithTimer(i,(()=>i.zoomCamera(t)))}zoomToPoint(t,i,s){this.operateWithTimer(s,(()=>s.zoomCameraToPoint(t,i)))}beginInteraction(t){this.didTransformBegin=!0,t.beginInteraction()}endInteraction(t){this.didTransformBegin=!1,t.endInteraction()}resetInteractionTimer(t){this.stopInteractionTimer(),this.startInteractionTimer(t)}startInteractionTimer(t){this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=void 0,this.endInteraction(t)}),this.interactionTimeout)}stopInteractionTimer(){null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0)}operateWithTimer(t,i){this.didTransformBegin||this.beginInteraction(t),this.resetInteractionTimer(t),i()}}class Kt extends Ft{constructor(){super(...arguments),this.type="pan"}beginDrag(t,i,s,n){null==this.currentPosition&&(this.currentPosition=u.create(t.screenX,t.screenY),this.canvasRect=n.getBoundingClientRect(),s.beginInteraction())}drag(t,i){if(null!=this.currentPosition&&null!=this.canvasRect){const s=V(t,this.canvasRect);i.panCameraToScreenPoint(s),this.currentPosition=s}}endDrag(t,i){super.endDrag(t,i)}}class $t extends Ft{constructor(){super(...arguments),this.type="twist"}beginDrag(t,i,s){this.currentPosition=u.create(t.screenX,t.screenY),s.beginInteraction()}drag(t,i){const s=u.create(t.screenX,t.screenY);this.currentPosition=s,i.twistCamera(s)}endDrag(t,i){super.endDrag(t,i)}}class Nt extends jt{constructor(t,i=new At,s=new Bt,n=new Lt,e=new Kt,h=new $t){super("mousedown","mouseup","mousemove",i,s,n,e,h,t)}}class Wt{initialize(t,i){this.element=t,this.interactionApi=i}dispose(){this.element=void 0}handleTwoPointTouchMove(t,i){var s,n,e,h;if(null!=this.currentPosition1&&null!=this.currentPosition2){const o=u.scale(u.add(u.subtract(t,this.currentPosition1),u.subtract(i,this.currentPosition2)),.25,.25),r=.5*(u.distance(t,i)-u.distance(this.currentPosition1,this.currentPosition2)),a=f.create(u.subtract(this.currentPosition1,this.currentPosition2),u.subtract(t,i)),c=l.toDegrees(Math.atan2(f.determinant(a),f.dot(a)));null===(s=this.interactionApi)||void 0===s||s.beginInteraction(),null===(n=this.interactionApi)||void 0===n||n.zoomCamera(r),null===(e=this.interactionApi)||void 0===e||e.panCameraByDelta(o),null===(h=this.interactionApi)||void 0===h||h.twistCamera(c)}this.currentPosition1=t,this.currentPosition2=i}}class Ut extends Wt{constructor(){super(),this.touchPoints={},this.handlePointerDown=this.handlePointerDown.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this)}dispose(){var t;null===(t=this.element)||void 0===t||t.removeEventListener("pointerdown",this.handlePointerDown),super.dispose()}initialize(t,i){super.initialize(t,i),t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){const i=u.create(t.screenX,t.screenY);this.touchPoints=Object.assign(Object.assign({},this.touchPoints),{[t.pointerId]:i}),1===Object.keys(this.touchPoints).length&&(window.addEventListener("pointermove",this.handlePointerMove),window.addEventListener("pointerup",this.handlePointerUp))}handlePointerMove(t){null!=this.touchPoints[t.pointerId]&&(this.touchPoints[t.pointerId]=u.create(t.screenX,t.screenY));const i=Object.keys(this.touchPoints);2===i.length&&this.handleTwoPointTouchMove(this.touchPoints[i[0]],this.touchPoints[i[1]])}handlePointerUp(t){var i;delete this.touchPoints[t.pointerId];const s=Object.keys(this.touchPoints);1===s.length&&(null===(i=this.interactionApi)||void 0===i||i.endInteraction(),this.currentPosition1=void 0,this.currentPosition2=void 0),0===s.length&&(window.removeEventListener("pointermove",this.handlePointerMove),window.removeEventListener("pointerup",this.handlePointerUp))}}class Vt extends jt{constructor(t){super("pointerdown","pointerup","pointermove",new At,new Bt,new Lt,new Kt,new $t,t),this.touchPoints=new Set,this.handlePointerDown=this.handlePointerDown.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this)}initialize(t,i){super.initialize(t,i),t.addEventListener("pointerdown",this.handlePointerDown)}handlePointerDown(t){this.downPosition=u.create(t.screenX,t.screenY),this.touchPoints.add(t.pointerId),1===this.touchPoints.size&&window.addEventListener("pointerup",this.handlePointerUp),2===this.touchPoints.size&&(this.disableIndividualInteractions=!0)}handlePointerUp(t){this.touchPoints.delete(t.pointerId),this.touchPoints.size<2&&(this.disableIndividualInteractions=!1),0===this.touchPoints.size&&window.removeEventListener("pointerup",this.handlePointerUp)}}class qt extends Wt{constructor(){super(),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this)}dispose(){var t;null===(t=this.element)||void 0===t||t.removeEventListener("touchstart",this.handleTouchStart),super.dispose()}initialize(t,i){super.initialize(t,i),t.addEventListener("touchstart",this.handleTouchStart)}handleTouchStart(t){if(t.touches.length>=1){const i=t.touches[0],s=t.touches[1];this.currentPosition1=u.create(i.screenX,i.screenY),this.currentPosition2=null!=s?u.create(s.screenX,s.screenY):void 0,window.addEventListener("touchmove",this.handleTouchMove,{passive:!1}),window.addEventListener("touchend",this.handleTouchEnd)}}handleTouchMove(t){if(1===t.touches.length)this.handleOnePointTouchMove(t.touches[0]);else if(2===t.touches.length){const i=u.create(t.touches[0].clientX,t.touches[0].clientY),s=u.create(t.touches[1].clientX,t.touches[1].clientY);this.handleTwoPointTouchMove(i,s)}}handleTouchEnd(t){var i;null===(i=this.interactionApi)||void 0===i||i.endInteraction(),this.isInteracting=!1,window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchEnd)}handleOnePointTouchMove(t){var i,s,n;const e=u.create(t.screenX,t.screenY);if(null!=this.currentPosition1){const t=u.subtract(e,this.currentPosition1),h=(null===(i=this.interactionApi)||void 0===i?void 0:i.pixelThreshold(!0))||2;(u.distance(e,this.currentPosition1)>=h||this.isInteracting)&&(null===(s=this.interactionApi)||void 0===s||s.beginInteraction(),null===(n=this.interactionApi)||void 0===n||n.rotateCamera(t),this.isInteracting=!0)}this.currentPosition1=e}}class Gt{constructor(t,i,s,n){this.downEvent=t,this.upEvent=i,this.moveEvent=s,this.getConfig=n,this.handleDown=this.handleDown.bind(this),this.handleUp=this.handleUp.bind(this),this.handleMove=this.handleMove.bind(this),this.handleTouchStart=this.handleTouchStart.bind(this),this.handleTouchMove=this.handleTouchMove.bind(this),this.handleTouchEnd=this.handleTouchEnd.bind(this),this.handlePointerMove=this.handlePointerMove.bind(this),this.handlePointerEnd=this.handlePointerEnd.bind(this),this.clearPositions=this.clearPositions.bind(this),this.restartDoubleTapTimer=this.restartDoubleTapTimer.bind(this),this.clearDoubleTapTimer=this.clearDoubleTapTimer.bind(this),this.restartLongPressTimer=this.restartLongPressTimer.bind(this),this.clearLongPressTimer=this.clearLongPressTimer.bind(this),this.setPointerPositions=this.setPointerPositions.bind(this),this.emit=this.emit.bind(this)}dispose(){var t,i;null===(t=this.element)||void 0===t||t.removeEventListener(this.downEvent,this.handleDown),null===(i=this.element)||void 0===i||i.removeEventListener("touchstart",this.handleTouchStart),this.element=void 0,this.clearDoubleTapTimer(),this.clearLongPressTimer()}initialize(t,i){this.element=t,this.interactionApi=i,t.addEventListener(this.downEvent,this.handleDown),t.addEventListener("touchstart",this.handleTouchStart)}handleTouchStart(t){1===t.touches.length&&(this.setPointerPositions(u.create(t.touches[0].clientX,t.touches[0].clientY)),this.restartLongPressTimer(),window.addEventListener("touchend",this.handleTouchEnd),window.addEventListener("touchmove",this.handleTouchMove))}handleTouchMove(t){t.touches.length>0&&this.handlePointerMove(u.create(t.touches[0].clientX,t.touches[0].clientY),!0)}handleTouchEnd(t){null!=this.pointerDownPosition&&(window.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("touchmove",this.handleTouchMove)),this.handlePointerEnd(this.pointerDownPosition)}handleDown(t){this.setPointerPositions(u.create(t.clientX,t.clientY)),this.buttons=t.buttons,this.restartLongPressTimer({altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey}),window.addEventListener(this.upEvent,this.handleUp),window.addEventListener(this.moveEvent,this.handleMove)}handleMove(t){this.handlePointerMove(u.create(t.clientX,t.clientY),this.isTouch(t))}handleUp(t){null!=this.pointerDownPosition&&(window.removeEventListener(this.upEvent,this.handleUp),window.removeEventListener(this.moveEvent,this.handleMove)),this.handlePointerEnd(u.create(t.clientX,t.clientY),{altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey},this.buttons,this.isTouch(t)),this.buttons=void 0}handlePointerMove(t,i){var s;const n=(null===(s=this.interactionApi)||void 0===s?void 0:s.pixelThreshold(i))||2;null!=this.pointerDownPosition&&u.distance(t,this.pointerDownPosition)>=n&&null==this.interactionTimer&&this.clearPositions()}handlePointerEnd(t,i={},s=0,n=!1){var e,h;null!=t&&(null!=this.longPressTimer&&this.emit(null===(e=this.interactionApi)||void 0===e?void 0:e.tap)(t,i,s),null!=this.doubleTapTimer&&null!=this.secondPointerDownPosition&&(this.emit(null===(h=this.interactionApi)||void 0===h?void 0:h.doubleTap)(t,i,s,this.secondPointerDownPosition),this.clearDoubleTapTimer())),this.pointerDownPosition=void 0,this.clearLongPressTimer()}emit(t){return(i,s={},n=0,e,h=!1)=>{var o;const r=e||this.pointerDownPosition,a=(null===(o=this.interactionApi)||void 0===o?void 0:o.pixelThreshold(h))||1;let l;null!=this.interactionTimer?l=this.getCanvasPosition(r||i):null!=r&&u.distance(r,i)<=a&&(l=this.getCanvasPosition(i)),null!=l&&null!=t&&t(l,s,n)}}getCanvasPosition(t){var i;const s=null===(i=this.element)||void 0===i?void 0:i.getBoundingClientRect(),n=null!=s?u.create(s.left,s.top):void 0;return null!=n?u.subtract(u.create(t.x,t.y),n):void 0}clearPositions(){this.pointerDownPosition=void 0,this.firstPointerDownPosition=void 0,this.secondPointerDownPosition=void 0,this.clearDoubleTapTimer(),this.clearLongPressTimer(),this.clearInteractionTimer()}clearDoubleTapTimer(){null!=this.doubleTapTimer&&window.clearTimeout(this.doubleTapTimer),this.doubleTapTimer=void 0,this.firstPointerDownPosition=void 0,this.secondPointerDownPosition=void 0}restartDoubleTapTimer(){this.clearDoubleTapTimer(),this.doubleTapTimer=window.setTimeout((()=>this.clearDoubleTapTimer()),this.getConfig().events.doubleTapThreshold)}clearLongPressTimer(){null!=this.longPressTimer&&window.clearTimeout(this.longPressTimer),this.longPressTimer=void 0}restartLongPressTimer(t={}){this.clearLongPressTimer(),this.longPressTimer=window.setTimeout((()=>{var i;this.pointerDownPosition&&this.emit(null===(i=this.interactionApi)||void 0===i?void 0:i.longPress)(this.pointerDownPosition,t,this.buttons),this.clearLongPressTimer()}),this.getConfig().events.longPressThreshold)}restartInteractionTimer(){this.clearInteractionTimer(),this.interactionTimer=window.setTimeout((()=>{this.interactionTimer=void 0}),this.getConfig().interactions.interactionDelay)}clearInteractionTimer(){null!=this.interactionTimer&&(window.clearTimeout(this.interactionTimer),this.interactionTimer=void 0)}setPointerPositions(t){this.pointerDownPosition=t,this.restartInteractionTimer(),null==this.firstPointerDownPosition?(this.restartDoubleTapTimer(),this.firstPointerDownPosition=t):this.secondPointerDownPosition=t}isTouch(t){return null!=window.PointerEvent&&t instanceof PointerEvent&&"touch"===t.pointerType}}class Jt{constructor(t,i,s){this.stream=t,this.configProvider=i,this.imageScaleProvider=s}predicate(t){return!!t.altKey}async fn(t){var i;const s=this.imageScaleProvider(),n=await this.stream.hitItems({point:u.scale(t.position,(null==s?void 0:s.x)||1,(null==s?void 0:s.y)||1)},!0);null!=(null===(i=n.hitItems)||void 0===i?void 0:i.hits)&&n.hitItems.hits.length>0?await this.stream.flyTo({itemId:n.hitItems.hits[0].itemId,animation:{duration:T(this.configProvider().animation.durationMs)}}):console.debug(`No hit results found for fly to part [position={x: ${t.position.x}, y: ${t.position.y}}]`)}}function Ht(t,i,s,n,e=1e3){let h,o,r=0,a=[];return s&&setInterval((()=>{if(null!=o){5===a.length?a=[...a.slice(1),o]:a.push(o);const t=a.reduce(((t,i)=>t+i))/a.length;console.debug(`Paint rate: ${o}fps`),console.debug(`Paint rate (avg): ${t}`),o=void 0}}),1e3),s=>(r++,null==h&&(h=window.setInterval((()=>{!function(t,i){const s=t.takeMeasurements();s.length>0&&i(s)}(t,n),0===r&&null!=h&&(window.clearInterval(h),h=void 0)}),e)),t.measure((async()=>{const t=await i(s);return o=null==o?1:o+1,t})).finally((()=>{r--})))}const _t=new class{constructor(t,i=window.performance){this.name=t,this.perf=i,this.measures=new Set,this.nextId=0}clearMeasurements(){this.perf.clearMeasures(this.name)}measure(t){if(null!=(i=t)&&i.then instanceof Function&&i.catch instanceof Function&&i.finally instanceof Function){const i=this.begin();return t.finally((()=>this.end(i)))}if("function"==typeof t){const i=this.begin(),s=t();return this.end(i),s}throw new Error("Input must be a function or Promise");var i}takeMeasurements(){const t=this.perf.getEntriesByName(this.name);return this.clearMeasurements(),t}takeLastMeasurement(){const t=this.takeMeasurements();return t[t.length-1]}begin(){const t=`${this.name}-${this.nextId++}`;return this.measures.add(t),this.perf.mark(t),t}end(t){this.perf.measure(this.name,t),this.perf.clearMarks(t),this.measures.delete(t)}}("paint_time");class Xt extends E{constructor(t=new I,i=!1,s=75e3,n=3e4){super(t,i),this.uninteractiveThreshold=s,this.offlineThreshold=n,this.handleOffline=this.handleOffline.bind(this),this.handleOnline=this.handleOnline.bind(this)}async connect(t,i={}){return window.addEventListener("offline",this.handleOffline),window.addEventListener("online",this.handleOnline),super.onRequest((()=>this.restartUninteractiveTimeout())),super.onResponse((()=>this.restartUninteractiveTimeout())),this.restartUninteractiveTimeout(),super.connect(t,i)}dispose(){window.removeEventListener("offline",this.handleOffline),window.removeEventListener("online",this.handleOnline),this.clearUninteractiveTimeout(),this.uninteractiveTimeout=void 0,this.clearOfflineTimeout(),this.offlineTimeout=void 0,super.dispose()}handleOffline(){this.restartOfflineTimeout()}handleOnline(){this.clearOfflineTimeout()}restartOfflineTimeout(){this.clearOfflineTimeout(),this.offlineTimeout=setTimeout((()=>{super.log("Disposing of StreamApi due to loss of network connection."),this.dispose()}),this.offlineThreshold)}clearOfflineTimeout(){null!=this.offlineTimeout&&clearTimeout(this.offlineTimeout)}restartUninteractiveTimeout(){this.clearUninteractiveTimeout(),this.uninteractiveTimeout=setTimeout((()=>{super.log("Disposing of StreamApi due to lack of interactivity."),this.dispose()}),this.uninteractiveThreshold)}clearUninteractiveTimeout(){null!=this.uninteractiveTimeout&&clearTimeout(this.uninteractiveTimeout)}}const Yt=t=>{var i,s,n,e,h,o,r,a,l,u,c;let d=S.protobuf.stream.FrameType.FRAME_TYPE_INVALID;switch(null===(i=t.depthBuffers)||void 0===i?void 0:i.frameType){case"final":d=S.protobuf.stream.FrameType.FRAME_TYPE_FINAL;break;case"all":d=S.protobuf.stream.FrameType.FRAME_TYPE_ALL}return Object.assign(Object.assign({},t),{depthBuffers:{enabled:Qt(null===(s=t.depthBuffers)||void 0===s?void 0:s.enabled),frameType:d},experimentalGhosting:{enabled:Qt(null===(n=t.experimentalGhosting)||void 0===n?void 0:n.enabled),opacity:"number"==typeof(null===(e=t.experimentalGhosting)||void 0===e?void 0:e.opacity)?{value:null===(h=t.experimentalGhosting)||void 0===h?void 0:h.opacity}:null===(o=t.experimentalGhosting)||void 0===o?void 0:o.opacity},featureLines:{lineWidth:null===(r=t.featureLines)||void 0===r?void 0:r.width,lineColor:(null===(a=t.featureLines)||void 0===a?void 0:a.color)?{r:null===(l=t.featureLines)||void 0===l?void 0:l.color.r,g:null===(u=t.featureLines)||void 0===u?void 0:u.color.g,b:null===(c=t.featureLines)||void 0===c?void 0:c.color.b}:null}})},Qt=t=>{if(null!=t)return"boolean"==typeof t?{value:t}:t},Zt=[0,1e3,1e3,5e3],ti=class{constructor(s){t(this,s),this.tap=i(this,"tap",7),this.doubletap=i(this,"doubletap",7),this.longpress=i(this,"longpress",7),this.frameReceived=i(this,"frameReceived",7),this.frameDrawn=i(this,"frameDrawn",7),this.tokenExpired=i(this,"tokenExpired",7),this.connectionChange=i(this,"connectionChange",7),this.sceneReady=i(this,"sceneReady",7),this.sceneChanged=i(this,"sceneChanged",7),this.interactionStarted=i(this,"interactionStarted",7),this.interactionFinished=i(this,"interactionFinished",7),this.sessionidchange=i(this,"sessionidchange",7),this.dimensionschange=i(this,"dimensionschange",7),this.configEnv="platprod",this.cameraControls=!0,this.keyboardControls=!0,this.rotateAroundTapPoint=!0,this.experimentalGhostingOpacity=0,this.selectionMaterial=D,this.streamAttributes={},this.stencilBuffer=new $(this.hostElement),this.stateMap={cursorManager:new G},this.interactionHandlers=[],this.tapKeyInteractions=[],this.isStreamStarted=!1,this.internalFrameDrawnDispatcher=new g,this.handleElementResize=this.handleElementResize.bind(this),this.streamSessionId=this.sessionId}componentWillLoad(){this.updateResolvedConfig(),this.calculateComponentDimensions(),this.resizeObserver=new Ot(this.handleElementResize),this.registerSlotChangeListeners();const t=new I;if(t.onClose((()=>this.handleWebSocketClose())),this.stream=new Xt(t,this.getResolvedConfig().flags.logWsMessages),this.setupStreamListeners(),this.commands=new zt(this.stream,(()=>this.getResolvedConfig())),this.commands.register("stream.connect",(t=>function({clientId:t,sessionId:i,resource:s}){return({stream:n,config:e})=>{if("stream-key"===s.type){const h=function(t,i,s,n){return p.appendPath(null!=s?p.toString(p.parseAndAddParams("/ws",{clientId:s,sessionId:n})):`/stream-keys/${i.id}/session`,p.parse(t.network.renderingHost))}(e,s,t,i),o={url:p.toString(h),protocols:["ws.vertexvis.com"]},r={EXPERIMENTAL_frameDelivery:Object.assign(Object.assign({},e.EXPERIMENTAL_frameDelivery),{rateLimitingEnabled:e.flags.throttleFrameDelivery}),EXPERIMENTAL_adaptiveRendering:Object.assign(Object.assign({},e.EXPERIMENTAL_adaptiveRendering),{enabled:e.flags.adaptiveRendering}),EXPERIMENTAL_qualityOfService:Object.assign({},e.EXPERIMENTAL_qualityOfService)};return n.connect(o,r)}throw new C(`Cannot load resource. Invalid type ${s.type}`)}}(t))),this.streamSessionId=this.sessionId,null==this.streamSessionId)try{this.streamSessionId=function(t,i){const s=window.localStorage.getItem("vertexvis:stream-sessions");if(null!=s)return i(JSON.parse(s))}(0,(t=>this.clientId?t[this.clientId]:void 0))}catch(t){}this.updateStreamAttributesProp(),this.stateMap.cursorManager.onChanged.on((()=>this.handleCursorChanged()))}componentDidLoad(){var t,i;if(this.interactionApi=this.createInteractionApi(),null!=this.src&&this.load(this.src),this.cameraControls)if(null!=window.PointerEvent){const t=new Gt("pointerdown","pointerup","pointermove",(()=>this.getResolvedConfig()));this.baseInteractionHandler=new Vt((()=>this.getResolvedConfig())),this.registerInteractionHandler(this.baseInteractionHandler),this.registerInteractionHandler(new Ut),this.registerInteractionHandler(t)}else{const t=new Gt("mousedown","mouseup","mousemove",(()=>this.getResolvedConfig()));this.baseInteractionHandler=new Nt((()=>this.getResolvedConfig())),this.registerInteractionHandler(this.baseInteractionHandler),this.registerInteractionHandler(new qt),this.registerInteractionHandler(t)}this.keyboardControls&&null!=this.stream&&(null===(t=this.baseInteractionHandler)||void 0===t||t.setDefaultKeyboardControls(this.keyboardControls),this.registerTapKeyInteraction(new Jt(this.stream,(()=>this.getResolvedConfig()),(()=>this.getImageScale())))),this.rotateAroundTapPoint&&(null===(i=this.baseInteractionHandler)||void 0===i||i.setPrimaryInteractionType("rotate-point")),this.injectViewerApi()}render(){var t;const i=this.getCanvasDimensions();return s(n,null,s("div",{class:"viewer-container",style:{cursor:q(null!==(t=this.cursor)&&void 0!==t?t:"")},onContextMenu:t=>t.preventDefault()},s("div",{ref:t=>this.containerElement=t,class:m("canvas-container",{"enable-pointer-events ":null!=window.PointerEvent})},s("canvas",{ref:t=>{this.canvasElement=t,this.stateMap.interactionTarget=t},class:"canvas",width:null!=i?i.width:0,height:null!=i?i.height:0}),null!=this.errorMessage?s("div",{class:"error-message"},this.errorMessage):null),s("slot",null)))}async registerCommand(t,i,s){return this.commands.register(t,i,s)}async dispatchFrameDrawn(t){this.lastFrame=t,this.frame=t,this.internalFrameDrawnDispatcher.emit(t),this.frameDrawn.emit(t)}async registerInteractionHandler(t){return this.interactionHandlers.push(t),this.initializeInteractionHandler(t),{dispose:()=>{const i=this.interactionHandlers.indexOf(t);-1!==i&&(this.interactionHandlers[i].dispose(),this.interactionHandlers.splice(i,1))}}}async registerTapKeyInteraction(t){this.tapKeyInteractions=[...this.tapKeyInteractions,t]}async getInteractionTarget(){if(null!=this.stateMap.interactionTarget)return this.stateMap.interactionTarget;throw new Error("Interaction target is undefined.")}async addCursor(t,i){return this.stateMap.cursorManager.add(t,i)}async getInteractionHandlers(){return this.interactionHandlers}async getBaseInteractionHandler(){return this.baseInteractionHandler}async getJwt(){return this.jwt}handleSrcChanged(t){null!=t?this.load(t):this.unload()}handleStreamAttributesChanged(t){this.isStreamStarted&&this.getStream().updateStream({streamAttributes:Yt(t)})}handleRotateAboutTapPointChanged(){var t,i;this.updateStreamAttributesProp(),this.rotateAroundTapPoint?null===(t=this.baseInteractionHandler)||void 0===t||t.setPrimaryInteractionType("rotate-point"):null===(i=this.baseInteractionHandler)||void 0===i||i.setPrimaryInteractionType("rotate")}handleDepthBuffersChanged(){this.updateStreamAttributesProp()}handleExperimentalGhostingOpacityChanged(){this.updateStreamAttributesProp()}handleFeatureLinesChanged(){this.updateStreamAttributesProp()}handleConfigChanged(){this.updateResolvedConfig()}handleConfigEnvChanged(){this.updateResolvedConfig()}async load(t){if(null==this.commands||null==this.dimensions)throw new O("Cannot load scene. Viewer has not been initialized.");{const{resource:i,queries:s}=null!=this.urn?k(this.urn):{},{resource:n,queries:e}=k(t),h=!b.isEqual(i,n),o=!b.isEqual(s,e),r=null!=e[0],a=await this.isSceneReady();if(this.urn=t,h||!a&&o)this.unload(),await this.connectStreamingClient(n,e[0]);else if(a&&o&&r){const t=await this.scene();await t.applySceneViewState(e[0].id)}}}async unload(){if(null!=this.streamDisposable&&(this.isStreamStarted=!1,this.streamId=void 0,this.streamDisposable.dispose(),this.lastFrame=void 0,this.frame=void 0,this.sceneViewId=void 0,this.clock=void 0,this.errorMessage=void 0,this.urn=void 0,this.stateMap.streamWorldOrientation=void 0),null!=this.canvasElement){const t=this.canvasElement.getContext("2d");null!=t&&t.clearRect(0,0,this.canvasElement.width,this.canvasElement.height)}}async scene(){return this.createScene()}async isSceneReady(){return null!=this.lastFrame&&null!=this.sceneViewId}async handleTapEvent(t){this.tapKeyInteractions.filter((i=>i.predicate(t.detail))).forEach((i=>i.fn(t.detail)))}async handleWebSocketClose(){if(this.isStreamStarted&&(this.isStreamStarted=!1,null!=this.streamId&&null!=this.urn&&!this.isReconnecting)){const{resource:t}=k(this.urn);await this.reconnectWebSocket(t,this.streamId)}}async connectStreamingClient(t,i){try{this.streamDisposable=await this.connectStream(t),this.calculateComponentDimensions();const{startStream:s}=await this.getStream().startStream(Object.assign({streamKey:{value:t.id},dimensions:this.dimensions,frameBackgroundColor:this.getBackgroundColor(),streamAttributes:Yt(this.streamAttributes)},"scene-view-state"===(null==i?void 0:i.type)&&{sceneViewStateId:{hex:i.id}})),{streamId:n,sessionId:e,sceneViewId:h,jwt:o,worldOrientation:r}=s||{};if(this.jwt=o||void 0,this.emitConnectionChange({status:"connected",jwt:this.jwt||""}),null!=this.clientId&&null!=(null==e?void 0:e.hex)){this.streamSessionId=e.hex,this.sessionidchange.emit(this.streamSessionId);try{!function(t,i){const s=window.localStorage,n=s.getItem(t);if(null!=n){const e=Object.assign(Object.assign({},JSON.parse(n)),i);s.setItem(t,JSON.stringify(e))}else s.setItem(t,JSON.stringify(i))}("vertexvis:stream-sessions",{[this.clientId]:this.streamSessionId})}catch(t){}}null!=(null==h?void 0:h.hex)&&(this.sceneViewId=h.hex,this.isStreamStarted=!0),null!=(null==n?void 0:n.hex)&&(this.streamId=n.hex),this.stateMap.streamWorldOrientation=N(r),console.debug(`Stream connected [stream-id=${this.streamId}, scene-view-id=${this.sceneViewId}]`),await this.waitNextDrawnFrame(15e3),this.sceneReady.emit()}catch(t){if(this.emitConnectionChange({status:"disconnected"}),t instanceof z)throw t;if(null==this.lastFrame)throw this.errorMessage="Unable to establish connection to Vertex.",console.error("Failed to establish WS connection",t),new M(this.errorMessage,t instanceof Error?t:void 0)}}async connectStream(t){var i;null==this.clientId&&console.warn("Client ID not provided, using legacy path. A Client ID will be required in an upcoming release.");const s=await this.commands.execute("stream.connect",{clientId:this.clientId,sessionId:this.sessionId||this.streamSessionId,resource:t});return this.synchronizeTime(),this.canvasRenderer=Ht(_t,function(){let t;return async i=>{const s=i.frame.sequenceNumber,n=await(e=i.frame.image.imageBytes,null!=window.createImageBitmap?async function(t){const i=new Blob([t]),s=await window.createImageBitmap(i);return{image:s,dispose:()=>s.close()}}(e):(h=e,new Promise(((t,i)=>{const s=new Blob([h]),n=URL.createObjectURL(s),e=new Image;e.addEventListener("load",(()=>{t({image:e,dispose:()=>{}}),URL.revokeObjectURL(n)})),e.addEventListener("error",(()=>{i(new P("Failed to load image data")),URL.revokeObjectURL(n)})),e.src=n}))));var e,h;return(null==t||s>t)&&(t=s,function(t,i){const s=i.viewport.calculateDrawRect(i.frame.image);i.canvas.clearRect(0,0,i.dimensions.width,i.dimensions.height),i.canvas.drawImage(t.image,s.x,s.y,s.width,s.height)}(n,i)),n.dispose(),i.frame}}(),this.getResolvedConfig().flags.logFrameRate,(t=>this.reportPerformance(t))),null!=this.containerElement&&(null===(i=this.resizeObserver)||void 0===i||i.observe(this.containerElement)),s}async synchronizeTime(){var t;try{const i=await this.getStream().syncTime({requestTime:R()});if(null!=(null===(t=i.syncTime)||void 0===t?void 0:t.replyTime)){const t=x(i.syncTime.replyTime);null!=t&&(this.clock=new j(t),console.debug(`Synchronized time [local-time=${this.clock.knownLocalTime.toISOString()}, remote-time=${this.clock.knownRemoteTime.toISOString()}]`))}}catch(t){console.error("Failed to synchronize clock",t)}}async reconnectStreamingClient(t,i,s=!1){var n,e;try{null===(n=this.streamDisposable)||void 0===n||n.dispose(),this.clock=void 0,this.emitConnectionChange({status:"connecting"}),this.streamDisposable=await this.connectStream(t);const s=await this.getStream().reconnect({streamId:{hex:i},dimensions:this.dimensions,frameBackgroundColor:this.getBackgroundColor(),streamAttributes:Yt(this.streamAttributes)});this.isStreamStarted=!0,this.isReconnecting=!1,this.jwt=(null===(e=s.reconnect)||void 0===e?void 0:e.jwt)||void 0,this.emitConnectionChange({status:"connected",jwt:this.jwt||""}),console.debug(`Stream reconnected [stream-id=${this.streamId}, scene-view-id=${this.sceneViewId}]`)}catch(t){if(this.emitConnectionChange({status:"disconnected"}),t instanceof z)throw t;const i="Unable to establish connection to Vertex.";throw s||(this.errorMessage=this.errorMessage||i,console.error("Failed to establish WS connection",t)),new M(i,t instanceof Error?t:void 0)}}async reconnectWebSocket(t,i,s=0){try{await this.reconnectStreamingClient(t,i,!0)}catch(n){setTimeout((()=>this.reconnectWebSocket(t,i,s+1)),Zt[Math.min(s,Zt.length-1)])}}emitConnectionChange(t){this.connectionChange.emit(t)}handleElementResize(t){t.length>=0&&null!=this.dimensions&&!w.isEqual(t[0].contentRect,this.dimensions)&&!this.isResizing&&(this.isResizing=!0,window.requestAnimationFrame((()=>this.recalculateComponentDimensions())))}registerSlotChangeListeners(){this.mutationObserver=new MutationObserver((()=>this.injectViewerApi())),this.mutationObserver.observe(this.hostElement,{childList:!0,subtree:!0})}injectViewerApi(){function t(t){return Array.from(t.querySelectorAll("*"))}t(this.hostElement).filter((t=>t.nodeName.startsWith("VERTEX-"))).reduce(((i,s)=>[...i,s,...t(s)]),[]).forEach((t=>{t.viewer=this.hostElement}))}async handleStreamRequest(t){null!=t.drawFrame?this.handleFrame(t.drawFrame):null!=t.gracefulReconnection&&this.handleGracefulReconnect(t.gracefulReconnection)}handleGracefulReconnect(t){var i;if(null!=(null===(i=t.streamId)||void 0===i?void 0:i.hex)&&null!=this.urn){const{resource:i}=k(this.urn);this.isReconnecting=!0,this.reconnectStreamingClient(i,t.streamId.hex)}}async handleFrame(t){const i=this.getCanvasDimensions(),s=this.stateMap.streamWorldOrientation;if(null!=this.canvasElement&&null!=i&&null!=s){const n=this.canvasElement.getContext("2d");if(null!=n){this.frame=W(s)(t);const e={canvas:n,dimensions:i,frame:this.frame,viewport:U.fromDimensions(this.getCanvasDimensions()||w.create(0,0))};this.frameReceived.emit(this.frame),this.frame.scene.hasChanged&&this.sceneChanged.emit();const h=await this.canvasRenderer(e);this.dispatchFrameDrawn(h)}}}waitNextDrawnFrame(t){const i=new Promise((t=>{const i=this.internalFrameDrawnDispatcher.on((s=>{t(s),i.dispose()}))}));return null!=t?y.timeout(t,i):i}calculateComponentDimensions(){const t=this.getBounds();if(null!=(null==t?void 0:t.width)&&null!=(null==t?void 0:t.height)){const i=w.create(t.width,t.height),s=w.scaleFit(2073600,i);this.hostDimensions=i,this.dimensions=null!=s?w.create(s.width,s.height):void 0}}recalculateComponentDimensions(){this.isResizing&&(this.calculateComponentDimensions(),this.isResizing=!1,this.dimensionschange.emit(this.dimensions),this.isStreamStarted&&this.getStream().updateDimensions({dimensions:this.dimensions}))}reportPerformance(t){if(this.isStreamStarted){const i={timings:t.map((t=>({receiveToPaintDuration:T(t.duration)})))};this.getStream().recordPerformance(i,!1)}}setupStreamListeners(){this.getStream().onRequest((t=>this.handleStreamRequest(t.request))),this.getStream().onRequest(function(t,i){const s=function(t){let i=!1;return s=>{const n=t();if(null!=n){const t=n.remoteTime(new Date(Date.now())),e=T(s,t);return x(e).getTime()>=0?e:void(i||(console.warn(`Possible erroneous send to receive timing. Muting for 60s. [sent-at=${s.toISOString()}, received-at=${t.toISOString()}, remote-time=${n.knownRemoteTime.toISOString()}]`),i=!0,setTimeout((()=>i=!1),6e4)))}}}(i);return n=i=>{return n=()=>n=>{const e=x(n.sentAtTime);null!=e&&t.replyResult(i,{drawFrame:{sendToReceiveDuration:s(e)}})},t=>{const{drawFrame:i}=t.request;null!=i&&n()(t)};var n},t=>{var i;const s=null===(i=t.request.requestId)||void 0===i?void 0:i.value;null!=s&&n(s)(t)};var n}(this.getStream(),(()=>this.clock)))}initializeInteractionHandler(t){if(null==this.stateMap.interactionTarget)throw new F("Cannot initialize interaction handler. Interaction target is undefined.");if(null==this.interactionApi)throw new F("Cannot initialize interaction handler. Interaction APi is undefined.");t.initialize(this.stateMap.interactionTarget,this.interactionApi)}createInteractionApi(){if(null==this.stream)throw new A("Cannot create interaction API. Component has not been initialized.");return new Mt(this.stream,(()=>this.getResolvedConfig().interactions),(()=>this.createScene()),(()=>this.frame),(()=>U.fromDimensions(this.getCanvasDimensions()||w.create(0,0))),this.tap,this.doubletap,this.longpress,this.interactionStarted,this.interactionFinished)}handleCursorChanged(){window.requestAnimationFrame((()=>{this.cursor=this.stateMap.cursorManager.getActiveCursor()}))}createScene(){if(null==this.frame||null==this.sceneViewId||null==this.stateMap.streamWorldOrientation)throw new B("Cannot create scene. Frame has not been rendered or stream not initialized.");const t="string"==typeof this.selectionMaterial?L(this.selectionMaterial):this.selectionMaterial;return new K(this.getStream(),this.frame,W(this.stateMap.streamWorldOrientation),(()=>this.getImageScale()),this.sceneViewId,t)}getBackgroundColor(){if(null!=this.containerElement)return h(this.containerElement)}getBounds(){return o(this.hostElement)}getCanvasDimensions(){return this.getResolvedConfig().flags.letterboxFrames?this.dimensions:this.hostDimensions}getImageScale(){const t=this.getCanvasDimensions();if(null!=this.dimensions&&null!=t)return u.create(this.dimensions.width/t.width,this.dimensions.height/t.height)}updateStreamAttributesProp(){const t=this.getDepthBufferStreamAttributesValue();this.streamAttributes={depthBuffers:{enabled:null!=t,frameType:t},experimentalGhosting:{enabled:this.experimentalGhostingOpacity>0,opacity:this.experimentalGhostingOpacity},featureLines:this.featureLines}}getDepthBufferStreamAttributesValue(){var t;return null!==(t=this.depthBuffers)&&void 0!==t?t:this.rotateAroundTapPoint?"final":void 0}updateResolvedConfig(){this.resolvedConfig=r(this.configEnv,this.config)}getResolvedConfig(){return ii("Resolved config is undefined",(()=>this.resolvedConfig))}getStream(){return ii("Stream is undefined",(()=>this.stream))}get hostElement(){return e(this)}static get watchers(){return{src:["handleSrcChanged"],streamAttributes:["handleStreamAttributesChanged"],rotateAroundTapPoint:["handleRotateAboutTapPointChanged"],depthBuffers:["handleDepthBuffersChanged"],experimentalGhostingOpacity:["handleExperimentalGhostingOpacityChanged"],featureLines:["handleFeatureLinesChanged"],config:["handleConfigChanged"],configEnv:["handleConfigEnvChanged"]}}};function ii(t,i){const s=i();if(null!=s)return s;throw new Error(t)}ti.style=":host{--image-background:var(--image-background);--viewer-background:var(--viewer-background);display:block;position:relative;width:300px;height:300px}.canvas-container{display:flex;justify-content:center;align-items:center;width:100%;height:100%;position:relative;background:var(--image-background, var(--viewer-background, #ffffff))}.enable-pointer-events{touch-action:none}.viewer-container{width:100%;height:100%;overflow:hidden;background:var(--viewer-background, #ffffff)}.error-message{position:absolute;top:50%;width:100%;transform:translateY(-50%);text-align:center}";export{ti as vertex_viewer}
@@ -0,0 +1,4 @@
1
+ /**!
2
+ * Copyright (c) 2021 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import{r as e,c as t,h as r,H as i,g as n}from"./p-c9d8a379.js";import{s}from"./p-c738296e.js";import{b as o,a,i as l}from"./p-835e158e.js";import{F as h,C as d,A as m}from"./p-5389e9d4.js";import"./p-640cb5f8.js";import"./p-59d075d4.js";const c=class{constructor(r){e(this,r),this.markupBegin=t(this,"markupBegin",7),this.markupEnd=t(this,"markupEnd",7),this.markupEditCancel=t(this,"markupEditCancel",7),this.tool="arrow",this.disabled=!1,this.stateMap={},this.handleMarkupEditBegin=()=>{this.markupBegin.emit()},this.handleMarkupEditEnd=()=>{const{markupElement:e}=this.stateMap;if(o(e)){const{points:t,bounds:r}=e;e.points=void 0,e.bounds=void 0,null!=t&&t.length>0&&null!=r&&this.markupEnd.emit(new h({points:t,bounds:r}))}else if(a(e)){const{bounds:t}=e;e.bounds=void 0,null!=t&&this.markupEnd.emit(new d({bounds:t}))}else if(l(e)){const{start:t,end:r}=e;e.start=void 0,e.end=void 0,e.mode="create",null!=t&&null!=r&&this.markupEnd.emit(new m({start:t,end:r}))}},this.handleMarkupEditCancel=()=>{this.markupEditCancel.emit()}}async handleViewerChanged(){null!=this.stateMap.markupElement&&(this.stateMap.markupElement.viewer=this.viewer)}handleToolChanged(){this.updateMarkupElement()}handleArrowTemplateIdChanged(){this.updateMarkupElement()}handleCircleTemplateIdChanged(){this.updateMarkupElement()}handleFreeformTemplateIdChanged(){this.updateMarkupElement()}handleDisabledChanged(){this.updateMarkupElement()}componentDidLoad(){this.updateMarkupElement()}render(){return this.disabled?r(i,null):r(i,null,"arrow"===this.tool||"circle"===this.tool||"freeform"===this.tool?r("slot",null):`Unsupported tool type '${this.tool}'.`)}createArrowMarkupElement(){if(null!=this.arrowTemplateId){const e=s(window.document.body,this.arrowTemplateId,l,(()=>console.warn(`Arrow template with ID ${this.arrowTemplateId} not found. Using default arrow element.`)),(()=>console.warn("Arrow template does not contain a vertex-viewer-markup-arrow. Using default arrow element.")));if(null!=e)return e}return document.createElement("vertex-viewer-markup-arrow")}createCircleMarkupElement(){if(null!=this.circleTemplateId){const e=s(window.document.body,this.circleTemplateId,a,(()=>console.warn(`Circle template with ID ${this.circleTemplateId} not found. Using default circle element.`)),(()=>console.warn("Circle template does not contain a vertex-viewer-markup-circle. Using default circle element.")));if(null!=e)return e}return document.createElement("vertex-viewer-markup-circle")}createFreeformMarkupElement(){if(null!=this.freeformTemplateId){const e=s(window.document.body,this.freeformTemplateId,o,(()=>console.warn(`Freeform template with ID ${this.freeformTemplateId} not found. Using default freeform element.`)),(()=>console.warn("Freeform template does not contain a vertex-viewer-markup-freeform. Using default freeform element.")));if(null!=e)return e}return document.createElement("vertex-viewer-markup-freeform")}createNewMarkupElement(){switch(this.tool){case"arrow":return this.createArrowMarkupElement();case"circle":return this.createCircleMarkupElement();case"freeform":return this.createFreeformMarkupElement()}}updateMarkupElement(){const{markupElement:e}=this.stateMap;if(null!=e&&(e.remove(),e.dispose(),e.viewer=void 0,e.removeEventListener("editBegin",this.handleMarkupEditBegin),e.removeEventListener("editEnd",this.handleMarkupEditEnd),e.removeEventListener("editCancel",this.handleMarkupEditCancel)),!this.disabled){const e=this.createNewMarkupElement();e.mode="create",e.viewer=this.viewer,e.addEventListener("editBegin",this.handleMarkupEditBegin),e.addEventListener("editEnd",this.handleMarkupEditEnd),e.addEventListener("editCancel",this.handleMarkupEditCancel),this.stateMap.markupElement=e,this.hostEl.append(e)}}get hostEl(){return n(this)}static get watchers(){return{viewer:["handleViewerChanged"],tool:["handleToolChanged"],arrowTemplateId:["handleArrowTemplateIdChanged"],circleTemplateId:["handleCircleTemplateIdChanged"],freeformTemplateId:["handleFreeformTemplateIdChanged"],disabled:["handleDisabledChanged"]}}};c.style=":host{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}";export{c as vertex_viewer_markup_tool}
@@ -1,4 +1,4 @@
1
1
  /**!
2
2
  * Copyright (c) 2021 Vertex Software LLC. All rights reserved.
3
3
  */
4
- import{d as e,N as t,w as a,p as r,b as n}from"./p-c9d8a379.js";(()=>{const n=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t)),i={};return i.resourcesUrl=new URL(".",new URL(n.getAttribute("data-resources-url")||n.src,a.location.href)).href,((r,n)=>{const i=`__sc_import_${t.replace(/\s|-/g,"_")}`;try{a[i]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const o=new Map;a[i]=t=>{const s=new URL(t,r).href;let l=o.get(s);if(!l){const t=e.createElement("script");t.type="module",t.crossOrigin=n.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(a[i].m),t.remove()}})),o.set(s,l),e.head.appendChild(t)}return l}}})(i.resourcesUrl,n),a.customElements?r(i):__sc_import_viewer("./p-db46d0d3.js").then((()=>i))})().then((e=>n([["p-9888f27e",[[1,"vertex-viewer-default-toolbar",{viewer:[16],placement:[1],direction:[1],animationsDisabled:[4,"animations-disabled"],animationMs:[2,"animation-ms"]}]]],["p-3dc15d99",[[1,"vertex-scene-tree",{overScanCount:[2,"over-scan-count"],viewerSelector:[1,"viewer-selector"],viewer:[1040],rowData:[16],config:[16],configEnv:[1,"config-env"],controller:[1040],metadataKeys:[16],isComputingRowHeight:[32],rows:[32],totalRows:[32],scrollTop:[32],computedRowHeight:[32],stateMap:[32],connectionErrorDetails:[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],fetchMetadataKeys:[64]},[[0,"search","handleSearch"]]]]],["p-4183c421",[[1,"vertex-viewer-measurement-tool",{distanceTemplateId:[1,"distance-template-id"],tool:[1],units:[1],fractionalDigits:[2,"fractional-digits"],disabled:[4],viewer:[16],isMeasuring:[1540,"is-measuring"],snapDistance:[2,"snap-distance"],stateMap:[32]}]]],["p-e3105f9a",[[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-f6d75616",[[1,"vertex-viewer-markup",{arrowTemplateId:[1,"arrow-template-id"],circleTemplateId:[1,"circle-template-id"],tool:[1],disabled:[4],viewer:[16],selectedMarkupId:[1025,"selected-markup-id"],addMarkup:[64],removeMarkup:[64],getMarkupElements:[64],getMarkupElement:[64]},[[0,"markupEnd","handleMarkupEnd"],[0,"markupEditCancel","handleMarkupEditCancel"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-14182324",[[1,"vertex-viewer-markup-tool",{arrowTemplateId:[1,"arrow-template-id"],circleTemplateId:[1,"circle-template-id"],tool:[1],disabled:[4],viewer:[16],stateMap:[32]}]]],["p-1ee75110",[[1,"vertex-viewer-measurements",{distanceTemplateId:[1,"distance-template-id"],tool:[1],units:[1],fractionalDigits:[2,"fractional-digits"],disabled:[4],viewer:[16],selectedMeasurementId:[1025,"selected-measurement-id"],snapDistance:[2,"snap-distance"],addMeasurement:[64],removeMeasurement:[64],getMeasurementElement:[64],getMeasurementElements:[64]},[[0,"measureEnd","handleMeasureEnd"],[1,"pointerdown","handleMeasurementPointerDown"]]]]],["p-50b28df6",[[1,"vertex-scene-tree-row",{node:[16],tree:[16],interactionsDisabled:[4,"interactions-disabled"],recurseParentSelectionDisabled:[4,"recurse-parent-selection-disabled"]}]]],["p-4027802e",[[1,"vertex-scene-tree-toolbar-group"]]],["p-a9434d8e",[[1,"vertex-viewer",{src:[1],clientId:[1,"client-id"],sessionId:[1,"session-id"],config:[1],configEnv:[1,"config-env"],resolvedConfig:[1040],cameraControls:[4,"camera-controls"],keyboardControls:[4,"keyboard-controls"],rotateAroundTapPoint:[4,"rotate-around-tap-point"],depthBuffers:[1,"depth-buffers"],experimentalGhostingOpacity:[2,"experimental-ghosting-opacity"],featureLines:[16],selectionMaterial:[1,"selection-material"],frame:[1040],streamAttributes:[1040],stream:[1040],stencilBuffer:[1040],dimensions:[32],hostDimensions:[32],errorMessage:[32],cursor:[32],stateMap:[32],registerCommand:[64],dispatchFrameDrawn:[64],registerInteractionHandler:[64],registerTapKeyInteraction:[64],getInteractionTarget:[64],addCursor:[64],getInteractionHandlers:[64],getBaseInteractionHandler:[64],getJwt:[64],load:[64],unload:[64],scene:[64],isSceneReady:[64],handleWebSocketClose:[64]},[[0,"tap","handleTapEvent"]]]]],["p-474e111a",[[1,"vertex-scene-tree-search",{debounce:[2],disabled:[4],placeholder:[1],value:[1025],focused:[32],setFocus:[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-a70080a6",[[1,"vertex-viewer-toolbar",{placement:[1],direction:[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{direction:[1]}]]],["p-7c71db57",[[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"]}],[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]}],[1,"vertex-viewer-dom-renderer",{drawMode:[1,"draw-mode"],viewer:[16],camera:[1040],depthBuffer:[1040],viewport:[32],invalidateFrameCounter:[32]},[[0,"propertyChange","handlePropertyChange"]]]]],["p-12d8af9a",[[1,"vertex-viewer-icon",{name:[1],size:[1]}]]],["p-8215b29a",[[1,"vertex-viewer-layer",{stretchOff:[516,"stretch-off"]}]]],["p-9e856d0a",[[1,"vertex-viewer-markup-arrow",{start:[1040],startJson:[1,"start"],end:[1040],endJson:[1,"end"],mode:[513],viewer:[16],elementBounds:[32],editAnchor:[32],dispose:[64]}],[1,"vertex-viewer-markup-circle",{bounds:[1040],boundsJson:[1,"bounds"],mode:[513],viewer:[16],elementBounds:[32],startPosition:[32],editAnchor:[32],resizeBounds:[32],dispose:[64]}]]],["p-f090a3f3",[[1,"vertex-viewer-measurement-distance",{start:[1040],startJson:[1,"start"],end:[1040],endJson:[1,"end"],distance:[1026],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],depthBuffer:[16],viewer:[16],line:[32],viewport:[32],elementBounds:[32],interactionCount:[32],internalCamera:[32],internalDepthBuffer:[32],invalidateStateCounter:[32],interactiveStartPoint:[32],interactiveEndPoint:[32],stateMap:[32],computeElementMetrics:[64]}],[1,"vertex-viewer-measurement-line",{start:[16],end:[16],capLength:[2,"cap-length"],pointerEvents:[1,"pointer-events"]}]]]],e)));
4
+ import{d as e,N as t,w as a,p as r,b as n}from"./p-c9d8a379.js";(()=>{const n=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t)),i={};return i.resourcesUrl=new URL(".",new URL(n.getAttribute("data-resources-url")||n.src,a.location.href)).href,((r,n)=>{const i=`__sc_import_${t.replace(/\s|-/g,"_")}`;try{a[i]=new Function("w",`return import(w);//${Math.random()}`)}catch(t){const o=new Map;a[i]=t=>{const s=new URL(t,r).href;let l=o.get(s);if(!l){const t=e.createElement("script");t.type="module",t.crossOrigin=n.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(a[i].m),t.remove()}})),o.set(s,l),e.head.appendChild(t)}return l}}})(i.resourcesUrl,n),a.customElements?r(i):__sc_import_viewer("./p-db46d0d3.js").then((()=>i))})().then((e=>n([["p-9888f27e",[[1,"vertex-viewer-default-toolbar",{viewer:[16],placement:[1],direction:[1],animationsDisabled:[4,"animations-disabled"],animationMs:[2,"animation-ms"]}]]],["p-117324c0",[[1,"vertex-scene-tree",{overScanCount:[2,"over-scan-count"],viewerSelector:[1,"viewer-selector"],viewer:[1040],rowData:[16],config:[16],configEnv:[1,"config-env"],controller:[1040],metadataKeys:[16],isComputingRowHeight:[32],rows:[32],totalRows:[32],scrollTop:[32],computedRowHeight:[32],stateMap:[32],connectionErrorDetails:[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],fetchMetadataKeys:[64]},[[0,"search","handleSearch"]]]]],["p-68aaf1f8",[[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"],addMarkup:[64],removeMarkup:[64],getMarkupElements:[64],getMarkupElement:[64]},[[0,"markupEnd","handleMarkupEnd"],[0,"markupEditCancel","handleMarkupEditCancel"],[1,"pointerdown","handleMarkupPointerDown"]]]]],["p-f75436be",[[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]}]]],["p-79c45c02",[[1,"vertex-viewer-measurement-tool",{distanceTemplateId:[1,"distance-template-id"],tool:[1],units:[1],fractionalDigits:[2,"fractional-digits"],disabled:[4],viewer:[16],isMeasuring:[1540,"is-measuring"],snapDistance:[2,"snap-distance"],stateMap:[32]}]]],["p-3c2aff67",[[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-1c772ec1",[[1,"vertex-viewer-measurements",{distanceTemplateId:[1,"distance-template-id"],tool:[1],units:[1],fractionalDigits:[2,"fractional-digits"],disabled:[4],viewer:[16],selectedMeasurementId:[1025,"selected-measurement-id"],snapDistance:[2,"snap-distance"],addMeasurement:[64],removeMeasurement:[64],getMeasurementElement:[64],getMeasurementElements:[64]},[[0,"measureEnd","handleMeasureEnd"],[1,"pointerdown","handleMeasurementPointerDown"]]]]],["p-50b28df6",[[1,"vertex-scene-tree-row",{node:[16],tree:[16],interactionsDisabled:[4,"interactions-disabled"],recurseParentSelectionDisabled:[4,"recurse-parent-selection-disabled"]}]]],["p-4027802e",[[1,"vertex-scene-tree-toolbar-group"]]],["p-f43e8cc2",[[1,"vertex-viewer",{src:[1],clientId:[1,"client-id"],sessionId:[1,"session-id"],config:[1],configEnv:[1,"config-env"],resolvedConfig:[1040],cameraControls:[4,"camera-controls"],keyboardControls:[4,"keyboard-controls"],rotateAroundTapPoint:[4,"rotate-around-tap-point"],depthBuffers:[1,"depth-buffers"],experimentalGhostingOpacity:[2,"experimental-ghosting-opacity"],featureLines:[16],selectionMaterial:[1,"selection-material"],frame:[1040],streamAttributes:[1040],stream:[1040],stencilBuffer:[1040],dimensions:[32],hostDimensions:[32],errorMessage:[32],cursor:[32],stateMap:[32],registerCommand:[64],dispatchFrameDrawn:[64],registerInteractionHandler:[64],registerTapKeyInteraction:[64],getInteractionTarget:[64],addCursor:[64],getInteractionHandlers:[64],getBaseInteractionHandler:[64],getJwt:[64],load:[64],unload:[64],scene:[64],isSceneReady:[64],handleWebSocketClose:[64]},[[0,"tap","handleTapEvent"]]]]],["p-474e111a",[[1,"vertex-scene-tree-search",{debounce:[2],disabled:[4],placeholder:[1],value:[1025],focused:[32],setFocus:[64]}],[1,"vertex-scene-tree-toolbar"]]],["p-a70080a6",[[1,"vertex-viewer-toolbar",{placement:[1],direction:[1]}],[1,"vertex-viewer-button"],[1,"vertex-viewer-toolbar-group",{direction:[1]}]]],["p-bc9e6919",[[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"]}],[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]}],[1,"vertex-viewer-dom-renderer",{drawMode:[1,"draw-mode"],viewer:[16],camera:[1040],depthBuffer:[1040],viewport:[32],invalidateFrameCounter:[32]},[[0,"propertyChange","handlePropertyChange"]]]]],["p-12d8af9a",[[1,"vertex-viewer-icon",{name:[1],size:[1]}]]],["p-8215b29a",[[1,"vertex-viewer-layer",{stretchOff:[516,"stretch-off"]}]]],["p-c818c80e",[[1,"vertex-viewer-measurement-distance",{start:[1040],startJson:[1,"start"],end:[1040],endJson:[1,"end"],distance:[1026],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],depthBuffer:[16],viewer:[16],line:[32],viewport:[32],elementBounds:[32],interactionCount:[32],internalCamera:[32],internalDepthBuffer:[32],invalidateStateCounter:[32],interactiveStartPoint:[32],interactiveEndPoint:[32],stateMap:[32],computeElementMetrics:[64]}],[1,"vertex-viewer-measurement-line",{start:[16],end:[16],capLength:[2,"cap-length"],pointerEvents:[1,"pointer-events"]}]]],["p-8c255868",[[1,"vertex-viewer-markup-arrow",{start:[1040],startJson:[1,"start"],end:[1040],endJson:[1,"end"],mode:[513],viewer:[16],elementBounds:[32],editAnchor:[32],dispose:[64]}],[1,"vertex-viewer-markup-circle",{bounds:[1040],boundsJson:[1,"bounds"],mode:[513],viewer:[16],elementBounds:[32],startPosition:[32],editAnchor:[32],resizeBounds:[32],dispose:[64]}],[1,"vertex-viewer-markup-freeform",{points:[1040],pointsJson:[1,"points"],bounds:[1040],boundsJson:[1,"bounds"],mode:[513],viewer:[16],elementBounds:[32],resizeStartPosition:[32],editAnchor:[32],resizeBounds:[32],resizePoints:[32],screenPoints:[32],dispose:[64]}]]]],e)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertexvis/viewer",
3
- "version": "0.10.2-canary.7",
3
+ "version": "0.11.0",
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)",
@@ -48,16 +48,16 @@
48
48
  "@improbable-eng/grpc-web": "^0.14.0",
49
49
  "@juggle/resize-observer": "^3.3.0",
50
50
  "@types/classnames": "^2.3.1",
51
- "@vertexvis/frame-streaming-protos": "^0.5.14",
52
- "@vertexvis/geometry": "^0.10.2-canary.7",
53
- "@vertexvis/scene-tree-protos": "^0.1.0",
54
- "@vertexvis/stream-api": "^0.10.2-canary.7",
55
- "@vertexvis/utils": "^0.10.2-canary.7",
51
+ "@vertexvis/frame-streaming-protos": "^0.6.1",
52
+ "@vertexvis/geometry": "0.11.0",
53
+ "@vertexvis/scene-tree-protos": "^0.1.4",
54
+ "@vertexvis/stream-api": "0.11.0",
55
+ "@vertexvis/utils": "0.11.0",
56
56
  "@vertexvis/web-workers": "^0.1.0",
57
57
  "camel-case": "^4.1.2",
58
58
  "classnames": "^2.3.1",
59
59
  "fast-png": "^5.0.4",
60
- "google-protobuf": "^3.15.7",
60
+ "google-protobuf": "^3.18.0",
61
61
  "jwt-decode": "^3.1.2",
62
62
  "protobufjs": "^6.9.0",
63
63
  "requestidlecallback-polyfill": "^1.0.2",
@@ -71,21 +71,23 @@
71
71
  "@types/google-protobuf": "^3.7.4",
72
72
  "@types/jest": "^26.0.20",
73
73
  "@types/jsonwebtoken": "^8.5.1",
74
- "@vertexvis/eslint-config-vertexvis-typescript": "0.4.0",
75
- "@vertexvis/rollup-plugin-vertexvis-copyright": "0.3.0",
74
+ "@vertexvis/eslint-config-vertexvis-typescript": "^0.4.1",
75
+ "@vertexvis/rollup-plugin-vertexvis-copyright": "^0.4.0",
76
76
  "@vertexvis/rollup-plugin-web-workers": "^0.1.0",
77
77
  "@vertexvis/typescript-config-vertexvis": "1.1.0",
78
- "@vertexwebsdk/build": "^0.10.2-canary.7",
79
- "chance": "^1.1.7",
78
+ "@vertexwebsdk/build": "0.11.0",
79
+ "chance": "^1.1.8",
80
80
  "eslint": "^7.20.0",
81
- "eslint-plugin-react": "^7.17.0",
81
+ "eslint-plugin-react": "^7.26.0",
82
82
  "jest": "^26.6.3",
83
83
  "jsonwebtoken": "^8.5.1",
84
- "rollup": "^1.19.4",
84
+ "rollup": "^2.57.0",
85
+ "rollup-plugin-commonjs": "^10.1.0",
86
+ "rollup-plugin-node-resolve": "^5.2.0",
85
87
  "ts-jest": "^26.5.2",
86
88
  "ts-toolbelt": "^9.6.0",
87
- "typedoc": "^0.21.0",
88
- "typescript": "^4.2.2"
89
+ "typedoc": "^0.22.4",
90
+ "typescript": "^4.4.3"
89
91
  },
90
- "gitHead": "ae6e2d73593c483c3b84fa3a5b380f8c4e94e755"
92
+ "gitHead": "eb6c1259546ee35c78a4ea1f413416a2047e16f7"
91
93
  }
package/readme.md CHANGED
@@ -27,15 +27,15 @@ 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.10.1/dist/viewer/viewer.css"
30
+ href="https://unpkg.com/@vertexvis/viewer@0.11.0/dist/viewer/viewer.css"
31
31
  />
32
32
  <script
33
33
  type="module"
34
- src="https://unpkg.com/@vertexvis/viewer@0.10.1/dist/viewer/viewer.esm.js"
34
+ src="https://unpkg.com/@vertexvis/viewer@0.11.0/dist/viewer/viewer.esm.js"
35
35
  ></script>
36
36
  <script
37
37
  nomodule
38
- src="https://unpkg.com/@vertexvis/viewer@0.10.1/dist/viewer.js"
38
+ src="https://unpkg.com/@vertexvis/viewer@0.11.0/dist/viewer.js"
39
39
  ></script>
40
40
  </head>
41
41
 
@@ -57,7 +57,7 @@ These utilities can be imported from a CDN as shown below:
57
57
  </head>
58
58
  <body>
59
59
  <script type="module">
60
- import { ColorMaterial } from 'https://unpkg.com/@vertexvis/viewer@0.10.1/dist/esm/index.mjs';
60
+ import { ColorMaterial } from 'https://unpkg.com/@vertexvis/viewer@0.11.0/dist/esm/index.mjs';
61
61
 
62
62
  function main() {
63
63
  const color = ColorMaterial.fromHex('#ff0000');
@@ -73,7 +73,7 @@ If you want to interact with the web component via JavaScript, you'll need to en
73
73
 
74
74
  Import `defineCustomElements`, and this will register all custom elements in your DOM.
75
75
  ```js
76
- import { defineCustomElements } from 'https://unpkg.com/@vertexvis/viewer@0.10.1/dist/esm/loader.mjs';
76
+ import { defineCustomElements } from 'https://unpkg.com/@vertexvis/viewer@0.11.0/dist/esm/loader.mjs';
77
77
 
78
78
  async function main() {
79
79
  const viewer = document.querySelector('#viewer');
@@ -94,7 +94,7 @@ dependency to your `package.json`:
94
94
  ```json
95
95
  {
96
96
  "dependencies": {
97
- "@vertexvis/viewer": "^0.10.1"
97
+ "@vertexvis/viewer": "^0.11.0"
98
98
  }
99
99
  }
100
100
  ```
@@ -1,104 +0,0 @@
1
- /**!
2
- * Copyright (c) 2021 Vertex Software LLC. All rights reserved.
3
- */
4
- 'use strict';
5
-
6
- const bundle_esm = require('./bundle.esm-c457ad4d.js');
7
-
8
- function createArrowheadPoints(start, end, arrowAngle = 60) {
9
- const distance = bundle_esm.point.distance(start, end);
10
- const angle = bundle_esm.angle.normalize(bundle_esm.angle.toDegrees(bundle_esm.angle.fromPoints(start, end)) - 270);
11
- // Adjust the arrow height in relation to the distance between the to and from
12
- // points. Uses a min and max size so the arrow doesn't become cartoonish.
13
- const height = Math.max(4, Math.min(16, distance * 0.25));
14
- const sideLength = height / Math.cos(bundle_esm.angle.toRadians(90 - arrowAngle));
15
- const rotation = bundle_esm.matrix.rotation(angle);
16
- const arrowLeft = bundle_esm.point.polar(sideLength, bundle_esm.angle.toRadians(arrowAngle * 2));
17
- const arrowRight = bundle_esm.point.polar(sideLength, bundle_esm.angle.toRadians(arrowAngle));
18
- const arrowBase = bundle_esm.point.polar(height, bundle_esm.angle.toRadians(90));
19
- return {
20
- tip: end,
21
- left: bundle_esm.point.add(end, bundle_esm.matrix.transformPoint(rotation, arrowLeft)),
22
- right: bundle_esm.point.add(end, bundle_esm.matrix.transformPoint(rotation, arrowRight)),
23
- base: bundle_esm.point.add(end, bundle_esm.matrix.transformPoint(rotation, arrowBase)),
24
- };
25
- }
26
- function arrowheadPointsToPolygonPoints(points) {
27
- return [points.tip, points.right, points.base, points.left]
28
- .map((pt) => `${pt.x},${pt.y}`)
29
- .join(' ');
30
- }
31
- function isVertexViewerArrowMarkup(el) {
32
- return (el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-ARROW');
33
- }
34
- function parsePoint(value) {
35
- return typeof value === 'string' ? bundle_esm.point.fromJson(value) : value;
36
- }
37
-
38
- function isVertexViewerCircleMarkup(el) {
39
- return (el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-CIRCLE');
40
- }
41
- function parseBounds(value) {
42
- return typeof value === 'string' ? bundle_esm.rectangle.fromJson(value) : value;
43
- }
44
- function createCircle(initialPoint, currentPoint, maintainAspectRatio) {
45
- const bounds = bundle_esm.rectangle.fromPoints(initialPoint, currentPoint);
46
- if (maintainAspectRatio) {
47
- const fitBoundsSize = Math.max(bounds.width, bounds.height);
48
- const isPortrait = bounds.height > bounds.width;
49
- const currentIsLeftOfInitial = currentPoint.x <= initialPoint.x;
50
- const currentIsAboveInitial = currentPoint.y <= initialPoint.y;
51
- const fitBoundsX = currentIsLeftOfInitial
52
- ? isPortrait
53
- ? initialPoint.x - fitBoundsSize
54
- : currentPoint.x
55
- : initialPoint.x;
56
- const fitBoundsY = currentIsAboveInitial
57
- ? isPortrait
58
- ? currentPoint.y
59
- : initialPoint.y - fitBoundsSize
60
- : initialPoint.y;
61
- return bundle_esm.rectangle.create(fitBoundsX, fitBoundsY, fitBoundsSize, fitBoundsSize);
62
- }
63
- else {
64
- return bounds;
65
- }
66
- }
67
- function transformCircle(bounds, start, current, anchor, maintainAspectRatio) {
68
- const delta = bundle_esm.point.subtract(current, start);
69
- const { x: left, y: top, width: w, height: h } = bounds;
70
- const right = left + w;
71
- const bottom = top + h;
72
- const topLeft = bundle_esm.point.create(left, top);
73
- const bottomLeft = bundle_esm.point.create(left, bottom);
74
- const topRight = bundle_esm.point.create(right, top);
75
- const bottomRight = bundle_esm.point.create(right, bottom);
76
- switch (anchor) {
77
- case 'top-left':
78
- return createCircle(bottomRight, current, !!maintainAspectRatio);
79
- case 'top':
80
- return createCircle(bottomRight, bundle_esm.point.create(left, current.y), !!maintainAspectRatio);
81
- case 'top-right':
82
- return createCircle(bottomLeft, current, !!maintainAspectRatio);
83
- case 'right':
84
- return createCircle(bottomLeft, bundle_esm.point.create(current.x, top), !!maintainAspectRatio);
85
- case 'bottom-right':
86
- return createCircle(topLeft, current, !!maintainAspectRatio);
87
- case 'bottom':
88
- return createCircle(topLeft, bundle_esm.point.create(right, current.y), !!maintainAspectRatio);
89
- case 'bottom-left':
90
- return createCircle(topRight, current, !!maintainAspectRatio);
91
- case 'left':
92
- return createCircle(bottomRight, bundle_esm.point.create(current.x, top), !!maintainAspectRatio);
93
- case 'center':
94
- return bundle_esm.rectangle.create(bounds.x + delta.x, bounds.y + delta.y, bounds.width, bounds.height);
95
- }
96
- }
97
-
98
- exports.arrowheadPointsToPolygonPoints = arrowheadPointsToPolygonPoints;
99
- exports.createArrowheadPoints = createArrowheadPoints;
100
- exports.isVertexViewerArrowMarkup = isVertexViewerArrowMarkup;
101
- exports.isVertexViewerCircleMarkup = isVertexViewerCircleMarkup;
102
- exports.parseBounds = parseBounds;
103
- exports.parsePoint = parsePoint;
104
- exports.transformCircle = transformCircle;