@vertexvis/viewer 1.0.2-canary.2 → 1.0.2-canary.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (501) hide show
  1. package/dist/cjs/config-20ozv4y8.js.map +1 -1
  2. package/dist/cjs/controller-BhcNbaX_.js.map +1 -1
  3. package/dist/cjs/controller-CSwG6gbQ.js.map +1 -1
  4. package/dist/cjs/cursors-BZmDRtaZ.js.map +1 -1
  5. package/dist/cjs/dom-BBil4aN3.js.map +1 -1
  6. package/dist/cjs/dom-CvGkFQon.js.map +1 -1
  7. package/dist/cjs/entities-D6kgGria.js.map +1 -1
  8. package/dist/cjs/geometry_pb-BTko2Wi0.js.map +1 -1
  9. package/dist/cjs/grpc-BsWFEUrc.js.map +1 -1
  10. package/dist/cjs/index.cjs.js.map +1 -1
  11. package/dist/cjs/model-C9WvOKYT.js.map +1 -1
  12. package/dist/cjs/model-D17EQTIh.js.map +1 -1
  13. package/dist/cjs/model-DAB4oD5n.js.map +1 -1
  14. package/dist/cjs/model-DkXCzhs_.js.map +1 -1
  15. package/dist/cjs/multiElementInteractionHandler-BHvRKVIp.js.map +1 -1
  16. package/dist/cjs/overlays-B-06bUbI.js.map +1 -1
  17. package/dist/cjs/queries-Da9I-xMf.js.map +1 -1
  18. package/dist/cjs/regl-component-HhKCyGQ3.js.map +1 -1
  19. package/dist/cjs/representation_pb-CrCGjlyP.js.map +1 -1
  20. package/dist/cjs/results-1wRRZiYG.js.map +1 -1
  21. package/dist/cjs/row-Cet6xXup.js.map +1 -1
  22. package/dist/cjs/stencil-Hsr_8Chs.js.map +1 -1
  23. package/dist/cjs/streamAttributes-D_J-W8-2.js.map +1 -1
  24. package/dist/cjs/templates-DvjgjnlO.js.map +1 -1
  25. package/dist/cjs/util-DIJSIQXH.js.map +1 -1
  26. package/dist/cjs/utils-CibrnHQ4.js.map +1 -1
  27. package/dist/cjs/utils-D8MbXbwO.js.map +1 -1
  28. package/dist/cjs/utils-qErVs2Vt.js.map +1 -1
  29. package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js +6 -8
  30. package/dist/cjs/vertex-scene-tree-notification-banner_4.cjs.entry.js.map +1 -1
  31. package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js +1 -1
  32. package/dist/cjs/vertex-scene-tree-table-cell.cjs.entry.js.map +1 -1
  33. package/dist/cjs/vertex-scene-tree.cjs.entry.js +2 -2
  34. package/dist/cjs/vertex-scene-tree.cjs.entry.js.map +1 -1
  35. package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js +2 -2
  36. package/dist/cjs/vertex-viewer-box-query-tool.cjs.entry.js.map +1 -1
  37. package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js +1 -1
  38. package/dist/cjs/vertex-viewer-dom-element_2.cjs.entry.js.map +1 -1
  39. package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js +1 -1
  40. package/dist/cjs/vertex-viewer-dom-group.cjs.entry.js.map +1 -1
  41. package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js +1 -1
  42. package/dist/cjs/vertex-viewer-hit-result-indicator.cjs.entry.js.map +1 -1
  43. package/dist/cjs/vertex-viewer-icon.cjs.entry.js.map +1 -1
  44. package/dist/cjs/vertex-viewer-markup-arrow_3.cjs.entry.js.map +1 -1
  45. package/dist/cjs/vertex-viewer-markup-tool.cjs.entry.js.map +1 -1
  46. package/dist/cjs/vertex-viewer-markup.cjs.entry.js +1 -1
  47. package/dist/cjs/vertex-viewer-markup.cjs.entry.js.map +1 -1
  48. package/dist/cjs/vertex-viewer-measurement-details.cjs.entry.js.map +1 -1
  49. package/dist/cjs/vertex-viewer-measurement-distance.cjs.entry.js.map +1 -1
  50. package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js +2 -2
  51. package/dist/cjs/vertex-viewer-measurement-line_2.cjs.entry.js.map +1 -1
  52. package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js.map +1 -1
  53. package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +2 -2
  54. package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js.map +1 -1
  55. package/dist/cjs/vertex-viewer-pin-label_2.cjs.entry.js.map +1 -1
  56. package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js +1 -1
  57. package/dist/cjs/vertex-viewer-pin-tool.cjs.entry.js.map +1 -1
  58. package/dist/cjs/vertex-viewer-teleport-tool.cjs.entry.js.map +1 -1
  59. package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js +4 -5
  60. package/dist/cjs/vertex-viewer-transform-widget.cjs.entry.js.map +1 -1
  61. package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js +1 -1
  62. package/dist/cjs/vertex-viewer-view-cube.cjs.entry.js.map +1 -1
  63. package/dist/cjs/vertex-viewer-walk-mode-tool.cjs.entry.js.map +1 -1
  64. package/dist/cjs/vertex-viewer.cjs.entry.js +9 -5
  65. package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
  66. package/dist/cjs/viewport-CG1VYkIU.js.map +1 -1
  67. package/dist/collection/components/scene-tree/errors.js.map +1 -1
  68. package/dist/collection/components/scene-tree/lib/controller.js.map +1 -1
  69. package/dist/collection/components/scene-tree/lib/dom.js.map +1 -1
  70. package/dist/collection/components/scene-tree/lib/errors.js.map +1 -1
  71. package/dist/collection/components/scene-tree/lib/grpc.js.map +1 -1
  72. package/dist/collection/components/scene-tree/lib/handlers.js.map +1 -1
  73. package/dist/collection/components/scene-tree/lib/row.js.map +1 -1
  74. package/dist/collection/components/scene-tree/lib/viewer-ops.js.map +1 -1
  75. package/dist/collection/components/scene-tree/scene-tree.js +2 -2
  76. package/dist/collection/components/scene-tree/scene-tree.js.map +1 -1
  77. package/dist/collection/components/scene-tree-search/scene-tree-search.js.map +1 -1
  78. package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js +1 -1
  79. package/dist/collection/components/scene-tree-table-cell/scene-tree-table-cell.js.map +1 -1
  80. package/dist/collection/components/scene-tree-table-cell/utils.js.map +1 -1
  81. package/dist/collection/components/scene-tree-table-layout/lib/dom.js.map +1 -1
  82. package/dist/collection/components/scene-tree-table-layout/lib/window.js.map +1 -1
  83. package/dist/collection/components/scene-tree-table-layout/scene-tree-table-layout.js +5 -5
  84. package/dist/collection/components/scene-tree-table-layout/scene-tree-table-layout.js.map +1 -1
  85. package/dist/collection/components/viewer/utils.js.map +1 -1
  86. package/dist/collection/components/viewer/viewer.js +9 -5
  87. package/dist/collection/components/viewer/viewer.js.map +1 -1
  88. package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.js +2 -2
  89. package/dist/collection/components/viewer-box-query-tool/viewer-box-query-tool.js.map +1 -1
  90. package/dist/collection/components/viewer-dom-element/utils.js.map +1 -1
  91. package/dist/collection/components/viewer-dom-element/viewer-dom-element.js +1 -1
  92. package/dist/collection/components/viewer-dom-element/viewer-dom-element.js.map +1 -1
  93. package/dist/collection/components/viewer-dom-group/utils.js.map +1 -1
  94. package/dist/collection/components/viewer-dom-group/viewer-dom-group.js +1 -1
  95. package/dist/collection/components/viewer-dom-group/viewer-dom-group.js.map +1 -1
  96. package/dist/collection/components/viewer-dom-renderer/renderer2d.js.map +1 -1
  97. package/dist/collection/components/viewer-dom-renderer/renderer3d.js.map +1 -1
  98. package/dist/collection/components/viewer-dom-renderer/viewer-dom-renderer.js.map +1 -1
  99. package/dist/collection/components/viewer-hit-result-indicator/lib/dom.js.map +1 -1
  100. package/dist/collection/components/viewer-hit-result-indicator/lib/indicator.js.map +1 -1
  101. package/dist/collection/components/viewer-hit-result-indicator/lib/plane.js.map +1 -1
  102. package/dist/collection/components/viewer-hit-result-indicator/lib/point.js.map +1 -1
  103. package/dist/collection/components/viewer-hit-result-indicator/viewer-hit-result-indicator.js +1 -1
  104. package/dist/collection/components/viewer-hit-result-indicator/viewer-hit-result-indicator.js.map +1 -1
  105. package/dist/collection/components/viewer-icon/viewer-icon.js.map +1 -1
  106. package/dist/collection/components/viewer-markup/markup-utils.js.map +1 -1
  107. package/dist/collection/components/viewer-markup/viewer-markup-components.js.map +1 -1
  108. package/dist/collection/components/viewer-markup/viewer-markup.js +1 -1
  109. package/dist/collection/components/viewer-markup/viewer-markup.js.map +1 -1
  110. package/dist/collection/components/viewer-markup-arrow/interactions.js.map +1 -1
  111. package/dist/collection/components/viewer-markup-arrow/utils.js.map +1 -1
  112. package/dist/collection/components/viewer-markup-arrow/viewer-markup-arrow-components.js.map +1 -1
  113. package/dist/collection/components/viewer-markup-arrow/viewer-markup-arrow.js.map +1 -1
  114. package/dist/collection/components/viewer-markup-circle/interactions.js.map +1 -1
  115. package/dist/collection/components/viewer-markup-circle/utils.js.map +1 -1
  116. package/dist/collection/components/viewer-markup-circle/viewer-markup-circle.js.map +1 -1
  117. package/dist/collection/components/viewer-markup-freeform/interactions.js.map +1 -1
  118. package/dist/collection/components/viewer-markup-freeform/utils.js.map +1 -1
  119. package/dist/collection/components/viewer-markup-freeform/viewer-markup-freeform.js.map +1 -1
  120. package/dist/collection/components/viewer-markup-tool/viewer-markup-tool.js.map +1 -1
  121. package/dist/collection/components/viewer-measurement-details/viewer-measurement-details.js.map +1 -1
  122. package/dist/collection/components/viewer-measurement-distance/hitTest.js.map +1 -1
  123. package/dist/collection/components/viewer-measurement-distance/interactions.js.map +1 -1
  124. package/dist/collection/components/viewer-measurement-distance/utils.js.map +1 -1
  125. package/dist/collection/components/viewer-measurement-distance/viewer-measurement-distance.js.map +1 -1
  126. package/dist/collection/components/viewer-measurement-line/viewer-measurement-line.js +1 -1
  127. package/dist/collection/components/viewer-measurement-line/viewer-measurement-line.js.map +1 -1
  128. package/dist/collection/components/viewer-measurement-overlays/viewer-measurement-overlays.js +1 -1
  129. package/dist/collection/components/viewer-measurement-overlays/viewer-measurement-overlays.js.map +1 -1
  130. package/dist/collection/components/viewer-measurement-precise/viewer-measurement-precise.js.map +1 -1
  131. package/dist/collection/components/viewer-pin-group/utils.js.map +1 -1
  132. package/dist/collection/components/viewer-pin-group/viewer-pin-group.js +2 -2
  133. package/dist/collection/components/viewer-pin-group/viewer-pin-group.js.map +1 -1
  134. package/dist/collection/components/viewer-pin-label/viewer-pin-label.js.map +1 -1
  135. package/dist/collection/components/viewer-pin-tool/utils.js.map +1 -1
  136. package/dist/collection/components/viewer-pin-tool/viewer-pin-tool.js +1 -1
  137. package/dist/collection/components/viewer-pin-tool/viewer-pin-tool.js.map +1 -1
  138. package/dist/collection/components/viewer-teleport-tool/viewer-teleport-tool.js.map +1 -1
  139. package/dist/collection/components/viewer-transform-widget/util.js +1 -2
  140. package/dist/collection/components/viewer-transform-widget/util.js.map +1 -1
  141. package/dist/collection/components/viewer-transform-widget/viewer-transform-widget-components.js.map +1 -1
  142. package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js +3 -3
  143. package/dist/collection/components/viewer-transform-widget/viewer-transform-widget.js.map +1 -1
  144. package/dist/collection/components/viewer-transform-widget/widget.js.map +1 -1
  145. package/dist/collection/components/viewer-view-cube/viewer-view-cube.js +1 -1
  146. package/dist/collection/components/viewer-view-cube/viewer-view-cube.js.map +1 -1
  147. package/dist/collection/components/viewer-walk-mode-tool/viewer-walk-mode-tool.js.map +1 -1
  148. package/dist/collection/lib/annotations/controller.js.map +1 -1
  149. package/dist/collection/lib/canvases/controller.js.map +1 -1
  150. package/dist/collection/lib/canvases/mapper.js.map +1 -1
  151. package/dist/collection/lib/config.js.map +1 -1
  152. package/dist/collection/lib/cursors.js.map +1 -1
  153. package/dist/collection/lib/dom.js.map +1 -1
  154. package/dist/collection/lib/grpc.js.map +1 -1
  155. package/dist/collection/lib/interactions/baseInteractionHandler.js.map +1 -1
  156. package/dist/collection/lib/interactions/flyToPartKeyInteraction.js.map +1 -1
  157. package/dist/collection/lib/interactions/flyToPositionKeyInteraction.js.map +1 -1
  158. package/dist/collection/lib/interactions/interactionApi.js.map +1 -1
  159. package/dist/collection/lib/interactions/interactionApiOrthographic.js.map +1 -1
  160. package/dist/collection/lib/interactions/interactionApiPerspective.js.map +1 -1
  161. package/dist/collection/lib/interactions/mouseInteractionHandler.js.map +1 -1
  162. package/dist/collection/lib/interactions/mouseInteractions.js.map +1 -1
  163. package/dist/collection/lib/interactions/multiElementInteractionHandler.js.map +1 -1
  164. package/dist/collection/lib/interactions/multiPointerInteractionHandler.js.map +1 -1
  165. package/dist/collection/lib/interactions/multiTouchInteractionHandler.js.map +1 -1
  166. package/dist/collection/lib/interactions/pointerInteractionHandler.js.map +1 -1
  167. package/dist/collection/lib/interactions/tapInteractionHandler.js.map +1 -1
  168. package/dist/collection/lib/interactions/touchInteractionHandler.js.map +1 -1
  169. package/dist/collection/lib/keyBinding.js.map +1 -1
  170. package/dist/collection/lib/mappers/annotation.js.map +1 -1
  171. package/dist/collection/lib/mappers/camera.js.map +1 -1
  172. package/dist/collection/lib/mappers/color.js.map +1 -1
  173. package/dist/collection/lib/mappers/colorMaterial.js.map +1 -1
  174. package/dist/collection/lib/mappers/corePb.js.map +1 -1
  175. package/dist/collection/lib/mappers/corePbJs.js.map +1 -1
  176. package/dist/collection/lib/mappers/frameStreaming.js.map +1 -1
  177. package/dist/collection/lib/mappers/geometry.js.map +1 -1
  178. package/dist/collection/lib/mappers/material.js.map +1 -1
  179. package/dist/collection/lib/mappers/pagination.js.map +1 -1
  180. package/dist/collection/lib/mappers/scalar.js.map +1 -1
  181. package/dist/collection/lib/mappers/streamAttributes.js.map +1 -1
  182. package/dist/collection/lib/markup/interactions.js.map +1 -1
  183. package/dist/collection/lib/measurement/controller.js.map +1 -1
  184. package/dist/collection/lib/measurement/entities.js.map +1 -1
  185. package/dist/collection/lib/measurement/interactions.js.map +1 -1
  186. package/dist/collection/lib/measurement/mapper.js.map +1 -1
  187. package/dist/collection/lib/measurement/model.js.map +1 -1
  188. package/dist/collection/lib/measurement/overlays.js.map +1 -1
  189. package/dist/collection/lib/measurement/results.js.map +1 -1
  190. package/dist/collection/lib/meters.js.map +1 -1
  191. package/dist/collection/lib/model-views/controller.js.map +1 -1
  192. package/dist/collection/lib/model-views/mapper.js.map +1 -1
  193. package/dist/collection/lib/pins/controller.js.map +1 -1
  194. package/dist/collection/lib/pins/interactions.js.map +1 -1
  195. package/dist/collection/lib/pmi/controller.js.map +1 -1
  196. package/dist/collection/lib/pmi/mapper.js.map +1 -1
  197. package/dist/collection/lib/rendering/canvas.js.map +1 -1
  198. package/dist/collection/lib/rendering/imageLoaders.js.map +1 -1
  199. package/dist/collection/lib/rendering/matrices.js.map +1 -1
  200. package/dist/collection/lib/rendering/timing.js.map +1 -1
  201. package/dist/collection/lib/rendering/utils.js.map +1 -1
  202. package/dist/collection/lib/rendering/vectors.js.map +1 -1
  203. package/dist/collection/lib/scene-items/controller.js.map +1 -1
  204. package/dist/collection/lib/scene-items/mapper.js.map +1 -1
  205. package/dist/collection/lib/scenes/camera.js.map +1 -1
  206. package/dist/collection/lib/scenes/cameraRenderResult.js.map +1 -1
  207. package/dist/collection/lib/scenes/colorMaterial.js.map +1 -1
  208. package/dist/collection/lib/scenes/crossSectioner.js.map +1 -1
  209. package/dist/collection/lib/scenes/mapper.js.map +1 -1
  210. package/dist/collection/lib/scenes/operations.js.map +1 -1
  211. package/dist/collection/lib/scenes/queries.js.map +1 -1
  212. package/dist/collection/lib/scenes/raycaster.js.map +1 -1
  213. package/dist/collection/lib/scenes/scene.js.map +1 -1
  214. package/dist/collection/lib/scenes/sceneOperationExecuteResult.js.map +1 -1
  215. package/dist/collection/lib/scenes/sceneViewStateLoader.js.map +1 -1
  216. package/dist/collection/lib/stencil.js.map +1 -1
  217. package/dist/collection/lib/storage.js.map +1 -1
  218. package/dist/collection/lib/stream/dispatcher.js.map +1 -1
  219. package/dist/collection/lib/stream/stream.js.map +1 -1
  220. package/dist/collection/lib/stream/utils.js.map +1 -1
  221. package/dist/collection/lib/teleportation/interactions.js.map +1 -1
  222. package/dist/collection/lib/templates.js.map +1 -1
  223. package/dist/collection/lib/token.js.map +1 -1
  224. package/dist/collection/lib/transforms/axis-lines.js.map +1 -1
  225. package/dist/collection/lib/transforms/axis-rotation.js.map +1 -1
  226. package/dist/collection/lib/transforms/axis-translation.js.map +1 -1
  227. package/dist/collection/lib/transforms/controller.js.map +1 -1
  228. package/dist/collection/lib/transforms/drawable.js.map +1 -1
  229. package/dist/collection/lib/transforms/hits.js.map +1 -1
  230. package/dist/collection/lib/transforms/line.js.map +1 -1
  231. package/dist/collection/lib/transforms/mesh.js.map +1 -1
  232. package/dist/collection/lib/transforms/shape.js.map +1 -1
  233. package/dist/collection/lib/transforms/transformation-delta.js.map +1 -1
  234. package/dist/collection/lib/transforms/util.js.map +1 -1
  235. package/dist/collection/lib/types/clippingPlanes.js.map +1 -1
  236. package/dist/collection/lib/types/depthBuffer.js.map +1 -1
  237. package/dist/collection/lib/types/featureMap.js.map +1 -1
  238. package/dist/collection/lib/types/flags.js.map +1 -1
  239. package/dist/collection/lib/types/frame.js.map +1 -1
  240. package/dist/collection/lib/types/frameCamera.js.map +1 -1
  241. package/dist/collection/lib/types/loadableResource.js.map +1 -1
  242. package/dist/collection/lib/types/orientation.js.map +1 -1
  243. package/dist/collection/lib/types/sceneViewStateIdentifier.js.map +1 -1
  244. package/dist/collection/lib/types/standardView.js.map +1 -1
  245. package/dist/collection/lib/types/stencilBuffer.js.map +1 -1
  246. package/dist/collection/lib/types/synchronizedClock.js.map +1 -1
  247. package/dist/collection/lib/types/viewport.js.map +1 -1
  248. package/dist/collection/lib/visibilityObserver.js.map +1 -1
  249. package/dist/collection/lib/volume-intersection/controller.js.map +1 -1
  250. package/dist/collection/lib/volume-intersection/interactions.js.map +1 -1
  251. package/dist/collection/lib/volume-intersection/model.js.map +1 -1
  252. package/dist/collection/lib/walk-mode/controller.js.map +1 -1
  253. package/dist/collection/lib/walk-mode/interactions.js.map +1 -1
  254. package/dist/collection/lib/walk-mode/model.js.map +1 -1
  255. package/dist/collection/lib/webgl/regl-component.js.map +1 -1
  256. package/dist/collection/testing/annotations.js.map +1 -1
  257. package/dist/collection/testing/canvases.js.map +1 -1
  258. package/dist/collection/testing/colors.js.map +1 -1
  259. package/dist/collection/testing/eventually.js.map +1 -1
  260. package/dist/collection/testing/fixtures.js.map +1 -1
  261. package/dist/collection/testing/grpc.js +3 -9
  262. package/dist/collection/testing/grpc.js.map +1 -1
  263. package/dist/collection/testing/modelViews.js.map +1 -1
  264. package/dist/collection/testing/pmi.js.map +1 -1
  265. package/dist/collection/testing/random.js.map +1 -1
  266. package/dist/collection/testing/resizeObserver.js.map +1 -1
  267. package/dist/collection/testing/scene-items-helper.js.map +1 -1
  268. package/dist/collection/testing/sceneTree.js.map +1 -1
  269. package/dist/collection/testing/viewer.js.map +1 -1
  270. package/dist/collection/testing/webgl.js.map +1 -1
  271. package/dist/components/index.js.map +1 -1
  272. package/dist/components/{p-St4ctu2K.js → p-3-bKfpqr.js} +2 -2
  273. package/dist/components/{p-St4ctu2K.js.map → p-3-bKfpqr.js.map} +1 -1
  274. package/dist/components/p-3DqRAYgO.js.map +1 -1
  275. package/dist/components/p-B-ToCp8-.js.map +1 -1
  276. package/dist/components/p-B156bTbY.js +5 -0
  277. package/dist/components/p-B156bTbY.js.map +1 -0
  278. package/dist/components/p-B9R0QWr4.js.map +1 -1
  279. package/dist/components/p-BCOD9yfw.js.map +1 -1
  280. package/dist/components/p-BHAaIoH5.js.map +1 -1
  281. package/dist/components/{p-Doltf1wO.js → p-BOJJZ1cN.js} +2 -2
  282. package/dist/components/p-BOJJZ1cN.js.map +1 -0
  283. package/dist/components/p-BkHp-aAR.js.map +1 -1
  284. package/dist/components/p-Bkm6H5uq.js.map +1 -1
  285. package/dist/components/p-C-VWDW9n.js.map +1 -1
  286. package/dist/components/p-C79PxobX.js.map +1 -1
  287. package/dist/components/p-CAugdB_8.js.map +1 -1
  288. package/dist/components/p-CEzVEgdQ.js.map +1 -1
  289. package/dist/components/p-CGCJ5hbJ.js.map +1 -1
  290. package/dist/components/p-COlcifvm.js.map +1 -1
  291. package/dist/components/p-CXTH3zrN.js.map +1 -1
  292. package/dist/components/p-CZCXdo3t.js.map +1 -1
  293. package/dist/components/p-Cd7kap5W.js.map +1 -1
  294. package/dist/components/p-CiSHWNC4.js.map +1 -1
  295. package/dist/components/p-CjG1fMh1.js.map +1 -1
  296. package/dist/components/p-CkjXRDNL.js.map +1 -1
  297. package/dist/components/p-D0KZu516.js.map +1 -1
  298. package/dist/components/p-D12q-fpW.js.map +1 -1
  299. package/dist/components/p-D33gVA2W.js.map +1 -1
  300. package/dist/components/p-DC86ZXai.js.map +1 -1
  301. package/dist/components/{p-B80hfIq6.js → p-DF4kEsJU.js} +2 -2
  302. package/dist/components/p-DF4kEsJU.js.map +1 -0
  303. package/dist/components/p-DRh4_Z-g.js.map +1 -1
  304. package/dist/components/p-DRnMrHWY.js.map +1 -1
  305. package/dist/components/{p-b0ZzPHz8.js → p-DUC59SSO.js} +2 -2
  306. package/dist/components/p-DUC59SSO.js.map +1 -0
  307. package/dist/components/p-DVW2WZTq.js.map +1 -1
  308. package/dist/components/p-DZI8pnGz.js.map +1 -1
  309. package/dist/components/p-Dbz9yUqC.js.map +1 -1
  310. package/dist/components/p-Yfi0i5Kj.js.map +1 -1
  311. package/dist/components/p-abSJ29r7.js.map +1 -1
  312. package/dist/components/p-ahjMltGJ.js.map +1 -1
  313. package/dist/components/p-bal2RLiw.js.map +1 -1
  314. package/dist/components/{p-BopQW1sA.js → p-oK38ynrd.js} +2 -2
  315. package/dist/components/p-oK38ynrd.js.map +1 -0
  316. package/dist/components/vertex-scene-tree-table-cell.js +1 -1
  317. package/dist/components/vertex-scene-tree-table-cell.js.map +1 -1
  318. package/dist/components/vertex-scene-tree-table-layout.js +1 -1
  319. package/dist/components/vertex-scene-tree.js +1 -1
  320. package/dist/components/vertex-scene-tree.js.map +1 -1
  321. package/dist/components/vertex-viewer-box-query-tool.js +1 -1
  322. package/dist/components/vertex-viewer-box-query-tool.js.map +1 -1
  323. package/dist/components/vertex-viewer-dom-element.js +1 -1
  324. package/dist/components/vertex-viewer-dom-group.js +1 -1
  325. package/dist/components/vertex-viewer-hit-result-indicator.js +1 -1
  326. package/dist/components/vertex-viewer-hit-result-indicator.js.map +1 -1
  327. package/dist/components/vertex-viewer-markup-tool.js.map +1 -1
  328. package/dist/components/vertex-viewer-markup.js +1 -1
  329. package/dist/components/vertex-viewer-markup.js.map +1 -1
  330. package/dist/components/vertex-viewer-measurement-details.js.map +1 -1
  331. package/dist/components/vertex-viewer-measurement-distance.js +1 -1
  332. package/dist/components/vertex-viewer-measurement-distance.js.map +1 -1
  333. package/dist/components/vertex-viewer-measurement-line.js +1 -1
  334. package/dist/components/vertex-viewer-measurement-overlays.js +1 -1
  335. package/dist/components/vertex-viewer-measurement-precise.js +1 -1
  336. package/dist/components/vertex-viewer-measurement-precise.js.map +1 -1
  337. package/dist/components/vertex-viewer-pin-group.js +1 -1
  338. package/dist/components/vertex-viewer-pin-tool.js +1 -1
  339. package/dist/components/vertex-viewer-pin-tool.js.map +1 -1
  340. package/dist/components/vertex-viewer-transform-widget.js +1 -1
  341. package/dist/components/vertex-viewer-transform-widget.js.map +1 -1
  342. package/dist/components/vertex-viewer-view-cube.js +1 -1
  343. package/dist/components/vertex-viewer-view-cube.js.map +1 -1
  344. package/dist/components/vertex-viewer-walk-mode-tool.js.map +1 -1
  345. package/dist/components/vertex-viewer.js +1 -1
  346. package/dist/components/vertex-viewer.js.map +1 -1
  347. package/dist/esm/config-lglER3mU.js.map +1 -1
  348. package/dist/esm/controller-BMWGs-I6.js.map +1 -1
  349. package/dist/esm/controller-Iymb_J2R.js.map +1 -1
  350. package/dist/esm/cursors-BbBDEutb.js.map +1 -1
  351. package/dist/esm/dom-B3m2VjbN.js.map +1 -1
  352. package/dist/esm/dom-DX6pEG54.js.map +1 -1
  353. package/dist/esm/entities-zRken6VS.js.map +1 -1
  354. package/dist/esm/geometry_pb-BiZRfctN.js.map +1 -1
  355. package/dist/esm/grpc-CZAYqbTu.js.map +1 -1
  356. package/dist/esm/index.js.map +1 -1
  357. package/dist/esm/model-BYW5YIye.js.map +1 -1
  358. package/dist/esm/model-CLtwOS0o.js.map +1 -1
  359. package/dist/esm/model-D0EJdHmW.js.map +1 -1
  360. package/dist/esm/model-DHJ5aE4y.js.map +1 -1
  361. package/dist/esm/multiElementInteractionHandler-DwjL-r55.js.map +1 -1
  362. package/dist/esm/overlays-BE1oqniA.js.map +1 -1
  363. package/dist/esm/queries-DEzCmbTD.js.map +1 -1
  364. package/dist/esm/regl-component-DmkowWhg.js.map +1 -1
  365. package/dist/esm/representation_pb-g4f0WC4k.js.map +1 -1
  366. package/dist/esm/results-CFB6nKu8.js.map +1 -1
  367. package/dist/esm/row-CiSHWNC4.js.map +1 -1
  368. package/dist/esm/stencil-BV-7pO4q.js.map +1 -1
  369. package/dist/esm/streamAttributes-Cp8PEH9A.js.map +1 -1
  370. package/dist/esm/templates-DRh4_Z-g.js.map +1 -1
  371. package/dist/esm/util-BCZZYmp4.js.map +1 -1
  372. package/dist/esm/utils-BvZ9-fs0.js.map +1 -1
  373. package/dist/esm/utils-DC86ZXai.js.map +1 -1
  374. package/dist/esm/utils-D_pIldrS.js.map +1 -1
  375. package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js +6 -8
  376. package/dist/esm/vertex-scene-tree-notification-banner_4.entry.js.map +1 -1
  377. package/dist/esm/vertex-scene-tree-table-cell.entry.js +1 -1
  378. package/dist/esm/vertex-scene-tree-table-cell.entry.js.map +1 -1
  379. package/dist/esm/vertex-scene-tree.entry.js +2 -2
  380. package/dist/esm/vertex-scene-tree.entry.js.map +1 -1
  381. package/dist/esm/vertex-viewer-box-query-tool.entry.js +2 -2
  382. package/dist/esm/vertex-viewer-box-query-tool.entry.js.map +1 -1
  383. package/dist/esm/vertex-viewer-dom-element_2.entry.js +1 -1
  384. package/dist/esm/vertex-viewer-dom-element_2.entry.js.map +1 -1
  385. package/dist/esm/vertex-viewer-dom-group.entry.js +1 -1
  386. package/dist/esm/vertex-viewer-dom-group.entry.js.map +1 -1
  387. package/dist/esm/vertex-viewer-hit-result-indicator.entry.js +1 -1
  388. package/dist/esm/vertex-viewer-hit-result-indicator.entry.js.map +1 -1
  389. package/dist/esm/vertex-viewer-icon.entry.js.map +1 -1
  390. package/dist/esm/vertex-viewer-markup-arrow_3.entry.js.map +1 -1
  391. package/dist/esm/vertex-viewer-markup-tool.entry.js.map +1 -1
  392. package/dist/esm/vertex-viewer-markup.entry.js +1 -1
  393. package/dist/esm/vertex-viewer-markup.entry.js.map +1 -1
  394. package/dist/esm/vertex-viewer-measurement-details.entry.js.map +1 -1
  395. package/dist/esm/vertex-viewer-measurement-distance.entry.js.map +1 -1
  396. package/dist/esm/vertex-viewer-measurement-line_2.entry.js +2 -2
  397. package/dist/esm/vertex-viewer-measurement-line_2.entry.js.map +1 -1
  398. package/dist/esm/vertex-viewer-measurement-precise.entry.js.map +1 -1
  399. package/dist/esm/vertex-viewer-pin-group.entry.js +2 -2
  400. package/dist/esm/vertex-viewer-pin-group.entry.js.map +1 -1
  401. package/dist/esm/vertex-viewer-pin-label_2.entry.js.map +1 -1
  402. package/dist/esm/vertex-viewer-pin-tool.entry.js +1 -1
  403. package/dist/esm/vertex-viewer-pin-tool.entry.js.map +1 -1
  404. package/dist/esm/vertex-viewer-teleport-tool.entry.js.map +1 -1
  405. package/dist/esm/vertex-viewer-transform-widget.entry.js +4 -5
  406. package/dist/esm/vertex-viewer-transform-widget.entry.js.map +1 -1
  407. package/dist/esm/vertex-viewer-view-cube.entry.js +1 -1
  408. package/dist/esm/vertex-viewer-view-cube.entry.js.map +1 -1
  409. package/dist/esm/vertex-viewer-walk-mode-tool.entry.js.map +1 -1
  410. package/dist/esm/vertex-viewer.entry.js +9 -5
  411. package/dist/esm/vertex-viewer.entry.js.map +1 -1
  412. package/dist/esm/viewport-C8WQZxvx.js.map +1 -1
  413. package/dist/types/regl-shape.d.ts +1 -1
  414. package/dist/viewer/index.esm.js.map +1 -1
  415. package/dist/viewer/{p-eac63070.entry.js → p-051b5154.entry.js} +2 -2
  416. package/dist/viewer/p-051b5154.entry.js.map +1 -0
  417. package/dist/viewer/{p-3d3a7eeb.entry.js → p-0984c51f.entry.js} +2 -2
  418. package/dist/viewer/{p-3d3a7eeb.entry.js.map → p-0984c51f.entry.js.map} +1 -1
  419. package/dist/viewer/{p-864f40c7.entry.js → p-11cf755a.entry.js} +2 -2
  420. package/dist/viewer/p-11cf755a.entry.js.map +1 -0
  421. package/dist/viewer/{p-29d14611.entry.js → p-16775f7d.entry.js} +2 -2
  422. package/dist/viewer/p-16775f7d.entry.js.map +1 -0
  423. package/dist/viewer/{p-5a85cae5.entry.js → p-1eb636f8.entry.js} +2 -2
  424. package/dist/viewer/p-1eb636f8.entry.js.map +1 -0
  425. package/dist/viewer/{p-e993f300.entry.js → p-228d1d43.entry.js} +2 -2
  426. package/dist/viewer/p-228d1d43.entry.js.map +1 -0
  427. package/dist/viewer/p-33f44cc1.entry.js.map +1 -1
  428. package/dist/viewer/{p-3300d3dc.entry.js → p-35601c85.entry.js} +2 -2
  429. package/dist/viewer/p-35601c85.entry.js.map +1 -0
  430. package/dist/viewer/p-47766566.entry.js.map +1 -1
  431. package/dist/viewer/p-6e3a6bbd.entry.js.map +1 -1
  432. package/dist/viewer/p-7f388b45.entry.js.map +1 -1
  433. package/dist/viewer/p-89544066.entry.js.map +1 -1
  434. package/dist/viewer/{p-07b99ac9.entry.js → p-8c369777.entry.js} +2 -2
  435. package/dist/viewer/p-8c369777.entry.js.map +1 -0
  436. package/dist/viewer/{p-e59983dc.entry.js → p-9835c5e2.entry.js} +2 -2
  437. package/dist/viewer/p-9835c5e2.entry.js.map +1 -0
  438. package/dist/viewer/{p-aa95e21a.entry.js → p-9d8ff406.entry.js} +2 -2
  439. package/dist/viewer/p-9d8ff406.entry.js.map +1 -0
  440. package/dist/viewer/p-BDvACHun.js.map +1 -1
  441. package/dist/viewer/p-BIkuvTVH.js.map +1 -1
  442. package/dist/viewer/p-BRPkbTVP.js.map +1 -1
  443. package/dist/viewer/p-BsBIynwj.js.map +1 -1
  444. package/dist/viewer/p-BxtKMwBH.js.map +1 -1
  445. package/dist/viewer/p-C4y4Noe-.js.map +1 -1
  446. package/dist/viewer/p-C6KrfydC.js.map +1 -1
  447. package/dist/viewer/p-C7dYsPFU.js.map +1 -1
  448. package/dist/viewer/p-C9Cqbq6H.js.map +1 -1
  449. package/dist/viewer/p-CVWO4w6b.js.map +1 -1
  450. package/dist/viewer/p-ChqXy0cG.js.map +1 -1
  451. package/dist/viewer/p-CiSHWNC4.js.map +1 -1
  452. package/dist/viewer/p-CjG1fMh1.js.map +1 -1
  453. package/dist/viewer/p-Cs5KOvOQ.js.map +1 -1
  454. package/dist/viewer/p-CyGlYje2.js.map +1 -1
  455. package/dist/viewer/p-D6eJC1q4.js.map +1 -1
  456. package/dist/viewer/p-DC86ZXai.js.map +1 -1
  457. package/dist/viewer/p-DRh4_Z-g.js.map +1 -1
  458. package/dist/viewer/p-DUX5FvBC.js.map +1 -1
  459. package/dist/viewer/p-DX6pEG54.js.map +1 -1
  460. package/dist/viewer/p-D_ixWHO7.js.map +1 -1
  461. package/dist/viewer/p-DacE-wPp.js.map +1 -1
  462. package/dist/viewer/p-Dp56p_jX.js.map +1 -1
  463. package/dist/viewer/p-EsKoKfmx.js.map +1 -1
  464. package/dist/viewer/p-F8e15or2.js.map +1 -1
  465. package/dist/viewer/p-Jfxh0jq9.js.map +1 -1
  466. package/dist/viewer/p-WPRMWirY.js.map +1 -1
  467. package/dist/viewer/p-_93RRNxT.js.map +1 -1
  468. package/dist/viewer/p-a8a81cba.entry.js +5 -0
  469. package/dist/viewer/p-a8a81cba.entry.js.map +1 -0
  470. package/dist/viewer/p-a9282481.entry.js.map +1 -1
  471. package/dist/viewer/{p-63f4f702.entry.js → p-c7e62d66.entry.js} +2 -2
  472. package/dist/viewer/p-c7e62d66.entry.js.map +1 -0
  473. package/dist/viewer/p-d37e647b.entry.js.map +1 -1
  474. package/dist/viewer/{p-302f2078.entry.js → p-d9fe788f.entry.js} +2 -2
  475. package/dist/viewer/p-d9fe788f.entry.js.map +1 -0
  476. package/dist/viewer/p-e9b83dae.entry.js.map +1 -1
  477. package/dist/viewer/{p-70f3629d.entry.js → p-f271dc4a.entry.js} +2 -2
  478. package/dist/viewer/p-f271dc4a.entry.js.map +1 -0
  479. package/dist/viewer/p-f65c0769.entry.js.map +1 -1
  480. package/dist/viewer/viewer.esm.js +1 -1
  481. package/package.json +7 -7
  482. package/dist/components/p-B80hfIq6.js.map +0 -1
  483. package/dist/components/p-BopQW1sA.js.map +0 -1
  484. package/dist/components/p-DNtS2F8J.js +0 -5
  485. package/dist/components/p-DNtS2F8J.js.map +0 -1
  486. package/dist/components/p-Doltf1wO.js.map +0 -1
  487. package/dist/components/p-b0ZzPHz8.js.map +0 -1
  488. package/dist/viewer/p-07b99ac9.entry.js.map +0 -1
  489. package/dist/viewer/p-29d14611.entry.js.map +0 -1
  490. package/dist/viewer/p-302f2078.entry.js.map +0 -1
  491. package/dist/viewer/p-3300d3dc.entry.js.map +0 -1
  492. package/dist/viewer/p-5a85cae5.entry.js.map +0 -1
  493. package/dist/viewer/p-60c915e3.entry.js +0 -5
  494. package/dist/viewer/p-60c915e3.entry.js.map +0 -1
  495. package/dist/viewer/p-63f4f702.entry.js.map +0 -1
  496. package/dist/viewer/p-70f3629d.entry.js.map +0 -1
  497. package/dist/viewer/p-864f40c7.entry.js.map +0 -1
  498. package/dist/viewer/p-aa95e21a.entry.js.map +0 -1
  499. package/dist/viewer/p-e59983dc.entry.js.map +0 -1
  500. package/dist/viewer/p-e993f300.entry.js.map +0 -1
  501. package/dist/viewer/p-eac63070.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["create","x","y","distance","a","b","delta","subtract","Math","sqrt","add","scaleProportional","pt","scale","magnitude","normalizeVector","magnitudeOfPoint","normalDirectionVector","ptA","ptB","orthogonalVector","unitVectorBetweenPoints","abs","vectorXValue","pow","vectorYValue","fromJson","json","obj","JSON","parse","Array","isArray","createArrowheadPoints","start","end","arrowSideLength","arrowHeadTheta","arrowOrthogonalVector","Point.orthogonalVector","normalizedDirection","Point.normalDirectionVector","arrowLeft","Point.subtract","Point.add","Point.scaleProportional","cos","sin","arrowRight","leftPoint","rightPoint","createLineAnchorStylePoints","triangleArrowAngle","lineArrowAngle","Point.distance","arrowHeadHeight","max","min","hashHeight","radius","triangleArrowRelativeHeight","triangleArrowBasePosition","triangleArrowTheta","Angle","toRadians","triangleArrowSideLength","triangleArrow","lineArrowTheta","lineArrowSideLength","lineArrow","hashLineTheta","hashLine","tip","base","arrowTriangle","arrowLine","hash","arrowheadPointsToPolygonPoints","points","scaledRight","scalePointProportional","scaledLeft","scaledBase","map","join","arrowheadPointsToPathPoints","arrowheadPointsToHashPoints","x1","y1","x2","y2","arrowheadPointsToCirclePoints","cx","cy","r","isVertexViewerArrowMarkup","el","HTMLElement","nodeName","parsePoint","value","Point.fromJson","basePoint","scaledPoint","isVertexViewerCircleMarkup","parseBounds","Rectangle","parsePoints","values","Point","stringify","isVertexViewerFreeformMarkup","getBoundingBox2dAnchorPosition","rect","position","width","height","center","translatePointToScreen","canvasDimensions","contentDimensions","centeringBehavior","canvasToContentScaleFactor","effectiveScalar","contentScaleFactor","getScaleFactor","contentRelativePoint","Dimensions","scaledContentWidth","scaledContentHeight","centerOffsetX","centerOffsetY","translateDimensionsToScreen","dimensions","contentRelativeDimensions","translateRectToScreen","fromPointAndDimensions","translatePointToRelative","offset","pointWithoutOffset","getWindowDevicePixelRatio","centeredContentPoint","contentCenterRelativePoint","translatePointsToBounds","original","bounds","createRectangle","initialPoint","currentPoint","maintainAspectRatio","fromPoints","fitBoundsSize","isPortrait","currentIsLeftOfInitial","currentIsAboveInitial","fitBoundsX","fitBoundsY","transformRectangle","current","anchor","left","top","w","h","right","bottom","topLeft","bottomLeft","topRight","bottomRight","isVertexViewerMarkupElement","isValidPointData","every","isNaN","isValidStartEvent","event","target","mode","RelativeAnchor","id","transform","rotation","name","point","onPointerDown","children","class","style","onTouchStart","preventDefault","SvgShadow","effectiveScale","xOffset","yOffset","filterUnits","in","stdDeviation","dx","dy","result","in2","operator","MarkupInteractionHandler","constructor","scalingOptions","this","handlePointerDown","handleInteractionAttempt","handlePointerMove","handleInteractionMove","handlePointerUp","window","removeEventListener","handleInteractionEnd","resizeObserver","ResizeObserver","entry","elementBounds","computeBoundingRect","initialize","element","observe","addEventListener","dispose","disconnect","_a","undefined","updateScalingOptions","getScalingOptions","acceptInteraction"],"sources":["../geometry/src/point.ts","src/components/viewer-markup-arrow/utils.ts","src/components/viewer-markup-circle/utils.ts","src/components/viewer-markup-freeform/utils.ts","src/components/viewer-markup/markup-utils.ts","src/components/viewer-markup/viewer-markup-components.tsx","src/lib/markup/interactions.ts"],"sourcesContent":["import * as Angle from './angle';\nimport { lerp as lerpNumber } from './math';\n\n/**\n * A `Point` represents a cartesian coordinate with a horizontal and vertical\n * position or length.\n */\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * Returns a new `Point` with the given horizontal and vertical position.\n */\nexport function create(x = 0, y = 0): Point {\n return { x, y };\n}\n\n/**\n * Converts a polar coordinate (length and angle) into a Cartesian coordinate.\n */\nexport function polar(length: number, radians: Angle.Angle): Point {\n const x = Math.cos(radians) * length;\n const y = Math.sin(radians) * length;\n return create(x, y);\n}\n\n/**\n * Returns the distance between two points.\n */\nexport function distance(a: Point, b: Point): number {\n const delta = subtract(a, b);\n return Math.sqrt(delta.x * delta.x + delta.y * delta.y);\n}\n\n/**\n * Returns a new `Point` where `b` is subtracted from `a`.\n */\nexport function subtract(a: Point, b: Point): Point {\n return { x: a.x - b.x, y: a.y - b.y };\n}\n\n/**\n * Returns a new `Point` where `b` is added to `a`.\n */\nexport function add(a: Point, b: Point): Point {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\n/**\n * Returns `true` if the `x` and `y` positions of `a` and `b` are equal.\n */\nexport function isEqual(a: Point, b: Point): boolean {\n return a.x === b.x && a.y === b.y;\n}\n\n/**\n * Performs a linear interpolation between `a` and `b` and returns the result.\n * The value of `t` is clamped between `[0, 1]`.\n *\n * @param a The start value.\n * @param b The end value.\n * @param t A value between 0 and 1.\n * @returns A point between `a` and `b`.\n */\nexport function lerp(a: Point, b: Point, t: number): Point {\n return {\n x: lerpNumber(a.x, b.x, t),\n y: lerpNumber(a.y, b.y, t),\n };\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are inverted.\n */\nexport function negate(pt: Point): Point {\n return create(-pt.x, -pt.y);\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are multiplied by the given scale\n * factors.\n */\nexport function scale(pt: Point, scaleX: number, scaleY: number): Point {\n return {\n x: pt.x * scaleX,\n y: pt.y * scaleY,\n };\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are multiplied by the given scale\n * factor.\n */\nexport function scaleProportional(pt: Point, scale: number): Point {\n return {\n x: pt.x * scale,\n y: pt.y * scale,\n };\n}\n\n/**\n * Returns the magnitude of a point.\n */\nexport function magnitude(pt: Point): number {\n return Math.sqrt(pt.x * pt.x + pt.y * pt.y);\n}\n\n/**\n * Transforms a vector into the corresponding normal (unit) vector.\n */\nexport function normalizeVector(pt: Point): Point {\n const magnitudeOfPoint = magnitude(pt);\n if (magnitudeOfPoint === 0) {\n return create(0, 0);\n } else {\n return scaleProportional(pt, 1 / magnitudeOfPoint);\n }\n}\n\n/**\n * Returns a new normal (unit) vector pointing between the two given points.\n */\nexport function normalDirectionVector(ptA: Point, ptB: Point): Point {\n return normalizeVector(subtract(ptB, ptA));\n}\n\n/**\n * Returns a vector orthogonal to the vector between the two given points.\n */\nexport function orthogonalVector(ptA: Point, ptB: Point): Point {\n const unitVectorBetweenPoints = normalDirectionVector(ptA, ptB);\n\n // Handle vectors that are parallel to the x or y axis\n if (unitVectorBetweenPoints.x === 0 || unitVectorBetweenPoints.y === 0) {\n return create(-1 * unitVectorBetweenPoints.y, unitVectorBetweenPoints.x);\n }\n\n if (\n Math.abs(unitVectorBetweenPoints.x) > Math.abs(unitVectorBetweenPoints.y)\n ) {\n const vectorXValue = 1 - Math.pow(unitVectorBetweenPoints.x, 2);\n const vectorYValue =\n -1 * unitVectorBetweenPoints.x * unitVectorBetweenPoints.y;\n return normalizeVector(create(vectorXValue, vectorYValue));\n } else {\n const vectorXValue =\n -1 * unitVectorBetweenPoints.x * unitVectorBetweenPoints.y;\n const vectorYValue = 1 - Math.pow(unitVectorBetweenPoints.y, 2);\n return normalizeVector(create(vectorXValue, vectorYValue));\n }\n}\n\n/**\n * Parses a JSON string representation of a Point and returns an object.\n *\n * @param json A JSON string, either in the form `[x,y]` or `{\"x\": 0, \"y\": 0}`\n * @returns A parsed Point.\n */\nexport function fromJson(json: string): Point {\n const obj = JSON.parse(json);\n if (Array.isArray(obj)) {\n const [x, y] = obj;\n return create(x, y);\n } else {\n const { x, y } = obj;\n return create(x, y);\n }\n}\n","import { Angle } from '@vertexvis/geometry';\n\nimport * as Point from '../../../../geometry/src/point';\n\nexport type LineAnchorStyle =\n | 'arrow-triangle'\n | 'arrow-line'\n | 'dot'\n | 'hash'\n | 'none';\n\nexport interface LineAnchorStylePoints {\n tip: Point.Point;\n base: Point.Point;\n arrowTriangle: ArrowheadPoints;\n arrowLine: ArrowheadPoints;\n hash: ArrowheadPoints;\n radius: number;\n}\n\nexport interface ArrowheadPoints {\n leftPoint: Point.Point;\n rightPoint: Point.Point;\n}\n\nexport interface LinePoints {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n}\n\nexport interface CirclePoints {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport function createArrowheadPoints(\n start: Point.Point,\n end: Point.Point,\n arrowSideLength: number,\n arrowHeadTheta: number\n): ArrowheadPoints {\n const arrowOrthogonalVector = Point.orthogonalVector(start, end);\n const normalizedDirection = Point.normalDirectionVector(start, end);\n\n const arrowLeft = Point.subtract(\n end,\n Point.add(\n Point.scaleProportional(\n normalizedDirection,\n arrowSideLength * Math.cos(arrowHeadTheta)\n ),\n Point.scaleProportional(\n arrowOrthogonalVector,\n arrowSideLength * Math.sin(arrowHeadTheta)\n )\n )\n );\n const arrowRight = Point.subtract(\n end,\n Point.subtract(\n Point.scaleProportional(\n normalizedDirection,\n arrowSideLength * Math.cos(arrowHeadTheta)\n ),\n Point.scaleProportional(\n arrowOrthogonalVector,\n arrowSideLength * Math.sin(arrowHeadTheta)\n )\n )\n );\n\n return {\n leftPoint: arrowLeft,\n rightPoint: arrowRight,\n };\n}\n\nexport function createLineAnchorStylePoints(\n start: Point.Point,\n end: Point.Point,\n triangleArrowAngle = 65,\n lineArrowAngle = 85\n): LineAnchorStylePoints {\n // Adjust the size of the end style to the distance between the start and end points\n const distance = Point.distance(start, end);\n const arrowHeadHeight = Math.max(4, Math.min(16, distance * 0.25));\n const hashHeight = Math.max(4, Math.min(12, distance * 0.16));\n const radius = Math.min(5, distance * 0.1);\n\n // Triangle arrow position\n const triangleArrowRelativeHeight = arrowHeadHeight / distance;\n const triangleArrowBasePosition = Point.add(\n Point.scaleProportional(end, 1 - triangleArrowRelativeHeight),\n Point.scaleProportional(start, triangleArrowRelativeHeight)\n );\n const triangleArrowTheta = Angle.toRadians(triangleArrowAngle / 2);\n const triangleArrowSideLength =\n arrowHeadHeight / Math.cos(triangleArrowTheta);\n const triangleArrow = createArrowheadPoints(\n start,\n end,\n triangleArrowSideLength,\n triangleArrowTheta\n );\n\n // Line arrow position\n const lineArrowTheta = Angle.toRadians(lineArrowAngle / 2);\n const lineArrowSideLength = arrowHeadHeight / Math.cos(lineArrowTheta);\n const lineArrow = createArrowheadPoints(\n start,\n end,\n lineArrowSideLength,\n lineArrowTheta\n );\n\n // Hash position\n // Setting the arrowHeadAngle to 90 degrees results in a\n // straight hash mark perpendicular to the direction of the line\n const hashLineTheta = Angle.toRadians(90);\n const hashLine = createArrowheadPoints(start, end, hashHeight, hashLineTheta);\n\n return {\n tip: end,\n base: triangleArrowBasePosition,\n arrowTriangle: triangleArrow,\n arrowLine: lineArrow,\n hash: hashLine,\n radius: radius,\n };\n}\n\nexport function arrowheadPointsToPolygonPoints(\n points: LineAnchorStylePoints,\n scale = 1\n): string {\n const scaledRight = scalePointProportional(\n points.tip,\n points.arrowTriangle.rightPoint,\n scale\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.arrowTriangle.leftPoint,\n scale\n );\n const scaledBase = scalePointProportional(points.tip, points.base, scale);\n\n return [points.tip, scaledRight, scaledBase, scaledLeft]\n .map((pt) => `${pt.x},${pt.y}`)\n .join(' ');\n}\n\nexport function arrowheadPointsToPathPoints(\n points: LineAnchorStylePoints,\n scale = 1\n): string {\n const scaledRight = scalePointProportional(\n points.tip,\n points.arrowLine.rightPoint,\n scale\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.arrowLine.leftPoint,\n scale\n );\n\n return `M${scaledRight.x} ${scaledRight.y} L${points.tip.x} ${points.tip.y} L${scaledLeft.x} ${scaledLeft.y} L${points.tip.x} ${points.tip.y} Z`;\n}\n\nexport function arrowheadPointsToHashPoints(\n points: LineAnchorStylePoints,\n scale = 1\n): LinePoints {\n const scaledRight = scalePointProportional(\n points.tip,\n points.hash.rightPoint,\n scale\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.hash.leftPoint,\n scale\n );\n\n return {\n x1: scaledRight.x,\n y1: scaledRight.y,\n x2: scaledLeft.x,\n y2: scaledLeft.y,\n };\n}\n\nexport function arrowheadPointsToCirclePoints(\n points: LineAnchorStylePoints,\n scale = 1\n): CirclePoints {\n return {\n cx: points.tip.x,\n cy: points.tip.y,\n r: points.radius * scale,\n };\n}\n\nexport function isVertexViewerArrowMarkup(\n el: unknown\n): el is HTMLVertexViewerMarkupArrowElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-ARROW'\n );\n}\n\nexport function parsePoint(\n value: string | Point.Point | undefined\n): Point.Point | undefined {\n return typeof value === 'string' ? Point.fromJson(value) : value;\n}\n\nexport function scalePointProportional(\n basePoint: Point.Point,\n scaledPoint: Point.Point,\n scale: number\n): Point.Point {\n return Point.add(\n basePoint,\n Point.scaleProportional(Point.subtract(scaledPoint, basePoint), scale)\n );\n}\n","import { Rectangle } from '@vertexvis/geometry';\n\nexport function isVertexViewerCircleMarkup(\n el: unknown\n): el is HTMLVertexViewerMarkupCircleElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-CIRCLE'\n );\n}\n\nexport function parseBounds(\n value: string | Rectangle.Rectangle | undefined\n): Rectangle.Rectangle | undefined {\n return typeof value === 'string' ? Rectangle.fromJson(value) : value;\n}\n","import { Point } from '@vertexvis/geometry';\n\nexport function parsePoints(\n value: string | Point.Point[] | undefined\n): Point.Point[] | undefined {\n return typeof value === 'string'\n ? JSON.parse(value).map((values: number[]) =>\n Point.fromJson(JSON.stringify(values))\n )\n : value;\n}\n\nexport function isVertexViewerFreeformMarkup(\n el: unknown\n): el is HTMLVertexViewerMarkupFreeformElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-FREEFORM'\n );\n}\n","import { Dimensions, Point, Rectangle } from '@vertexvis/geometry';\n\nimport { getWindowDevicePixelRatio } from '../../lib/dom';\nimport { MarkupCenteringBehavior } from '../../lib/types';\nimport { isVertexViewerArrowMarkup } from '../viewer-markup-arrow/utils';\nimport { isVertexViewerCircleMarkup } from '../viewer-markup-circle/utils';\nimport { isVertexViewerFreeformMarkup } from '../viewer-markup-freeform/utils';\n\nexport type BoundingBox2dAnchorPosition =\n | 'left'\n | 'right'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n | 'center';\n\nexport function getBoundingBox2dAnchorPosition(\n rect: Rectangle.Rectangle,\n position: BoundingBox2dAnchorPosition\n): Point.Point {\n switch (position) {\n case 'top-left':\n return Point.create(rect.x, rect.y);\n case 'top':\n return Point.create(rect.x + rect.width / 2, rect.y);\n case 'top-right':\n return Point.create(rect.x + rect.width, rect.y);\n case 'right':\n return Point.create(rect.x + rect.width, rect.y + rect.height / 2);\n case 'bottom-right':\n return Point.create(rect.x + rect.width, rect.y + rect.height);\n case 'bottom':\n return Point.create(rect.x + rect.width / 2, rect.y + rect.height);\n case 'bottom-left':\n return Point.create(rect.x, rect.y + rect.height);\n case 'left':\n return Point.create(rect.x, rect.y + rect.height / 2);\n case 'center':\n return Rectangle.center(rect);\n }\n}\n\nexport function translatePointToScreen(\n pt: Point.Point,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions: Dimensions.Dimensions = canvasDimensions,\n centeringBehavior: MarkupCenteringBehavior = 'none',\n scale = 1\n): Point.Point {\n const canvasToContentScaleFactor = Math.min(\n canvasDimensions.width / contentDimensions.width,\n canvasDimensions.height / contentDimensions.height\n );\n const effectiveScalar = canvasToContentScaleFactor * scale;\n const contentScaleFactor = getScaleFactor(contentDimensions);\n const contentRelativePoint = Point.add(\n Point.scale(pt, contentScaleFactor, contentScaleFactor),\n Dimensions.center(contentDimensions)\n );\n\n // Include an offset for width and height to account for cases where the\n // content dimensions are smaller than the canvas dimensions.\n const scaledContentWidth = contentDimensions.width * effectiveScalar;\n const scaledContentHeight = contentDimensions.height * effectiveScalar;\n const centerOffsetX =\n centeringBehavior === 'both' || centeringBehavior === 'x-only'\n ? Math.max(0, (canvasDimensions.width - scaledContentWidth) / 2)\n : 0;\n const centerOffsetY =\n centeringBehavior === 'both' || centeringBehavior === 'y-only'\n ? Math.max(0, (canvasDimensions.height - scaledContentHeight) / 2)\n : 0;\n\n return Point.create(\n contentRelativePoint.x * effectiveScalar + centerOffsetX,\n contentRelativePoint.y * effectiveScalar + centerOffsetY\n );\n}\n\nexport function translatePointToBounds(\n pt: Point.Point,\n rect: Rectangle.Rectangle,\n canvasDimensions: Dimensions.Dimensions\n): Point.Point {\n const rectToScreen = translateRectToScreen(rect, canvasDimensions);\n return Point.add(pt, rectToScreen);\n}\n\nexport function translateDimensionsToScreen(\n dimensions: Dimensions.Dimensions,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions: Dimensions.Dimensions = canvasDimensions,\n scale = 1\n): Dimensions.Dimensions {\n const canvasToContentScaleFactor = Math.min(\n canvasDimensions.width / contentDimensions.width,\n canvasDimensions.height / contentDimensions.height\n );\n const effectiveScalar = canvasToContentScaleFactor * scale;\n const contentScaleFactor = getScaleFactor(contentDimensions);\n const contentRelativeDimensions = Dimensions.scale(\n contentScaleFactor,\n contentScaleFactor,\n dimensions\n );\n\n return Dimensions.scale(\n effectiveScalar,\n effectiveScalar,\n contentRelativeDimensions\n );\n}\n\n/**\n * Translates a rectangle in relative units, to a rectangle in screen units.\n *\n * Shape coordinates are persisted in relative units, so they can be presented\n * at any size.\n */\nexport function translateRectToScreen(\n rect: Rectangle.Rectangle,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions?: Dimensions.Dimensions,\n centeringBehavior: MarkupCenteringBehavior = 'none',\n scale = 1\n): Rectangle.Rectangle {\n const position = translatePointToScreen(\n rect,\n canvasDimensions,\n contentDimensions,\n centeringBehavior,\n scale\n );\n const dimensions = translateDimensionsToScreen(\n rect,\n canvasDimensions,\n contentDimensions,\n scale\n );\n return Rectangle.fromPointAndDimensions(position, dimensions);\n}\n\n/**\n * Translates a point in screen units, to a point in relative units.\n */\nexport function translatePointToRelative(\n pt: Point.Point,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions: Dimensions.Dimensions = canvasDimensions,\n centeringBehavior: MarkupCenteringBehavior = 'none',\n scale = 1,\n offset: Point.Point = Point.create(0, 0)\n): Point.Point {\n const canvasToContentScaleFactor = Math.min(\n canvasDimensions.width / contentDimensions.width,\n canvasDimensions.height / contentDimensions.height\n );\n const effectiveScalar = canvasToContentScaleFactor * scale;\n\n // Include an offset for width and height to account for cases where the\n // content dimensions are smaller than the canvas dimensions.\n const scaledContentWidth = contentDimensions.width * effectiveScalar;\n const scaledContentHeight = contentDimensions.height * effectiveScalar;\n const centerOffsetX =\n centeringBehavior === 'both' || centeringBehavior === 'x-only'\n ? Math.max(0, (canvasDimensions.width - scaledContentWidth) / 2)\n : 0;\n const centerOffsetY =\n centeringBehavior === 'both' || centeringBehavior === 'y-only'\n ? Math.max(0, (canvasDimensions.height - scaledContentHeight) / 2)\n : 0;\n\n const pointWithoutOffset = Point.subtract(\n pt,\n Point.scale(\n offset,\n 1 / getWindowDevicePixelRatio(),\n 1 / getWindowDevicePixelRatio()\n )\n );\n const centeredContentPoint = Point.create(\n (pointWithoutOffset.x - centerOffsetX) / effectiveScalar,\n (pointWithoutOffset.y - centerOffsetY) / effectiveScalar\n );\n const contentScaleFactor = getScaleFactor(contentDimensions);\n const contentCenterRelativePoint = Point.subtract(\n centeredContentPoint,\n Dimensions.center(contentDimensions)\n );\n\n return Point.scale(\n contentCenterRelativePoint,\n 1 / contentScaleFactor,\n 1 / contentScaleFactor\n );\n}\n\n/**\n * Translates a set of points in relative `original` units to\n * points in relative `bounds` units.\n */\nexport function translatePointsToBounds(\n points: Point.Point[],\n original: Rectangle.Rectangle,\n bounds: Rectangle.Rectangle\n): Point.Point[] {\n return points.map((pt) =>\n Point.add(\n Point.scale(\n Point.subtract(pt, original),\n bounds.width / (original.width || 1),\n bounds.height / (original.height || 1)\n ),\n bounds\n )\n );\n}\n\nexport function createRectangle(\n initialPoint: Point.Point,\n currentPoint: Point.Point,\n maintainAspectRatio: boolean\n): Rectangle.Rectangle {\n const bounds = Rectangle.fromPoints(initialPoint, currentPoint);\n if (maintainAspectRatio) {\n const fitBoundsSize = Math.max(bounds.width, bounds.height);\n const isPortrait = bounds.height > bounds.width;\n const currentIsLeftOfInitial = currentPoint.x <= initialPoint.x;\n const currentIsAboveInitial = currentPoint.y <= initialPoint.y;\n const fitBoundsX = currentIsLeftOfInitial\n ? isPortrait\n ? initialPoint.x - fitBoundsSize\n : currentPoint.x\n : initialPoint.x;\n const fitBoundsY = currentIsAboveInitial\n ? isPortrait\n ? currentPoint.y\n : initialPoint.y - fitBoundsSize\n : initialPoint.y;\n return Rectangle.create(\n fitBoundsX,\n fitBoundsY,\n fitBoundsSize,\n fitBoundsSize\n );\n } else {\n return bounds;\n }\n}\n\nexport function transformRectangle(\n bounds: Rectangle.Rectangle,\n start: Point.Point,\n current: Point.Point,\n anchor: BoundingBox2dAnchorPosition,\n maintainAspectRatio?: boolean\n): Rectangle.Rectangle {\n const delta = Point.subtract(current, start);\n const { x: left, y: top, width: w, height: h } = bounds;\n const right = left + w;\n const bottom = top + h;\n const topLeft = Point.create(left, top);\n const bottomLeft = Point.create(left, bottom);\n const topRight = Point.create(right, top);\n const bottomRight = Point.create(right, bottom);\n switch (anchor) {\n case 'top-left':\n return createRectangle(bottomRight, current, !!maintainAspectRatio);\n case 'top':\n return createRectangle(\n bottomRight,\n Point.create(left, current.y),\n !!maintainAspectRatio\n );\n case 'top-right':\n return createRectangle(bottomLeft, current, !!maintainAspectRatio);\n case 'right':\n return createRectangle(\n bottomLeft,\n Point.create(current.x, top),\n !!maintainAspectRatio\n );\n case 'bottom-right':\n return createRectangle(topLeft, current, !!maintainAspectRatio);\n case 'bottom':\n return createRectangle(\n topLeft,\n Point.create(right, current.y),\n !!maintainAspectRatio\n );\n case 'bottom-left':\n return createRectangle(topRight, current, !!maintainAspectRatio);\n case 'left':\n return createRectangle(\n bottomRight,\n Point.create(current.x, top),\n !!maintainAspectRatio\n );\n case 'center':\n return Rectangle.create(\n bounds.x + delta.x,\n bounds.y + delta.y,\n bounds.width,\n bounds.height\n );\n }\n}\n\nexport function isVertexViewerMarkupElement(\n el: HTMLElement\n): el is\n | HTMLVertexViewerMarkupArrowElement\n | HTMLVertexViewerMarkupCircleElement\n | HTMLVertexViewerMarkupFreeformElement {\n return (\n isVertexViewerArrowMarkup(el) ||\n isVertexViewerCircleMarkup(el) ||\n isVertexViewerFreeformMarkup(el)\n );\n}\n\nexport function isValidPointData(...points: Point.Point[]): boolean {\n return points.every((pt) => !isNaN(pt.x) && !isNaN(pt.y));\n}\n\nexport function isValidStartEvent(event: PointerEvent): boolean {\n const el = event.target as HTMLElement;\n\n return isVertexViewerMarkupElement(el) && el.mode !== 'edit';\n}\n\nfunction getScaleFactor(dimensions: Dimensions.Dimensions): number {\n // We intentionally use the content's height when scaling to maintain a consistent coordinate\n // space for markup. This is to ensure the markup will be displayed in the same position\n // on the canvas regardless of the aspect ratio at the time the markup was created.\n // See https://github.com/Vertexvis/vertex-web-sdk/pull/429 for more details.\n return dimensions.height;\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { FunctionalComponent, h } from '@stencil/core';\nimport { Point } from '@vertexvis/geometry';\n\nexport interface RelativeAnchorProps {\n id?: string;\n transform?: string;\n rotation?: number;\n name: string;\n point: Point.Point;\n onPointerDown?: (event: PointerEvent) => void;\n}\n\nexport const RelativeAnchor: FunctionalComponent<RelativeAnchorProps> = (\n { id, transform, rotation, name, point, onPointerDown },\n children\n) => {\n return (\n <div\n id={id}\n class=\"bounds-anchor-position\"\n style={{\n top: `${point.y}px`,\n left: `${point.x}px`,\n }}\n onTouchStart={(event) => event.preventDefault()}\n onPointerDown={onPointerDown}\n >\n <div style={{ transform }}>\n <div\n class=\"bounds-anchor\"\n style={{\n transform: `rotateZ(${rotation ?? 0}deg)`,\n }}\n >\n <slot name={name}>{children}</slot>\n </div>\n </div>\n </div>\n );\n};\n\nexport interface SvgShadowProps {\n id: string;\n scale?: number;\n}\n\nexport const SvgShadow: FunctionalComponent<SvgShadowProps> = ({\n id,\n scale,\n}) => {\n // Scale default values for a `<filter>` element by the provided scale.\n // This prevents the filter area from being too small when scale is greater than 1,\n // and uses the default values for a scale less than 1 to prevent the same issue.\n // See https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/filter\n // for more details on the default values used here.\n const effectiveScale = scale ?? 1;\n const xOffset = Math.max(10, 10 * effectiveScale);\n const yOffset = Math.max(10, 10 * effectiveScale);\n const width = Math.max(120, 110 * effectiveScale + xOffset);\n const height = Math.max(120, 110 * effectiveScale + yOffset);\n\n return (\n <filter\n id={id}\n filterUnits=\"userSpaceOnUse\"\n x={`${-xOffset}%`}\n y={`${-yOffset}%`}\n width={`${width}%`}\n height={`${height}%`}\n >\n <feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"2\" />\n <feOffset dx=\"0\" dy=\"1\" result=\"offsetblur\" />\n <feFlood flood-color=\"#000000\" flood-opacity=\"0.25\" />\n <feComposite in2=\"offsetblur\" operator=\"in\" />\n <feMerge>\n <feMergeNode />\n <feMergeNode in=\"SourceGraphic\" />\n </feMerge>\n </filter>\n );\n};\n","import { Dimensions, Point } from '@vertexvis/geometry';\nimport { BasicInteractionHandler } from '@vertexvis/utils';\n\nimport { MarkupCenteringBehavior } from '../types';\n\nexport interface MarkupInteractionHandlerScalingOptions {\n scale?: number;\n offset?: Point.Point;\n originatingViewport?: Dimensions.Dimensions;\n centeringBehavior?: MarkupCenteringBehavior;\n}\n\nexport abstract class MarkupInteractionHandler implements BasicInteractionHandler {\n protected element?: HTMLElement;\n protected elementBounds?: DOMRect;\n protected scalingOptions: MarkupInteractionHandlerScalingOptions;\n\n private resizeObserver: ResizeObserver;\n\n public constructor(scalingOptions?: MarkupInteractionHandlerScalingOptions) {\n this.resizeObserver = new ResizeObserver(([entry]) => {\n this.elementBounds = this.computeBoundingRect();\n });\n\n this.scalingOptions = scalingOptions ?? {};\n }\n\n public initialize(element: HTMLElement): void {\n this.element = element;\n\n this.elementBounds = this.computeBoundingRect();\n this.resizeObserver.observe(this.element);\n\n this.element.addEventListener('pointerdown', this.handlePointerDown);\n }\n\n public dispose(): void {\n this.resizeObserver.disconnect();\n this.element?.removeEventListener('pointerdown', this.handlePointerDown);\n\n this.element = undefined;\n }\n\n public updateScalingOptions(\n scalingOptions: MarkupInteractionHandlerScalingOptions\n ): void {\n this.scalingOptions = {\n ...this.scalingOptions,\n ...scalingOptions,\n };\n }\n\n public getScalingOptions(): MarkupInteractionHandlerScalingOptions {\n return this.scalingOptions;\n }\n\n protected acceptInteraction(): void {\n window.addEventListener('pointermove', this.handlePointerMove);\n window.addEventListener('pointerup', this.handlePointerUp);\n }\n\n private handlePointerDown = (event: PointerEvent): void => {\n this.handleInteractionAttempt(event);\n };\n\n private handlePointerMove = (event: PointerEvent): void => {\n this.handleInteractionMove(event);\n };\n\n private handlePointerUp = (event: PointerEvent): void => {\n window.removeEventListener('pointermove', this.handlePointerMove);\n window.removeEventListener('pointerup', this.handlePointerUp);\n\n this.handleInteractionEnd(event);\n };\n\n protected abstract computeBoundingRect(): DOMRect;\n\n protected abstract handleInteractionAttempt(event: PointerEvent): void;\n\n protected abstract handleInteractionMove(event: PointerEvent): void;\n\n protected abstract handleInteractionEnd(event: PointerEvent): void;\n}\n"],"mappings":";;;iIAeM,SAAUA,EAAOC,EAAI,EAAGC,EAAI,GAChC,MAAO,CAAED,IAAGC,IACd,CAcM,SAAUC,EAASC,EAAUC,GACjC,MAAMC,EAAQC,EAASH,EAAGC,GAC1B,OAAOG,KAAKC,KAAKH,EAAML,EAAIK,EAAML,EAAIK,EAAMJ,EAAII,EAAMJ,EACvD,CAKM,SAAUK,EAASH,EAAUC,GACjC,MAAO,CAAEJ,EAAGG,EAAEH,EAAII,EAAEJ,EAAGC,EAAGE,EAAEF,EAAIG,EAAEH,EACpC,CAKM,SAAUQ,EAAIN,EAAUC,GAC5B,MAAO,CAAEJ,EAAGG,EAAEH,EAAII,EAAEJ,EAAGC,EAAGE,EAAEF,EAAIG,EAAEH,EACpC,CA+CM,SAAUS,EAAkBC,EAAWC,GAC3C,MAAO,CACLZ,EAAGW,EAAGX,EAAIY,EACVX,EAAGU,EAAGV,EAAIW,EAEd,CAKM,SAAUC,EAAUF,GACxB,OAAOJ,KAAKC,KAAKG,EAAGX,EAAIW,EAAGX,EAAIW,EAAGV,EAAIU,EAAGV,EAC3C,CAKM,SAAUa,EAAgBH,GAC9B,MAAMI,EAAmBF,EAAUF,GACnC,GAAII,IAAqB,EAAG,CAC1B,OAAOhB,EAAO,EAAG,E,KACZ,CACL,OAAOW,EAAkBC,EAAI,EAAII,E,CAErC,CAKM,SAAUC,EAAsBC,EAAYC,GAChD,OAAOJ,EAAgBR,EA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C,EAAA,yBAAqB,UAAS,gBAAe,SAC7CA,EAAA,eAAaqC,IAAI,aAAaC,SAAS,OACvCtC,EAAA,eACEA,EAAA,oBACAA,EAAA,eAAagC,GAAG,mBAEX,E,MCnESO,EAOpB,WAAAC,CAAmBC,GA0CXC,KAAAC,kBAAqB/B,IAC3B8B,KAAKE,yBAAyBhC,EAAM,EAG9B8B,KAAAG,kBAAqBjC,IAC3B8B,KAAKI,sBAAsBlC,EAAM,EAG3B8B,KAAAK,gBAAmBnC,IACzBoC,OAAOC,oBAAoB,cAAeP,KAAKG,mBAC/CG,OAAOC,oBAAoB,YAAaP,KAAKK,iBAE7CL,KAAKQ,qBAAqBtC,EAAM,EArDhC8B,KAAKS,eAAiB,IAAIC,gBAAe,EAAEC,MACzCX,KAAKY,cAAgBZ,KAAKa,qBAAqB,IAGjDb,KAAKD,eAAiBA,IAAc,MAAdA,SAAc,EAAdA,EAAkB,E,CAGnC,UAAAe,CAAWC,GAChBf,KAAKe,QAAUA,EAEff,KAAKY,cAAgBZ,KAAKa,sBAC1Bb,KAAKS,eAAeO,QAAQhB,KAAKe,SAEjCf,KAAKe,QAAQE,iBAAiB,cAAejB,KAAKC,kB,CAG7C,OAAAiB,G,MACLlB,KAAKS,eAAeU,cACpBC,EAAApB,KAAKe,WAAO,MAAAK,SAAA,SAAAA,EAAEb,oBAAoB,cAAeP,KAAKC,mBAEtDD,KAAKe,QAAUM,S,CAGV,oBAAAC,CACLvB,GAEAC,KAAKD,eAAiB,IACjBC,KAAKD,kBACLA,E,CAIA,iBAAAwB,GACL,OAAOvB,KAAKD,c,CAGJ,iBAAAyB,GACRlB,OAAOW,iBAAiB,cAAejB,KAAKG,mBAC5CG,OAAOW,iBAAiB,YAAajB,KAAKK,gB","ignoreList":[]}
1
+ {"version":3,"names":["create","x","y","distance","a","b","delta","subtract","Math","sqrt","add","scaleProportional","pt","scale","magnitude","normalizeVector","magnitudeOfPoint","normalDirectionVector","ptA","ptB","orthogonalVector","unitVectorBetweenPoints","abs","vectorXValue","pow","vectorYValue","fromJson","json","obj","JSON","parse","Array","isArray","createArrowheadPoints","start","end","arrowSideLength","arrowHeadTheta","arrowOrthogonalVector","Point.orthogonalVector","normalizedDirection","Point.normalDirectionVector","arrowLeft","Point.subtract","Point.add","Point.scaleProportional","cos","sin","arrowRight","leftPoint","rightPoint","createLineAnchorStylePoints","triangleArrowAngle","lineArrowAngle","Point.distance","arrowHeadHeight","max","min","hashHeight","radius","triangleArrowRelativeHeight","triangleArrowBasePosition","triangleArrowTheta","Angle","toRadians","triangleArrowSideLength","triangleArrow","lineArrowTheta","lineArrowSideLength","lineArrow","hashLineTheta","hashLine","tip","base","arrowTriangle","arrowLine","hash","arrowheadPointsToPolygonPoints","points","scaledRight","scalePointProportional","scaledLeft","scaledBase","map","join","arrowheadPointsToPathPoints","arrowheadPointsToHashPoints","x1","y1","x2","y2","arrowheadPointsToCirclePoints","cx","cy","r","isVertexViewerArrowMarkup","el","HTMLElement","nodeName","parsePoint","value","Point.fromJson","basePoint","scaledPoint","isVertexViewerCircleMarkup","parseBounds","Rectangle","parsePoints","values","Point","stringify","isVertexViewerFreeformMarkup","getBoundingBox2dAnchorPosition","rect","position","width","height","center","translatePointToScreen","canvasDimensions","contentDimensions","centeringBehavior","canvasToContentScaleFactor","effectiveScalar","contentScaleFactor","getScaleFactor","contentRelativePoint","Dimensions","scaledContentWidth","scaledContentHeight","centerOffsetX","centerOffsetY","translateDimensionsToScreen","dimensions","contentRelativeDimensions","translateRectToScreen","fromPointAndDimensions","translatePointToRelative","offset","pointWithoutOffset","getWindowDevicePixelRatio","centeredContentPoint","contentCenterRelativePoint","translatePointsToBounds","original","bounds","createRectangle","initialPoint","currentPoint","maintainAspectRatio","fromPoints","fitBoundsSize","isPortrait","currentIsLeftOfInitial","currentIsAboveInitial","fitBoundsX","fitBoundsY","transformRectangle","current","anchor","left","top","w","h","right","bottom","topLeft","bottomLeft","topRight","bottomRight","isVertexViewerMarkupElement","isValidPointData","every","isNaN","isValidStartEvent","event","target","mode","RelativeAnchor","id","transform","rotation","name","point","onPointerDown","children","class","style","onTouchStart","preventDefault","SvgShadow","effectiveScale","xOffset","yOffset","filterUnits","in","stdDeviation","dx","dy","result","in2","operator","MarkupInteractionHandler","constructor","scalingOptions","this","handlePointerDown","handleInteractionAttempt","handlePointerMove","handleInteractionMove","handlePointerUp","window","removeEventListener","handleInteractionEnd","resizeObserver","ResizeObserver","entry","elementBounds","computeBoundingRect","initialize","element","observe","addEventListener","dispose","disconnect","_a","undefined","updateScalingOptions","getScalingOptions","acceptInteraction"],"sources":["../geometry/src/point.ts","src/components/viewer-markup-arrow/utils.ts","src/components/viewer-markup-circle/utils.ts","src/components/viewer-markup-freeform/utils.ts","src/components/viewer-markup/markup-utils.ts","src/components/viewer-markup/viewer-markup-components.tsx","src/lib/markup/interactions.ts"],"sourcesContent":["import * as Angle from './angle';\nimport { lerp as lerpNumber } from './math';\n\n/**\n * A `Point` represents a cartesian coordinate with a horizontal and vertical\n * position or length.\n */\nexport interface Point {\n x: number;\n y: number;\n}\n\n/**\n * Returns a new `Point` with the given horizontal and vertical position.\n */\nexport function create(x = 0, y = 0): Point {\n return { x, y };\n}\n\n/**\n * Converts a polar coordinate (length and angle) into a Cartesian coordinate.\n */\nexport function polar(length: number, radians: Angle.Angle): Point {\n const x = Math.cos(radians) * length;\n const y = Math.sin(radians) * length;\n return create(x, y);\n}\n\n/**\n * Returns the distance between two points.\n */\nexport function distance(a: Point, b: Point): number {\n const delta = subtract(a, b);\n return Math.sqrt(delta.x * delta.x + delta.y * delta.y);\n}\n\n/**\n * Returns a new `Point` where `b` is subtracted from `a`.\n */\nexport function subtract(a: Point, b: Point): Point {\n return { x: a.x - b.x, y: a.y - b.y };\n}\n\n/**\n * Returns a new `Point` where `b` is added to `a`.\n */\nexport function add(a: Point, b: Point): Point {\n return { x: a.x + b.x, y: a.y + b.y };\n}\n\n/**\n * Returns `true` if the `x` and `y` positions of `a` and `b` are equal.\n */\nexport function isEqual(a: Point, b: Point): boolean {\n return a.x === b.x && a.y === b.y;\n}\n\n/**\n * Performs a linear interpolation between `a` and `b` and returns the result.\n * The value of `t` is clamped between `[0, 1]`.\n *\n * @param a The start value.\n * @param b The end value.\n * @param t A value between 0 and 1.\n * @returns A point between `a` and `b`.\n */\nexport function lerp(a: Point, b: Point, t: number): Point {\n return {\n x: lerpNumber(a.x, b.x, t),\n y: lerpNumber(a.y, b.y, t),\n };\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are inverted.\n */\nexport function negate(pt: Point): Point {\n return create(-pt.x, -pt.y);\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are multiplied by the given scale\n * factors.\n */\nexport function scale(pt: Point, scaleX: number, scaleY: number): Point {\n return {\n x: pt.x * scaleX,\n y: pt.y * scaleY,\n };\n}\n\n/**\n * Returns a new `Point` where `x` and `y` are multiplied by the given scale\n * factor.\n */\nexport function scaleProportional(pt: Point, scale: number): Point {\n return {\n x: pt.x * scale,\n y: pt.y * scale,\n };\n}\n\n/**\n * Returns the magnitude of a point.\n */\nexport function magnitude(pt: Point): number {\n return Math.sqrt(pt.x * pt.x + pt.y * pt.y);\n}\n\n/**\n * Transforms a vector into the corresponding normal (unit) vector.\n */\nexport function normalizeVector(pt: Point): Point {\n const magnitudeOfPoint = magnitude(pt);\n if (magnitudeOfPoint === 0) {\n return create(0, 0);\n } else {\n return scaleProportional(pt, 1 / magnitudeOfPoint);\n }\n}\n\n/**\n * Returns a new normal (unit) vector pointing between the two given points.\n */\nexport function normalDirectionVector(ptA: Point, ptB: Point): Point {\n return normalizeVector(subtract(ptB, ptA));\n}\n\n/**\n * Returns a vector orthogonal to the vector between the two given points.\n */\nexport function orthogonalVector(ptA: Point, ptB: Point): Point {\n const unitVectorBetweenPoints = normalDirectionVector(ptA, ptB);\n\n // Handle vectors that are parallel to the x or y axis\n if (unitVectorBetweenPoints.x === 0 || unitVectorBetweenPoints.y === 0) {\n return create(-1 * unitVectorBetweenPoints.y, unitVectorBetweenPoints.x);\n }\n\n if (\n Math.abs(unitVectorBetweenPoints.x) > Math.abs(unitVectorBetweenPoints.y)\n ) {\n const vectorXValue = 1 - Math.pow(unitVectorBetweenPoints.x, 2);\n const vectorYValue =\n -1 * unitVectorBetweenPoints.x * unitVectorBetweenPoints.y;\n return normalizeVector(create(vectorXValue, vectorYValue));\n } else {\n const vectorXValue =\n -1 * unitVectorBetweenPoints.x * unitVectorBetweenPoints.y;\n const vectorYValue = 1 - Math.pow(unitVectorBetweenPoints.y, 2);\n return normalizeVector(create(vectorXValue, vectorYValue));\n }\n}\n\n/**\n * Parses a JSON string representation of a Point and returns an object.\n *\n * @param json A JSON string, either in the form `[x,y]` or `{\"x\": 0, \"y\": 0}`\n * @returns A parsed Point.\n */\nexport function fromJson(json: string): Point {\n const obj = JSON.parse(json);\n if (Array.isArray(obj)) {\n const [x, y] = obj;\n return create(x, y);\n } else {\n const { x, y } = obj;\n return create(x, y);\n }\n}\n","import { Angle } from '@vertexvis/geometry';\n\nimport * as Point from '../../../../geometry/src/point';\n\nexport type LineAnchorStyle =\n | 'arrow-triangle'\n | 'arrow-line'\n | 'dot'\n | 'hash'\n | 'none';\n\nexport interface LineAnchorStylePoints {\n tip: Point.Point;\n base: Point.Point;\n arrowTriangle: ArrowheadPoints;\n arrowLine: ArrowheadPoints;\n hash: ArrowheadPoints;\n radius: number;\n}\n\nexport interface ArrowheadPoints {\n leftPoint: Point.Point;\n rightPoint: Point.Point;\n}\n\nexport interface LinePoints {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n}\n\nexport interface CirclePoints {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport function createArrowheadPoints(\n start: Point.Point,\n end: Point.Point,\n arrowSideLength: number,\n arrowHeadTheta: number,\n): ArrowheadPoints {\n const arrowOrthogonalVector = Point.orthogonalVector(start, end);\n const normalizedDirection = Point.normalDirectionVector(start, end);\n\n const arrowLeft = Point.subtract(\n end,\n Point.add(\n Point.scaleProportional(\n normalizedDirection,\n arrowSideLength * Math.cos(arrowHeadTheta),\n ),\n Point.scaleProportional(\n arrowOrthogonalVector,\n arrowSideLength * Math.sin(arrowHeadTheta),\n ),\n ),\n );\n const arrowRight = Point.subtract(\n end,\n Point.subtract(\n Point.scaleProportional(\n normalizedDirection,\n arrowSideLength * Math.cos(arrowHeadTheta),\n ),\n Point.scaleProportional(\n arrowOrthogonalVector,\n arrowSideLength * Math.sin(arrowHeadTheta),\n ),\n ),\n );\n\n return {\n leftPoint: arrowLeft,\n rightPoint: arrowRight,\n };\n}\n\nexport function createLineAnchorStylePoints(\n start: Point.Point,\n end: Point.Point,\n triangleArrowAngle = 65,\n lineArrowAngle = 85,\n): LineAnchorStylePoints {\n // Adjust the size of the end style to the distance between the start and end points\n const distance = Point.distance(start, end);\n const arrowHeadHeight = Math.max(4, Math.min(16, distance * 0.25));\n const hashHeight = Math.max(4, Math.min(12, distance * 0.16));\n const radius = Math.min(5, distance * 0.1);\n\n // Triangle arrow position\n const triangleArrowRelativeHeight = arrowHeadHeight / distance;\n const triangleArrowBasePosition = Point.add(\n Point.scaleProportional(end, 1 - triangleArrowRelativeHeight),\n Point.scaleProportional(start, triangleArrowRelativeHeight),\n );\n const triangleArrowTheta = Angle.toRadians(triangleArrowAngle / 2);\n const triangleArrowSideLength =\n arrowHeadHeight / Math.cos(triangleArrowTheta);\n const triangleArrow = createArrowheadPoints(\n start,\n end,\n triangleArrowSideLength,\n triangleArrowTheta,\n );\n\n // Line arrow position\n const lineArrowTheta = Angle.toRadians(lineArrowAngle / 2);\n const lineArrowSideLength = arrowHeadHeight / Math.cos(lineArrowTheta);\n const lineArrow = createArrowheadPoints(\n start,\n end,\n lineArrowSideLength,\n lineArrowTheta,\n );\n\n // Hash position\n // Setting the arrowHeadAngle to 90 degrees results in a\n // straight hash mark perpendicular to the direction of the line\n const hashLineTheta = Angle.toRadians(90);\n const hashLine = createArrowheadPoints(start, end, hashHeight, hashLineTheta);\n\n return {\n tip: end,\n base: triangleArrowBasePosition,\n arrowTriangle: triangleArrow,\n arrowLine: lineArrow,\n hash: hashLine,\n radius: radius,\n };\n}\n\nexport function arrowheadPointsToPolygonPoints(\n points: LineAnchorStylePoints,\n scale = 1,\n): string {\n const scaledRight = scalePointProportional(\n points.tip,\n points.arrowTriangle.rightPoint,\n scale,\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.arrowTriangle.leftPoint,\n scale,\n );\n const scaledBase = scalePointProportional(points.tip, points.base, scale);\n\n return [points.tip, scaledRight, scaledBase, scaledLeft]\n .map((pt) => `${pt.x},${pt.y}`)\n .join(' ');\n}\n\nexport function arrowheadPointsToPathPoints(\n points: LineAnchorStylePoints,\n scale = 1,\n): string {\n const scaledRight = scalePointProportional(\n points.tip,\n points.arrowLine.rightPoint,\n scale,\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.arrowLine.leftPoint,\n scale,\n );\n\n return `M${scaledRight.x} ${scaledRight.y} L${points.tip.x} ${points.tip.y} L${scaledLeft.x} ${scaledLeft.y} L${points.tip.x} ${points.tip.y} Z`;\n}\n\nexport function arrowheadPointsToHashPoints(\n points: LineAnchorStylePoints,\n scale = 1,\n): LinePoints {\n const scaledRight = scalePointProportional(\n points.tip,\n points.hash.rightPoint,\n scale,\n );\n const scaledLeft = scalePointProportional(\n points.tip,\n points.hash.leftPoint,\n scale,\n );\n\n return {\n x1: scaledRight.x,\n y1: scaledRight.y,\n x2: scaledLeft.x,\n y2: scaledLeft.y,\n };\n}\n\nexport function arrowheadPointsToCirclePoints(\n points: LineAnchorStylePoints,\n scale = 1,\n): CirclePoints {\n return {\n cx: points.tip.x,\n cy: points.tip.y,\n r: points.radius * scale,\n };\n}\n\nexport function isVertexViewerArrowMarkup(\n el: unknown,\n): el is HTMLVertexViewerMarkupArrowElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-ARROW'\n );\n}\n\nexport function parsePoint(\n value: string | Point.Point | undefined,\n): Point.Point | undefined {\n return typeof value === 'string' ? Point.fromJson(value) : value;\n}\n\nexport function scalePointProportional(\n basePoint: Point.Point,\n scaledPoint: Point.Point,\n scale: number,\n): Point.Point {\n return Point.add(\n basePoint,\n Point.scaleProportional(Point.subtract(scaledPoint, basePoint), scale),\n );\n}\n","import { Rectangle } from '@vertexvis/geometry';\n\nexport function isVertexViewerCircleMarkup(\n el: unknown,\n): el is HTMLVertexViewerMarkupCircleElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-CIRCLE'\n );\n}\n\nexport function parseBounds(\n value: string | Rectangle.Rectangle | undefined,\n): Rectangle.Rectangle | undefined {\n return typeof value === 'string' ? Rectangle.fromJson(value) : value;\n}\n","import { Point } from '@vertexvis/geometry';\n\nexport function parsePoints(\n value: string | Point.Point[] | undefined,\n): Point.Point[] | undefined {\n return typeof value === 'string'\n ? JSON.parse(value).map((values: number[]) =>\n Point.fromJson(JSON.stringify(values)),\n )\n : value;\n}\n\nexport function isVertexViewerFreeformMarkup(\n el: unknown,\n): el is HTMLVertexViewerMarkupFreeformElement {\n return (\n el instanceof HTMLElement && el.nodeName === 'VERTEX-VIEWER-MARKUP-FREEFORM'\n );\n}\n","import { Dimensions, Point, Rectangle } from '@vertexvis/geometry';\n\nimport { getWindowDevicePixelRatio } from '../../lib/dom';\nimport { MarkupCenteringBehavior } from '../../lib/types';\nimport { isVertexViewerArrowMarkup } from '../viewer-markup-arrow/utils';\nimport { isVertexViewerCircleMarkup } from '../viewer-markup-circle/utils';\nimport { isVertexViewerFreeformMarkup } from '../viewer-markup-freeform/utils';\n\nexport type BoundingBox2dAnchorPosition =\n | 'left'\n | 'right'\n | 'top'\n | 'bottom'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n | 'center';\n\nexport function getBoundingBox2dAnchorPosition(\n rect: Rectangle.Rectangle,\n position: BoundingBox2dAnchorPosition,\n): Point.Point {\n switch (position) {\n case 'top-left':\n return Point.create(rect.x, rect.y);\n case 'top':\n return Point.create(rect.x + rect.width / 2, rect.y);\n case 'top-right':\n return Point.create(rect.x + rect.width, rect.y);\n case 'right':\n return Point.create(rect.x + rect.width, rect.y + rect.height / 2);\n case 'bottom-right':\n return Point.create(rect.x + rect.width, rect.y + rect.height);\n case 'bottom':\n return Point.create(rect.x + rect.width / 2, rect.y + rect.height);\n case 'bottom-left':\n return Point.create(rect.x, rect.y + rect.height);\n case 'left':\n return Point.create(rect.x, rect.y + rect.height / 2);\n case 'center':\n return Rectangle.center(rect);\n }\n}\n\nexport function translatePointToScreen(\n pt: Point.Point,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions: Dimensions.Dimensions = canvasDimensions,\n centeringBehavior: MarkupCenteringBehavior = 'none',\n scale = 1,\n): Point.Point {\n const canvasToContentScaleFactor = Math.min(\n canvasDimensions.width / contentDimensions.width,\n canvasDimensions.height / contentDimensions.height,\n );\n const effectiveScalar = canvasToContentScaleFactor * scale;\n const contentScaleFactor = getScaleFactor(contentDimensions);\n const contentRelativePoint = Point.add(\n Point.scale(pt, contentScaleFactor, contentScaleFactor),\n Dimensions.center(contentDimensions),\n );\n\n // Include an offset for width and height to account for cases where the\n // content dimensions are smaller than the canvas dimensions.\n const scaledContentWidth = contentDimensions.width * effectiveScalar;\n const scaledContentHeight = contentDimensions.height * effectiveScalar;\n const centerOffsetX =\n centeringBehavior === 'both' || centeringBehavior === 'x-only'\n ? Math.max(0, (canvasDimensions.width - scaledContentWidth) / 2)\n : 0;\n const centerOffsetY =\n centeringBehavior === 'both' || centeringBehavior === 'y-only'\n ? Math.max(0, (canvasDimensions.height - scaledContentHeight) / 2)\n : 0;\n\n return Point.create(\n contentRelativePoint.x * effectiveScalar + centerOffsetX,\n contentRelativePoint.y * effectiveScalar + centerOffsetY,\n );\n}\n\nexport function translatePointToBounds(\n pt: Point.Point,\n rect: Rectangle.Rectangle,\n canvasDimensions: Dimensions.Dimensions,\n): Point.Point {\n const rectToScreen = translateRectToScreen(rect, canvasDimensions);\n return Point.add(pt, rectToScreen);\n}\n\nexport function translateDimensionsToScreen(\n dimensions: Dimensions.Dimensions,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions: Dimensions.Dimensions = canvasDimensions,\n scale = 1,\n): Dimensions.Dimensions {\n const canvasToContentScaleFactor = Math.min(\n canvasDimensions.width / contentDimensions.width,\n canvasDimensions.height / contentDimensions.height,\n );\n const effectiveScalar = canvasToContentScaleFactor * scale;\n const contentScaleFactor = getScaleFactor(contentDimensions);\n const contentRelativeDimensions = Dimensions.scale(\n contentScaleFactor,\n contentScaleFactor,\n dimensions,\n );\n\n return Dimensions.scale(\n effectiveScalar,\n effectiveScalar,\n contentRelativeDimensions,\n );\n}\n\n/**\n * Translates a rectangle in relative units, to a rectangle in screen units.\n *\n * Shape coordinates are persisted in relative units, so they can be presented\n * at any size.\n */\nexport function translateRectToScreen(\n rect: Rectangle.Rectangle,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions?: Dimensions.Dimensions,\n centeringBehavior: MarkupCenteringBehavior = 'none',\n scale = 1,\n): Rectangle.Rectangle {\n const position = translatePointToScreen(\n rect,\n canvasDimensions,\n contentDimensions,\n centeringBehavior,\n scale,\n );\n const dimensions = translateDimensionsToScreen(\n rect,\n canvasDimensions,\n contentDimensions,\n scale,\n );\n return Rectangle.fromPointAndDimensions(position, dimensions);\n}\n\n/**\n * Translates a point in screen units, to a point in relative units.\n */\nexport function translatePointToRelative(\n pt: Point.Point,\n canvasDimensions: Dimensions.Dimensions,\n contentDimensions: Dimensions.Dimensions = canvasDimensions,\n centeringBehavior: MarkupCenteringBehavior = 'none',\n scale = 1,\n offset: Point.Point = Point.create(0, 0),\n): Point.Point {\n const canvasToContentScaleFactor = Math.min(\n canvasDimensions.width / contentDimensions.width,\n canvasDimensions.height / contentDimensions.height,\n );\n const effectiveScalar = canvasToContentScaleFactor * scale;\n\n // Include an offset for width and height to account for cases where the\n // content dimensions are smaller than the canvas dimensions.\n const scaledContentWidth = contentDimensions.width * effectiveScalar;\n const scaledContentHeight = contentDimensions.height * effectiveScalar;\n const centerOffsetX =\n centeringBehavior === 'both' || centeringBehavior === 'x-only'\n ? Math.max(0, (canvasDimensions.width - scaledContentWidth) / 2)\n : 0;\n const centerOffsetY =\n centeringBehavior === 'both' || centeringBehavior === 'y-only'\n ? Math.max(0, (canvasDimensions.height - scaledContentHeight) / 2)\n : 0;\n\n const pointWithoutOffset = Point.subtract(\n pt,\n Point.scale(\n offset,\n 1 / getWindowDevicePixelRatio(),\n 1 / getWindowDevicePixelRatio(),\n ),\n );\n const centeredContentPoint = Point.create(\n (pointWithoutOffset.x - centerOffsetX) / effectiveScalar,\n (pointWithoutOffset.y - centerOffsetY) / effectiveScalar,\n );\n const contentScaleFactor = getScaleFactor(contentDimensions);\n const contentCenterRelativePoint = Point.subtract(\n centeredContentPoint,\n Dimensions.center(contentDimensions),\n );\n\n return Point.scale(\n contentCenterRelativePoint,\n 1 / contentScaleFactor,\n 1 / contentScaleFactor,\n );\n}\n\n/**\n * Translates a set of points in relative `original` units to\n * points in relative `bounds` units.\n */\nexport function translatePointsToBounds(\n points: Point.Point[],\n original: Rectangle.Rectangle,\n bounds: Rectangle.Rectangle,\n): Point.Point[] {\n return points.map((pt) =>\n Point.add(\n Point.scale(\n Point.subtract(pt, original),\n bounds.width / (original.width || 1),\n bounds.height / (original.height || 1),\n ),\n bounds,\n ),\n );\n}\n\nexport function createRectangle(\n initialPoint: Point.Point,\n currentPoint: Point.Point,\n maintainAspectRatio: boolean,\n): Rectangle.Rectangle {\n const bounds = Rectangle.fromPoints(initialPoint, currentPoint);\n if (maintainAspectRatio) {\n const fitBoundsSize = Math.max(bounds.width, bounds.height);\n const isPortrait = bounds.height > bounds.width;\n const currentIsLeftOfInitial = currentPoint.x <= initialPoint.x;\n const currentIsAboveInitial = currentPoint.y <= initialPoint.y;\n const fitBoundsX = currentIsLeftOfInitial\n ? isPortrait\n ? initialPoint.x - fitBoundsSize\n : currentPoint.x\n : initialPoint.x;\n const fitBoundsY = currentIsAboveInitial\n ? isPortrait\n ? currentPoint.y\n : initialPoint.y - fitBoundsSize\n : initialPoint.y;\n return Rectangle.create(\n fitBoundsX,\n fitBoundsY,\n fitBoundsSize,\n fitBoundsSize,\n );\n } else {\n return bounds;\n }\n}\n\nexport function transformRectangle(\n bounds: Rectangle.Rectangle,\n start: Point.Point,\n current: Point.Point,\n anchor: BoundingBox2dAnchorPosition,\n maintainAspectRatio?: boolean,\n): Rectangle.Rectangle {\n const delta = Point.subtract(current, start);\n const { x: left, y: top, width: w, height: h } = bounds;\n const right = left + w;\n const bottom = top + h;\n const topLeft = Point.create(left, top);\n const bottomLeft = Point.create(left, bottom);\n const topRight = Point.create(right, top);\n const bottomRight = Point.create(right, bottom);\n switch (anchor) {\n case 'top-left':\n return createRectangle(bottomRight, current, !!maintainAspectRatio);\n case 'top':\n return createRectangle(\n bottomRight,\n Point.create(left, current.y),\n !!maintainAspectRatio,\n );\n case 'top-right':\n return createRectangle(bottomLeft, current, !!maintainAspectRatio);\n case 'right':\n return createRectangle(\n bottomLeft,\n Point.create(current.x, top),\n !!maintainAspectRatio,\n );\n case 'bottom-right':\n return createRectangle(topLeft, current, !!maintainAspectRatio);\n case 'bottom':\n return createRectangle(\n topLeft,\n Point.create(right, current.y),\n !!maintainAspectRatio,\n );\n case 'bottom-left':\n return createRectangle(topRight, current, !!maintainAspectRatio);\n case 'left':\n return createRectangle(\n bottomRight,\n Point.create(current.x, top),\n !!maintainAspectRatio,\n );\n case 'center':\n return Rectangle.create(\n bounds.x + delta.x,\n bounds.y + delta.y,\n bounds.width,\n bounds.height,\n );\n }\n}\n\nexport function isVertexViewerMarkupElement(\n el: HTMLElement,\n): el is\n | HTMLVertexViewerMarkupArrowElement\n | HTMLVertexViewerMarkupCircleElement\n | HTMLVertexViewerMarkupFreeformElement {\n return (\n isVertexViewerArrowMarkup(el) ||\n isVertexViewerCircleMarkup(el) ||\n isVertexViewerFreeformMarkup(el)\n );\n}\n\nexport function isValidPointData(...points: Point.Point[]): boolean {\n return points.every((pt) => !isNaN(pt.x) && !isNaN(pt.y));\n}\n\nexport function isValidStartEvent(event: PointerEvent): boolean {\n const el = event.target as HTMLElement;\n\n return isVertexViewerMarkupElement(el) && el.mode !== 'edit';\n}\n\nfunction getScaleFactor(dimensions: Dimensions.Dimensions): number {\n // We intentionally use the content's height when scaling to maintain a consistent coordinate\n // space for markup. This is to ensure the markup will be displayed in the same position\n // on the canvas regardless of the aspect ratio at the time the markup was created.\n // See https://github.com/Vertexvis/vertex-web-sdk/pull/429 for more details.\n return dimensions.height;\n}\n","// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { FunctionalComponent, h } from '@stencil/core';\nimport { Point } from '@vertexvis/geometry';\n\nexport interface RelativeAnchorProps {\n id?: string;\n transform?: string;\n rotation?: number;\n name: string;\n point: Point.Point;\n onPointerDown?: (event: PointerEvent) => void;\n}\n\nexport const RelativeAnchor: FunctionalComponent<RelativeAnchorProps> = (\n { id, transform, rotation, name, point, onPointerDown },\n children,\n) => {\n return (\n <div\n id={id}\n class=\"bounds-anchor-position\"\n style={{\n top: `${point.y}px`,\n left: `${point.x}px`,\n }}\n onTouchStart={(event) => event.preventDefault()}\n onPointerDown={onPointerDown}\n >\n <div style={{ transform }}>\n <div\n class=\"bounds-anchor\"\n style={{\n transform: `rotateZ(${rotation ?? 0}deg)`,\n }}\n >\n <slot name={name}>{children}</slot>\n </div>\n </div>\n </div>\n );\n};\n\nexport interface SvgShadowProps {\n id: string;\n scale?: number;\n}\n\nexport const SvgShadow: FunctionalComponent<SvgShadowProps> = ({\n id,\n scale,\n}) => {\n // Scale default values for a `<filter>` element by the provided scale.\n // This prevents the filter area from being too small when scale is greater than 1,\n // and uses the default values for a scale less than 1 to prevent the same issue.\n // See https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/filter\n // for more details on the default values used here.\n const effectiveScale = scale ?? 1;\n const xOffset = Math.max(10, 10 * effectiveScale);\n const yOffset = Math.max(10, 10 * effectiveScale);\n const width = Math.max(120, 110 * effectiveScale + xOffset);\n const height = Math.max(120, 110 * effectiveScale + yOffset);\n\n return (\n <filter\n id={id}\n filterUnits=\"userSpaceOnUse\"\n x={`${-xOffset}%`}\n y={`${-yOffset}%`}\n width={`${width}%`}\n height={`${height}%`}\n >\n <feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"2\" />\n <feOffset dx=\"0\" dy=\"1\" result=\"offsetblur\" />\n <feFlood flood-color=\"#000000\" flood-opacity=\"0.25\" />\n <feComposite in2=\"offsetblur\" operator=\"in\" />\n <feMerge>\n <feMergeNode />\n <feMergeNode in=\"SourceGraphic\" />\n </feMerge>\n </filter>\n );\n};\n","import { Dimensions, Point } from '@vertexvis/geometry';\nimport { BasicInteractionHandler } from '@vertexvis/utils';\n\nimport { MarkupCenteringBehavior } from '../types';\n\nexport interface MarkupInteractionHandlerScalingOptions {\n scale?: number;\n offset?: Point.Point;\n originatingViewport?: Dimensions.Dimensions;\n centeringBehavior?: MarkupCenteringBehavior;\n}\n\nexport abstract class MarkupInteractionHandler implements BasicInteractionHandler {\n protected element?: HTMLElement;\n protected elementBounds?: DOMRect;\n protected scalingOptions: MarkupInteractionHandlerScalingOptions;\n\n private resizeObserver: ResizeObserver;\n\n public constructor(scalingOptions?: MarkupInteractionHandlerScalingOptions) {\n this.resizeObserver = new ResizeObserver(([entry]) => {\n this.elementBounds = this.computeBoundingRect();\n });\n\n this.scalingOptions = scalingOptions ?? {};\n }\n\n public initialize(element: HTMLElement): void {\n this.element = element;\n\n this.elementBounds = this.computeBoundingRect();\n this.resizeObserver.observe(this.element);\n\n this.element.addEventListener('pointerdown', this.handlePointerDown);\n }\n\n public dispose(): void {\n this.resizeObserver.disconnect();\n this.element?.removeEventListener('pointerdown', this.handlePointerDown);\n\n this.element = undefined;\n }\n\n public updateScalingOptions(\n scalingOptions: MarkupInteractionHandlerScalingOptions,\n ): void {\n this.scalingOptions = {\n ...this.scalingOptions,\n ...scalingOptions,\n };\n }\n\n public getScalingOptions(): MarkupInteractionHandlerScalingOptions {\n return this.scalingOptions;\n }\n\n protected acceptInteraction(): void {\n window.addEventListener('pointermove', this.handlePointerMove);\n window.addEventListener('pointerup', this.handlePointerUp);\n }\n\n private handlePointerDown = (event: PointerEvent): void => {\n this.handleInteractionAttempt(event);\n };\n\n private handlePointerMove = (event: PointerEvent): void => {\n this.handleInteractionMove(event);\n };\n\n private handlePointerUp = (event: PointerEvent): void => {\n window.removeEventListener('pointermove', this.handlePointerMove);\n window.removeEventListener('pointerup', this.handlePointerUp);\n\n this.handleInteractionEnd(event);\n };\n\n protected abstract computeBoundingRect(): DOMRect;\n\n protected abstract handleInteractionAttempt(event: PointerEvent): void;\n\n protected abstract handleInteractionMove(event: PointerEvent): void;\n\n protected abstract handleInteractionEnd(event: PointerEvent): void;\n}\n"],"mappings":";;;iIAeM,SAAUA,EAAOC,EAAI,EAAGC,EAAI,GAChC,MAAO,CAAED,IAAGC,IACd,CAcM,SAAUC,EAASC,EAAUC,GACjC,MAAMC,EAAQC,EAASH,EAAGC,GAC1B,OAAOG,KAAKC,KAAKH,EAAML,EAAIK,EAAML,EAAIK,EAAMJ,EAAII,EAAMJ,EACvD,CAKM,SAAUK,EAASH,EAAUC,GACjC,MAAO,CAAEJ,EAAGG,EAAEH,EAAII,EAAEJ,EAAGC,EAAGE,EAAEF,EAAIG,EAAEH,EACpC,CAKM,SAAUQ,EAAIN,EAAUC,GAC5B,MAAO,CAAEJ,EAAGG,EAAEH,EAAII,EAAEJ,EAAGC,EAAGE,EAAEF,EAAIG,EAAEH,EACpC,CA+CM,SAAUS,EAAkBC,EAAWC,GAC3C,MAAO,CACLZ,EAAGW,EAAGX,EAAIY,EACVX,EAAGU,EAAGV,EAAIW,EAEd,CAKM,SAAUC,EAAUF,GACxB,OAAOJ,KAAKC,KAAKG,EAAGX,EAAIW,EAAGX,EAAIW,EAAGV,EAAIU,EAAGV,EAC3C,CAKM,SAAUa,EAAgBH,GAC9B,MAAMI,EAAmBF,EAAUF,GACnC,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B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["TeleportInteractionHandler","constructor","model","animationConfiguration","this","rectObserver","ElementRectObserver","handlePointerDown","bind","handlePointerUp","handleEnabledChange","handleTeleportModeChange","enabledChangeDisposable","onEnabledChange","dispose","disable","_a","element","undefined","api","disconnect","initialize","observe","getEnabled","setAnimations","config","enable","teleportModeChangeDisposable","onTeleportModeChange","addEventListener","getTeleportMode","_b","cursorDisposable","_c","removeEventListener","event","downPosition","getMouseClientPosition","rect","downButtons","buttons","window","mode","threshold","pixelThreshold","point","isRightClick","hasModifier","shiftKey","altKey","metaKey","ctrlKey","Point","distance","teleportToHit","teleportTowardHit","teleportAndAlign","beginInteraction","isInteracting","endInteraction","worldPoint","getWorldPointFromViewport","mouseRay","getRayFromPoint","teleportDistancePercentage","teleportCollisionDistance","getConfiguration","teleportDistanceScalar","performInteraction","camera","boundingBox","stepDistance","Math","max","Vector3","toArray","BoundingBox","lengths","positionPlane","Plane","fromNormalAndCoplanarPoint","up","position","projectedWorldPoint","projectPoint","distanceToWorldPoint","mouseRayAtWorldPoint","Ray","create","origin","nextPosition","at","update","lookAt","add","subtract","projectedNextStep","getWorldPointWithFallback","shortestBoundingBoxLength","shortestLength","heightScalar","getTeleportHeightPercentage","cameraPlane","projectedHitPosition","rayToHitPosition","direction","normalize","distanceToHitPosition","distanceToLookAt","newPosition","newPositionViewVectorRay","viewVector","hits","hitItems","hit","hitNormal","hitPoint","upRay","alignTo","fn","transformCamera","renderConfiguration","enabled","addCursor","min","animation","milliseconds","durationMs","KeyBinding","bindings","map","binding","toLowerCase","matches","keys","length","every","bindingMatches","negated","includes","key","replace","WalkModeController","excludeTagNames","excludePredicates","updateModelExclusions","updateModel","setEnabled","setTeleportMode","updateConfiguration","configuration","existing","setConfiguration","addKeyBinding","operation","replaceKeyBinding","excludeElement","args","filter","tn","setExcludedPredicate","el","some","tagName","p","ViewerWalkModeOperation","WalkModeModel","keyBindings","MOVE_DOWN","MOVE_UP","PIVOT_DOWN","PIVOT_LEFT","PIVOT_RIGHT","PIVOT_UP","WALK_BACKWARD","WALK_FORWARD","WALK_LEFT","WALK_RIGHT","teleportHeightPercentage","keyboardWalkSpeed","keyboardPivotDegrees","keyboardRepeatIntervalMs","enabledChanged","EventDispatcher","teleportModeChanged","configurationChanged","keyBindingsChanged","emit","teleportMode","keyBinding","predicate","excludedPredicate","getKeyboardWalkSpeed","getKeyboardPivotDegrees","getKeyboardRepeatInterval","getKeyBindings","operationMatches","state","isElementExcluded","call","listener","on","onConfigurationChange","onKeyBindingsChange","viewerTeleportToolCss","ViewerTeleportTool","__stencil_proxyCustomElement","HTMLElement","registerHost","animationsDisabled","animationMs","stateMap","componentWillLoad","setupController","setupInteractionHandler","setDepthBuffers","connectedCallback","disconnectedCallback","clearInteractionHandler","resetDepthBuffers","handleModeChange","controller","handleViewerChanged","handleAnimationMsChanged","interactionHandler","handleAnimationsDisabledChanged","handleControllerChanged","controllerChanged","handleModelChanged","render","h","Host","viewer","depthBuffers","shouldClearDepthBuffers","interactionHandlerDisposable","registerInteractionHandler"],"sources":["src/lib/teleportation/interactions.ts","src/lib/keyBinding.ts","src/lib/walk-mode/controller.ts","src/lib/walk-mode/model.ts","src/components/viewer-teleport-tool/viewer-teleport-tool.css?tag=vertex-viewer-teleport-tool&encapsulation=shadow","src/components/viewer-teleport-tool/viewer-teleport-tool.tsx"],"sourcesContent":["import { BoundingBox, Plane, Point, Ray, Vector3 } from '@vertexvis/geometry';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { getMouseClientPosition } from '../dom';\nimport { ElementRectObserver } from '../elementRectObserver';\nimport {\n CameraTransform,\n InteractionApi,\n InteractionHandler,\n} from '../interactions';\nimport { Camera, CameraRenderOptions } from '../scenes';\nimport { ViewerTeleportMode, WalkModeModel } from '../walk-mode/model';\n\nexport interface AnimationConfiguration {\n durationMs: number;\n}\n\nexport class TeleportInteractionHandler implements InteractionHandler {\n private api?: InteractionApi;\n private element?: HTMLElement;\n\n private rectObserver = new ElementRectObserver();\n\n private downPosition?: Point.Point;\n private downButtons?: number;\n\n private enabledChangeDisposable?: Disposable;\n private teleportModeChangeDisposable?: Disposable;\n private cursorDisposable?: Disposable;\n\n public constructor(\n private model: WalkModeModel,\n private animationConfiguration?: AnimationConfiguration\n ) {\n this.handlePointerDown = this.handlePointerDown.bind(this);\n this.handlePointerUp = this.handlePointerUp.bind(this);\n this.handleEnabledChange = this.handleEnabledChange.bind(this);\n this.handleTeleportModeChange = this.handleTeleportModeChange.bind(this);\n\n this.enabledChangeDisposable = this.model.onEnabledChange(\n this.handleEnabledChange\n );\n }\n\n public dispose(): void {\n this.disable();\n this.enabledChangeDisposable?.dispose();\n\n this.element = undefined;\n this.api = undefined;\n\n this.rectObserver.disconnect();\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.api = api;\n\n this.rectObserver.observe(element);\n\n this.handleEnabledChange(this.model.getEnabled());\n }\n\n public setAnimations(config?: AnimationConfiguration): void {\n this.animationConfiguration = config;\n }\n\n public enable(): void {\n this.disable();\n\n this.teleportModeChangeDisposable = this.model.onTeleportModeChange(\n this.handleTeleportModeChange\n );\n this.element?.addEventListener('pointerdown', this.handlePointerDown);\n\n this.handleTeleportModeChange(this.model.getTeleportMode());\n }\n\n public disable(): void {\n this.teleportModeChangeDisposable?.dispose();\n this.cursorDisposable?.dispose();\n\n this.element?.removeEventListener('pointerdown', this.handlePointerDown);\n }\n\n private async handlePointerDown(event: PointerEvent): Promise<void> {\n this.downPosition = getMouseClientPosition(event, this.rectObserver.rect);\n this.downButtons = event.buttons;\n\n window.addEventListener('pointerup', this.handlePointerUp);\n }\n\n private async handlePointerUp(event: PointerEvent): Promise<void> {\n const mode = this.model.getTeleportMode();\n const threshold = this.api?.pixelThreshold() ?? 2;\n const point = getMouseClientPosition(event, this.rectObserver.rect);\n const isRightClick = this.downButtons === 2;\n const hasModifier =\n event.shiftKey || event.altKey || event.metaKey || event.ctrlKey;\n\n if (\n mode != null &&\n this.downPosition != null &&\n Point.distance(this.downPosition, point) <= threshold &&\n !isRightClick &&\n !hasModifier\n ) {\n switch (mode) {\n case 'teleport':\n return this.teleportToHit(point);\n case 'teleport-toward':\n return this.teleportTowardHit(point);\n case 'teleport-and-align':\n return this.teleportAndAlign(point);\n }\n }\n\n this.downPosition = undefined;\n\n window.removeEventListener('pointerup', this.handlePointerUp);\n }\n\n private async beginInteraction(): Promise<void> {\n if (!this.api?.isInteracting()) {\n await this.api?.beginInteraction();\n }\n }\n\n private async endInteraction(): Promise<void> {\n await this.api?.endInteraction();\n }\n\n private async teleportTowardHit(point: Point.Point): Promise<void> {\n const worldPoint = await this.api?.getWorldPointFromViewport(point);\n const mouseRay = this.api?.getRayFromPoint(point);\n\n if (mouseRay != null) {\n const { teleportDistancePercentage, teleportCollisionDistance } =\n this.model.getConfiguration();\n const teleportDistanceScalar = teleportDistancePercentage / 100;\n\n return this.performInteraction(({ camera, boundingBox }) => {\n const stepDistance =\n Math.max(...Vector3.toArray(BoundingBox.lengths(boundingBox))) *\n teleportDistanceScalar;\n\n const positionPlane = Plane.fromNormalAndCoplanarPoint(\n camera.up,\n camera.position\n );\n const projectedWorldPoint = Plane.projectPoint(\n positionPlane,\n worldPoint ?? camera.position\n );\n const distanceToWorldPoint = Vector3.distance(\n camera.position,\n projectedWorldPoint\n );\n\n if (\n distanceToWorldPoint < stepDistance &&\n distanceToWorldPoint > teleportCollisionDistance * 1.1\n ) {\n const mouseRayAtWorldPoint = Ray.create({\n ...mouseRay,\n origin: projectedWorldPoint,\n });\n const nextPosition = Plane.projectPoint(\n positionPlane,\n Ray.at(mouseRayAtWorldPoint, -teleportCollisionDistance)\n );\n\n return camera.update({\n position: nextPosition,\n lookAt: Vector3.add(\n camera.lookAt,\n Vector3.subtract(nextPosition, camera.position)\n ),\n });\n } else {\n const projectedNextStep = Plane.projectPoint(\n positionPlane,\n Ray.at(mouseRay, stepDistance)\n );\n\n return camera.update({\n position: projectedNextStep,\n lookAt: Vector3.add(\n camera.lookAt,\n Vector3.subtract(projectedNextStep, camera.position)\n ),\n });\n }\n });\n }\n }\n\n private async teleportToHit(point: Point.Point): Promise<void> {\n const worldPoint = await this.getWorldPointWithFallback(point);\n\n if (worldPoint != null) {\n return this.performInteraction(({ camera, boundingBox }) => {\n const shortestBoundingBoxLength = this.shortestLength(boundingBox);\n const heightScalar = this.model.getTeleportHeightPercentage() / 100;\n\n const cameraPlane = Plane.fromNormalAndCoplanarPoint(\n camera.up,\n camera.position\n );\n const projectedHitPosition = Plane.projectPoint(\n cameraPlane,\n worldPoint\n );\n\n const rayToHitPosition = Ray.create({\n origin: camera.position,\n direction: Vector3.normalize(\n Vector3.subtract(projectedHitPosition, camera.position)\n ),\n });\n const distanceToHitPosition = Vector3.distance(\n camera.position,\n projectedHitPosition\n );\n const distanceToLookAt = Vector3.distance(\n camera.position,\n camera.lookAt\n );\n\n const newPosition = Ray.at(\n rayToHitPosition,\n distanceToHitPosition - shortestBoundingBoxLength * heightScalar\n );\n const newPositionViewVectorRay = Ray.create({\n origin: newPosition,\n direction: Vector3.normalize(camera.viewVector),\n });\n\n return camera.update({\n position: newPosition,\n lookAt: Ray.at(newPositionViewVectorRay, distanceToLookAt),\n });\n });\n }\n }\n\n private async teleportAndAlign(point: Point.Point): Promise<void> {\n const hits = await this.api?.hitItems(point);\n const hit = hits != null ? hits[0] : undefined;\n\n if (hit?.hitNormal != null && hit?.hitPoint) {\n await this.performInteraction(({ camera, boundingBox }) => {\n const shortestBoundingBoxLength = this.shortestLength(boundingBox);\n const heightScalar = this.model.getTeleportHeightPercentage() / 100;\n\n const upRay = Ray.create({\n origin: hit.hitPoint as Vector3.Vector3,\n direction: hit.hitNormal as Vector3.Vector3,\n });\n\n return camera.alignTo(\n Ray.at(upRay, shortestBoundingBoxLength * heightScalar),\n hit.hitNormal as Vector3.Vector3\n );\n });\n }\n }\n\n private async performInteraction(fn: CameraTransform<Camera>): Promise<void> {\n await this.beginInteraction();\n await this.api?.transformCamera(fn, this.renderConfiguration());\n await this.endInteraction();\n }\n\n private async getWorldPointWithFallback(\n point: Point.Point\n ): Promise<Vector3.Vector3 | undefined> {\n const worldPoint = await this.api?.getWorldPointFromViewport(point);\n\n if (worldPoint == null) {\n const hits = await this.api?.hitItems(point);\n const hit = hits != null ? hits[0] : undefined;\n\n return hit?.hitPoint != null\n ? (hit.hitPoint as Vector3.Vector3)\n : worldPoint;\n }\n return worldPoint;\n }\n\n private handleEnabledChange(enabled: boolean): void {\n if (enabled) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n private handleTeleportModeChange(mode?: ViewerTeleportMode): void {\n this.cursorDisposable?.dispose();\n\n if (mode != null) {\n this.cursorDisposable = this.api?.addCursor('crosshair');\n }\n }\n\n private shortestLength(boundingBox: BoundingBox.BoundingBox): number {\n return Math.min(...Vector3.toArray(BoundingBox.lengths(boundingBox)));\n }\n\n private renderConfiguration(): CameraRenderOptions {\n return this.animationConfiguration != null\n ? { animation: { milliseconds: this.animationConfiguration.durationMs } }\n : {};\n }\n}\n","export class KeyBinding {\n private bindings: string[];\n\n public constructor(...bindings: string[]) {\n this.bindings = bindings.map((binding) => binding.toLowerCase());\n }\n\n public matches(keys: Record<string, boolean>): boolean {\n return (\n this.bindings.length > 0 &&\n this.bindings.every((binding) => this.bindingMatches(keys, binding))\n );\n }\n\n private bindingMatches(\n keys: Record<string, boolean>,\n binding: string\n ): boolean {\n const negated = binding.includes('!');\n const key = binding.replace('!', '');\n\n return negated ? !keys[key] : keys[key];\n }\n}\n","import { Disposable } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\nimport {\n ViewerTeleportMode,\n ViewerWalkModeConfiguration,\n ViewerWalkModeOperation,\n WalkModeModel,\n} from './model';\n\nexport class WalkModeController {\n private excludeTagNames: Array<string> = [\n 'VERTEX-SCENE-TREE',\n 'VERTEX-SCENE-TREE-SEARCH',\n 'VERTEX-VIEWER-PIN-TOOL',\n 'INPUT',\n 'TEXTAREA',\n ];\n\n private excludePredicates: Array<(el: Element) => boolean> = [];\n\n public constructor(private model: WalkModeModel) {\n this.updateModelExclusions();\n }\n\n /**\n * @internal\n */\n public updateModel(model: WalkModeModel): void {\n this.model = model;\n }\n\n /**\n * Sets whether downstream walk mode interaction handlers are enabled.\n * Setting this value to `false` will remove all event listeners for\n * the interactions, and setting this value to `true` will add or\n * re-add the event listeners.\n */\n public setEnabled(enabled: boolean): void {\n this.model.setEnabled(enabled);\n }\n\n /**\n * Sets the `ViewerTeleportMode` to be used with a `<vertex-viewer-teleport-tool>`.\n */\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.model.setTeleportMode(mode);\n }\n\n /**\n * Updates the configuration for downstream walk mode interaction handlers.\n *\n * `teleportHeightPercentage` - percentage used for fine-tuning the distance to offset\n * the camera from a surface when performing a `teleport-and-align`. This percentage is\n * used alongside the shortest side of the visible bounding box to determine how far to\n * place the camera from the surface that has been hit, with a larger percentage placing\n * the camera further from the surface and vice-versa. Defaults to 11.75%.\n *\n * `teleportDistancePercentage` - percentage used for fine-tuning the distance moved per\n * click with the `teleport-toward` mode. This percentage is used alongside the longest\n * side of the visible bounding box to determine how far to move the camera's position\n * with each click, with a larger percentage moving the camera further and vice-versa.\n * Defaults to 2%.\n *\n * `teleportCollisionDistance` - distance used alongside the `teleportCollisionPercentage`\n * to determine whether a click with the `teleport-toward` mode would cause a \"collision\",\n * or would pass through the point clicked. If such a collision would occur, the camera is\n * instead placed this distance back from the point clicked once, then allowed to pass\n * through the point on subsequent clicks. Note that this will not apply if clicks occur\n * in quick succession without setting the `depthBuffers` property on the `<vertex-viewer>`\n * to `all` frames. Defaults to `1000`.\n *\n * `keyboardWalkSpeed` - speed to move the camera when performing keyboard-based\n * walk interactions. A larger number here will result in a faster walk speed through\n * the model and vice-versa. Defaults to `5`.\n *\n * `keyboardPivotDegrees` - number of degrees to move the camera when performing\n * keyboard-based pivot interactions. Defaults to `1`.\n *\n * `keyboardRepeatIntervalMs` - number of milliseconds to repeat keyboard-based interactions.\n * this value is multiplicative with the `keyboardWalkSpeed` and `keyboardPivotDegrees`, and\n * lower numbers will result in faster movement and vice-versa. Defaults to `25`.\n *\n */\n public updateConfiguration(\n configuration: Partial<ViewerWalkModeConfiguration>\n ): void {\n const existing = this.model.getConfiguration();\n\n this.model.setConfiguration({\n ...existing,\n ...configuration,\n });\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will append to the\n * existing set of keybindings to allow for multiple keybindings for a specific\n * operation. To replace the defaults, see `replaceKeyBinding`.\n */\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.addKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will replace any\n * existing keybindings to allow for overriding the default behavior.\n *\n * @example\n * ```\n * const walkModeTool = document.querySelector('vertex-viewer-walk-mode-tool');\n *\n * // Remove keybinding for the `PIVOT_UP` operation\n * walkModeTool.controller.replaceKeyBinding('PIVOT_UP');\n *\n * // Replace keybinding for `WALK_FORWARD` with `ArrowUp` instead of `w`\n * walkModeTool.controller.replaceKeyBinding('WALK_FORWARD', 'ArrowUp');\n * ```\n */\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.replaceKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds an exclusion for specific elements when responding to keyboard\n * events. This is useful when there are other elements on screen that\n * require keyboard interaction and the walk mode handlers should not\n * respond to the keyboard events. Can be either a element's `tagName`\n * or a predicate. Returns a `Disposable` that can be used to remove the\n * exclusion.\n *\n * Default `tagName` exclusions:\n * 'VERTEX-SCENE-TREE'\n * 'VERTEX-SCENE-TREE-SEARCH'\n * 'VERTEX-VIEWER-PIN-TOOL'\n * 'INPUT'\n * 'TEXTAREA'\n */\n public excludeElement(predicate: (el: Element) => boolean): Disposable;\n public excludeElement(tagName: string): Disposable;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public excludeElement(...args: any[]): Disposable {\n if (typeof args[0] === 'string') {\n this.excludeTagNames = [...this.excludeTagNames, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludeTagNames = this.excludeTagNames.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n } else {\n this.excludePredicates = [...this.excludePredicates, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludePredicates = this.excludePredicates.filter(\n (tn) => tn !== args[0]\n );\n },\n };\n }\n }\n\n private updateModelExclusions(): void {\n this.model.setExcludedPredicate(\n (el) =>\n this.excludeTagNames.some((tn) => tn === el.tagName) ||\n this.excludePredicates.some((p) => p(el))\n );\n }\n}\n","import { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\n\nexport interface ViewerWalkModeConfiguration {\n teleportHeightPercentage: number;\n teleportDistancePercentage: number;\n teleportCollisionDistance: number;\n keyboardWalkSpeed: number;\n keyboardPivotDegrees: number;\n keyboardRepeatIntervalMs: number;\n}\n\nexport type ViewerTeleportMode =\n | 'teleport'\n | 'teleport-and-align'\n | 'teleport-toward';\n\nexport enum ViewerWalkModeOperation {\n 'MOVE_DOWN' = 'MOVE_DOWN',\n 'MOVE_UP' = 'MOVE_UP',\n 'PIVOT_DOWN' = 'PIVOT_DOWN',\n 'PIVOT_LEFT' = 'PIVOT_LEFT',\n 'PIVOT_RIGHT' = 'PIVOT_RIGHT',\n 'PIVOT_UP' = 'PIVOT_UP',\n 'WALK_BACKWARD' = 'WALK_BACKWARD',\n 'WALK_FORWARD' = 'WALK_FORWARD',\n 'WALK_LEFT' = 'WALK_LEFT',\n 'WALK_RIGHT' = 'WALK_RIGHT',\n}\n\nexport type ViewerWalkModeKeyBindings = Record<\n ViewerWalkModeOperation,\n KeyBinding[]\n>;\n\nexport class WalkModeModel {\n private keyBindings: ViewerWalkModeKeyBindings = {\n [ViewerWalkModeOperation.MOVE_DOWN]: [\n new KeyBinding('PageDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.MOVE_UP]: [\n new KeyBinding('PageUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_DOWN]: [\n new KeyBinding('ArrowDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_LEFT]: [\n new KeyBinding('ArrowLeft', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_RIGHT]: [\n new KeyBinding('ArrowRight', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_UP]: [\n new KeyBinding('ArrowUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.WALK_BACKWARD]: [new KeyBinding('s')],\n [ViewerWalkModeOperation.WALK_FORWARD]: [new KeyBinding('w')],\n [ViewerWalkModeOperation.WALK_LEFT]: [new KeyBinding('a')],\n [ViewerWalkModeOperation.WALK_RIGHT]: [new KeyBinding('d')],\n };\n\n private configuration: ViewerWalkModeConfiguration = {\n teleportHeightPercentage: 11.75,\n teleportDistancePercentage: 2,\n teleportCollisionDistance: 1000,\n keyboardWalkSpeed: 5,\n keyboardPivotDegrees: 1,\n keyboardRepeatIntervalMs: 25,\n };\n\n private excludedPredicate?: (el: Element) => boolean;\n\n private enabled = true;\n private teleportMode?: ViewerTeleportMode;\n\n private enabledChanged: EventDispatcher<boolean> = new EventDispatcher();\n\n private teleportModeChanged: EventDispatcher<ViewerTeleportMode | undefined> =\n new EventDispatcher<ViewerTeleportMode | undefined>();\n\n private configurationChanged: EventDispatcher<ViewerWalkModeConfiguration> =\n new EventDispatcher<ViewerWalkModeConfiguration>();\n\n private keyBindingsChanged: EventDispatcher<ViewerWalkModeKeyBindings> =\n new EventDispatcher<ViewerWalkModeKeyBindings>();\n\n public setEnabled(enabled: boolean): void {\n this.enabled = enabled;\n this.enabledChanged.emit(enabled);\n }\n\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.teleportMode = mode;\n this.teleportModeChanged.emit(mode);\n }\n\n public setConfiguration(configuration: ViewerWalkModeConfiguration): void {\n this.configuration = configuration;\n this.configurationChanged.emit(configuration);\n }\n\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [...this.keyBindings[operation], keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding\n ): void {\n this.keyBindings[operation] = [keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public setExcludedPredicate(predicate: (el: Element) => boolean): void {\n this.excludedPredicate = predicate;\n }\n\n public getEnabled(): boolean {\n return this.enabled;\n }\n\n public getTeleportMode(): ViewerTeleportMode | undefined {\n return this.teleportMode;\n }\n\n public getTeleportHeightPercentage(): number {\n return this.configuration.teleportHeightPercentage;\n }\n\n public getKeyboardWalkSpeed(): number {\n return this.configuration.keyboardWalkSpeed;\n }\n\n public getKeyboardPivotDegrees(): number {\n return this.configuration.keyboardPivotDegrees;\n }\n\n public getKeyboardRepeatInterval(): number {\n return this.configuration.keyboardRepeatIntervalMs;\n }\n\n public getConfiguration(): ViewerWalkModeConfiguration {\n return this.configuration;\n }\n\n public getKeyBindings(): ViewerWalkModeKeyBindings {\n return this.keyBindings;\n }\n\n public operationMatches(\n operation: ViewerWalkModeOperation,\n state: Record<string, boolean>\n ): boolean {\n return this.keyBindings[operation].some((binding) =>\n binding.matches(state)\n );\n }\n\n public isElementExcluded(el: Element): boolean {\n return !!this.excludedPredicate?.(el);\n }\n\n public onEnabledChange(listener: Listener<boolean>): Disposable {\n return this.enabledChanged.on(listener);\n }\n\n public onTeleportModeChange(\n listener: Listener<ViewerTeleportMode | undefined>\n ): Disposable {\n return this.teleportModeChanged.on(listener);\n }\n\n public onConfigurationChange(\n listener: Listener<ViewerWalkModeConfiguration>\n ): Disposable {\n return this.configurationChanged.on(listener);\n }\n\n public onKeyBindingsChange(\n listener: Listener<ViewerWalkModeKeyBindings>\n ): Disposable {\n return this.keyBindingsChanged.on(listener);\n }\n}\n",":host {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n}\n","import {\n Component,\n Event,\n EventEmitter,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n h,\n Host,\n JSX,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { TeleportInteractionHandler } from '../../lib/teleportation/interactions';\nimport { WalkModeController } from '../../lib/walk-mode/controller';\nimport { ViewerTeleportMode, WalkModeModel } from '../../lib/walk-mode/model';\n\ninterface StateMap {\n shouldClearDepthBuffers?: boolean;\n}\n\n/**\n * The `<vertex-viewer-teleport-tool>` allows for click-based \"teleportation\"\n * around a model, which is particularly useful for walking through a model.\n * This tool is automatically included as part of the <vertex-viewer-walk-mode-tool>.\n */\n@Component({\n tag: 'vertex-viewer-teleport-tool',\n styleUrl: 'viewer-teleport-tool.css',\n shadow: true,\n})\nexport class ViewerTeleportTool {\n /**\n * The viewer that this component is bound to. This is automatically assigned\n * if added to the light-dom of a parent viewer element.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The type of teleportation to perform when clicking.\n *\n * `teleport` - the camera's `position` is moved to the location of the hit result\n * constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `teleport-and-align` - the camera's `position`, `lookAt`, and `up` vectors are updated\n * to align to the plane represented by the hit result's position and normal.\n *\n * `teleport-toward` - the camera's `position` is moved a fixed distance toward the location of the\n * hit result constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `undefined` - no teleportation will occur when clicking.\n *\n * Defaults to `undefined`.\n */\n @Prop({ mutable: true })\n public mode?: ViewerTeleportMode;\n\n /**\n * Indicates whether animations will be used when performing camera\n * operations. Defaults to `false`.\n */\n @Prop()\n public animationsDisabled = false;\n\n /**\n * The duration of animations, in milliseconds. Defaults to `500`.\n */\n @Prop()\n public animationMs?: number = 500;\n\n @Prop({ mutable: true })\n public controller?: WalkModeController;\n\n @Prop({ mutable: true })\n public model: WalkModeModel = new WalkModeModel();\n\n /**\n * Event emitted when the `WalkModeController` associated with this tool changes.\n */\n @Event()\n public controllerChanged!: EventEmitter<WalkModeController>;\n\n private interactionHandlerDisposable?: Disposable;\n private interactionHandler?: TeleportInteractionHandler;\n\n private stateMap: StateMap = {};\n\n /**\n * @ignore\n */\n protected componentWillLoad(): void {\n this.setupController();\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n protected connectedCallback(): void {\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n protected disconnectedCallback(): void {\n this.clearInteractionHandler();\n this.resetDepthBuffers();\n }\n\n /**\n * @ignore\n */\n @Watch('mode')\n protected handleModeChange(): void {\n this.controller?.setTeleportMode(this.mode);\n\n if (this.mode != null) {\n this.setDepthBuffers();\n } else {\n this.resetDepthBuffers();\n }\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(): void {\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n @Watch('animationMs')\n protected handleAnimationMsChanged(): void {\n if (this.animationMs != null) {\n this.interactionHandler?.setAnimations({ durationMs: this.animationMs });\n }\n }\n\n /**\n * @ignore\n */\n @Watch('animationsDisabled')\n protected handleAnimationsDisabledChanged(): void {\n if (this.animationsDisabled) {\n this.interactionHandler?.setAnimations(undefined);\n } else if (this.animationMs != null) {\n this.interactionHandler?.setAnimations({ durationMs: this.animationMs });\n }\n }\n\n /**\n * @ignore\n */\n @Watch('controller')\n protected handleControllerChanged(): void {\n this.setupInteractionHandler();\n this.setupController();\n this.controllerChanged.emit(this.controller);\n }\n\n @Watch('model')\n protected handleModelChanged(): void {\n this.setupController();\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n }\n\n protected render(): JSX.Element {\n return <Host></Host>;\n }\n\n private setupController(): void {\n if (this.controller == null) {\n this.controller = new WalkModeController(this.model);\n this.controller.setTeleportMode(this.mode);\n this.controllerChanged.emit(this.controller);\n } else {\n this.controller.setTeleportMode(this.mode);\n this.controller.updateModel(this.model);\n }\n }\n\n private setDepthBuffers(): void {\n if (\n this.mode != null &&\n this.viewer != null &&\n this.viewer.depthBuffers == null\n ) {\n this.stateMap.shouldClearDepthBuffers = true;\n this.viewer.depthBuffers = 'final';\n }\n }\n\n private resetDepthBuffers(): void {\n if (this.stateMap.shouldClearDepthBuffers && this.viewer != null) {\n this.viewer.depthBuffers = undefined;\n this.stateMap.shouldClearDepthBuffers = undefined;\n }\n }\n\n private clearInteractionHandler(): void {\n this.interactionHandlerDisposable?.dispose();\n this.interactionHandlerDisposable = undefined;\n this.interactionHandler?.dispose();\n this.interactionHandler = undefined;\n }\n\n private async setupInteractionHandler(): Promise<void> {\n if (this.interactionHandler == null) {\n this.interactionHandler = new TeleportInteractionHandler(\n this.model,\n !this.animationsDisabled && this.animationMs != null\n ? { durationMs: this.animationMs }\n : undefined\n );\n\n this.interactionHandlerDisposable =\n await this.viewer?.registerInteractionHandler(this.interactionHandler);\n }\n }\n}\n"],"mappings":";;;oPAiBaA,EAaX,WAAAC,CACUC,EACAC,GADAC,KAAAF,QACAE,KAAAD,yBAXFC,KAAAC,aAAe,IAAIC,EAazBF,KAAKG,kBAAoBH,KAAKG,kBAAkBC,KAAKJ,MACrDA,KAAKK,gBAAkBL,KAAKK,gBAAgBD,KAAKJ,MACjDA,KAAKM,oBAAsBN,KAAKM,oBAAoBF,KAAKJ,MACzDA,KAAKO,yBAA2BP,KAAKO,yBAAyBH,KAAKJ,MAEnEA,KAAKQ,wBAA0BR,KAAKF,MAAMW,gBACxCT,KAAKM,oB,CAIF,OAAAI,G,MACLV,KAAKW,WACLC,EAAAZ,KAAKQ,2BAAuB,MAAAI,SAAA,SAAAA,EAAEF,UAE9BV,KAAKa,QAAUC,UACfd,KAAKe,IAAMD,UAEXd,KAAKC,aAAae,Y,CAGb,UAAAC,CA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AKuO,gCAA4B,MAAA3N,SAAA,SAAAA,EAAEF,UACnCV,KAAKuO,6BAA+BzN,WACpCa,EAAA3B,KAAK4N,sBAAkB,MAAAjM,SAAA,SAAAA,EAAEjB,UACzBV,KAAK4N,mBAAqB9M,S,CAGpB,6BAAMoM,G,MACZ,GAAIlN,KAAK4N,oBAAsB,KAAM,CACnC5N,KAAK4N,mBAAqB,IAAIhO,EAC5BI,KAAKF,OACJE,KAAK6M,oBAAsB7M,KAAK8M,aAAe,KAC5C,CAAEnF,WAAY3H,KAAK8M,aACnBhM,WAGNd,KAAKuO,oCACG3N,EAAAZ,KAAKoO,UAAM,MAAAxN,SAAA,SAAAA,EAAE4N,2BAA2BxO,KAAK4N,oB","ignoreList":[]}
1
+ {"version":3,"names":["TeleportInteractionHandler","constructor","model","animationConfiguration","this","rectObserver","ElementRectObserver","handlePointerDown","bind","handlePointerUp","handleEnabledChange","handleTeleportModeChange","enabledChangeDisposable","onEnabledChange","dispose","disable","_a","element","undefined","api","disconnect","initialize","observe","getEnabled","setAnimations","config","enable","teleportModeChangeDisposable","onTeleportModeChange","addEventListener","getTeleportMode","_b","cursorDisposable","_c","removeEventListener","event","downPosition","getMouseClientPosition","rect","downButtons","buttons","window","mode","threshold","pixelThreshold","point","isRightClick","hasModifier","shiftKey","altKey","metaKey","ctrlKey","Point","distance","teleportToHit","teleportTowardHit","teleportAndAlign","beginInteraction","isInteracting","endInteraction","worldPoint","getWorldPointFromViewport","mouseRay","getRayFromPoint","teleportDistancePercentage","teleportCollisionDistance","getConfiguration","teleportDistanceScalar","performInteraction","camera","boundingBox","stepDistance","Math","max","Vector3","toArray","BoundingBox","lengths","positionPlane","Plane","fromNormalAndCoplanarPoint","up","position","projectedWorldPoint","projectPoint","distanceToWorldPoint","mouseRayAtWorldPoint","Ray","create","origin","nextPosition","at","update","lookAt","add","subtract","projectedNextStep","getWorldPointWithFallback","shortestBoundingBoxLength","shortestLength","heightScalar","getTeleportHeightPercentage","cameraPlane","projectedHitPosition","rayToHitPosition","direction","normalize","distanceToHitPosition","distanceToLookAt","newPosition","newPositionViewVectorRay","viewVector","hits","hitItems","hit","hitNormal","hitPoint","upRay","alignTo","fn","transformCamera","renderConfiguration","enabled","addCursor","min","animation","milliseconds","durationMs","KeyBinding","bindings","map","binding","toLowerCase","matches","keys","length","every","bindingMatches","negated","includes","key","replace","WalkModeController","excludeTagNames","excludePredicates","updateModelExclusions","updateModel","setEnabled","setTeleportMode","updateConfiguration","configuration","existing","setConfiguration","addKeyBinding","operation","replaceKeyBinding","excludeElement","args","filter","tn","setExcludedPredicate","el","some","tagName","p","ViewerWalkModeOperation","WalkModeModel","keyBindings","MOVE_DOWN","MOVE_UP","PIVOT_DOWN","PIVOT_LEFT","PIVOT_RIGHT","PIVOT_UP","WALK_BACKWARD","WALK_FORWARD","WALK_LEFT","WALK_RIGHT","teleportHeightPercentage","keyboardWalkSpeed","keyboardPivotDegrees","keyboardRepeatIntervalMs","enabledChanged","EventDispatcher","teleportModeChanged","configurationChanged","keyBindingsChanged","emit","teleportMode","keyBinding","predicate","excludedPredicate","getKeyboardWalkSpeed","getKeyboardPivotDegrees","getKeyboardRepeatInterval","getKeyBindings","operationMatches","state","isElementExcluded","call","listener","on","onConfigurationChange","onKeyBindingsChange","viewerTeleportToolCss","ViewerTeleportTool","__stencil_proxyCustomElement","HTMLElement","registerHost","animationsDisabled","animationMs","stateMap","componentWillLoad","setupController","setupInteractionHandler","setDepthBuffers","connectedCallback","disconnectedCallback","clearInteractionHandler","resetDepthBuffers","handleModeChange","controller","handleViewerChanged","handleAnimationMsChanged","interactionHandler","handleAnimationsDisabledChanged","handleControllerChanged","controllerChanged","handleModelChanged","render","h","Host","viewer","depthBuffers","shouldClearDepthBuffers","interactionHandlerDisposable","registerInteractionHandler"],"sources":["src/lib/teleportation/interactions.ts","src/lib/keyBinding.ts","src/lib/walk-mode/controller.ts","src/lib/walk-mode/model.ts","src/components/viewer-teleport-tool/viewer-teleport-tool.css?tag=vertex-viewer-teleport-tool&encapsulation=shadow","src/components/viewer-teleport-tool/viewer-teleport-tool.tsx"],"sourcesContent":["import { BoundingBox, Plane, Point, Ray, Vector3 } from '@vertexvis/geometry';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { getMouseClientPosition } from '../dom';\nimport { ElementRectObserver } from '../elementRectObserver';\nimport {\n CameraTransform,\n InteractionApi,\n InteractionHandler,\n} from '../interactions';\nimport { Camera, CameraRenderOptions } from '../scenes';\nimport { ViewerTeleportMode, WalkModeModel } from '../walk-mode/model';\n\nexport interface AnimationConfiguration {\n durationMs: number;\n}\n\nexport class TeleportInteractionHandler implements InteractionHandler {\n private api?: InteractionApi;\n private element?: HTMLElement;\n\n private rectObserver = new ElementRectObserver();\n\n private downPosition?: Point.Point;\n private downButtons?: number;\n\n private enabledChangeDisposable?: Disposable;\n private teleportModeChangeDisposable?: Disposable;\n private cursorDisposable?: Disposable;\n\n public constructor(\n private model: WalkModeModel,\n private animationConfiguration?: AnimationConfiguration,\n ) {\n this.handlePointerDown = this.handlePointerDown.bind(this);\n this.handlePointerUp = this.handlePointerUp.bind(this);\n this.handleEnabledChange = this.handleEnabledChange.bind(this);\n this.handleTeleportModeChange = this.handleTeleportModeChange.bind(this);\n\n this.enabledChangeDisposable = this.model.onEnabledChange(\n this.handleEnabledChange,\n );\n }\n\n public dispose(): void {\n this.disable();\n this.enabledChangeDisposable?.dispose();\n\n this.element = undefined;\n this.api = undefined;\n\n this.rectObserver.disconnect();\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.api = api;\n\n this.rectObserver.observe(element);\n\n this.handleEnabledChange(this.model.getEnabled());\n }\n\n public setAnimations(config?: AnimationConfiguration): void {\n this.animationConfiguration = config;\n }\n\n public enable(): void {\n this.disable();\n\n this.teleportModeChangeDisposable = this.model.onTeleportModeChange(\n this.handleTeleportModeChange,\n );\n this.element?.addEventListener('pointerdown', this.handlePointerDown);\n\n this.handleTeleportModeChange(this.model.getTeleportMode());\n }\n\n public disable(): void {\n this.teleportModeChangeDisposable?.dispose();\n this.cursorDisposable?.dispose();\n\n this.element?.removeEventListener('pointerdown', this.handlePointerDown);\n }\n\n private async handlePointerDown(event: PointerEvent): Promise<void> {\n this.downPosition = getMouseClientPosition(event, this.rectObserver.rect);\n this.downButtons = event.buttons;\n\n window.addEventListener('pointerup', this.handlePointerUp);\n }\n\n private async handlePointerUp(event: PointerEvent): Promise<void> {\n const mode = this.model.getTeleportMode();\n const threshold = this.api?.pixelThreshold() ?? 2;\n const point = getMouseClientPosition(event, this.rectObserver.rect);\n const isRightClick = this.downButtons === 2;\n const hasModifier =\n event.shiftKey || event.altKey || event.metaKey || event.ctrlKey;\n\n if (\n mode != null &&\n this.downPosition != null &&\n Point.distance(this.downPosition, point) <= threshold &&\n !isRightClick &&\n !hasModifier\n ) {\n switch (mode) {\n case 'teleport':\n return this.teleportToHit(point);\n case 'teleport-toward':\n return this.teleportTowardHit(point);\n case 'teleport-and-align':\n return this.teleportAndAlign(point);\n }\n }\n\n this.downPosition = undefined;\n\n window.removeEventListener('pointerup', this.handlePointerUp);\n }\n\n private async beginInteraction(): Promise<void> {\n if (!this.api?.isInteracting()) {\n await this.api?.beginInteraction();\n }\n }\n\n private async endInteraction(): Promise<void> {\n await this.api?.endInteraction();\n }\n\n private async teleportTowardHit(point: Point.Point): Promise<void> {\n const worldPoint = await this.api?.getWorldPointFromViewport(point);\n const mouseRay = this.api?.getRayFromPoint(point);\n\n if (mouseRay != null) {\n const { teleportDistancePercentage, teleportCollisionDistance } =\n this.model.getConfiguration();\n const teleportDistanceScalar = teleportDistancePercentage / 100;\n\n return this.performInteraction(({ camera, boundingBox }) => {\n const stepDistance =\n Math.max(...Vector3.toArray(BoundingBox.lengths(boundingBox))) *\n teleportDistanceScalar;\n\n const positionPlane = Plane.fromNormalAndCoplanarPoint(\n camera.up,\n camera.position,\n );\n const projectedWorldPoint = Plane.projectPoint(\n positionPlane,\n worldPoint ?? camera.position,\n );\n const distanceToWorldPoint = Vector3.distance(\n camera.position,\n projectedWorldPoint,\n );\n\n if (\n distanceToWorldPoint < stepDistance &&\n distanceToWorldPoint > teleportCollisionDistance * 1.1\n ) {\n const mouseRayAtWorldPoint = Ray.create({\n ...mouseRay,\n origin: projectedWorldPoint,\n });\n const nextPosition = Plane.projectPoint(\n positionPlane,\n Ray.at(mouseRayAtWorldPoint, -teleportCollisionDistance),\n );\n\n return camera.update({\n position: nextPosition,\n lookAt: Vector3.add(\n camera.lookAt,\n Vector3.subtract(nextPosition, camera.position),\n ),\n });\n } else {\n const projectedNextStep = Plane.projectPoint(\n positionPlane,\n Ray.at(mouseRay, stepDistance),\n );\n\n return camera.update({\n position: projectedNextStep,\n lookAt: Vector3.add(\n camera.lookAt,\n Vector3.subtract(projectedNextStep, camera.position),\n ),\n });\n }\n });\n }\n }\n\n private async teleportToHit(point: Point.Point): Promise<void> {\n const worldPoint = await this.getWorldPointWithFallback(point);\n\n if (worldPoint != null) {\n return this.performInteraction(({ camera, boundingBox }) => {\n const shortestBoundingBoxLength = this.shortestLength(boundingBox);\n const heightScalar = this.model.getTeleportHeightPercentage() / 100;\n\n const cameraPlane = Plane.fromNormalAndCoplanarPoint(\n camera.up,\n camera.position,\n );\n const projectedHitPosition = Plane.projectPoint(\n cameraPlane,\n worldPoint,\n );\n\n const rayToHitPosition = Ray.create({\n origin: camera.position,\n direction: Vector3.normalize(\n Vector3.subtract(projectedHitPosition, camera.position),\n ),\n });\n const distanceToHitPosition = Vector3.distance(\n camera.position,\n projectedHitPosition,\n );\n const distanceToLookAt = Vector3.distance(\n camera.position,\n camera.lookAt,\n );\n\n const newPosition = Ray.at(\n rayToHitPosition,\n distanceToHitPosition - shortestBoundingBoxLength * heightScalar,\n );\n const newPositionViewVectorRay = Ray.create({\n origin: newPosition,\n direction: Vector3.normalize(camera.viewVector),\n });\n\n return camera.update({\n position: newPosition,\n lookAt: Ray.at(newPositionViewVectorRay, distanceToLookAt),\n });\n });\n }\n }\n\n private async teleportAndAlign(point: Point.Point): Promise<void> {\n const hits = await this.api?.hitItems(point);\n const hit = hits != null ? hits[0] : undefined;\n\n if (hit?.hitNormal != null && hit?.hitPoint) {\n await this.performInteraction(({ camera, boundingBox }) => {\n const shortestBoundingBoxLength = this.shortestLength(boundingBox);\n const heightScalar = this.model.getTeleportHeightPercentage() / 100;\n\n const upRay = Ray.create({\n origin: hit.hitPoint as Vector3.Vector3,\n direction: hit.hitNormal as Vector3.Vector3,\n });\n\n return camera.alignTo(\n Ray.at(upRay, shortestBoundingBoxLength * heightScalar),\n hit.hitNormal as Vector3.Vector3,\n );\n });\n }\n }\n\n private async performInteraction(fn: CameraTransform<Camera>): Promise<void> {\n await this.beginInteraction();\n await this.api?.transformCamera(fn, this.renderConfiguration());\n await this.endInteraction();\n }\n\n private async getWorldPointWithFallback(\n point: Point.Point,\n ): Promise<Vector3.Vector3 | undefined> {\n const worldPoint = await this.api?.getWorldPointFromViewport(point);\n\n if (worldPoint == null) {\n const hits = await this.api?.hitItems(point);\n const hit = hits != null ? hits[0] : undefined;\n\n return hit?.hitPoint != null\n ? (hit.hitPoint as Vector3.Vector3)\n : worldPoint;\n }\n return worldPoint;\n }\n\n private handleEnabledChange(enabled: boolean): void {\n if (enabled) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n private handleTeleportModeChange(mode?: ViewerTeleportMode): void {\n this.cursorDisposable?.dispose();\n\n if (mode != null) {\n this.cursorDisposable = this.api?.addCursor('crosshair');\n }\n }\n\n private shortestLength(boundingBox: BoundingBox.BoundingBox): number {\n return Math.min(...Vector3.toArray(BoundingBox.lengths(boundingBox)));\n }\n\n private renderConfiguration(): CameraRenderOptions {\n return this.animationConfiguration != null\n ? { animation: { milliseconds: this.animationConfiguration.durationMs } }\n : {};\n }\n}\n","export class KeyBinding {\n private bindings: string[];\n\n public constructor(...bindings: string[]) {\n this.bindings = bindings.map((binding) => binding.toLowerCase());\n }\n\n public matches(keys: Record<string, boolean>): boolean {\n return (\n this.bindings.length > 0 &&\n this.bindings.every((binding) => this.bindingMatches(keys, binding))\n );\n }\n\n private bindingMatches(\n keys: Record<string, boolean>,\n binding: string,\n ): boolean {\n const negated = binding.includes('!');\n const key = binding.replace('!', '');\n\n return negated ? !keys[key] : keys[key];\n }\n}\n","import { Disposable } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\nimport {\n ViewerTeleportMode,\n ViewerWalkModeConfiguration,\n ViewerWalkModeOperation,\n WalkModeModel,\n} from './model';\n\nexport class WalkModeController {\n private excludeTagNames: Array<string> = [\n 'VERTEX-SCENE-TREE',\n 'VERTEX-SCENE-TREE-SEARCH',\n 'VERTEX-VIEWER-PIN-TOOL',\n 'INPUT',\n 'TEXTAREA',\n ];\n\n private excludePredicates: Array<(el: Element) => boolean> = [];\n\n public constructor(private model: WalkModeModel) {\n this.updateModelExclusions();\n }\n\n /**\n * @internal\n */\n public updateModel(model: WalkModeModel): void {\n this.model = model;\n }\n\n /**\n * Sets whether downstream walk mode interaction handlers are enabled.\n * Setting this value to `false` will remove all event listeners for\n * the interactions, and setting this value to `true` will add or\n * re-add the event listeners.\n */\n public setEnabled(enabled: boolean): void {\n this.model.setEnabled(enabled);\n }\n\n /**\n * Sets the `ViewerTeleportMode` to be used with a `<vertex-viewer-teleport-tool>`.\n */\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.model.setTeleportMode(mode);\n }\n\n /**\n * Updates the configuration for downstream walk mode interaction handlers.\n *\n * `teleportHeightPercentage` - percentage used for fine-tuning the distance to offset\n * the camera from a surface when performing a `teleport-and-align`. This percentage is\n * used alongside the shortest side of the visible bounding box to determine how far to\n * place the camera from the surface that has been hit, with a larger percentage placing\n * the camera further from the surface and vice-versa. Defaults to 11.75%.\n *\n * `teleportDistancePercentage` - percentage used for fine-tuning the distance moved per\n * click with the `teleport-toward` mode. This percentage is used alongside the longest\n * side of the visible bounding box to determine how far to move the camera's position\n * with each click, with a larger percentage moving the camera further and vice-versa.\n * Defaults to 2%.\n *\n * `teleportCollisionDistance` - distance used alongside the `teleportCollisionPercentage`\n * to determine whether a click with the `teleport-toward` mode would cause a \"collision\",\n * or would pass through the point clicked. If such a collision would occur, the camera is\n * instead placed this distance back from the point clicked once, then allowed to pass\n * through the point on subsequent clicks. Note that this will not apply if clicks occur\n * in quick succession without setting the `depthBuffers` property on the `<vertex-viewer>`\n * to `all` frames. Defaults to `1000`.\n *\n * `keyboardWalkSpeed` - speed to move the camera when performing keyboard-based\n * walk interactions. A larger number here will result in a faster walk speed through\n * the model and vice-versa. Defaults to `5`.\n *\n * `keyboardPivotDegrees` - number of degrees to move the camera when performing\n * keyboard-based pivot interactions. Defaults to `1`.\n *\n * `keyboardRepeatIntervalMs` - number of milliseconds to repeat keyboard-based interactions.\n * this value is multiplicative with the `keyboardWalkSpeed` and `keyboardPivotDegrees`, and\n * lower numbers will result in faster movement and vice-versa. Defaults to `25`.\n *\n */\n public updateConfiguration(\n configuration: Partial<ViewerWalkModeConfiguration>,\n ): void {\n const existing = this.model.getConfiguration();\n\n this.model.setConfiguration({\n ...existing,\n ...configuration,\n });\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will append to the\n * existing set of keybindings to allow for multiple keybindings for a specific\n * operation. To replace the defaults, see `replaceKeyBinding`.\n */\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.addKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds a custom keybinding for a specific walk operation. This will replace any\n * existing keybindings to allow for overriding the default behavior.\n *\n * @example\n * ```\n * const walkModeTool = document.querySelector('vertex-viewer-walk-mode-tool');\n *\n * // Remove keybinding for the `PIVOT_UP` operation\n * walkModeTool.controller.replaceKeyBinding('PIVOT_UP');\n *\n * // Replace keybinding for `WALK_FORWARD` with `ArrowUp` instead of `w`\n * walkModeTool.controller.replaceKeyBinding('WALK_FORWARD', 'ArrowUp');\n * ```\n */\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n ...keys: string[]\n ): void {\n this.model.replaceKeyBinding(operation, new KeyBinding(...keys));\n }\n\n /**\n * Adds an exclusion for specific elements when responding to keyboard\n * events. This is useful when there are other elements on screen that\n * require keyboard interaction and the walk mode handlers should not\n * respond to the keyboard events. Can be either a element's `tagName`\n * or a predicate. Returns a `Disposable` that can be used to remove the\n * exclusion.\n *\n * Default `tagName` exclusions:\n * 'VERTEX-SCENE-TREE'\n * 'VERTEX-SCENE-TREE-SEARCH'\n * 'VERTEX-VIEWER-PIN-TOOL'\n * 'INPUT'\n * 'TEXTAREA'\n */\n public excludeElement(predicate: (el: Element) => boolean): Disposable;\n public excludeElement(tagName: string): Disposable;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public excludeElement(...args: any[]): Disposable {\n if (typeof args[0] === 'string') {\n this.excludeTagNames = [...this.excludeTagNames, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludeTagNames = this.excludeTagNames.filter(\n (tn) => tn !== args[0],\n );\n },\n };\n } else {\n this.excludePredicates = [...this.excludePredicates, args[0]];\n\n this.updateModelExclusions();\n\n return {\n dispose: () => {\n this.excludePredicates = this.excludePredicates.filter(\n (tn) => tn !== args[0],\n );\n },\n };\n }\n }\n\n private updateModelExclusions(): void {\n this.model.setExcludedPredicate(\n (el) =>\n this.excludeTagNames.some((tn) => tn === el.tagName) ||\n this.excludePredicates.some((p) => p(el)),\n );\n }\n}\n","import { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { KeyBinding } from '../keyBinding';\n\nexport interface ViewerWalkModeConfiguration {\n teleportHeightPercentage: number;\n teleportDistancePercentage: number;\n teleportCollisionDistance: number;\n keyboardWalkSpeed: number;\n keyboardPivotDegrees: number;\n keyboardRepeatIntervalMs: number;\n}\n\nexport type ViewerTeleportMode =\n | 'teleport'\n | 'teleport-and-align'\n | 'teleport-toward';\n\nexport enum ViewerWalkModeOperation {\n 'MOVE_DOWN' = 'MOVE_DOWN',\n 'MOVE_UP' = 'MOVE_UP',\n 'PIVOT_DOWN' = 'PIVOT_DOWN',\n 'PIVOT_LEFT' = 'PIVOT_LEFT',\n 'PIVOT_RIGHT' = 'PIVOT_RIGHT',\n 'PIVOT_UP' = 'PIVOT_UP',\n 'WALK_BACKWARD' = 'WALK_BACKWARD',\n 'WALK_FORWARD' = 'WALK_FORWARD',\n 'WALK_LEFT' = 'WALK_LEFT',\n 'WALK_RIGHT' = 'WALK_RIGHT',\n}\n\nexport type ViewerWalkModeKeyBindings = Record<\n ViewerWalkModeOperation,\n KeyBinding[]\n>;\n\nexport class WalkModeModel {\n private keyBindings: ViewerWalkModeKeyBindings = {\n [ViewerWalkModeOperation.MOVE_DOWN]: [\n new KeyBinding('PageDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.MOVE_UP]: [\n new KeyBinding('PageUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_DOWN]: [\n new KeyBinding('ArrowDown', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_LEFT]: [\n new KeyBinding('ArrowLeft', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_RIGHT]: [\n new KeyBinding('ArrowRight', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.PIVOT_UP]: [\n new KeyBinding('ArrowUp', '!Shift', '!Alt'),\n ],\n [ViewerWalkModeOperation.WALK_BACKWARD]: [new KeyBinding('s')],\n [ViewerWalkModeOperation.WALK_FORWARD]: [new KeyBinding('w')],\n [ViewerWalkModeOperation.WALK_LEFT]: [new KeyBinding('a')],\n [ViewerWalkModeOperation.WALK_RIGHT]: [new KeyBinding('d')],\n };\n\n private configuration: ViewerWalkModeConfiguration = {\n teleportHeightPercentage: 11.75,\n teleportDistancePercentage: 2,\n teleportCollisionDistance: 1000,\n keyboardWalkSpeed: 5,\n keyboardPivotDegrees: 1,\n keyboardRepeatIntervalMs: 25,\n };\n\n private excludedPredicate?: (el: Element) => boolean;\n\n private enabled = true;\n private teleportMode?: ViewerTeleportMode;\n\n private enabledChanged: EventDispatcher<boolean> = new EventDispatcher();\n\n private teleportModeChanged: EventDispatcher<ViewerTeleportMode | undefined> =\n new EventDispatcher<ViewerTeleportMode | undefined>();\n\n private configurationChanged: EventDispatcher<ViewerWalkModeConfiguration> =\n new EventDispatcher<ViewerWalkModeConfiguration>();\n\n private keyBindingsChanged: EventDispatcher<ViewerWalkModeKeyBindings> =\n new EventDispatcher<ViewerWalkModeKeyBindings>();\n\n public setEnabled(enabled: boolean): void {\n this.enabled = enabled;\n this.enabledChanged.emit(enabled);\n }\n\n public setTeleportMode(mode?: ViewerTeleportMode): void {\n this.teleportMode = mode;\n this.teleportModeChanged.emit(mode);\n }\n\n public setConfiguration(configuration: ViewerWalkModeConfiguration): void {\n this.configuration = configuration;\n this.configurationChanged.emit(configuration);\n }\n\n public addKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding,\n ): void {\n this.keyBindings[operation] = [...this.keyBindings[operation], keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public replaceKeyBinding(\n operation: ViewerWalkModeOperation,\n keyBinding: KeyBinding,\n ): void {\n this.keyBindings[operation] = [keyBinding];\n this.keyBindingsChanged.emit(this.keyBindings);\n }\n\n public setExcludedPredicate(predicate: (el: Element) => boolean): void {\n this.excludedPredicate = predicate;\n }\n\n public getEnabled(): boolean {\n return this.enabled;\n }\n\n public getTeleportMode(): ViewerTeleportMode | undefined {\n return this.teleportMode;\n }\n\n public getTeleportHeightPercentage(): number {\n return this.configuration.teleportHeightPercentage;\n }\n\n public getKeyboardWalkSpeed(): number {\n return this.configuration.keyboardWalkSpeed;\n }\n\n public getKeyboardPivotDegrees(): number {\n return this.configuration.keyboardPivotDegrees;\n }\n\n public getKeyboardRepeatInterval(): number {\n return this.configuration.keyboardRepeatIntervalMs;\n }\n\n public getConfiguration(): ViewerWalkModeConfiguration {\n return this.configuration;\n }\n\n public getKeyBindings(): ViewerWalkModeKeyBindings {\n return this.keyBindings;\n }\n\n public operationMatches(\n operation: ViewerWalkModeOperation,\n state: Record<string, boolean>,\n ): boolean {\n return this.keyBindings[operation].some((binding) =>\n binding.matches(state),\n );\n }\n\n public isElementExcluded(el: Element): boolean {\n return !!this.excludedPredicate?.(el);\n }\n\n public onEnabledChange(listener: Listener<boolean>): Disposable {\n return this.enabledChanged.on(listener);\n }\n\n public onTeleportModeChange(\n listener: Listener<ViewerTeleportMode | undefined>,\n ): Disposable {\n return this.teleportModeChanged.on(listener);\n }\n\n public onConfigurationChange(\n listener: Listener<ViewerWalkModeConfiguration>,\n ): Disposable {\n return this.configurationChanged.on(listener);\n }\n\n public onKeyBindingsChange(\n listener: Listener<ViewerWalkModeKeyBindings>,\n ): Disposable {\n return this.keyBindingsChanged.on(listener);\n }\n}\n",":host {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n}\n","import {\n Component,\n Event,\n EventEmitter,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n h,\n Host,\n JSX,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { TeleportInteractionHandler } from '../../lib/teleportation/interactions';\nimport { WalkModeController } from '../../lib/walk-mode/controller';\nimport { ViewerTeleportMode, WalkModeModel } from '../../lib/walk-mode/model';\n\ninterface StateMap {\n shouldClearDepthBuffers?: boolean;\n}\n\n/**\n * The `<vertex-viewer-teleport-tool>` allows for click-based \"teleportation\"\n * around a model, which is particularly useful for walking through a model.\n * This tool is automatically included as part of the <vertex-viewer-walk-mode-tool>.\n */\n@Component({\n tag: 'vertex-viewer-teleport-tool',\n styleUrl: 'viewer-teleport-tool.css',\n shadow: true,\n})\nexport class ViewerTeleportTool {\n /**\n * The viewer that this component is bound to. This is automatically assigned\n * if added to the light-dom of a parent viewer element.\n */\n @Prop()\n public viewer?: HTMLVertexViewerElement;\n\n /**\n * The type of teleportation to perform when clicking.\n *\n * `teleport` - the camera's `position` is moved to the location of the hit result\n * constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `teleport-and-align` - the camera's `position`, `lookAt`, and `up` vectors are updated\n * to align to the plane represented by the hit result's position and normal.\n *\n * `teleport-toward` - the camera's `position` is moved a fixed distance toward the location of the\n * hit result constrained by the plane represented by the camera's current `position` and `up`\n * vectors.\n *\n * `undefined` - no teleportation will occur when clicking.\n *\n * Defaults to `undefined`.\n */\n @Prop({ mutable: true })\n public mode?: ViewerTeleportMode;\n\n /**\n * Indicates whether animations will be used when performing camera\n * operations. Defaults to `false`.\n */\n @Prop()\n public animationsDisabled = false;\n\n /**\n * The duration of animations, in milliseconds. Defaults to `500`.\n */\n @Prop()\n public animationMs?: number = 500;\n\n @Prop({ mutable: true })\n public controller?: WalkModeController;\n\n @Prop({ mutable: true })\n public model: WalkModeModel = new WalkModeModel();\n\n /**\n * Event emitted when the `WalkModeController` associated with this tool changes.\n */\n @Event()\n public controllerChanged!: EventEmitter<WalkModeController>;\n\n private interactionHandlerDisposable?: Disposable;\n private interactionHandler?: TeleportInteractionHandler;\n\n private stateMap: StateMap = {};\n\n /**\n * @ignore\n */\n protected componentWillLoad(): void {\n this.setupController();\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n protected connectedCallback(): void {\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n protected disconnectedCallback(): void {\n this.clearInteractionHandler();\n this.resetDepthBuffers();\n }\n\n /**\n * @ignore\n */\n @Watch('mode')\n protected handleModeChange(): void {\n this.controller?.setTeleportMode(this.mode);\n\n if (this.mode != null) {\n this.setDepthBuffers();\n } else {\n this.resetDepthBuffers();\n }\n }\n\n /**\n * @ignore\n */\n @Watch('viewer')\n protected handleViewerChanged(): void {\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n this.setDepthBuffers();\n }\n\n /**\n * @ignore\n */\n @Watch('animationMs')\n protected handleAnimationMsChanged(): void {\n if (this.animationMs != null) {\n this.interactionHandler?.setAnimations({ durationMs: this.animationMs });\n }\n }\n\n /**\n * @ignore\n */\n @Watch('animationsDisabled')\n protected handleAnimationsDisabledChanged(): void {\n if (this.animationsDisabled) {\n this.interactionHandler?.setAnimations(undefined);\n } else if (this.animationMs != null) {\n this.interactionHandler?.setAnimations({ durationMs: this.animationMs });\n }\n }\n\n /**\n * @ignore\n */\n @Watch('controller')\n protected handleControllerChanged(): void {\n this.setupInteractionHandler();\n this.setupController();\n this.controllerChanged.emit(this.controller);\n }\n\n @Watch('model')\n protected handleModelChanged(): void {\n this.setupController();\n this.clearInteractionHandler();\n this.setupInteractionHandler();\n }\n\n protected render(): JSX.Element {\n return <Host></Host>;\n }\n\n private setupController(): void {\n if (this.controller == null) {\n this.controller = new WalkModeController(this.model);\n this.controller.setTeleportMode(this.mode);\n this.controllerChanged.emit(this.controller);\n } else {\n this.controller.setTeleportMode(this.mode);\n this.controller.updateModel(this.model);\n }\n }\n\n private setDepthBuffers(): void {\n if (\n this.mode != null &&\n this.viewer != null &&\n this.viewer.depthBuffers == null\n ) {\n this.stateMap.shouldClearDepthBuffers = true;\n this.viewer.depthBuffers = 'final';\n }\n }\n\n private resetDepthBuffers(): void {\n if (this.stateMap.shouldClearDepthBuffers && this.viewer != null) {\n this.viewer.depthBuffers = undefined;\n this.stateMap.shouldClearDepthBuffers = undefined;\n }\n }\n\n private clearInteractionHandler(): void {\n this.interactionHandlerDisposable?.dispose();\n this.interactionHandlerDisposable = undefined;\n this.interactionHandler?.dispose();\n this.interactionHandler = undefined;\n }\n\n private async setupInteractionHandler(): Promise<void> {\n if (this.interactionHandler == null) {\n this.interactionHandler = new TeleportInteractionHandler(\n this.model,\n !this.animationsDisabled && this.animationMs != null\n ? { durationMs: this.animationMs }\n : undefined,\n );\n\n this.interactionHandlerDisposable =\n await this.viewer?.registerInteractionHandler(this.interactionHandler);\n }\n }\n}\n"],"mappings":";;;oPAiBaA,EAaX,WAAAC,CACUC,EACAC,GADAC,KAAAF,QACAE,KAAA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AKvL,KAAKyN,W,KAC5B,CACLzN,KAAKyN,WAAWzE,gBAAgBhJ,KAAKsC,MACrCtC,KAAKyN,WAAW3E,YAAY9I,KAAKF,M,EAI7B,eAAAqN,GACN,GACEnN,KAAKsC,MAAQ,MACbtC,KAAKoO,QAAU,MACfpO,KAAKoO,OAAOC,cAAgB,KAC5B,CACArO,KAAK+M,SAASuB,wBAA0B,KACxCtO,KAAKoO,OAAOC,aAAe,O,EAIvB,iBAAAd,GACN,GAAIvN,KAAK+M,SAASuB,yBAA2BtO,KAAKoO,QAAU,KAAM,CAChEpO,KAAKoO,OAAOC,aAAevN,UAC3Bd,KAAK+M,SAASuB,wBAA0BxN,S,EAIpC,uBAAAwM,G,SACN1M,EAAAZ,KAAKuO,gCAA4B,MAAA3N,SAAA,SAAAA,EAAEF,UACnCV,KAAKuO,6BAA+BzN,WACpCa,EAAA3B,KAAK4N,sBAAkB,MAAAjM,SAAA,SAAAA,EAAEjB,UACzBV,KAAK4N,mBAAqB9M,S,CAGpB,6BAAMoM,G,MACZ,GAAIlN,KAAK4N,oBAAsB,KAAM,CACnC5N,KAAK4N,mBAAqB,IAAIhO,EAC5BI,KAAKF,OACJE,KAAK6M,oBAAsB7M,KAAK8M,aAAe,KAC5C,CAAEnF,WAAY3H,KAAK8M,aACnBhM,WAGNd,KAAKuO,oCACG3N,EAAAZ,KAAKoO,UAAM,MAAAxN,SAAA,SAAAA,EAAE4N,2BAA2BxO,KAAK4N,oB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["MeasurementModel","constructor","this","entities","Set","results","entitiesChanged","EventDispatcher","outcomeChanged","addEntity","entity","has","add","emit","getEntities","clearEntities","forEach","e","removeEntity","clearOutcome","setOutcome","undefined","outcome","Objects","isEqual","Array","from","getOutcome","getResults","delete","setEntities","clear","onOutcomeChanged","listener","on","onEntitiesChanged"],"sources":["src/lib/measurement/model.ts"],"sourcesContent":["import {\n Disposable,\n EventDispatcher,\n Listener,\n Objects,\n} from '@vertexvis/utils';\n\nimport { MeasurementEntity } from './entities';\nimport { MeasurementOutcome } from './outcomes';\nimport { MeasurementResult } from './results';\n\n/**\n * A model representing the state of measurement.\n *\n * Measurement contains a set of `MeasureEntity`s that represent what's being\n * measured, and a set of `MeasurementResult`s representing the results of the\n * measurement.\n *\n * Views can register event listeners to the model to be notified when new\n * measurements have been added.\n */\nexport class MeasurementModel {\n private entities = new Set<MeasurementEntity>();\n private outcome?: MeasurementOutcome;\n private results = new Set<MeasurementResult>();\n\n private entitiesChanged = new EventDispatcher<MeasurementEntity[]>();\n\n private outcomeChanged = new EventDispatcher<\n MeasurementOutcome | undefined\n >();\n\n /**\n * Registers an entity to be measured with the model.\n *\n * @param entity An entity to measure.\n * @returns `true` if the entity has been added.\n */\n public addEntity(entity: MeasurementEntity): boolean {\n if (!this.entities.has(entity)) {\n this.entities.add(entity);\n this.entitiesChanged.emit(this.getEntities());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Clears all registered entities from the model.\n */\n public clearEntities(): void {\n this.entities.forEach((e) => this.removeEntity(e));\n }\n\n /**\n * Clears the outcome containing the results of a measurement.\n */\n public clearOutcome(): void {\n this.setOutcome(undefined);\n }\n\n /**\n * Sets the outcome containing the results of a measurement.\n *\n * Emits a _outcome changed_ event.\n *\n * @param outcome The outcome containing results.\n */\n public setOutcome(outcome: MeasurementOutcome | undefined): void {\n if (!Objects.isEqual(this.outcome, outcome)) {\n this.outcome = outcome;\n this.outcomeChanged.emit(outcome);\n }\n }\n\n /**\n * Returns all the entities registered with the model.\n */\n public getEntities(): MeasurementEntity[] {\n return Array.from(this.entities);\n }\n\n /**\n * Returns the outcome that contains the results of a measurement.\n */\n public getOutcome(): MeasurementOutcome | undefined {\n return this.outcome;\n }\n\n /**\n * Returns all the measurement results of the model.\n */\n public getResults(): MeasurementResult[] {\n return Array.from(this.results);\n }\n\n /**\n * Unregisters an entity from the model.\n *\n * @param entity The entity to remove.\n * @returns `true` if the entity was removed.\n */\n public removeEntity(entity: MeasurementEntity): boolean {\n if (this.entities.has(entity)) {\n this.entities.delete(entity);\n this.entitiesChanged.emit(this.getEntities());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Sets the set of entities to be measured with the model.\n *\n * @param entities A set of entities to measure.\n * @returns `true` if the entity has been added.\n */\n public setEntities(entities: Set<MeasurementEntity>): boolean {\n this.entities.clear();\n entities.forEach((e) => this.entities.add(e));\n this.entitiesChanged.emit(this.getEntities());\n return true;\n }\n\n /**\n * Registers an event listener that will be invoked when the model's outcome\n * changes.\n *\n * @param listener The listener to add.\n * @returns A disposable that can be used to remove the listener.\n */\n public onOutcomeChanged(\n listener: Listener<MeasurementOutcome | undefined>\n ): Disposable {\n return this.outcomeChanged.on(listener);\n }\n\n /**\n * Registers an event listener that will be invoked when the model's\n * measurement entities change.\n *\n * @param listener The listener to add.\n * @returns A disposable that can be used to remove the listener.\n */\n public onEntitiesChanged(\n listener: Listener<MeasurementEntity[]>\n ): Disposable {\n return this.entitiesChanged.on(listener);\n }\n}\n"],"mappings":";;;iDAqBaA,EAAb,WAAAC,GACUC,KAAAC,SAAW,IAAIC,IAEfF,KAAAG,QAAU,IAAID,IAEdF,KAAAI,gBAAkB,IAAIC,EAEtBL,KAAAM,eAAiB,IAAID,C,CAUtB,SAAAE,CAAUC,GACf,IAAKR,KAAKC,SAASQ,IAAID,GAAS,CAC9BR,KAAKC,SAASS,IAAIF,GAClBR,KAAKI,gBAAgBO,KAAKX,KAAKY,eAC/B,OAAO,I,KACF,CACL,OAAO,K,EAOJ,aAAAC,GACLb,KAAKC,SAASa,SAASC,GAAMf,KAAKgB,aAAaD,I,CAM1C,YAAAE,GACLjB,KAAKkB,WAAWC,U,CAUX,UAAAD,CAAWE,GAChB,IAAKC,EAAQC,QAAQtB,KAAKoB,QAASA,GAAU,CAC3CpB,KAAKoB,QAAUA,EACfpB,KAAKM,eAAeK,KAAKS,E,EAOtB,WAAAR,GACL,OAAOW,MAAMC,KAAKxB,KAAKC,S,CAMlB,UAAAwB,GACL,OAAOzB,KAAKoB,O,CAMP,UAAAM,GACL,OAAOH,MAAMC,KAAKxB,KAAKG,Q,CASlB,YAAAa,CAAaR,GAClB,GAAIR,KAAKC,SAASQ,IAAID,GAAS,CAC7BR,KAAKC,SAAS0B,OAAOnB,GACrBR,KAAKI,gBAAgBO,KAAKX,KAAKY,eAC/B,OAAO,I,KACF,CACL,OAAO,K,EAUJ,WAAAgB,CAAY3B,GACjBD,KAAKC,SAAS4B,QACd5B,EAASa,SAASC,GAAMf,KAAKC,SAASS,IAAIK,KAC1Cf,KAAKI,gBAAgBO,KAAKX,KAAKY,eAC/B,OAAO,I,CAUF,gBAAAkB,CACLC,GAEA,OAAO/B,KAAKM,eAAe0B,GAAGD,E,CAUzB,iBAAAE,CACLF,GAEA,OAAO/B,KAAKI,gBAAgB4B,GAAGD,E","ignoreList":[]}
1
+ {"version":3,"names":["MeasurementModel","constructor","this","entities","Set","results","entitiesChanged","EventDispatcher","outcomeChanged","addEntity","entity","has","add","emit","getEntities","clearEntities","forEach","e","removeEntity","clearOutcome","setOutcome","undefined","outcome","Objects","isEqual","Array","from","getOutcome","getResults","delete","setEntities","clear","onOutcomeChanged","listener","on","onEntitiesChanged"],"sources":["src/lib/measurement/model.ts"],"sourcesContent":["import {\n Disposable,\n EventDispatcher,\n Listener,\n Objects,\n} from '@vertexvis/utils';\n\nimport { MeasurementEntity } from './entities';\nimport { MeasurementOutcome } from './outcomes';\nimport { MeasurementResult } from './results';\n\n/**\n * A model representing the state of measurement.\n *\n * Measurement contains a set of `MeasureEntity`s that represent what's being\n * measured, and a set of `MeasurementResult`s representing the results of the\n * measurement.\n *\n * Views can register event listeners to the model to be notified when new\n * measurements have been added.\n */\nexport class MeasurementModel {\n private entities = new Set<MeasurementEntity>();\n private outcome?: MeasurementOutcome;\n private results = new Set<MeasurementResult>();\n\n private entitiesChanged = new EventDispatcher<MeasurementEntity[]>();\n\n private outcomeChanged = new EventDispatcher<\n MeasurementOutcome | undefined\n >();\n\n /**\n * Registers an entity to be measured with the model.\n *\n * @param entity An entity to measure.\n * @returns `true` if the entity has been added.\n */\n public addEntity(entity: MeasurementEntity): boolean {\n if (!this.entities.has(entity)) {\n this.entities.add(entity);\n this.entitiesChanged.emit(this.getEntities());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Clears all registered entities from the model.\n */\n public clearEntities(): void {\n this.entities.forEach((e) => this.removeEntity(e));\n }\n\n /**\n * Clears the outcome containing the results of a measurement.\n */\n public clearOutcome(): void {\n this.setOutcome(undefined);\n }\n\n /**\n * Sets the outcome containing the results of a measurement.\n *\n * Emits a _outcome changed_ event.\n *\n * @param outcome The outcome containing results.\n */\n public setOutcome(outcome: MeasurementOutcome | undefined): void {\n if (!Objects.isEqual(this.outcome, outcome)) {\n this.outcome = outcome;\n this.outcomeChanged.emit(outcome);\n }\n }\n\n /**\n * Returns all the entities registered with the model.\n */\n public getEntities(): MeasurementEntity[] {\n return Array.from(this.entities);\n }\n\n /**\n * Returns the outcome that contains the results of a measurement.\n */\n public getOutcome(): MeasurementOutcome | undefined {\n return this.outcome;\n }\n\n /**\n * Returns all the measurement results of the model.\n */\n public getResults(): MeasurementResult[] {\n return Array.from(this.results);\n }\n\n /**\n * Unregisters an entity from the model.\n *\n * @param entity The entity to remove.\n * @returns `true` if the entity was removed.\n */\n public removeEntity(entity: MeasurementEntity): boolean {\n if (this.entities.has(entity)) {\n this.entities.delete(entity);\n this.entitiesChanged.emit(this.getEntities());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Sets the set of entities to be measured with the model.\n *\n * @param entities A set of entities to measure.\n * @returns `true` if the entity has been added.\n */\n public setEntities(entities: Set<MeasurementEntity>): boolean {\n this.entities.clear();\n entities.forEach((e) => this.entities.add(e));\n this.entitiesChanged.emit(this.getEntities());\n return true;\n }\n\n /**\n * Registers an event listener that will be invoked when the model's outcome\n * changes.\n *\n * @param listener The listener to add.\n * @returns A disposable that can be used to remove the listener.\n */\n public onOutcomeChanged(\n listener: Listener<MeasurementOutcome | undefined>,\n ): Disposable {\n return this.outcomeChanged.on(listener);\n }\n\n /**\n * Registers an event listener that will be invoked when the model's\n * measurement entities change.\n *\n * @param listener The listener to add.\n * @returns A disposable that can be used to remove the listener.\n */\n public onEntitiesChanged(\n listener: Listener<MeasurementEntity[]>,\n ): Disposable {\n return this.entitiesChanged.on(listener);\n }\n}\n"],"mappings":";;;iDAqBaA,EAAb,WAAAC,GACUC,KAAAC,SAAW,IAAIC,IAEfF,KAAAG,QAAU,IAAID,IAEdF,KAAAI,gBAAkB,IAAIC,EAEtBL,KAAAM,eAAiB,IAAID,C,CAUtB,SAAAE,CAAUC,GACf,IAAKR,KAAKC,SAASQ,IAAID,GAAS,CAC9BR,KAAKC,SAASS,IAAIF,GAClBR,KAAKI,gBAAgBO,KAAKX,KAAKY,eAC/B,OAAO,I,KACF,CACL,OAAO,K,EAOJ,aAAAC,GACLb,KAAKC,SAASa,SAASC,GAAMf,KAAKgB,aAAaD,I,CAM1C,YAAAE,GACLjB,KAAKkB,WAAWC,U,CAUX,UAAAD,CAAWE,GAChB,IAAKC,EAAQC,QAAQtB,KAAKoB,QAASA,GAAU,CAC3CpB,KAAKoB,QAAUA,EACfpB,KAAKM,eAAeK,KAAKS,E,EAOtB,WAAAR,GACL,OAAOW,MAAMC,KAAKxB,KAAKC,S,CAMlB,UAAAwB,GACL,OAAOzB,KAAKoB,O,CAMP,UAAAM,GACL,OAAOH,MAAMC,KAAKxB,KAAKG,Q,CASlB,YAAAa,CAAaR,GAClB,GAAIR,KAAKC,SAASQ,IAAID,GAAS,CAC7BR,KAAKC,SAAS0B,OAAOnB,GACrBR,KAAKI,gBAAgBO,KAAKX,KAAKY,eAC/B,OAAO,I,KACF,CACL,OAAO,K,EAUJ,WAAAgB,CAAY3B,GACjBD,KAAKC,SAAS4B,QACd5B,EAASa,SAASC,GAAMf,KAAKC,SAASS,IAAIK,KAC1Cf,KAAKI,gBAAgBO,KAAKX,KAAKY,eAC/B,OAAO,I,CAUF,gBAAAkB,CACLC,GAEA,OAAO/B,KAAKM,eAAe0B,GAAGD,E,CAUzB,iBAAAE,CACLF,GAEA,OAAO/B,KAAKI,gBAAgB4B,GAAGD,E","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["flattenPointArray","arr","reduce","res","pt","x","y","toRadiansTransform","transform","position","rotation","r","scale","Vector3","create","Angle","toRadians","z","toDegreesTransform","toDegrees","toMatrix","t","Quaternion","fromEuler","Euler","s","Matrix4","makeTRS","toTransform","matrix","fromMatrixPosition","fromRotationMatrix","fromMatrixScale","toWorldTransform","localT","parentWM","localM","worldM","multiply","toLocalTransform","worldT","invert"],"sources":["src/lib/transforms/util.ts"],"sourcesContent":["import {\n Angle,\n Euler,\n Matrix4,\n Point,\n Quaternion,\n Vector3,\n} from '@vertexvis/geometry';\n\n/**\n * A type that wraps the local and world transforms for an item.\n */\nexport interface Transform {\n position: Vector3.Vector3;\n rotation: Vector3.Vector3;\n scale: number;\n}\n\n/**\n * Converts an array of points to an array of numbers\n * @param arr The array to convert\n * @returns The given array as an array of numbers\n */\nexport function flattenPointArray(arr: Point.Point[]): number[] {\n return arr.reduce((res, pt) => [...res, pt.x, pt.y], [] as number[]);\n}\n\n/**\n * Converts the rotation vector of a Transform from degrees to radians\n * @param transform The Transform to convert\n * @returns The Transform where the rotation matrix is in terms of radians\n */\nexport function toRadiansTransform(transform: Transform): Transform {\n const { position, rotation: r, scale } = transform;\n const rotation = Vector3.create(\n Angle.toRadians(r.x),\n Angle.toRadians(r.y),\n Angle.toRadians(r.z)\n );\n\n return { position, rotation, scale };\n}\n\n/**\n * Converts the rotation vector of a Transform from radians to degrees\n * @param transform The Transform to convert\n * @returns The Transform where the rotation matrix is in terms of degrees\n */\nexport function toDegreesTransform(transform: Transform): Transform {\n const { position, rotation: r, scale } = transform;\n const rotation = Vector3.create(\n Angle.toDegrees(r.x),\n Angle.toDegrees(r.y),\n Angle.toDegrees(r.z)\n );\n return { position, rotation, scale };\n}\n\n/**\n * Converts a Transform to a Matrix4 transform\n * @param transform The Transform to convert\n * @returns The transform as a Matrix4\n */\nexport function toMatrix(transform: Transform): Matrix4.Matrix4 {\n const { position: t, rotation, scale } = transform;\n const r = Quaternion.fromEuler(Euler.create(rotation));\n const s = Vector3.create(scale, scale, scale);\n return Matrix4.makeTRS(t, r, s);\n}\n\n/**\n * Converts a Matrix4 transform to a Transform\n * @param matrix The Matrix4 transform to convert\n * @returns The transform as a Transform\n */\nexport function toTransform(matrix: Matrix4.Matrix4): Transform {\n const position = Vector3.fromMatrixPosition(matrix);\n const rotation = Euler.fromRotationMatrix(matrix);\n const { x: scale } = Vector3.fromMatrixScale(matrix);\n return { position, rotation, scale };\n}\n\n/**\n * Converts a local transform to a world transform relative to the given parent world matrix.\n * @param localT The local transform to convert\n * @param parentWM The world matrix of the item's parent\n * @returns The world transform of the item\n */\nexport function toWorldTransform(\n localT: Transform,\n parentWM: Matrix4.Matrix4\n): Transform {\n const localM = toMatrix(toRadiansTransform(localT));\n const worldM = Matrix4.multiply(parentWM, localM);\n return toDegreesTransform(toTransform(worldM));\n}\n\n/**\n * Converts a world transform to a local transform relative to the given parent world matrix.\n * @param worldT The world transform to convert\n * @param parentWM The world matrix of the item's parent\n * @returns The local transform of the item\n */\nexport function toLocalTransform(\n worldT: Transform,\n parentWM: Matrix4.Matrix4\n): Transform {\n const worldM = toMatrix(toRadiansTransform(worldT));\n const localM = Matrix4.multiply(Matrix4.invert(parentWM), worldM);\n return toDegreesTransform(toTransform(localM));\n}\n"],"mappings":";;;gEAuBM,SAAUA,EAAkBC,GAChC,OAAOA,EAAIC,QAAO,CAACC,EAAKC,IAAO,IAAID,EAAKC,EAAGC,EAAGD,EAAGE,IAAI,GACvD,CAOM,SAAUC,EAAmBC,GACjC,MAAMC,SAAEA,EAAUC,SAAUC,EAACC,MAAEA,GAAUJ,EACzC,MAAME,EAAWG,EAAQC,OACvBC,EAAMC,UAAUL,EAAEN,GAClBU,EAAMC,UAAUL,EAAEL,GAClBS,EAAMC,UAAUL,EAAEM,IAGpB,MAAO,CAAER,WAAUC,WAAUE,QAC/B,CAOM,SAAUM,EAAmBV,GACjC,MAAMC,SAAEA,EAAUC,SAAUC,EAACC,MAAEA,GAAUJ,EACzC,MAAME,EAAWG,EAAQC,OACvBC,EAAMI,UAAUR,EAAEN,GAClBU,EAAMI,UAAUR,EAAEL,GAClBS,EAAMI,UAAUR,EAAEM,IAEpB,MAAO,CAAER,WAAUC,WAAUE,QAC/B,CAOM,SAAUQ,EAASZ,GACvB,MAAQC,SAAUY,EAACX,SAAEA,EAAQE,MAAEA,GAAUJ,EACzC,MAAMG,EAAIW,EAAWC,UAAUC,EAAMV,OAAOJ,IAC5C,MAAMe,EAAIZ,EAAQC,OAAOF,EAAOA,EAAOA,GACvC,OAAOc,EAAQC,QAAQN,EAAGV,EAAGc,EAC/B,CAOM,SAAUG,EAAYC,GAC1B,MAAMpB,EAAWI,EAAQiB,mBAAmBD,GAC5C,MAAMnB,EAAWc,EAAMO,mBAAmBF,GAC1C,MAAQxB,EAAGO,GAAUC,EAAQmB,gBAAgBH,GAC7C,MAAO,CAAEpB,WAAUC,WAAUE,QAC/B,CAQM,SAAUqB,EACdC,EACAC,GAEA,MAAMC,EAAShB,EAASb,EAAmB2B,IAC3C,MAAMG,EAASX,EAAQY,SAASH,EAAUC,GAC1C,OAAOlB,EAAmBU,EAAYS,GACxC,CAQM,SAAUE,EACdC,EACAL,GAEA,MAAME,EAASjB,EAASb,EAAmBiC,IAC3C,MAAMJ,EAASV,EAAQY,SAASZ,EAAQe,OAAON,GAAWE,GAC1D,OAAOnB,EAAmBU,EAAYQ,GACxC,Q","ignoreList":[]}
1
+ {"version":3,"names":["flattenPointArray","arr","reduce","res","pt","x","y","toRadiansTransform","transform","position","rotation","r","scale","Vector3","create","Angle","toRadians","z","toDegreesTransform","toDegrees","toMatrix","t","Quaternion","fromEuler","Euler","s","Matrix4","makeTRS","toTransform","matrix","fromMatrixPosition","fromRotationMatrix","fromMatrixScale","toWorldTransform","localT","parentWM","localM","worldM","multiply","toLocalTransform","worldT","invert"],"sources":["src/lib/transforms/util.ts"],"sourcesContent":["import {\n Angle,\n Euler,\n Matrix4,\n Point,\n Quaternion,\n Vector3,\n} from '@vertexvis/geometry';\n\n/**\n * A type that wraps the local and world transforms for an item.\n */\nexport interface Transform {\n position: Vector3.Vector3;\n rotation: Vector3.Vector3;\n scale: number;\n}\n\n/**\n * Converts an array of points to an array of numbers\n * @param arr The array to convert\n * @returns The given array as an array of numbers\n */\nexport function flattenPointArray(arr: Point.Point[]): number[] {\n return arr.reduce((res, pt) => [...res, pt.x, pt.y], [] as number[]);\n}\n\n/**\n * Converts the rotation vector of a Transform from degrees to radians\n * @param transform The Transform to convert\n * @returns The Transform where the rotation matrix is in terms of radians\n */\nexport function toRadiansTransform(transform: Transform): Transform {\n const { position, rotation: r, scale } = transform;\n const rotation = Vector3.create(\n Angle.toRadians(r.x),\n Angle.toRadians(r.y),\n Angle.toRadians(r.z),\n );\n\n return { position, rotation, scale };\n}\n\n/**\n * Converts the rotation vector of a Transform from radians to degrees\n * @param transform The Transform to convert\n * @returns The Transform where the rotation matrix is in terms of degrees\n */\nexport function toDegreesTransform(transform: Transform): Transform {\n const { position, rotation: r, scale } = transform;\n const rotation = Vector3.create(\n Angle.toDegrees(r.x),\n Angle.toDegrees(r.y),\n Angle.toDegrees(r.z),\n );\n return { position, rotation, scale };\n}\n\n/**\n * Converts a Transform to a Matrix4 transform\n * @param transform The Transform to convert\n * @returns The transform as a Matrix4\n */\nexport function toMatrix(transform: Transform): Matrix4.Matrix4 {\n const { position: t, rotation, scale } = transform;\n const r = Quaternion.fromEuler(Euler.create(rotation));\n const s = Vector3.create(scale, scale, scale);\n return Matrix4.makeTRS(t, r, s);\n}\n\n/**\n * Converts a Matrix4 transform to a Transform\n * @param matrix The Matrix4 transform to convert\n * @returns The transform as a Transform\n */\nexport function toTransform(matrix: Matrix4.Matrix4): Transform {\n const position = Vector3.fromMatrixPosition(matrix);\n const rotation = Euler.fromRotationMatrix(matrix);\n const { x: scale } = Vector3.fromMatrixScale(matrix);\n return { position, rotation, scale };\n}\n\n/**\n * Converts a local transform to a world transform relative to the given parent world matrix.\n * @param localT The local transform to convert\n * @param parentWM The world matrix of the item's parent\n * @returns The world transform of the item\n */\nexport function toWorldTransform(\n localT: Transform,\n parentWM: Matrix4.Matrix4,\n): Transform {\n const localM = toMatrix(toRadiansTransform(localT));\n const worldM = Matrix4.multiply(parentWM, localM);\n return toDegreesTransform(toTransform(worldM));\n}\n\n/**\n * Converts a world transform to a local transform relative to the given parent world matrix.\n * @param worldT The world transform to convert\n * @param parentWM The world matrix of the item's parent\n * @returns The local transform of the item\n */\nexport function toLocalTransform(\n worldT: Transform,\n parentWM: Matrix4.Matrix4,\n): Transform {\n const worldM = toMatrix(toRadiansTransform(worldT));\n const localM = Matrix4.multiply(Matrix4.invert(parentWM), worldM);\n return toDegreesTransform(toTransform(localM));\n}\n"],"mappings":";;;gEAuBM,SAAUA,EAAkBC,GAChC,OAAOA,EAAIC,QAAO,CAACC,EAAKC,IAAO,IAAID,EAAKC,EAAGC,EAAGD,EAAGE,IAAI,GACvD,CAOM,SAAUC,EAAmBC,GACjC,MAAMC,SAAEA,EAAUC,SAAUC,EAACC,MAAEA,GAAUJ,EACzC,MAAME,EAAWG,EAAQC,OACvBC,EAAMC,UAAUL,EAAEN,GAClBU,EAAMC,UAAUL,EAAEL,GAClBS,EAAMC,UAAUL,EAAEM,IAGpB,MAAO,CAAER,WAAUC,WAAUE,QAC/B,CAOM,SAAUM,EAAmBV,GACjC,MAAMC,SAAEA,EAAUC,SAAUC,EAACC,MAAEA,GAAUJ,EACzC,MAAME,EAAWG,EAAQC,OACvBC,EAAMI,UAAUR,EAAEN,GAClBU,EAAMI,UAAUR,EAAEL,GAClBS,EAAMI,UAAUR,EAAEM,IAEpB,MAAO,CAAER,WAAUC,WAAUE,QAC/B,CAOM,SAAUQ,EAASZ,GACvB,MAAQC,SAAUY,EAACX,SAAEA,EAAQE,MAAEA,GAAUJ,EACzC,MAAMG,EAAIW,EAAWC,UAAUC,EAAMV,OAAOJ,IAC5C,MAAMe,EAAIZ,EAAQC,OAAOF,EAAOA,EAAOA,GACvC,OAAOc,EAAQC,QAAQN,EAAGV,EAAGc,EAC/B,CAOM,SAAUG,EAAYC,GAC1B,MAAMpB,EAAWI,EAAQiB,mBAAmBD,GAC5C,MAAMnB,EAAWc,EAAMO,mBAAmBF,GAC1C,MAAQxB,EAAGO,GAAUC,EAAQmB,gBAAgBH,GAC7C,MAAO,CAAEpB,WAAUC,WAAUE,QAC/B,CAQM,SAAUqB,EACdC,EACAC,GAEA,MAAMC,EAAShB,EAASb,EAAmB2B,IAC3C,MAAMG,EAASX,EAAQY,SAASH,EAAUC,GAC1C,OAAOlB,EAAmBU,EAAYS,GACxC,CAQM,SAAUE,EACdC,EACAL,GAEA,MAAME,EAASjB,EAASb,EAAmBiC,IAC3C,MAAMJ,EAASV,EAAQY,SAASZ,EAAQe,OAAON,GAAWE,GAC1D,OAAOnB,EAAmBU,EAAYQ,GACxC,Q","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["MeasurementController","constructor","model","client","jwtProvider","deviceId","this","outcome","Promise","resolve","undefined","debugLogs","addEntity","entity","deserializedEntity","ModelEntity","deserializeBinary","modelEntity","log","getEntityId","getSceneItemId","performMeasurement","clearEntities","clearOutcome","removeEntity","setEntities","entities","deserializedEntities","Array","from","map","e","length","join","setDebugLogs","effect","previous","getEntities","changed","measureAndUpdateModel","highlightEntities","measureEntities","then","setOutcome","getOutcome","res","requestUnary","async","handler","meta","createMetadata","req","MeasureRequest","setEntitiesList","toProto","measure","mapMeasureResponseOrThrow","toObject","entitySet","Set","newPrevious","filter","has","update","ModelEntityUpdate","setModelEntity","setHighlight","BoolValue","setValue","UpdateModelEntitiesRequest","setUpdatesList","updateModelEntities","message","optionalParams","console","debug","MeasurementEntity","point","fromHit","hit","hitPoint","Mapper","ifInvalidThrow","fromPbVector3f","vertexvis","protobuf","core","encode","finish","Error","MeasureEntity","Vector3f","setX","x","setY","y","setZ","z","setPoint"],"sources":["src/lib/measurement/controller.ts","src/lib/measurement/entities.ts"],"sourcesContent":["import { ModelEntity } from '@vertexvis/scene-view-protos/core/protos/model_entity_pb';\nimport {\n MeasureRequest,\n MeasureResponse,\n ModelEntityUpdate,\n UpdateModelEntitiesRequest,\n} from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { SceneViewAPIClient } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb_service';\nimport { BoolValue } from 'google-protobuf/google/protobuf/wrappers_pb';\n\nimport { createMetadata, JwtProvider, requestUnary } from '../grpc';\nimport { MeasurementEntity } from './entities';\nimport { mapMeasureResponseOrThrow } from './mapper';\nimport { MeasurementModel } from './model';\nimport { MeasurementOutcome } from './outcomes';\n\n/**\n * The `MeasurementController` is responsible for performing measurements of\n * registered entities, and updating the model with their measurement results.\n */\nexport class MeasurementController {\n private outcome = Promise.resolve<MeasurementOutcome | undefined>(undefined);\n private debugLogs = false;\n\n public constructor(\n private model: MeasurementModel,\n private client: SceneViewAPIClient,\n private jwtProvider: JwtProvider,\n private deviceId: string | undefined\n ) {}\n\n /**\n * Registers an entity to measure and performs a measurement if this entity\n * has not been previously registered.\n *\n * @param entity The entity to measure.\n * @returns A promise that resolves with the results after registering this\n * entity.\n */\n public addEntity(\n entity: MeasurementEntity\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntity = ModelEntity.deserializeBinary(\n entity.modelEntity\n );\n\n this.log(\n `Adding ModelEntity. [entityId={${deserializedEntity.getEntityId()}}, sceneItemId={${deserializedEntity.getSceneItemId()}}]`\n );\n }\n\n return this.performMeasurement(() => this.model.addEntity(entity));\n }\n\n /**\n * Clears all entities and returns a promise that resolves with an empty list\n * of measurement results.\n */\n public clearEntities(): Promise<MeasurementOutcome | undefined> {\n this.log('Clearing all ModelEntities.');\n\n return this.performMeasurement(() => {\n this.model.clearEntities();\n this.model.clearOutcome();\n return true;\n });\n }\n\n /**\n * Deregisters an entity and performs a measurement if this entity was\n * removed.\n *\n * @param entity The entity to remove.\n * @returns A promise that resolves with the results after removing this\n * entity.\n */\n public removeEntity(\n entity: MeasurementEntity\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntity = ModelEntity.deserializeBinary(\n entity.modelEntity\n );\n\n this.log(\n `Removing ModelEntity. [entityId={${deserializedEntity.getEntityId()}}, sceneItemId={${deserializedEntity.getSceneItemId()}}]`\n );\n }\n\n return this.performMeasurement(() => this.model.removeEntity(entity));\n }\n\n /**\n * Registers a set of entities and performs a measurement\n *\n * @param entities The entities to measure.\n * @returns A promise that resolves with the results after registering these\n * entities.\n */\n public setEntities(\n entities: Set<MeasurementEntity>\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntities = Array.from(entities).map((e) =>\n ModelEntity.deserializeBinary(e.modelEntity)\n );\n\n this.log(\n `Setting ${deserializedEntities.length} ModelEntities. [entityIds=[${deserializedEntities.map((e) => e.getEntityId()).join(', ')}], sceneItemIds=[${deserializedEntities.map((e) => e.getSceneItemId()).join(', ')}]]`\n );\n }\n\n return this.performMeasurement(() => this.model.setEntities(entities));\n }\n\n public setDebugLogs(debugLogs: boolean): void {\n this.debugLogs = debugLogs;\n }\n\n private performMeasurement(\n effect: () => boolean\n ): Promise<MeasurementOutcome | undefined> {\n const previous = this.model.getEntities();\n const changed = effect();\n const entities = this.model.getEntities();\n if (changed) {\n this.measureAndUpdateModel(entities);\n this.highlightEntities(previous, entities);\n }\n return this.outcome;\n }\n\n private measureAndUpdateModel(entities: MeasurementEntity[]): void {\n if (entities.length > 0) {\n this.outcome = this.measureEntities(entities).then((outcome) => {\n this.model.setOutcome(outcome);\n return this.model.getOutcome();\n });\n } else {\n this.outcome = Promise.resolve(undefined);\n }\n }\n\n private async measureEntities(\n entities: MeasurementEntity[]\n ): Promise<MeasurementOutcome | undefined> {\n if (entities.length > 0) {\n const res = await requestUnary<MeasureResponse>(async (handler) => {\n const meta = await createMetadata(this.jwtProvider, this.deviceId);\n const req = new MeasureRequest();\n req.setEntitiesList(entities.map((e) => e.toProto()));\n\n this.client.measure(req, meta, handler);\n });\n\n return mapMeasureResponseOrThrow(res.toObject());\n } else {\n return undefined;\n }\n }\n\n private async highlightEntities(\n previous: MeasurementEntity[],\n entities: MeasurementEntity[]\n ): Promise<void> {\n await requestUnary(async (handler) => {\n const meta = await createMetadata(this.jwtProvider, this.deviceId);\n\n const entitySet = new Set(entities);\n const newPrevious = previous.filter((e) => !entitySet.has(e));\n\n const clearEntities = newPrevious.map((e) => {\n const update = new ModelEntityUpdate();\n update.setModelEntity(ModelEntity.deserializeBinary(e.modelEntity));\n update.setHighlight(new BoolValue().setValue(false));\n return update;\n });\n const highlightEntities = entities.map((e) => {\n const update = new ModelEntityUpdate();\n update.setModelEntity(ModelEntity.deserializeBinary(e.modelEntity));\n update.setHighlight(new BoolValue().setValue(true));\n return update;\n });\n\n const req = new UpdateModelEntitiesRequest();\n req.setUpdatesList([...clearEntities, ...highlightEntities]);\n this.client.updateModelEntities(req, meta, handler);\n });\n }\n\n private log(message?: string, ...optionalParams: unknown[]): void {\n if (this.debugLogs) {\n console.debug(message, optionalParams);\n }\n }\n}\n","import { vertexvis } from '@vertexvis/frame-streaming-protos';\nimport { Vector3 } from '@vertexvis/geometry';\nimport { Vector3f } from '@vertexvis/scene-view-protos/core/protos/geometry_pb';\nimport { ModelEntity } from '@vertexvis/scene-view-protos/core/protos/model_entity_pb';\nimport { MeasureEntity } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { Mapper } from '@vertexvis/utils';\n\nimport { fromPbVector3f } from '../mappers';\n\nexport class MeasurementEntity {\n public constructor(\n public readonly point: Vector3.Vector3,\n public readonly modelEntity: Uint8Array\n ) {}\n\n public static fromHit(\n hit: vertexvis.protobuf.stream.IHit\n ): MeasurementEntity {\n if (hit.hitPoint != null && hit.modelEntity != null) {\n const hitPoint = Mapper.ifInvalidThrow(fromPbVector3f)(hit.hitPoint);\n const modelEntity = vertexvis.protobuf.core.ModelEntity.encode(\n hit.modelEntity\n ).finish();\n return new MeasurementEntity(hitPoint, modelEntity);\n } else {\n throw new Error(\n 'Cannot create MeasurementEntity from Hit. Hit is missing hit point and model entity'\n );\n }\n }\n\n public toProto(): MeasureEntity {\n const entity = new MeasureEntity();\n\n const point = new Vector3f();\n point.setX(this.point.x);\n point.setY(this.point.y);\n point.setZ(this.point.z);\n entity.setPoint(point);\n\n const modelEntity = ModelEntity.deserializeBinary(this.modelEntity);\n entity.setModelEntity(modelEntity);\n\n return entity;\n }\n}\n"],"mappings":";;;qPAoBaA,EAIX,WAAAC,CACUC,EACAC,EACAC,EACAC,GAHAC,KAAAJ,QACAI,KAAAH,SACAG,KAAAF,cACAE,KAAAD,WAPFC,KAAAC,QAAUC,QAAQC,QAAwCC,WAC1DJ,KAAAK,UAAY,K,CAiBb,SAAAC,CACLC,GAEA,GAAIP,KAAKK,UAAW,CAClB,MAAMG,EAAqBC,cAAYC,kBACrCH,EAAOI,aAGTX,KAAKY,IACH,kCAAkCJ,EAAmBK,gCAAgCL,EAAmBM,qB,CAI5G,OAAOd,KAAKe,oBAAmB,IAAMf,KAAKJ,MAAMU,UAAUC,I,CAOrD,aAAAS,GACLhB,KAAKY,IAAI,+BAET,OAAOZ,KAAKe,oBAAmB,KAC7Bf,KAAKJ,MAAMoB,gBACXhB,KAAKJ,MAAMqB,eACX,OAAO,IAAI,G,CAYR,YAAAC,CACLX,GAEA,GAAIP,KAAKK,UAAW,CAClB,MAAMG,EAAqBC,cAAYC,kBACrCH,EAAOI,aAGTX,KAAKY,IACH,oCAAoCJ,EAAmBK,gCAAgCL,EAAmBM,qB,CAI9G,OAAOd,KAAKe,oBAAmB,IAAMf,KAAKJ,MAAMsB,aAAaX,I,CAUxD,WAAAY,CACLC,GAEA,GAAIpB,KAAKK,UAA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GACtBpF,EAAOqF,SAASrB,GAEhB,MAAM5D,EAAcF,cAAYC,kBAAkBV,KAAKW,aACvDJ,EAAOoD,eAAehD,GAEtB,OAAOJ,C","ignoreList":[]}
1
+ {"version":3,"names":["MeasurementController","constructor","model","client","jwtProvider","deviceId","this","outcome","Promise","resolve","undefined","debugLogs","addEntity","entity","deserializedEntity","ModelEntity","deserializeBinary","modelEntity","log","getEntityId","getSceneItemId","performMeasurement","clearEntities","clearOutcome","removeEntity","setEntities","entities","deserializedEntities","Array","from","map","e","length","join","setDebugLogs","effect","previous","getEntities","changed","measureAndUpdateModel","highlightEntities","measureEntities","then","setOutcome","getOutcome","res","requestUnary","async","handler","meta","createMetadata","req","MeasureRequest","setEntitiesList","toProto","measure","mapMeasureResponseOrThrow","toObject","entitySet","Set","newPrevious","filter","has","update","ModelEntityUpdate","setModelEntity","setHighlight","BoolValue","setValue","UpdateModelEntitiesRequest","setUpdatesList","updateModelEntities","message","optionalParams","console","debug","MeasurementEntity","point","fromHit","hit","hitPoint","Mapper","ifInvalidThrow","fromPbVector3f","vertexvis","protobuf","core","encode","finish","Error","MeasureEntity","Vector3f","setX","x","setY","y","setZ","z","setPoint"],"sources":["src/lib/measurement/controller.ts","src/lib/measurement/entities.ts"],"sourcesContent":["import { ModelEntity } from '@vertexvis/scene-view-protos/core/protos/model_entity_pb';\nimport {\n MeasureRequest,\n MeasureResponse,\n ModelEntityUpdate,\n UpdateModelEntitiesRequest,\n} from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { SceneViewAPIClient } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb_service';\nimport { BoolValue } from 'google-protobuf/google/protobuf/wrappers_pb';\n\nimport { createMetadata, JwtProvider, requestUnary } from '../grpc';\nimport { MeasurementEntity } from './entities';\nimport { mapMeasureResponseOrThrow } from './mapper';\nimport { MeasurementModel } from './model';\nimport { MeasurementOutcome } from './outcomes';\n\n/**\n * The `MeasurementController` is responsible for performing measurements of\n * registered entities, and updating the model with their measurement results.\n */\nexport class MeasurementController {\n private outcome = Promise.resolve<MeasurementOutcome | undefined>(undefined);\n private debugLogs = false;\n\n public constructor(\n private model: MeasurementModel,\n private client: SceneViewAPIClient,\n private jwtProvider: JwtProvider,\n private deviceId: string | undefined,\n ) {}\n\n /**\n * Registers an entity to measure and performs a measurement if this entity\n * has not been previously registered.\n *\n * @param entity The entity to measure.\n * @returns A promise that resolves with the results after registering this\n * entity.\n */\n public addEntity(\n entity: MeasurementEntity,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntity = ModelEntity.deserializeBinary(\n entity.modelEntity,\n );\n\n this.log(\n `Adding ModelEntity. [entityId={${deserializedEntity.getEntityId()}}, sceneItemId={${deserializedEntity.getSceneItemId()}}]`,\n );\n }\n\n return this.performMeasurement(() => this.model.addEntity(entity));\n }\n\n /**\n * Clears all entities and returns a promise that resolves with an empty list\n * of measurement results.\n */\n public clearEntities(): Promise<MeasurementOutcome | undefined> {\n this.log('Clearing all ModelEntities.');\n\n return this.performMeasurement(() => {\n this.model.clearEntities();\n this.model.clearOutcome();\n return true;\n });\n }\n\n /**\n * Deregisters an entity and performs a measurement if this entity was\n * removed.\n *\n * @param entity The entity to remove.\n * @returns A promise that resolves with the results after removing this\n * entity.\n */\n public removeEntity(\n entity: MeasurementEntity,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntity = ModelEntity.deserializeBinary(\n entity.modelEntity,\n );\n\n this.log(\n `Removing ModelEntity. [entityId={${deserializedEntity.getEntityId()}}, sceneItemId={${deserializedEntity.getSceneItemId()}}]`,\n );\n }\n\n return this.performMeasurement(() => this.model.removeEntity(entity));\n }\n\n /**\n * Registers a set of entities and performs a measurement\n *\n * @param entities The entities to measure.\n * @returns A promise that resolves with the results after registering these\n * entities.\n */\n public setEntities(\n entities: Set<MeasurementEntity>,\n ): Promise<MeasurementOutcome | undefined> {\n if (this.debugLogs) {\n const deserializedEntities = Array.from(entities).map((e) =>\n ModelEntity.deserializeBinary(e.modelEntity),\n );\n\n this.log(\n `Setting ${deserializedEntities.length} ModelEntities. [entityIds=[${deserializedEntities.map((e) => e.getEntityId()).join(', ')}], sceneItemIds=[${deserializedEntities.map((e) => e.getSceneItemId()).join(', ')}]]`,\n );\n }\n\n return this.performMeasurement(() => this.model.setEntities(entities));\n }\n\n public setDebugLogs(debugLogs: boolean): void {\n this.debugLogs = debugLogs;\n }\n\n private performMeasurement(\n effect: () => boolean,\n ): Promise<MeasurementOutcome | undefined> {\n const previous = this.model.getEntities();\n const changed = effect();\n const entities = this.model.getEntities();\n if (changed) {\n this.measureAndUpdateModel(entities);\n this.highlightEntities(previous, entities);\n }\n return this.outcome;\n }\n\n private measureAndUpdateModel(entities: MeasurementEntity[]): void {\n if (entities.length > 0) {\n this.outcome = this.measureEntities(entities).then((outcome) => {\n this.model.setOutcome(outcome);\n return this.model.getOutcome();\n });\n } else {\n this.outcome = Promise.resolve(undefined);\n }\n }\n\n private async measureEntities(\n entities: MeasurementEntity[],\n ): Promise<MeasurementOutcome | undefined> {\n if (entities.length > 0) {\n const res = await requestUnary<MeasureResponse>(async (handler) => {\n const meta = await createMetadata(this.jwtProvider, this.deviceId);\n const req = new MeasureRequest();\n req.setEntitiesList(entities.map((e) => e.toProto()));\n\n this.client.measure(req, meta, handler);\n });\n\n return mapMeasureResponseOrThrow(res.toObject());\n } else {\n return undefined;\n }\n }\n\n private async highlightEntities(\n previous: MeasurementEntity[],\n entities: MeasurementEntity[],\n ): Promise<void> {\n await requestUnary(async (handler) => {\n const meta = await createMetadata(this.jwtProvider, this.deviceId);\n\n const entitySet = new Set(entities);\n const newPrevious = previous.filter((e) => !entitySet.has(e));\n\n const clearEntities = newPrevious.map((e) => {\n const update = new ModelEntityUpdate();\n update.setModelEntity(ModelEntity.deserializeBinary(e.modelEntity));\n update.setHighlight(new BoolValue().setValue(false));\n return update;\n });\n const highlightEntities = entities.map((e) => {\n const update = new ModelEntityUpdate();\n update.setModelEntity(ModelEntity.deserializeBinary(e.modelEntity));\n update.setHighlight(new BoolValue().setValue(true));\n return update;\n });\n\n const req = new UpdateModelEntitiesRequest();\n req.setUpdatesList([...clearEntities, ...highlightEntities]);\n this.client.updateModelEntities(req, meta, handler);\n });\n }\n\n private log(message?: string, ...optionalParams: unknown[]): void {\n if (this.debugLogs) {\n console.debug(message, optionalParams);\n }\n }\n}\n","import { vertexvis } from '@vertexvis/frame-streaming-protos';\nimport { Vector3 } from '@vertexvis/geometry';\nimport { Vector3f } from '@vertexvis/scene-view-protos/core/protos/geometry_pb';\nimport { ModelEntity } from '@vertexvis/scene-view-protos/core/protos/model_entity_pb';\nimport { MeasureEntity } from '@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb';\nimport { Mapper } from '@vertexvis/utils';\n\nimport { fromPbVector3f } from '../mappers';\n\nexport class MeasurementEntity {\n public constructor(\n public readonly point: Vector3.Vector3,\n public readonly modelEntity: Uint8Array,\n ) {}\n\n public static fromHit(\n hit: vertexvis.protobuf.stream.IHit,\n ): MeasurementEntity {\n if (hit.hitPoint != null && hit.modelEntity != null) {\n const hitPoint = Mapper.ifInvalidThrow(fromPbVector3f)(hit.hitPoint);\n const modelEntity = vertexvis.protobuf.core.ModelEntity.encode(\n hit.modelEntity,\n ).finish();\n return new MeasurementEntity(hitPoint, modelEntity);\n } else {\n throw new Error(\n 'Cannot create MeasurementEntity from Hit. Hit is missing hit point and model entity',\n );\n }\n }\n\n public toProto(): MeasureEntity {\n const entity = new MeasureEntity();\n\n const point = new Vector3f();\n point.setX(this.point.x);\n point.setY(this.point.y);\n point.setZ(this.point.z);\n entity.setPoint(point);\n\n const modelEntity = ModelEntity.deserializeBinary(this.modelEntity);\n entity.setModelEntity(modelEntity);\n\n return entity;\n }\n}\n"],"mappings":";;;qPAoBaA,EAIX,WAAAC,CACUC,EACAC,EACAC,EACAC,GAHAC,KAAAJ,QACAI,KAAAH,SACAG,KAAAF,cACAE,KAAAD,WAPFC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,EAAKF,EAAMD,EAAQ,G,CAI/C,GAAA9B,CAAIsD,KAAqBC,GAC/B,GAAInE,KAAKK,UAAW,CAClB+D,QAAQC,MAAMH,EAASC,E,SCxLhBG,EACX,WAAA3E,CACkB4E,EACA5D,GADAX,KAAAuE,QACAvE,KAAAW,a,CAGX,cAAO6D,CACZC,GAEA,GAAIA,EAAIC,UAAY,MAAQD,EAAI9D,aAAe,KAAM,CACnD,MAAM+D,EAAWC,EAAOC,eAAeC,EAAtBF,CAAsCF,EAAIC,UAC3D,MAAM/D,EAAcmE,EAAUC,SAASC,KAAKvE,YAAYwE,OACtDR,EAAI9D,aACJuE,SACF,OAAO,IAAIZ,EAAkBI,EAAU/D,E,KAClC,CACL,MAAM,IAAIwE,MACR,sF,EAKC,OAAAnC,GACL,MAAMzC,EAAS,IAAI6E,gBAEnB,MAAMb,EAAQ,IAAIc,WAClBd,EAAMe,KAAKtF,KAAKuE,MAAMgB,GACtBhB,EAAMiB,KAAKxF,KAAKuE,MAAMkB,GACtBlB,EAAMmB,KAAK1F,KAAKuE,MAAMoB,GACtBpF,EAAOqF,SAASrB,GAEhB,MAAM5D,EAAcF,cAAYC,kBAAkBV,KAAKW,aACvDJ,EAAOoD,eAAehD,GAEtB,OAAOJ,C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["readDOM","task","readTask","writeDOM","writeTask","debounceEvent","event","wait","timer","undefined","debounce","value","window","clearTimeout","setTimeout","emit","dispose"],"sources":["src/lib/stencil.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { EventEmitter, readTask, writeTask } from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nexport interface EventEmitterDisposable<E>\n extends EventEmitter<E>, Disposable {}\n\nexport function readDOM(task: () => void): void {\n readTask(task);\n}\n\nexport function writeDOM(task: () => void): void {\n writeTask(task);\n}\n\nexport function debounceEvent<E>(\n event: EventEmitter<E>,\n wait: number\n): EventEmitterDisposable<E> {\n let timer: number | undefined = undefined;\n function debounce(value: E): void {\n window.clearTimeout(timer);\n timer = window.setTimeout(() => event.emit(value), wait);\n }\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n emit: debounce as any,\n dispose() {\n window.clearTimeout(timer);\n },\n };\n}\n"],"mappings":";;;2CAOM,SAAUA,EAAQC,GACtBC,EAASD,EACX,CAEM,SAAUE,EAASF,GACvBG,EAAUH,EACZ,CAEM,SAAUI,EACdC,EACAC,GAEA,IAAIC,EAA4BC,UAChC,SAASC,EAASC,GAChBC,OAAOC,aAAaL,GACpBA,EAAQI,OAAOE,YAAW,IAAMR,EAAMS,KAAKJ,IAAQJ,E,CAErD,MAAO,CAELQ,KAAML,EACN,OAAAM,GACEJ,OAAOC,aAAaL,E,EAG1B,Q","ignoreList":[]}
1
+ {"version":3,"names":["readDOM","task","readTask","writeDOM","writeTask","debounceEvent","event","wait","timer","undefined","debounce","value","window","clearTimeout","setTimeout","emit","dispose"],"sources":["src/lib/stencil.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport { EventEmitter, readTask, writeTask } from '@stencil/core';\nimport { Disposable } from '@vertexvis/utils';\n\nexport interface EventEmitterDisposable<E>\n extends EventEmitter<E>, Disposable {}\n\nexport function readDOM(task: () => void): void {\n readTask(task);\n}\n\nexport function writeDOM(task: () => void): void {\n writeTask(task);\n}\n\nexport function debounceEvent<E>(\n event: EventEmitter<E>,\n wait: number,\n): EventEmitterDisposable<E> {\n let timer: number | undefined = undefined;\n function debounce(value: E): void {\n window.clearTimeout(timer);\n timer = window.setTimeout(() => event.emit(value), wait);\n }\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n emit: debounce as any,\n dispose() {\n window.clearTimeout(timer);\n },\n };\n}\n"],"mappings":";;;2CAOM,SAAUA,EAAQC,GACtBC,EAASD,EACX,CAEM,SAAUE,EAASF,GACvBG,EAAUH,EACZ,CAEM,SAAUI,EACdC,EACAC,GAEA,IAAIC,EAA4BC,UAChC,SAASC,EAASC,GAChBC,OAAOC,aAAaL,GACpBA,EAAQI,OAAOE,YAAW,IAAMR,EAAMS,KAAKJ,IAAQJ,E,CAErD,MAAO,CAELQ,KAAML,EACN,OAAAM,GACEJ,OAAOC,aAAaL,E,EAG1B,Q","ignoreList":[]}