@vertexvis/viewer 1.0.2-canary.3 → 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,"file":"baseInteractionHandler.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/baseInteractionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAc,eAAe,EAAY,MAAM,kBAAkB,CAAC;AAGzE,OAAO,EAAE,sB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,OAAO,MAAM,CAAC,YAAY,IAAI,IAAI,IAAI,KAAK,YAAY,YAAY;YACjE,CAAC,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO;YAC/B,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;CACF","sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { ConfigProvider } from '../config';\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionApi } from './interactionApi';\nimport { BaseEvent } from './interactionEvent';\nimport { InteractionHandler } from './interactionHandler';\nimport {\n MouseInteraction,\n PanInteraction,\n PivotInteraction,\n RotateInteraction,\n RotatePointInteraction,\n TwistInteraction,\n ZoomInteraction,\n} from './mouseInteractions';\n\nexport type InteractionType =\n | 'rotate'\n | 'zoom'\n | 'pan'\n | 'twist'\n | 'rotate-point'\n | 'pivot';\n\nconst DEFAULT_FONT_SIZE = 16;\nconst DEFAULT_LINE_HEIGHT = 1.2;\n\nexport abstract class BaseInteractionHandler implements InteractionHandler {\n protected interactionApi?: InteractionApi;\n protected element?: HTMLElement;\n protected downPosition?: Point.Point;\n private downPositionCanvas?: Point.Point;\n private primaryInteraction: MouseInteraction;\n private currentInteraction?: MouseInteraction;\n private draggingInteraction: MouseInteraction | undefined;\n private lastPrimaryRotateInteraction?: MouseInteraction;\n private isDragging = false;\n private lastMoveEvent?: BaseEvent;\n private interactionTimer?: number;\n private keyboardControls = false;\n\n protected disableIndividualInteractions = false;\n\n private bodyStyleCache?: {\n fontSize: number;\n lineHeight: number;\n height: number;\n };\n\n private primaryInteractionTypeChange = new EventDispatcher<void>();\n\n public constructor(\n protected downEvent: 'mousedown' | 'pointerdown',\n protected upEvent: 'mouseup' | 'pointerup',\n protected moveEvent: 'mousemove' | 'pointermove',\n private rotateInteraction: RotateInteraction,\n private rotatePointInteraction: RotatePointInteraction,\n private zoomInteraction: ZoomInteraction,\n private panInteraction: PanInteraction,\n private twistInteraction: TwistInteraction,\n private pivotInteraction: PivotInteraction,\n private getConfig: ConfigProvider\n ) {\n this.primaryInteraction = rotateInteraction;\n this.handleDownEvent = this.handleDownEvent.bind(this);\n this.handleMouseWheel = this.handleMouseWheel.bind(this);\n this.handleWindowMove = this.handleWindowMove.bind(this);\n this.handleWindowUp = this.handleWindowUp.bind(this);\n this.handleDoubleClick = this.handleDoubleClick.bind(this);\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.interactionApi = api;\n element.addEventListener(this.downEvent, this.handleDownEvent);\n element.addEventListener('mousedown', this.handleDoubleClick);\n element.addEventListener('wheel', this.handleMouseWheel, {\n passive: false,\n });\n }\n\n public dispose(): void {\n this.element?.removeEventListener(this.downEvent, this.handleDownEvent);\n this.element?.removeEventListener('mousedown', this.handleDoubleClick);\n this.element?.removeEventListener('wheel', this.handleMouseWheel);\n this.element = undefined;\n }\n\n public onPrimaryInteractionTypeChange(listener: Listener<void>): Disposable {\n return this.primaryInteractionTypeChange.on(listener);\n }\n\n public setCurrentInteractionType(type?: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.currentInteraction = this.rotateInteraction;\n break;\n case 'zoom':\n this.currentInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.currentInteraction = this.panInteraction;\n break;\n case 'twist':\n this.currentInteraction = this.twistInteraction;\n break;\n case 'rotate-point':\n this.currentInteraction = this.rotatePointInteraction;\n break;\n case 'pivot':\n this.currentInteraction = this.pivotInteraction;\n break;\n default:\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction) {\n const point = this.draggingInteraction.getPosition();\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n this.interactionApi?.resetLastAngle();\n this.draggingInteraction.setPosition(point);\n }\n }\n\n public getPrimaryInteractionType(): InteractionType {\n return this.primaryInteraction.getType();\n }\n\n public getCurrentInteractionType(): InteractionType {\n return (this.currentInteraction || this.primaryInteraction).getType();\n }\n\n public setPrimaryInteractionType(type: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.primaryInteraction = this.rotateInteraction;\n this.lastPrimaryRotateInteraction = this.rotateInteraction;\n break;\n case 'rotate-point':\n this.primaryInteraction = this.rotatePointInteraction;\n this.lastPrimaryRotateInteraction = this.rotatePointInteraction;\n break;\n case 'zoom':\n this.primaryInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.primaryInteraction = this.panInteraction;\n break;\n case 'pivot':\n this.primaryInteraction = this.pivotInteraction;\n break;\n }\n this.primaryInteractionTypeChange.emit();\n }\n\n public setDefaultKeyboardControls(keyboardControls: boolean): void {\n this.keyboardControls = keyboardControls;\n }\n\n protected handleDownEvent(event: BaseEvent): void {\n // Prevent selection of any text while interacting with the model.\n event.preventDefault();\n\n this.interactionTimer = window.setTimeout(() => {\n this.downPosition = Point.create(event.screenX, event.screenY);\n this.downPositionCanvas = this.getCanvasPosition(event);\n this.interactionTimer = undefined;\n\n // Perform the current movement in the case that the interaction timer elapses\n if (this.lastMoveEvent != null) {\n this.handleWindowMove(this.lastMoveEvent);\n }\n }, this.getConfig().interactions.interactionDelay);\n\n window.addEventListener(this.moveEvent, this.handleWindowMove);\n window.addEventListener(this.upEvent, this.handleWindowUp);\n }\n\n protected handleWindowMove(event: BaseEvent): void {\n if (this.interactionTimer == null) {\n if (this.disableIndividualInteractions) {\n return;\n }\n\n const position = Point.create(event.screenX, event.screenY);\n const pixelThreshold =\n this.interactionApi != null\n ? this.interactionApi.pixelThreshold(this.isTouch(event))\n : 2;\n if (\n this.downPosition != null &&\n Point.distance(position, this.downPosition) >= pixelThreshold &&\n !this.isDragging\n ) {\n this.beginDrag(event);\n this.isDragging = true;\n }\n\n if (this.isDragging) {\n this.drag(event);\n }\n }\n\n this.lastMoveEvent = event;\n }\n\n protected async handleWindowUp(event: BaseEvent): Promise<void> {\n if (this.isDragging) {\n this.endDrag(event);\n this.isDragging = false;\n }\n\n if (this.interactionTimer != null) {\n window.clearTimeout(this.interactionTimer);\n this.interactionTimer = undefined;\n }\n\n window.removeEventListener(this.moveEvent, this.handleWindowMove);\n window.removeEventListener(this.upEvent, this.handleWindowUp);\n this.lastMoveEvent = undefined;\n }\n\n protected async handleDoubleClick(event: BaseEvent): Promise<void> {\n // event.detail is the number of clicks that have happened recently. If the number is 2, then the user double clicked.\n if (\n event.detail === 2 &&\n event.buttons === 4 &&\n this.interactionApi != null\n ) {\n await this.interactionApi.viewAll();\n }\n }\n\n protected beginDrag(event: BaseEvent): void {\n if (this.keyboardControls && event.metaKey && event.shiftKey) {\n this.currentInteraction = this.rotatePointInteraction;\n } else if (this.keyboardControls && event.shiftKey && event.altKey) {\n this.currentInteraction = this.twistInteraction;\n } else if (this.keyboardControls && event.shiftKey) {\n this.currentInteraction = this.zoomInteraction;\n } else if (this.keyboardControls && (event.metaKey || event.ctrlKey)) {\n this.currentInteraction = this.panInteraction;\n } else if (this.keyboardControls && event.altKey) {\n this.currentInteraction = this.rotateInteraction;\n }\n\n if (event.buttons === 1) {\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n } else if (event.buttons === 2) {\n this.draggingInteraction = this.panInteraction;\n } else if (event.buttons === 4) {\n this.draggingInteraction =\n this.lastPrimaryRotateInteraction ?? this.rotateInteraction;\n }\n\n if (\n this.draggingInteraction != null &&\n this.interactionApi != null &&\n this.element != null\n ) {\n // Ensure any scroll wheel interactions have been ended prior to beginning\n // another interaction to prevent the interaction from being ended early.\n this.zoomInteraction.endDrag(event, this.interactionApi);\n\n this.draggingInteraction.beginDrag(\n event,\n this.downPositionCanvas || Point.create(event.clientX, event.clientY),\n this.interactionApi,\n this.element\n );\n }\n }\n\n protected drag(event: BaseEvent): void {\n if (this.keyboardControls && event.altKey && event.shiftKey) {\n this.currentInteraction = this.twistInteraction;\n } else {\n this.currentInteraction = undefined;\n }\n this.draggingInteraction =\n this.currentInteraction ||\n this.draggingInteraction ||\n this.primaryInteraction;\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.drag(event, this.interactionApi);\n }\n }\n\n protected endDrag(event: BaseEvent): void {\n if (\n this.keyboardControls &&\n this.currentInteraction === this.twistInteraction\n ) {\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.endDrag(event, this.interactionApi);\n this.draggingInteraction = undefined;\n }\n }\n\n protected handleMouseWheel(event: WheelEvent): void {\n event.preventDefault();\n\n if (\n this.element != null &&\n this.interactionApi != null &&\n event.buttons !== 4\n ) {\n const delta =\n -this.wheelDeltaToPixels(event.deltaY, event.deltaMode) / 10;\n const rect = this.element.getBoundingClientRect();\n const point = getMouseClientPosition(event, rect);\n const scrollSize = Math.abs(event.deltaY);\n\n if (scrollSize < 12) {\n // For small wheel movements, send a single zoom event.\n void this.zoomInteraction.zoomToPoint(\n point,\n delta,\n this.interactionApi\n );\n } else {\n const divisions = Math.min(10, Math.ceil(scrollSize / 12));\n const zoomDelta = delta / divisions;\n // For larger wheel movements, divide the delta into multiple zoom events with increasing delay\n // which approximates a smooth zoom deceleration curve for the end user.\n for (let i = 1; i <= divisions; i++) {\n const delayMs = i * 5;\n window.setTimeout(() => {\n if (this.interactionApi != null) {\n this.zoomInteraction.zoomToPoint(\n point,\n zoomDelta,\n this.interactionApi,\n delayMs\n );\n }\n }, delayMs);\n }\n }\n }\n }\n\n protected wheelDeltaToPixels(deltaY: number, deltaMode: number): number {\n // Cached values are an optimization we can use given mouseWheel\n // events can happen dozen or hundreds of times per scroll, but body style\n // is very unlikely to change frequently or while doing wheel movements.\n if (this.bodyStyleCache == null) {\n const bodyStyle = window.getComputedStyle(document.body);\n this.bodyStyleCache = {\n fontSize:\n parseFloat(bodyStyle.getPropertyValue('fontSize')) ||\n DEFAULT_FONT_SIZE,\n lineHeight:\n parseFloat(bodyStyle.getPropertyValue('lineHeight')) ||\n DEFAULT_LINE_HEIGHT,\n height:\n parseFloat(bodyStyle.getPropertyValue('height')) ||\n window.innerHeight,\n };\n window.setTimeout(() => {\n this.bodyStyleCache = undefined;\n }, 4800); // For now hardcoded. Could be derived. eg mouseWheelInteractionEndDebounce * 12\n }\n\n if (deltaMode === 1) {\n // deltaMode 1 corresponds to DOM_DELTA_LINE, which computes deltas in lines\n return (\n deltaY * (this.bodyStyleCache.fontSize * this.bodyStyleCache.lineHeight)\n );\n } else if (deltaMode === 2) {\n // deltaMode 2 corresponds to DOM_DELTA_PAGE, which computes deltas in pages\n return deltaY * this.bodyStyleCache.height;\n }\n // deltaMode 0 corresponds to DOM_DELTA_PIXEL, which computes deltas in pixels\n return deltaY;\n }\n\n protected getCanvasPosition(event: BaseEvent): Point.Point | undefined {\n const canvasBounds = this.element?.getBoundingClientRect();\n const canvasOffset =\n canvasBounds != null\n ? Point.create(canvasBounds.left, canvasBounds.top)\n : undefined;\n\n return canvasOffset != null\n ? Point.subtract(Point.create(event.clientX, event.clientY), canvasOffset)\n : undefined;\n }\n\n protected isTouch(event: BaseEvent): boolean {\n return window.PointerEvent != null && event instanceof PointerEvent\n ? event.pointerType === 'touch'\n : false;\n }\n}\n"]}
1
+ {"version":3,"file":"baseInteractionHandler.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/baseInteractionHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAc,eAAe,EAAY,MAAM,kBAAkB,CAAC;AAGzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAsBhD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,OAAgB,sBAAsB;IAwB1C,YACY,SAAsC,EACtC,OAAgC,EAChC,SAAsC,EACxC,iBAAoC,EACpC,sBAA8C,EAC9C,eAAgC,EAChC,cAA8B,EAC9B,gBAAkC,EAClC,gBAAkC,EAClC,SAAyB;QATvB,cAAS,GAAT,SAAS,CAA6B;QACtC,YAAO,GAAP,OAAO,CAAyB;QAChC,cAAS,GAAT,SAAS,CAA6B;QACxC,sBAAiB,GA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pB,4EAA4E;YAC5E,OAAO,CACL,MAAM,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CACzE,CAAC;QACJ,CAAC;aAAM,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;YAC3B,4EAA4E;YAC5E,OAAO,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;QAC7C,CAAC;QACD,8EAA8E;QAC9E,OAAO,MAAM,CAAC;IAChB,CAAC;IAES,iBAAiB,CAAC,KAAgB;;QAC1C,MAAM,YAAY,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,qBAAqB,EAAE,CAAC;QAC3D,MAAM,YAAY,GAChB,YAAY,IAAI,IAAI;YAClB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC;YACnD,CAAC,CAAC,SAAS,CAAC;QAEhB,OAAO,YAAY,IAAI,IAAI;YACzB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;YAC1E,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAES,OAAO,CAAC,KAAgB;QAChC,OAAO,MAAM,CAAC,YAAY,IAAI,IAAI,IAAI,KAAK,YAAY,YAAY;YACjE,CAAC,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO;YAC/B,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;CACF","sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { Disposable, EventDispatcher, Listener } from '@vertexvis/utils';\n\nimport { ConfigProvider } from '../config';\nimport { getMouseClientPosition } from '../dom';\nimport { InteractionApi } from './interactionApi';\nimport { BaseEvent } from './interactionEvent';\nimport { InteractionHandler } from './interactionHandler';\nimport {\n MouseInteraction,\n PanInteraction,\n PivotInteraction,\n RotateInteraction,\n RotatePointInteraction,\n TwistInteraction,\n ZoomInteraction,\n} from './mouseInteractions';\n\nexport type InteractionType =\n | 'rotate'\n | 'zoom'\n | 'pan'\n | 'twist'\n | 'rotate-point'\n | 'pivot';\n\nconst DEFAULT_FONT_SIZE = 16;\nconst DEFAULT_LINE_HEIGHT = 1.2;\n\nexport abstract class BaseInteractionHandler implements InteractionHandler {\n protected interactionApi?: InteractionApi;\n protected element?: HTMLElement;\n protected downPosition?: Point.Point;\n private downPositionCanvas?: Point.Point;\n private primaryInteraction: MouseInteraction;\n private currentInteraction?: MouseInteraction;\n private draggingInteraction: MouseInteraction | undefined;\n private lastPrimaryRotateInteraction?: MouseInteraction;\n private isDragging = false;\n private lastMoveEvent?: BaseEvent;\n private interactionTimer?: number;\n private keyboardControls = false;\n\n protected disableIndividualInteractions = false;\n\n private bodyStyleCache?: {\n fontSize: number;\n lineHeight: number;\n height: number;\n };\n\n private primaryInteractionTypeChange = new EventDispatcher<void>();\n\n public constructor(\n protected downEvent: 'mousedown' | 'pointerdown',\n protected upEvent: 'mouseup' | 'pointerup',\n protected moveEvent: 'mousemove' | 'pointermove',\n private rotateInteraction: RotateInteraction,\n private rotatePointInteraction: RotatePointInteraction,\n private zoomInteraction: ZoomInteraction,\n private panInteraction: PanInteraction,\n private twistInteraction: TwistInteraction,\n private pivotInteraction: PivotInteraction,\n private getConfig: ConfigProvider,\n ) {\n this.primaryInteraction = rotateInteraction;\n this.handleDownEvent = this.handleDownEvent.bind(this);\n this.handleMouseWheel = this.handleMouseWheel.bind(this);\n this.handleWindowMove = this.handleWindowMove.bind(this);\n this.handleWindowUp = this.handleWindowUp.bind(this);\n this.handleDoubleClick = this.handleDoubleClick.bind(this);\n }\n\n public initialize(element: HTMLElement, api: InteractionApi): void {\n this.element = element;\n this.interactionApi = api;\n element.addEventListener(this.downEvent, this.handleDownEvent);\n element.addEventListener('mousedown', this.handleDoubleClick);\n element.addEventListener('wheel', this.handleMouseWheel, {\n passive: false,\n });\n }\n\n public dispose(): void {\n this.element?.removeEventListener(this.downEvent, this.handleDownEvent);\n this.element?.removeEventListener('mousedown', this.handleDoubleClick);\n this.element?.removeEventListener('wheel', this.handleMouseWheel);\n this.element = undefined;\n }\n\n public onPrimaryInteractionTypeChange(listener: Listener<void>): Disposable {\n return this.primaryInteractionTypeChange.on(listener);\n }\n\n public setCurrentInteractionType(type?: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.currentInteraction = this.rotateInteraction;\n break;\n case 'zoom':\n this.currentInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.currentInteraction = this.panInteraction;\n break;\n case 'twist':\n this.currentInteraction = this.twistInteraction;\n break;\n case 'rotate-point':\n this.currentInteraction = this.rotatePointInteraction;\n break;\n case 'pivot':\n this.currentInteraction = this.pivotInteraction;\n break;\n default:\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction) {\n const point = this.draggingInteraction.getPosition();\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n this.interactionApi?.resetLastAngle();\n this.draggingInteraction.setPosition(point);\n }\n }\n\n public getPrimaryInteractionType(): InteractionType {\n return this.primaryInteraction.getType();\n }\n\n public getCurrentInteractionType(): InteractionType {\n return (this.currentInteraction || this.primaryInteraction).getType();\n }\n\n public setPrimaryInteractionType(type: InteractionType): void {\n switch (type) {\n case 'rotate':\n this.primaryInteraction = this.rotateInteraction;\n this.lastPrimaryRotateInteraction = this.rotateInteraction;\n break;\n case 'rotate-point':\n this.primaryInteraction = this.rotatePointInteraction;\n this.lastPrimaryRotateInteraction = this.rotatePointInteraction;\n break;\n case 'zoom':\n this.primaryInteraction = this.zoomInteraction;\n break;\n case 'pan':\n this.primaryInteraction = this.panInteraction;\n break;\n case 'pivot':\n this.primaryInteraction = this.pivotInteraction;\n break;\n }\n this.primaryInteractionTypeChange.emit();\n }\n\n public setDefaultKeyboardControls(keyboardControls: boolean): void {\n this.keyboardControls = keyboardControls;\n }\n\n protected handleDownEvent(event: BaseEvent): void {\n // Prevent selection of any text while interacting with the model.\n event.preventDefault();\n\n this.interactionTimer = window.setTimeout(() => {\n this.downPosition = Point.create(event.screenX, event.screenY);\n this.downPositionCanvas = this.getCanvasPosition(event);\n this.interactionTimer = undefined;\n\n // Perform the current movement in the case that the interaction timer elapses\n if (this.lastMoveEvent != null) {\n this.handleWindowMove(this.lastMoveEvent);\n }\n }, this.getConfig().interactions.interactionDelay);\n\n window.addEventListener(this.moveEvent, this.handleWindowMove);\n window.addEventListener(this.upEvent, this.handleWindowUp);\n }\n\n protected handleWindowMove(event: BaseEvent): void {\n if (this.interactionTimer == null) {\n if (this.disableIndividualInteractions) {\n return;\n }\n\n const position = Point.create(event.screenX, event.screenY);\n const pixelThreshold =\n this.interactionApi != null\n ? this.interactionApi.pixelThreshold(this.isTouch(event))\n : 2;\n if (\n this.downPosition != null &&\n Point.distance(position, this.downPosition) >= pixelThreshold &&\n !this.isDragging\n ) {\n this.beginDrag(event);\n this.isDragging = true;\n }\n\n if (this.isDragging) {\n this.drag(event);\n }\n }\n\n this.lastMoveEvent = event;\n }\n\n protected async handleWindowUp(event: BaseEvent): Promise<void> {\n if (this.isDragging) {\n this.endDrag(event);\n this.isDragging = false;\n }\n\n if (this.interactionTimer != null) {\n window.clearTimeout(this.interactionTimer);\n this.interactionTimer = undefined;\n }\n\n window.removeEventListener(this.moveEvent, this.handleWindowMove);\n window.removeEventListener(this.upEvent, this.handleWindowUp);\n this.lastMoveEvent = undefined;\n }\n\n protected async handleDoubleClick(event: BaseEvent): Promise<void> {\n // event.detail is the number of clicks that have happened recently. If the number is 2, then the user double clicked.\n if (\n event.detail === 2 &&\n event.buttons === 4 &&\n this.interactionApi != null\n ) {\n await this.interactionApi.viewAll();\n }\n }\n\n protected beginDrag(event: BaseEvent): void {\n if (this.keyboardControls && event.metaKey && event.shiftKey) {\n this.currentInteraction = this.rotatePointInteraction;\n } else if (this.keyboardControls && event.shiftKey && event.altKey) {\n this.currentInteraction = this.twistInteraction;\n } else if (this.keyboardControls && event.shiftKey) {\n this.currentInteraction = this.zoomInteraction;\n } else if (this.keyboardControls && (event.metaKey || event.ctrlKey)) {\n this.currentInteraction = this.panInteraction;\n } else if (this.keyboardControls && event.altKey) {\n this.currentInteraction = this.rotateInteraction;\n }\n\n if (event.buttons === 1) {\n this.draggingInteraction =\n this.currentInteraction || this.primaryInteraction;\n } else if (event.buttons === 2) {\n this.draggingInteraction = this.panInteraction;\n } else if (event.buttons === 4) {\n this.draggingInteraction =\n this.lastPrimaryRotateInteraction ?? this.rotateInteraction;\n }\n\n if (\n this.draggingInteraction != null &&\n this.interactionApi != null &&\n this.element != null\n ) {\n // Ensure any scroll wheel interactions have been ended prior to beginning\n // another interaction to prevent the interaction from being ended early.\n this.zoomInteraction.endDrag(event, this.interactionApi);\n\n this.draggingInteraction.beginDrag(\n event,\n this.downPositionCanvas || Point.create(event.clientX, event.clientY),\n this.interactionApi,\n this.element,\n );\n }\n }\n\n protected drag(event: BaseEvent): void {\n if (this.keyboardControls && event.altKey && event.shiftKey) {\n this.currentInteraction = this.twistInteraction;\n } else {\n this.currentInteraction = undefined;\n }\n this.draggingInteraction =\n this.currentInteraction ||\n this.draggingInteraction ||\n this.primaryInteraction;\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.drag(event, this.interactionApi);\n }\n }\n\n protected endDrag(event: BaseEvent): void {\n if (\n this.keyboardControls &&\n this.currentInteraction === this.twistInteraction\n ) {\n this.currentInteraction = undefined;\n }\n\n if (this.draggingInteraction != null && this.interactionApi != null) {\n this.draggingInteraction.endDrag(event, this.interactionApi);\n this.draggingInteraction = undefined;\n }\n }\n\n protected handleMouseWheel(event: WheelEvent): void {\n event.preventDefault();\n\n if (\n this.element != null &&\n this.interactionApi != null &&\n event.buttons !== 4\n ) {\n const delta =\n -this.wheelDeltaToPixels(event.deltaY, event.deltaMode) / 10;\n const rect = this.element.getBoundingClientRect();\n const point = getMouseClientPosition(event, rect);\n const scrollSize = Math.abs(event.deltaY);\n\n if (scrollSize < 12) {\n // For small wheel movements, send a single zoom event.\n void this.zoomInteraction.zoomToPoint(\n point,\n delta,\n this.interactionApi,\n );\n } else {\n const divisions = Math.min(10, Math.ceil(scrollSize / 12));\n const zoomDelta = delta / divisions;\n // For larger wheel movements, divide the delta into multiple zoom events with increasing delay\n // which approximates a smooth zoom deceleration curve for the end user.\n for (let i = 1; i <= divisions; i++) {\n const delayMs = i * 5;\n window.setTimeout(() => {\n if (this.interactionApi != null) {\n this.zoomInteraction.zoomToPoint(\n point,\n zoomDelta,\n this.interactionApi,\n delayMs,\n );\n }\n }, delayMs);\n }\n }\n }\n }\n\n protected wheelDeltaToPixels(deltaY: number, deltaMode: number): number {\n // Cached values are an optimization we can use given mouseWheel\n // events can happen dozen or hundreds of times per scroll, but body style\n // is very unlikely to change frequently or while doing wheel movements.\n if (this.bodyStyleCache == null) {\n const bodyStyle = window.getComputedStyle(document.body);\n this.bodyStyleCache = {\n fontSize:\n parseFloat(bodyStyle.getPropertyValue('fontSize')) ||\n DEFAULT_FONT_SIZE,\n lineHeight:\n parseFloat(bodyStyle.getPropertyValue('lineHeight')) ||\n DEFAULT_LINE_HEIGHT,\n height:\n parseFloat(bodyStyle.getPropertyValue('height')) ||\n window.innerHeight,\n };\n window.setTimeout(() => {\n this.bodyStyleCache = undefined;\n }, 4800); // For now hardcoded. Could be derived. eg mouseWheelInteractionEndDebounce * 12\n }\n\n if (deltaMode === 1) {\n // deltaMode 1 corresponds to DOM_DELTA_LINE, which computes deltas in lines\n return (\n deltaY * (this.bodyStyleCache.fontSize * this.bodyStyleCache.lineHeight)\n );\n } else if (deltaMode === 2) {\n // deltaMode 2 corresponds to DOM_DELTA_PAGE, which computes deltas in pages\n return deltaY * this.bodyStyleCache.height;\n }\n // deltaMode 0 corresponds to DOM_DELTA_PIXEL, which computes deltas in pixels\n return deltaY;\n }\n\n protected getCanvasPosition(event: BaseEvent): Point.Point | undefined {\n const canvasBounds = this.element?.getBoundingClientRect();\n const canvasOffset =\n canvasBounds != null\n ? Point.create(canvasBounds.left, canvasBounds.top)\n : undefined;\n\n return canvasOffset != null\n ? Point.subtract(Point.create(event.clientX, event.clientY), canvasOffset)\n : undefined;\n }\n\n protected isTouch(event: BaseEvent): boolean {\n return window.PointerEvent != null && event instanceof PointerEvent\n ? event.pointerType === 'touch'\n : false;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"flyToPartKeyInteraction.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/flyToPartKeyInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAa,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOnE,MAAM,OAAO,uBAAuB;IAClC,YACU,MAAiB,EACjB,cAA8B,EAC9B,kBAAsC;QAFtC,WAAM,GAAN,MAAM,CAAW;QACjB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC7C,CAAC;IAEG,SAAS,CAAC,CAAkB;QACjC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,EAAE,CAAC,CAAkB;;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAC1C;YACE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,CAAC,KAAI,CAAC,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,CAAC,KAAI,CAAC,CAAC;SAC7D,EACD,IAAI,CACL,CAAC;QAEF,IACE,CAAA,MAAA,SAAS,CAAC,QAAQ,0CAAE,IAAI,KAAI,IAAI;YAChC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAClC,CAAC;YACD,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBACtB,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM;gBACzC,SAAS,EAAE;oBACT,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC;iBACtE;aACF,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CACX,sDAAsD,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAC3F,CAAC;QACJ,CAAC;IACH,CAAC;CACF","sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { StreamApi, toProtoDuration } from '@vertexvis/stream-api';\n\nimport { ConfigProvider } from '../config';\nimport { ImageScaleProvider } from '../scenes';\nimport { KeyInteraction } from './keyInteraction';\nimport { TapEventDetails } from './tapEventDetails';\n\nexport class FlyToPartKeyInteraction implements KeyInteraction<TapEventDetails> {\n public constructor(\n private stream: StreamApi,\n private configProvider: ConfigProvider,\n private imageScaleProvider: ImageScaleProvider\n ) {}\n\n public predicate(e: TapEventDetails): boolean {\n return e.altKey && !e.shiftKey;\n }\n\n public async fn(e: TapEventDetails): Promise<void> {\n const scale = this.imageScaleProvider();\n const hitResult = await this.stream.hitItems(\n {\n point: Point.scale(e.position, scale?.x || 1, scale?.y || 1),\n },\n true\n );\n\n if (\n hitResult.hitItems?.hits != null &&\n hitResult.hitItems.hits.length > 0\n ) {\n await this.stream.flyTo({\n itemId: hitResult.hitItems.hits[0].itemId,\n animation: {\n duration: toProtoDuration(this.configProvider().animation.durationMs),\n },\n });\n } else {\n console.debug(\n `No hit results found for fly to part [position={x: ${e.position.x}, y: ${e.position.y}}]`\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"flyToPartKeyInteraction.js","sourceRoot":"","sources":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,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CACX,sDAAsD,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAC3F,CAAC;QACJ,CAAC;IACH,CAAC;CACF","sourcesContent":["import { Point } from '@vertexvis/geometry';\nimport { StreamApi, toProtoDuration } from '@vertexvis/stream-api';\n\nimport { ConfigProvider } from '../config';\nimport { ImageScaleProvider } from '../scenes';\nimport { KeyInteraction } from './keyInteraction';\nimport { TapEventDetails } from './tapEventDetails';\n\nexport class FlyToPartKeyInteraction implements KeyInteraction<TapEventDetails> {\n public constructor(\n private stream: StreamApi,\n private configProvider: ConfigProvider,\n private imageScaleProvider: ImageScaleProvider,\n ) {}\n\n public predicate(e: TapEventDetails): boolean {\n return e.altKey && !e.shiftKey;\n }\n\n public async fn(e: TapEventDetails): Promise<void> {\n const scale = this.imageScaleProvider();\n const hitResult = await this.stream.hitItems(\n {\n point: Point.scale(e.position, scale?.x || 1, scale?.y || 1),\n },\n true,\n );\n\n if (\n hitResult.hitItems?.hits != null &&\n hitResult.hitItems.hits.length > 0\n ) {\n await this.stream.flyTo({\n itemId: hitResult.hitItems.hits[0].itemId,\n animation: {\n duration: toProtoDuration(this.configProvider().animation.durationMs),\n },\n });\n } else {\n console.debug(\n `No hit results found for fly to part [position={x: ${e.position.x}, y: ${e.position.y}}]`,\n );\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"flyToPositionKeyInteraction.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/flyToPositionKeyInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAa,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAA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E,EAAE,CAAC;YAC3B,uEAAuE;YACvE,uEAAuE;YACvE,gFAAgF;YAChF,OAAO,uCAAuC,CAC5C,QAAQ,EACR,UAAU,EACV,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CACxC,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,6CAA6C;YAC7C,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;CACF","sourcesContent":["import { BoundingBox, Point, Vector3 } from '@vertexvis/geometry';\nimport { StreamApi, toProtoDuration } from '@vertexvis/stream-api';\n\nimport { ConfigProvider } from '../config';\nimport { updateLookAtRelativeToBoundingBoxCenter } from '../rendering/vectors';\nimport { ImageScaleProvider, Scene } from '../scenes';\nimport { FrameCamera } from '../types';\nimport { KeyInteraction } from './keyInteraction';\nimport { TapEventDetails } from './tapEventDetails';\n\ntype SceneProvider = () => Promise<Scene>;\n\nexport class FlyToPositionKeyInteraction implements KeyInteraction<TapEventDetails> {\n public constructor(\n private stream: StreamApi,\n private configProvider: ConfigProvider,\n private imageScaleProvider: ImageScaleProvider,\n private sceneProvider: SceneProvider\n ) {}\n\n public predicate(e: TapEventDetails): boolean {\n return e.altKey && e.shiftKey;\n }\n\n public async fn(e: TapEventDetails): Promise<void> {\n const scale = this.imageScaleProvider();\n const hitResult = await this.stream.hitItems(\n {\n point: Point.scale(e.position, scale?.x || 1, scale?.y || 1),\n },\n true\n );\n\n if (\n hitResult.hitItems?.hits != null &&\n hitResult.hitItems.hits.length > 0 &&\n hitResult.hitItems.hits[0].hitPoint != null\n ) {\n const scene = await this.sceneProvider();\n const camera = (await this.sceneProvider()).camera();\n const hit = hitResult.hitItems.hits[0];\n\n if (\n hit.hitPoint != null &&\n hit.hitPoint.x != null &&\n hit.hitPoint.y != null &&\n hit.hitPoint.z != null\n ) {\n const hitPoint = Vector3.create(\n hit.hitPoint.x,\n hit.hitPoint.y,\n hit.hitPoint.z\n );\n const newLookAt = await this.getLookAtPoint(\n scene,\n hitPoint,\n camera.viewVector\n );\n\n await this.stream.flyTo({\n camera: FrameCamera.toProtobuf(\n camera\n .update({\n lookAt: newLookAt,\n rotationPoint: newLookAt,\n })\n .toFrameCamera()\n ),\n animation: {\n duration: toProtoDuration(\n this.configProvider().animation.durationMs\n ),\n },\n });\n } else {\n console.debug(\n `No hit position found for fly to position [position={x: ${e.position.x}, y: ${e.position.y}}, hit-id={${hit.itemId?.hex}}]`\n );\n }\n } else {\n console.debug(\n `No hit results found for fly to position [position={x: ${e.position.x}, y: ${e.position.y}}]`\n );\n }\n }\n\n protected getLookAtPoint(\n scene: Scene,\n hitPoint: Vector3.Vector3,\n viewVector: Vector3.Vector3\n ): Vector3.Vector3 {\n if (scene.isOrthographic()) {\n // Update the lookAt point to take the center of the model into account\n // This change helps ensure that the lookAt point is consistent between\n // the SDK and back-end system such that the calculated depth buffer is correct.\n return updateLookAtRelativeToBoundingBoxCenter(\n hitPoint,\n viewVector,\n BoundingBox.center(scene.boundingBox())\n );\n } else {\n // For perspective, just return the hit point\n return hitPoint;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"flyToPositionKeyInteraction.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/flyToPositionKeyInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAa,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAMvC,MAAM,OAAO,2BAA2B;IACtC,YACU,MAAiB,EACjB,cAA8B,EAC9B,kBAAsC,EACtC,aAA4B;QAH5B,WAAM,GAAN,MAAM,CAAW;QACjB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,kBAAa,GAAb,aAAa,CAAe;IACnC,CAAC;IA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;IACH,CAAC;CACF","sourcesContent":["import { BoundingBox, Point, Vector3 } from '@vertexvis/geometry';\nimport { StreamApi, toProtoDuration } from '@vertexvis/stream-api';\n\nimport { ConfigProvider } from '../config';\nimport { updateLookAtRelativeToBoundingBoxCenter } from '../rendering/vectors';\nimport { ImageScaleProvider, Scene } from '../scenes';\nimport { FrameCamera } from '../types';\nimport { KeyInteraction } from './keyInteraction';\nimport { TapEventDetails } from './tapEventDetails';\n\ntype SceneProvider = () => Promise<Scene>;\n\nexport class FlyToPositionKeyInteraction implements KeyInteraction<TapEventDetails> {\n public constructor(\n private stream: StreamApi,\n private configProvider: ConfigProvider,\n private imageScaleProvider: ImageScaleProvider,\n private sceneProvider: SceneProvider,\n ) {}\n\n public predicate(e: TapEventDetails): boolean {\n return e.altKey && e.shiftKey;\n }\n\n public async fn(e: TapEventDetails): Promise<void> {\n const scale = this.imageScaleProvider();\n const hitResult = await this.stream.hitItems(\n {\n point: Point.scale(e.position, scale?.x || 1, scale?.y || 1),\n },\n true,\n );\n\n if (\n hitResult.hitItems?.hits != null &&\n hitResult.hitItems.hits.length > 0 &&\n hitResult.hitItems.hits[0].hitPoint != null\n ) {\n const scene = await this.sceneProvider();\n const camera = (await this.sceneProvider()).camera();\n const hit = hitResult.hitItems.hits[0];\n\n if (\n hit.hitPoint != null &&\n hit.hitPoint.x != null &&\n hit.hitPoint.y != null &&\n hit.hitPoint.z != null\n ) {\n const hitPoint = Vector3.create(\n hit.hitPoint.x,\n hit.hitPoint.y,\n hit.hitPoint.z,\n );\n const newLookAt = await this.getLookAtPoint(\n scene,\n hitPoint,\n camera.viewVector,\n );\n\n await this.stream.flyTo({\n camera: FrameCamera.toProtobuf(\n camera\n .update({\n lookAt: newLookAt,\n rotationPoint: newLookAt,\n })\n .toFrameCamera(),\n ),\n animation: {\n duration: toProtoDuration(\n this.configProvider().animation.durationMs,\n ),\n },\n });\n } else {\n console.debug(\n `No hit position found for fly to position [position={x: ${e.position.x}, y: ${e.position.y}}, hit-id={${hit.itemId?.hex}}]`,\n );\n }\n } else {\n console.debug(\n `No hit results found for fly to position [position={x: ${e.position.x}, y: ${e.position.y}}]`,\n );\n }\n }\n\n protected getLookAtPoint(\n scene: Scene,\n hitPoint: Vector3.Vector3,\n viewVector: Vector3.Vector3,\n ): Vector3.Vector3 {\n if (scene.isOrthographic()) {\n // Update the lookAt point to take the center of the model into account\n // This change helps ensure that the lookAt point is consistent between\n // the SDK and back-end system such that the calculated depth buffer is correct.\n return updateLookAtRelativeToBoundingBoxCenter(\n hitPoint,\n viewVector,\n BoundingBox.center(scene.boundingBox()),\n );\n } else {\n // For perspective, just return the hit point\n return hitPoint;\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactionApi.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/interactionApi.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,EACL,GAAG,EACH,OAAO,GACR,MAAM,qBAAqB,CAAC;AAY7B,OAAO,EAEL,UAAU,GAIX,MAAM,UAAU,CAAC;AA8BlB;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAUlC,YACY,MAAiB,EACnB,OAAsB,EACpB,SAAoC,EACpC,QAAuB,EACvB,QAAyC,EAC5C,WAA2B,EAC1B,UAAyC,EACzC,gBAA+C,EAC/C,gBAA+C,EAC/C,yBAA6C,EAC7C,0BAA8C;QAV5C,WAAM,GAAN,MAAM,CAAW;QACnB,YAAO,GAAP,OAAO,CAAe;QACpB,cAAS,GAAT,SAAS,CAA2B;QACpC,aAAQ,GAAR,QAAQ,CAAe;QACvB,aAAQ,GAAR,QAAQ,CAAiC;QAC5C,gBAAW,GAAX,WAAW,CAAgB;QAC1B,eAAU,GAAV,UAAU,CAA+B;QACzC,qBAAgB,GAAhB,gBAAgB,CAA+B;QAC/C,qBAAgB,GAAhB,gBAAgB,CAA+B;QAC/C,8BAAyB,GAAzB,yBAAyB,CAAoB;QAC7C,+BAA0B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;YACN,OAAO;YACP,OAAO;YACP,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAEO,mBAAmB,CAAC,OAAiB;QAC3C,OAAO,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC;IACnE,CAAC;IAES,aAAa,CACrB,KAAkB,EAClB,WAAwB,EACxB,aAA8B;QAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,QAAQ;YACb,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC;YACzD,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;CAeF","sourcesContent":["import { EventEmitter } from '@stencil/core';\nimport { vertexvis } from '@vertexvis/frame-streaming-protos';\nimport {\n Angle,\n BoundingBox,\n Plane,\n Point,\n Ray,\n Vector3,\n} from '@vertexvis/geometry';\nimport { StreamApi } from '@vertexvis/stream-api';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { ReceivedFrame } from '../..';\nimport { Cursor, CursorManager } from '../cursors';\nimport {\n Camera,\n CameraRenderOptions,\n OrthographicCamera,\n Scene,\n} from '../scenes';\nimport {\n DepthBuffer,\n EntityType,\n FrameCameraBase,\n Interactions,\n Viewport,\n} from '../types';\nimport { TapEventDetails, TapEventKeys } from './tapEventDetails';\n\nexport type SceneProvider = () => Promise<Scene>;\n\nexport type InteractionConfigProvider = () => Interactions.InteractionConfig;\n\nexport type CameraTransform<\n T extends Camera = Camera,\n R extends Camera = Camera,\n> = (data: {\n camera: T;\n viewport: Viewport;\n scale: Point.Point;\n boundingBox: BoundingBox.BoundingBox;\n frame: ReceivedFrame;\n depthBuffer?: DepthBuffer;\n}) => R;\n\nexport interface PanData {\n hitPt: Vector3.Vector3;\n hitPlane: Plane.Plane;\n startingCamera: FrameCameraBase;\n}\n\nexport interface ZoomData {\n hitPt: Vector3.Vector3;\n hitPlane: Plane.Plane;\n}\n\n/**\n * The `InteractionApi` provides methods that API developers can use to modify\n * the internal state of an interaction.\n */\nexport abstract class InteractionApi<T extends Camera = Camera> {\n protected currentCamera?: Camera;\n private activeRenderOptions?: CameraRenderOptions;\n private sceneLoadingPromise?: Promise<Scene>;\n private lastAngle: Angle.Angle | undefined;\n private worldRotationPoint?: Vector3.Vector3;\n\n protected panData?: PanData;\n protected zoomData?: ZoomData;\n\n public constructor(\n protected stream: StreamApi,\n private cursors: CursorManager,\n protected getConfig: InteractionConfigProvider,\n protected getScene: SceneProvider,\n protected getFrame: () => ReceivedFrame | undefined,\n public getViewport: () => Viewport,\n private tapEmitter: EventEmitter<TapEventDetails>,\n private doubleTapEmitter: EventEmitter<TapEventDetails>,\n private longPressEmitter: EventEmitter<TapEventDetails>,\n private interactionStartedEmitter: EventEmitter<void>,\n private interactionFinishedEmitter: EventEmitter<void>\n ) {\n this.tap = this.tap.bind(this);\n this.doubleTap = this.doubleTap.bind(this);\n this.longPress = this.longPress.bind(this);\n this.emitTapEvent = this.emitTapEvent.bind(this);\n }\n\n /**\n * Displays a cursor over the viewer with the given priority. Cursors with\n * higher priority will take precedence over cursors with lower priorities if\n * there's more than a single cursor added.\n *\n * @param cursor The cursor to add.\n * @param priority The priority of the cursor.\n * @returns A `Disposable` that can be used to remove the cursor.\n */\n public addCursor(cursor: Cursor, priority?: number): Disposable {\n return this.cursors.add(cursor, priority);\n }\n\n /**\n * Returns a 3D point in world space for the given 2D point in viewport space.\n *\n * @param point A point in 2D viewport space to transform.\n * @returns A 3D point in world space.\n */\n public async getWorldPointFromViewport(\n point: Point.Point\n ): Promise<Vector3.Vector3 | undefined> {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame == null) {\n throw new Error('Cannot get world point. Frame is undefined.');\n }\n\n const depthBuffer = await frame.depthBuffer();\n return depthBuffer != null\n ? viewport.transformPointToWorldSpace(point, depthBuffer, 0.5)\n : undefined;\n }\n\n /**\n * Returns the entity at the given point in viewport space.\n *\n * @param point A point in viewport space.\n * @returns The entity that was found.\n */\n public async getEntityTypeAtPoint(point: Point.Point): Promise<EntityType> {\n const viewport = this.getViewport();\n const featureMap = await this.getFrame()?.featureMap();\n\n if (featureMap != null) {\n const framePt = viewport.transformPointToFrame(point, featureMap);\n return featureMap.getEntityType(framePt);\n } else {\n return EntityType.NO_GEOMETRY;\n }\n }\n\n /**\n * Generates a ray from the given point, in viewport coordinates.\n *\n * @param point A point in viewport coordinates.\n * @returns A ray representing the direction of the point in world\n * coordinates.\n */\n public getRayFromPoint(point: Point.Point): Ray.Ray {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame != null) {\n return viewport.transformPointToRay(\n point,\n frame.image,\n frame.scene.camera\n );\n } else throw new Error('Cannot get camera. Frame is undefined.');\n }\n\n /**\n * Emits a tap event with the provided position relative to the viewer\n * canvas, along with the set of modifier keys held (if applicable).\n *\n * @param position An {x, y} coordinate marking the position of the tap.\n * @param keyDetails A set of pressed keyboard keys that you want to include\n * in the tap event.\n */\n public async tap(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(this.tapEmitter.emit, position, keyDetails, buttons);\n }\n\n public async doubleTap(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(\n this.doubleTapEmitter.emit,\n position,\n keyDetails,\n buttons\n );\n }\n\n public async longPress(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): Promise<void> {\n this.emitTapEvent(\n this.longPressEmitter.emit,\n position,\n keyDetails,\n buttons\n );\n }\n\n /**\n * Marks the start of an interaction. This method must be called before\n * performing any additional interaction operations. Use `endInteraction()` to\n * mark the end of an interaction.\n */\n public async beginInteraction(\n renderOptions: CameraRenderOptions = {}\n ): Promise<void> {\n if (!this.isInteracting()) {\n this.activeRenderOptions = renderOptions;\n this.interactionStartedEmitter.emit();\n this.sceneLoadingPromise = this.getScene();\n this.currentCamera = (await this.sceneLoadingPromise).camera();\n this.sceneLoadingPromise = undefined;\n await this.stream.beginInteraction();\n }\n }\n\n /**\n * Invokes a function to transform the scene's camera and request a new image\n * for the updated scene.\n *\n * @param t A function to transform the camera. Function will be passed the\n * camera and scene viewport and is expected to return an updated camera.\n */\n public async transformCamera(\n t: CameraTransform<T>,\n renderOptions: CameraRenderOptions = this.activeRenderOptions ?? {}\n ): Promise<void> {\n if (this.isInteracting()) {\n const scene = await this.getScene();\n const viewport = this.getViewport();\n const frame = this.getFrame();\n const depthBuffer = await frame?.depthBuffer();\n\n this.currentCamera =\n this.currentCamera != null && viewport != null && frame != null\n ? t({\n camera: this.currentCamera as T,\n viewport,\n scale: scene.scale(),\n boundingBox: scene.boundingBox(),\n frame,\n depthBuffer,\n })\n : undefined;\n\n await this.currentCamera?.render(renderOptions);\n }\n }\n\n /**\n * Performs a twist operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer or the angle to twist the camera by around the view vector.\n */\n public async twistCamera(delta: number): Promise<void>;\n public async twistCamera(delta: Point.Point): Promise<void>;\n public async twistCamera(...args: any[]): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const axis = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n\n if (args.length === 1 && typeof args[0] === 'number') {\n const angleInRadians = Angle.toRadians(-args[0]);\n return camera.rotateAroundAxis(angleInRadians, axis);\n } else if (args.length === 1) {\n const center = Point.create(viewport.width / 2, viewport.height / 2);\n const currentAngle = Angle.toDegrees(Angle.fromPoints(center, args[0]));\n const angleDelta =\n this.lastAngle != null ? currentAngle - this.lastAngle : 0;\n\n this.lastAngle = currentAngle;\n const axis = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n const angleInRadians = Angle.toRadians(-angleDelta);\n return camera.rotateAroundAxis(angleInRadians, axis);\n }\n return camera;\n });\n }\n\n /**\n * Moves the camera's position and look at to the given screen coordinate.\n *\n * If the screen coordinate intersects with an object, the camera will track\n * the hit point so the mouse position is always under the mouse.\n *\n * If the screen coordinate doesn't intersect with an object, then ???.\n *\n * @param screenPt A point in screen coordinates.\n */\n public async panCameraToScreenPoint(screenPt: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, frame, viewport, depthBuffer }) => {\n // Capture the starting state of the pan.\n if (this.panData == null) {\n const startingCamera = camera.toFrameCamera();\n const direction = startingCamera.direction;\n\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera\n );\n const fallbackPlane = Plane.fromNormalAndCoplanarPoint(\n direction,\n camera.lookAt\n );\n const fallback = Ray.intersectPlane(ray, fallbackPlane);\n if (fallback == null) {\n console.warn(\n 'Cannot determine fallback for pan. Ray does not intersect plane.'\n );\n return camera;\n }\n\n // Create a plane for the hit point that will be used to determine the\n // delta of future mouse movements to the original hit point. Fallback\n // to a plane placed at the look at point, in case there's no hit.\n const hitPt =\n depthBuffer != null\n ? this.getWorldPoint(screenPt, depthBuffer, fallback)\n : fallback;\n const hitPlane = Plane.fromNormalAndCoplanarPoint(direction, hitPt);\n\n this.panData = { hitPt, hitPlane, startingCamera };\n }\n\n if (this.panData != null) {\n const { hitPt, hitPlane, startingCamera } = this.panData;\n\n // Use a ray that originates at the screen and intersects with the hit\n // plane to determine the move distance.\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera\n );\n const movePt = Ray.intersectPlane(ray, hitPlane);\n\n if (movePt != null) {\n const delta = Vector3.subtract(hitPt, movePt);\n return camera.update(startingCamera).moveBy(delta);\n }\n }\n return camera;\n });\n }\n\n /**\n * Performs a view all operation for the scene's bounding box, and requests a\n * new image for the updated scene.\n */\n public async viewAll(): Promise<void> {\n await (await this.getScene()).camera().viewAll().render({});\n }\n\n /**\n * Performs a rotate operation of the scene around the camera's look at point,\n * and requests a new image for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async rotateCamera(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const upVector = Vector3.normalize(camera.up);\n const directionVector = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n const crossX = Vector3.cross(upVector, directionVector);\n const crossY = Vector3.cross(directionVector, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxis = Vector3.cross(mouseToWorld, directionVector);\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n return camera.rotateAroundAxis(angle, rotationAxis);\n });\n }\n\n public async rotateCameraAtPoint(\n delta: Point.Point,\n point: Point.Point\n ): Promise<void> {\n return this.transformCamera(({ camera, viewport, depthBuffer }) => {\n if (this.worldRotationPoint == null) {\n this.worldRotationPoint =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, camera.lookAt)\n : camera.lookAt;\n }\n\n const upVector = Vector3.normalize(camera.up);\n const vv = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n\n const crossX = Vector3.cross(upVector, vv);\n const crossY = Vector3.cross(vv, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxis = Vector3.cross(mouseToWorld, vv);\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n const updated = camera.rotateAroundAxisAtPoint(\n angle,\n this.worldRotationPoint,\n rotationAxis\n );\n\n return updated.update({\n // Scale the lookAt point to the same length as the distance to the\n // center of the bounding box to maintain zoom and pan behavior.\n lookAt: Vector3.add(\n Vector3.scale(\n Math.abs(camera.signedDistanceToBoundingBoxCenter()) /\n Vector3.magnitude(updated.viewVector),\n updated.viewVector\n ),\n updated.position\n ),\n });\n });\n }\n\n /**\n * Performs a zoom operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta The distance to zoom. Positive values zoom in and negative\n * values zoom out.\n */\n public async zoomCamera(delta: number): Promise<void> {\n return this.transformCamera(({ camera, viewport, frame, boundingBox }) => {\n if (viewport != null && frame != null) {\n const isPerspective = camera?.toFrameCamera().isPerspective();\n\n if (isPerspective) {\n const vv = camera.viewVector;\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 3 multiplier was chosen to match the desired zoom speed.\n const distance = Vector3.magnitude(vv);\n const relativeDeltaToViewportHeight =\n 3 * distance * (delta / viewport.height);\n\n // Scale the current viewVector by the scalar calculated above to determine how to adjust the camera position\n const v = Vector3.normalize(vv);\n const positionChange = Vector3.scale(\n relativeDeltaToViewportHeight,\n v\n );\n\n // Calculate the new camera position\n const position = Vector3.add(camera.position, positionChange);\n\n // Update the camera with the new position\n const newCamera = camera.update({ position });\n return newCamera;\n } else {\n // Retrieve properties of the current camera\n const orthographicCamera = camera as unknown as OrthographicCamera;\n const frameCam = camera.toFrameCamera();\n const dir = frameCam.direction;\n const ray = viewport.transformPointToRay(\n viewport.center,\n frame.image,\n frameCam\n );\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 4 multiplier was chosen to match the desired zoom speed.\n const relativeDeltaToViewportHeight = 4 * (delta / viewport.height);\n\n // Calculate the fovHeight after performing the zoom. zoomedFovHeight has the\n // same units of camera.fovHeight (the world units). The new fovHeight\n // has a minimum value, which is a function of the size of the bounding box,\n // which ensures the new fovHeight is a positive, non-zero number.\n const minimumFovHeight =\n Vector3.magnitude(BoundingBox.diagonal(boundingBox)) * 1e-5;\n const zoomedFovHeight = Math.max(\n minimumFovHeight,\n orthographicCamera.fovHeight * (1 - relativeDeltaToViewportHeight)\n );\n\n // Calculate the plane and point to zoom relative to\n const planeToZoomRelativeTo = Plane.fromNormalAndCoplanarPoint(\n dir,\n frameCam.lookAt\n );\n const pointToZoomRelativeTo = Ray.intersectPlane(\n ray,\n planeToZoomRelativeTo\n );\n\n if (pointToZoomRelativeTo != null) {\n // Project the current look at point onto the zoom plane\n const projectedLookAt = Plane.projectPoint(\n planeToZoomRelativeTo,\n orthographicCamera.lookAt\n );\n\n // Calculate the vector to determine how to adjust the camera's look at point.\n // Ensure that the viewVector is scaled to the expected length in order to\n // ensure other camera calculations are correct, for example, the occlusion\n // calculations for pins.\n const fovHeightRelativeChange =\n (orthographicCamera.fovHeight - zoomedFovHeight) /\n orthographicCamera.fovHeight;\n const lookAtChangeVector = Vector3.scale(\n fovHeightRelativeChange,\n Vector3.subtract(pointToZoomRelativeTo, projectedLookAt)\n );\n\n // Calculate the camera's new look at point\n const updatedLookAt = Vector3.add(\n orthographicCamera.lookAt,\n lookAtChangeVector\n );\n\n // Update the orthographic camera\n // Note rotationPoint should match lookAt after a zoom interaction\n const newCamera = camera.update({\n lookAt: updatedLookAt,\n rotationPoint: updatedLookAt,\n fovHeight: zoomedFovHeight,\n });\n return newCamera;\n }\n }\n }\n\n return camera;\n });\n }\n\n /**\n * Performs a pivot operation of the scene's camera, updating the lookAt\n * while maintaining the position, and requests a new image for the\n * updated scene.\n *\n * @param degreesLocalX The angle to rotate the lookAt point around the local x-axis\n * @param degreesLocalY The angle to rotate the lookAt point around the local y-axis\n */\n public async pivotCamera(\n degreesLocalX: number,\n degreesLocalY: number\n ): Promise<void> {\n return this.transformCamera(({ camera }) => {\n const { position, up, lookAt } = camera;\n const normalizedUp = Vector3.normalize(up);\n const normalizedViewVector = Vector3.normalize(camera.viewVector);\n const xVector = Vector3.cross(normalizedUp, normalizedViewVector);\n const yVector = Vector3.cross(normalizedViewVector, xVector);\n\n const updatedLookAtX = Vector3.rotateAboutAxis(\n Angle.toRadians(degreesLocalX),\n lookAt,\n xVector,\n position\n );\n const updatedLookAtY = Vector3.rotateAboutAxis(\n Angle.toRadians(degreesLocalY),\n updatedLookAtX,\n yVector,\n position\n );\n\n return camera.update({ ...camera, lookAt: updatedLookAtY });\n });\n }\n\n /**\n * Marks the end of an interaction.\n */\n public async endInteraction(): Promise<void> {\n await this.sceneLoadingPromise;\n\n if (this.isInteracting()) {\n this.currentCamera = undefined;\n this.worldRotationPoint = undefined;\n this.panData = undefined;\n this.zoomData = undefined;\n this.resetLastAngle();\n\n this.interactionFinishedEmitter.emit();\n await this.stream.endInteraction();\n }\n this.activeRenderOptions = undefined;\n }\n\n /**\n * resets the last recorded angle for a twist op\n */\n public resetLastAngle(): void {\n this.lastAngle = undefined;\n }\n\n /**\n * Indicates if the API is in an interacting state.\n */\n public isInteracting(): boolean {\n return this.currentCamera != null;\n }\n\n /**\n * Returns the pixel threshold that should be used to detect\n * movement based on the type of pointer input being coarse or fine.\n * This threshold is based on the configured `coarsePointerThreshold`\n * or the `finePointerThreshold` respectively.\n *\n * @param isTouch - Whether the event is a touch or not, if false or\n * undefined, a media query will be used to determine pointer type\n * @returns The pixel threshold.\n */\n public pixelThreshold(isTouch?: boolean): number {\n const pixelThreshold = this.isCoarseInputDevice(isTouch)\n ? this.getConfig().coarsePointerThreshold\n : this.getConfig().finePointerThreshold;\n\n return pixelThreshold * window.devicePixelRatio;\n }\n\n /**\n * Performs a hit test at the given point and returns a list of hit results\n * indicating any scene items that exist at the given point.\n *\n * @param pt A point, in viewport coordinates.\n * @returns A promise that resolves with the list of hit results.\n */\n public async hitItems(\n pt: Point.Point\n ): Promise<vertexvis.protobuf.stream.IHit[]> {\n const res = await (await this.getScene()).raycaster().hitItems(pt);\n return res?.hits ?? [];\n }\n\n private emitTapEvent(\n emit: (details: TapEventDetails) => void,\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0\n ): void {\n const {\n altKey = false,\n ctrlKey = false,\n metaKey = false,\n shiftKey = false,\n } = keyDetails;\n emit({\n position,\n altKey,\n ctrlKey,\n metaKey,\n shiftKey,\n buttons,\n });\n }\n\n private isCoarseInputDevice(isTouch?: boolean): boolean {\n return isTouch || window.matchMedia('(pointer: coarse)').matches;\n }\n\n protected getWorldPoint(\n point: Point.Point,\n depthBuffer: DepthBuffer,\n fallbackPoint: Vector3.Vector3\n ): Vector3.Vector3 {\n const viewport = this.getViewport();\n const framePt = viewport.transformPointToFrame(point, depthBuffer);\n const hasDepth = depthBuffer.hitTest(framePt);\n return hasDepth\n ? viewport.transformPointToWorldSpace(point, depthBuffer)\n : fallbackPoint;\n }\n\n /**\n * Performs a pan operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public abstract panCameraByDelta(delta: Point.Point): Promise<void>;\n\n public abstract zoomCameraToPoint(\n point: Point.Point,\n delta: number\n ): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"interactionApi.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/interactionApi.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,EACL,GAAG,EACH,OAAO,GACR,MAAM,qBAAqB,CAAC;AAY7B,OAAO,EAEL,UAAU,GAIX,MAAM,UAAU,CAAC;AA8BlB;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAU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MG;IACI,KAAK,CAAC,QAAQ,CACnB,EAAe;;QAEf,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnE,OAAO,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,mCAAI,EAAE,CAAC;IACzB,CAAC;IAEO,YAAY,CAClB,IAAwC,EACxC,QAAqB,EACrB,aAAoC,EAAE,EACtC,OAAO,GAAG,CAAC;QAEX,MAAM,EACJ,MAAM,GAAG,KAAK,EACd,OAAO,GAAG,KAAK,EACf,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,GACjB,GAAG,UAAU,CAAC;QACf,IAAI,CAAC;YACH,QAAQ;YACR,MAAM;YACN,OAAO;YACP,OAAO;YACP,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAEO,mBAAmB,CAAC,OAAiB;QAC3C,OAAO,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC;IACnE,CAAC;IAES,aAAa,CACrB,KAAkB,EAClB,WAAwB,EACxB,aAA8B;QAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,QAAQ;YACb,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC;YACzD,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;CAeF","sourcesContent":["import { EventEmitter } from '@stencil/core';\nimport { vertexvis } from '@vertexvis/frame-streaming-protos';\nimport {\n Angle,\n BoundingBox,\n Plane,\n Point,\n Ray,\n Vector3,\n} from '@vertexvis/geometry';\nimport { StreamApi } from '@vertexvis/stream-api';\nimport { Disposable } from '@vertexvis/utils';\n\nimport { ReceivedFrame } from '../..';\nimport { Cursor, CursorManager } from '../cursors';\nimport {\n Camera,\n CameraRenderOptions,\n OrthographicCamera,\n Scene,\n} from '../scenes';\nimport {\n DepthBuffer,\n EntityType,\n FrameCameraBase,\n Interactions,\n Viewport,\n} from '../types';\nimport { TapEventDetails, TapEventKeys } from './tapEventDetails';\n\nexport type SceneProvider = () => Promise<Scene>;\n\nexport type InteractionConfigProvider = () => Interactions.InteractionConfig;\n\nexport type CameraTransform<\n T extends Camera = Camera,\n R extends Camera = Camera,\n> = (data: {\n camera: T;\n viewport: Viewport;\n scale: Point.Point;\n boundingBox: BoundingBox.BoundingBox;\n frame: ReceivedFrame;\n depthBuffer?: DepthBuffer;\n}) => R;\n\nexport interface PanData {\n hitPt: Vector3.Vector3;\n hitPlane: Plane.Plane;\n startingCamera: FrameCameraBase;\n}\n\nexport interface ZoomData {\n hitPt: Vector3.Vector3;\n hitPlane: Plane.Plane;\n}\n\n/**\n * The `InteractionApi` provides methods that API developers can use to modify\n * the internal state of an interaction.\n */\nexport abstract class InteractionApi<T extends Camera = Camera> {\n protected currentCamera?: Camera;\n private activeRenderOptions?: CameraRenderOptions;\n private sceneLoadingPromise?: Promise<Scene>;\n private lastAngle: Angle.Angle | undefined;\n private worldRotationPoint?: Vector3.Vector3;\n\n protected panData?: PanData;\n protected zoomData?: ZoomData;\n\n public constructor(\n protected stream: StreamApi,\n private cursors: CursorManager,\n protected getConfig: InteractionConfigProvider,\n protected getScene: SceneProvider,\n protected getFrame: () => ReceivedFrame | undefined,\n public getViewport: () => Viewport,\n private tapEmitter: EventEmitter<TapEventDetails>,\n private doubleTapEmitter: EventEmitter<TapEventDetails>,\n private longPressEmitter: EventEmitter<TapEventDetails>,\n private interactionStartedEmitter: EventEmitter<void>,\n private interactionFinishedEmitter: EventEmitter<void>,\n ) {\n this.tap = this.tap.bind(this);\n this.doubleTap = this.doubleTap.bind(this);\n this.longPress = this.longPress.bind(this);\n this.emitTapEvent = this.emitTapEvent.bind(this);\n }\n\n /**\n * Displays a cursor over the viewer with the given priority. Cursors with\n * higher priority will take precedence over cursors with lower priorities if\n * there's more than a single cursor added.\n *\n * @param cursor The cursor to add.\n * @param priority The priority of the cursor.\n * @returns A `Disposable` that can be used to remove the cursor.\n */\n public addCursor(cursor: Cursor, priority?: number): Disposable {\n return this.cursors.add(cursor, priority);\n }\n\n /**\n * Returns a 3D point in world space for the given 2D point in viewport space.\n *\n * @param point A point in 2D viewport space to transform.\n * @returns A 3D point in world space.\n */\n public async getWorldPointFromViewport(\n point: Point.Point,\n ): Promise<Vector3.Vector3 | undefined> {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame == null) {\n throw new Error('Cannot get world point. Frame is undefined.');\n }\n\n const depthBuffer = await frame.depthBuffer();\n return depthBuffer != null\n ? viewport.transformPointToWorldSpace(point, depthBuffer, 0.5)\n : undefined;\n }\n\n /**\n * Returns the entity at the given point in viewport space.\n *\n * @param point A point in viewport space.\n * @returns The entity that was found.\n */\n public async getEntityTypeAtPoint(point: Point.Point): Promise<EntityType> {\n const viewport = this.getViewport();\n const featureMap = await this.getFrame()?.featureMap();\n\n if (featureMap != null) {\n const framePt = viewport.transformPointToFrame(point, featureMap);\n return featureMap.getEntityType(framePt);\n } else {\n return EntityType.NO_GEOMETRY;\n }\n }\n\n /**\n * Generates a ray from the given point, in viewport coordinates.\n *\n * @param point A point in viewport coordinates.\n * @returns A ray representing the direction of the point in world\n * coordinates.\n */\n public getRayFromPoint(point: Point.Point): Ray.Ray {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame != null) {\n return viewport.transformPointToRay(\n point,\n frame.image,\n frame.scene.camera,\n );\n } else throw new Error('Cannot get camera. Frame is undefined.');\n }\n\n /**\n * Emits a tap event with the provided position relative to the viewer\n * canvas, along with the set of modifier keys held (if applicable).\n *\n * @param position An {x, y} coordinate marking the position of the tap.\n * @param keyDetails A set of pressed keyboard keys that you want to include\n * in the tap event.\n */\n public async tap(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0,\n ): Promise<void> {\n this.emitTapEvent(this.tapEmitter.emit, position, keyDetails, buttons);\n }\n\n public async doubleTap(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0,\n ): Promise<void> {\n this.emitTapEvent(\n this.doubleTapEmitter.emit,\n position,\n keyDetails,\n buttons,\n );\n }\n\n public async longPress(\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0,\n ): Promise<void> {\n this.emitTapEvent(\n this.longPressEmitter.emit,\n position,\n keyDetails,\n buttons,\n );\n }\n\n /**\n * Marks the start of an interaction. This method must be called before\n * performing any additional interaction operations. Use `endInteraction()` to\n * mark the end of an interaction.\n */\n public async beginInteraction(\n renderOptions: CameraRenderOptions = {},\n ): Promise<void> {\n if (!this.isInteracting()) {\n this.activeRenderOptions = renderOptions;\n this.interactionStartedEmitter.emit();\n this.sceneLoadingPromise = this.getScene();\n this.currentCamera = (await this.sceneLoadingPromise).camera();\n this.sceneLoadingPromise = undefined;\n await this.stream.beginInteraction();\n }\n }\n\n /**\n * Invokes a function to transform the scene's camera and request a new image\n * for the updated scene.\n *\n * @param t A function to transform the camera. Function will be passed the\n * camera and scene viewport and is expected to return an updated camera.\n */\n public async transformCamera(\n t: CameraTransform<T>,\n renderOptions: CameraRenderOptions = this.activeRenderOptions ?? {},\n ): Promise<void> {\n if (this.isInteracting()) {\n const scene = await this.getScene();\n const viewport = this.getViewport();\n const frame = this.getFrame();\n const depthBuffer = await frame?.depthBuffer();\n\n this.currentCamera =\n this.currentCamera != null && viewport != null && frame != null\n ? t({\n camera: this.currentCamera as T,\n viewport,\n scale: scene.scale(),\n boundingBox: scene.boundingBox(),\n frame,\n depthBuffer,\n })\n : undefined;\n\n await this.currentCamera?.render(renderOptions);\n }\n }\n\n /**\n * Performs a twist operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer or the angle to twist the camera by around the view vector.\n */\n public async twistCamera(delta: number): Promise<void>;\n public async twistCamera(delta: Point.Point): Promise<void>;\n public async twistCamera(...args: any[]): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const axis = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position),\n );\n\n if (args.length === 1 && typeof args[0] === 'number') {\n const angleInRadians = Angle.toRadians(-args[0]);\n return camera.rotateAroundAxis(angleInRadians, axis);\n } else if (args.length === 1) {\n const center = Point.create(viewport.width / 2, viewport.height / 2);\n const currentAngle = Angle.toDegrees(Angle.fromPoints(center, args[0]));\n const angleDelta =\n this.lastAngle != null ? currentAngle - this.lastAngle : 0;\n\n this.lastAngle = currentAngle;\n const axis = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position),\n );\n const angleInRadians = Angle.toRadians(-angleDelta);\n return camera.rotateAroundAxis(angleInRadians, axis);\n }\n return camera;\n });\n }\n\n /**\n * Moves the camera's position and look at to the given screen coordinate.\n *\n * If the screen coordinate intersects with an object, the camera will track\n * the hit point so the mouse position is always under the mouse.\n *\n * If the screen coordinate doesn't intersect with an object, then ???.\n *\n * @param screenPt A point in screen coordinates.\n */\n public async panCameraToScreenPoint(screenPt: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, frame, viewport, depthBuffer }) => {\n // Capture the starting state of the pan.\n if (this.panData == null) {\n const startingCamera = camera.toFrameCamera();\n const direction = startingCamera.direction;\n\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera,\n );\n const fallbackPlane = Plane.fromNormalAndCoplanarPoint(\n direction,\n camera.lookAt,\n );\n const fallback = Ray.intersectPlane(ray, fallbackPlane);\n if (fallback == null) {\n console.warn(\n 'Cannot determine fallback for pan. Ray does not intersect plane.',\n );\n return camera;\n }\n\n // Create a plane for the hit point that will be used to determine the\n // delta of future mouse movements to the original hit point. Fallback\n // to a plane placed at the look at point, in case there's no hit.\n const hitPt =\n depthBuffer != null\n ? this.getWorldPoint(screenPt, depthBuffer, fallback)\n : fallback;\n const hitPlane = Plane.fromNormalAndCoplanarPoint(direction, hitPt);\n\n this.panData = { hitPt, hitPlane, startingCamera };\n }\n\n if (this.panData != null) {\n const { hitPt, hitPlane, startingCamera } = this.panData;\n\n // Use a ray that originates at the screen and intersects with the hit\n // plane to determine the move distance.\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera,\n );\n const movePt = Ray.intersectPlane(ray, hitPlane);\n\n if (movePt != null) {\n const delta = Vector3.subtract(hitPt, movePt);\n return camera.update(startingCamera).moveBy(delta);\n }\n }\n return camera;\n });\n }\n\n /**\n * Performs a view all operation for the scene's bounding box, and requests a\n * new image for the updated scene.\n */\n public async viewAll(): Promise<void> {\n await (await this.getScene()).camera().viewAll().render({});\n }\n\n /**\n * Performs a rotate operation of the scene around the camera's look at point,\n * and requests a new image for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async rotateCamera(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const upVector = Vector3.normalize(camera.up);\n const directionVector = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position),\n );\n const crossX = Vector3.cross(upVector, directionVector);\n const crossY = Vector3.cross(directionVector, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxis = Vector3.cross(mouseToWorld, directionVector);\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n return camera.rotateAroundAxis(angle, rotationAxis);\n });\n }\n\n public async rotateCameraAtPoint(\n delta: Point.Point,\n point: Point.Point,\n ): Promise<void> {\n return this.transformCamera(({ camera, viewport, depthBuffer }) => {\n if (this.worldRotationPoint == null) {\n this.worldRotationPoint =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, camera.lookAt)\n : camera.lookAt;\n }\n\n const upVector = Vector3.normalize(camera.up);\n const vv = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position),\n );\n\n const crossX = Vector3.cross(upVector, vv);\n const crossY = Vector3.cross(vv, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxis = Vector3.cross(mouseToWorld, vv);\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n const updated = camera.rotateAroundAxisAtPoint(\n angle,\n this.worldRotationPoint,\n rotationAxis,\n );\n\n return updated.update({\n // Scale the lookAt point to the same length as the distance to the\n // center of the bounding box to maintain zoom and pan behavior.\n lookAt: Vector3.add(\n Vector3.scale(\n Math.abs(camera.signedDistanceToBoundingBoxCenter()) /\n Vector3.magnitude(updated.viewVector),\n updated.viewVector,\n ),\n updated.position,\n ),\n });\n });\n }\n\n /**\n * Performs a zoom operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta The distance to zoom. Positive values zoom in and negative\n * values zoom out.\n */\n public async zoomCamera(delta: number): Promise<void> {\n return this.transformCamera(({ camera, viewport, frame, boundingBox }) => {\n if (viewport != null && frame != null) {\n const isPerspective = camera?.toFrameCamera().isPerspective();\n\n if (isPerspective) {\n const vv = camera.viewVector;\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 3 multiplier was chosen to match the desired zoom speed.\n const distance = Vector3.magnitude(vv);\n const relativeDeltaToViewportHeight =\n 3 * distance * (delta / viewport.height);\n\n // Scale the current viewVector by the scalar calculated above to determine how to adjust the camera position\n const v = Vector3.normalize(vv);\n const positionChange = Vector3.scale(\n relativeDeltaToViewportHeight,\n v,\n );\n\n // Calculate the new camera position\n const position = Vector3.add(camera.position, positionChange);\n\n // Update the camera with the new position\n const newCamera = camera.update({ position });\n return newCamera;\n } else {\n // Retrieve properties of the current camera\n const orthographicCamera = camera as unknown as OrthographicCamera;\n const frameCam = camera.toFrameCamera();\n const dir = frameCam.direction;\n const ray = viewport.transformPointToRay(\n viewport.center,\n frame.image,\n frameCam,\n );\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 4 multiplier was chosen to match the desired zoom speed.\n const relativeDeltaToViewportHeight = 4 * (delta / viewport.height);\n\n // Calculate the fovHeight after performing the zoom. zoomedFovHeight has the\n // same units of camera.fovHeight (the world units). The new fovHeight\n // has a minimum value, which is a function of the size of the bounding box,\n // which ensures the new fovHeight is a positive, non-zero number.\n const minimumFovHeight =\n Vector3.magnitude(BoundingBox.diagonal(boundingBox)) * 1e-5;\n const zoomedFovHeight = Math.max(\n minimumFovHeight,\n orthographicCamera.fovHeight * (1 - relativeDeltaToViewportHeight),\n );\n\n // Calculate the plane and point to zoom relative to\n const planeToZoomRelativeTo = Plane.fromNormalAndCoplanarPoint(\n dir,\n frameCam.lookAt,\n );\n const pointToZoomRelativeTo = Ray.intersectPlane(\n ray,\n planeToZoomRelativeTo,\n );\n\n if (pointToZoomRelativeTo != null) {\n // Project the current look at point onto the zoom plane\n const projectedLookAt = Plane.projectPoint(\n planeToZoomRelativeTo,\n orthographicCamera.lookAt,\n );\n\n // Calculate the vector to determine how to adjust the camera's look at point.\n // Ensure that the viewVector is scaled to the expected length in order to\n // ensure other camera calculations are correct, for example, the occlusion\n // calculations for pins.\n const fovHeightRelativeChange =\n (orthographicCamera.fovHeight - zoomedFovHeight) /\n orthographicCamera.fovHeight;\n const lookAtChangeVector = Vector3.scale(\n fovHeightRelativeChange,\n Vector3.subtract(pointToZoomRelativeTo, projectedLookAt),\n );\n\n // Calculate the camera's new look at point\n const updatedLookAt = Vector3.add(\n orthographicCamera.lookAt,\n lookAtChangeVector,\n );\n\n // Update the orthographic camera\n // Note rotationPoint should match lookAt after a zoom interaction\n const newCamera = camera.update({\n lookAt: updatedLookAt,\n rotationPoint: updatedLookAt,\n fovHeight: zoomedFovHeight,\n });\n return newCamera;\n }\n }\n }\n\n return camera;\n });\n }\n\n /**\n * Performs a pivot operation of the scene's camera, updating the lookAt\n * while maintaining the position, and requests a new image for the\n * updated scene.\n *\n * @param degreesLocalX The angle to rotate the lookAt point around the local x-axis\n * @param degreesLocalY The angle to rotate the lookAt point around the local y-axis\n */\n public async pivotCamera(\n degreesLocalX: number,\n degreesLocalY: number,\n ): Promise<void> {\n return this.transformCamera(({ camera }) => {\n const { position, up, lookAt } = camera;\n const normalizedUp = Vector3.normalize(up);\n const normalizedViewVector = Vector3.normalize(camera.viewVector);\n const xVector = Vector3.cross(normalizedUp, normalizedViewVector);\n const yVector = Vector3.cross(normalizedViewVector, xVector);\n\n const updatedLookAtX = Vector3.rotateAboutAxis(\n Angle.toRadians(degreesLocalX),\n lookAt,\n xVector,\n position,\n );\n const updatedLookAtY = Vector3.rotateAboutAxis(\n Angle.toRadians(degreesLocalY),\n updatedLookAtX,\n yVector,\n position,\n );\n\n return camera.update({ ...camera, lookAt: updatedLookAtY });\n });\n }\n\n /**\n * Marks the end of an interaction.\n */\n public async endInteraction(): Promise<void> {\n await this.sceneLoadingPromise;\n\n if (this.isInteracting()) {\n this.currentCamera = undefined;\n this.worldRotationPoint = undefined;\n this.panData = undefined;\n this.zoomData = undefined;\n this.resetLastAngle();\n\n this.interactionFinishedEmitter.emit();\n await this.stream.endInteraction();\n }\n this.activeRenderOptions = undefined;\n }\n\n /**\n * resets the last recorded angle for a twist op\n */\n public resetLastAngle(): void {\n this.lastAngle = undefined;\n }\n\n /**\n * Indicates if the API is in an interacting state.\n */\n public isInteracting(): boolean {\n return this.currentCamera != null;\n }\n\n /**\n * Returns the pixel threshold that should be used to detect\n * movement based on the type of pointer input being coarse or fine.\n * This threshold is based on the configured `coarsePointerThreshold`\n * or the `finePointerThreshold` respectively.\n *\n * @param isTouch - Whether the event is a touch or not, if false or\n * undefined, a media query will be used to determine pointer type\n * @returns The pixel threshold.\n */\n public pixelThreshold(isTouch?: boolean): number {\n const pixelThreshold = this.isCoarseInputDevice(isTouch)\n ? this.getConfig().coarsePointerThreshold\n : this.getConfig().finePointerThreshold;\n\n return pixelThreshold * window.devicePixelRatio;\n }\n\n /**\n * Performs a hit test at the given point and returns a list of hit results\n * indicating any scene items that exist at the given point.\n *\n * @param pt A point, in viewport coordinates.\n * @returns A promise that resolves with the list of hit results.\n */\n public async hitItems(\n pt: Point.Point,\n ): Promise<vertexvis.protobuf.stream.IHit[]> {\n const res = await (await this.getScene()).raycaster().hitItems(pt);\n return res?.hits ?? [];\n }\n\n private emitTapEvent(\n emit: (details: TapEventDetails) => void,\n position: Point.Point,\n keyDetails: Partial<TapEventKeys> = {},\n buttons = 0,\n ): void {\n const {\n altKey = false,\n ctrlKey = false,\n metaKey = false,\n shiftKey = false,\n } = keyDetails;\n emit({\n position,\n altKey,\n ctrlKey,\n metaKey,\n shiftKey,\n buttons,\n });\n }\n\n private isCoarseInputDevice(isTouch?: boolean): boolean {\n return isTouch || window.matchMedia('(pointer: coarse)').matches;\n }\n\n protected getWorldPoint(\n point: Point.Point,\n depthBuffer: DepthBuffer,\n fallbackPoint: Vector3.Vector3,\n ): Vector3.Vector3 {\n const viewport = this.getViewport();\n const framePt = viewport.transformPointToFrame(point, depthBuffer);\n const hasDepth = depthBuffer.hitTest(framePt);\n return hasDepth\n ? viewport.transformPointToWorldSpace(point, depthBuffer)\n : fallbackPoint;\n }\n\n /**\n * Performs a pan operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public abstract panCameraByDelta(delta: Point.Point): Promise<void>;\n\n public abstract zoomCameraToPoint(\n point: Point.Point,\n delta: number,\n ): Promise<void>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactionApiOrthographic.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/interactionApiOrthographic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK9E,OAAO,EAAE,uCAAuC,EAAE,MAAM,sBAAsB,CAAC;AAI/E,OAAO,EACL,cAAc,GAGf,MAAM,kBAAkB,CAAC;AAO1B,MAAM,OAAO,0BAA2B,SAAQ,cAAkC;IAGhF,YACE,MAAiB,EACjB,OAAsB,EACtB,SAAoC,EACpC,QAAuB,EACvB,QAAyC,EACzC,WAA2B,EAC3B,UAAyC,EACzC,gBAA+C,EAC/C,gBAA+C,EAC/C,yBAA6C,EAC7C,0BAA8C;QAE9C,KAAK,CACH,MAAM,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,CAC3B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,yBAAyB,CACpC,KAAkB;QAElB,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,MA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C,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAES,aAAa,CACrB,KAAkB,EAClB,WAAwB,EACxB,aAA8B;QAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,QAAQ;YACb,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC;YACzD,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;CACF","sourcesContent":["import { EventEmitter } from '@stencil/core';\nimport { BoundingBox, Plane, Point, Ray, Vector3 } from '@vertexvis/geometry';\nimport { StreamApi } from '@vertexvis/stream-api';\n\nimport { ReceivedFrame } from '../..';\nimport { CursorManager } from '../cursors';\nimport { updateLookAtRelativeToBoundingBoxCenter } from '../rendering/vectors';\nimport { OrthographicCamera } from '../scenes';\nimport { DepthBuffer, Viewport } from '../types';\nimport { ZoomData } from './interactionApi';\nimport {\n InteractionApi,\n InteractionConfigProvider,\n SceneProvider,\n} from './interactionApi';\nimport { TapEventDetails } from './tapEventDetails';\n\ninterface OrthographicZoomData extends ZoomData {\n startingScreenPt: Point.Point;\n}\n\nexport class InteractionApiOrthographic extends InteractionApi<OrthographicCamera> {\n private orthographicZoomData?: OrthographicZoomData;\n\n public constructor(\n stream: StreamApi,\n cursors: CursorManager,\n getConfig: InteractionConfigProvider,\n getScene: SceneProvider,\n getFrame: () => ReceivedFrame | undefined,\n getViewport: () => Viewport,\n tapEmitter: EventEmitter<TapEventDetails>,\n doubleTapEmitter: EventEmitter<TapEventDetails>,\n longPressEmitter: EventEmitter<TapEventDetails>,\n interactionStartedEmitter: EventEmitter<void>,\n interactionFinishedEmitter: EventEmitter<void>\n ) {\n super(\n stream,\n cursors,\n getConfig,\n getScene,\n getFrame,\n getViewport,\n tapEmitter,\n doubleTapEmitter,\n longPressEmitter,\n interactionStartedEmitter,\n interactionFinishedEmitter\n );\n }\n\n /**\n * Returns a 3D point in world space for the given 2D point in viewport space.\n *\n * @param point A point in 2D viewport space to transform.\n * @returns A 3D point in world space.\n */\n public async getWorldPointFromViewport(\n point: Point.Point\n ): Promise<Vector3.Vector3 | undefined> {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame == null) {\n throw new Error('Cannot get world point. Frame is undefined.');\n }\n\n const depthBuffer = await frame.depthBuffer();\n return depthBuffer != null\n ? viewport.transformPointToWorldSpace(point, depthBuffer, 0.5)\n : undefined;\n }\n\n /**\n * Performs a pan operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async panCameraByDelta(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const viewVector = camera.viewVector;\n const normalizedUpVector = Vector3.normalize(camera.up);\n const normalizedViewVector = Vector3.normalize(viewVector);\n\n const throttledDelta = Point.scale(delta, 0.5, 0.5);\n const d = Vector3.magnitude(viewVector);\n const epsilonX = (throttledDelta.x * d) / viewport.width;\n const epsilonY = (throttledDelta.y * d) / viewport.height;\n\n const xvec = Vector3.cross(normalizedUpVector, normalizedViewVector);\n const yvec = Vector3.cross(normalizedViewVector, xvec);\n const offset = Vector3.add(\n Vector3.scale(epsilonX, xvec),\n Vector3.scale(epsilonY, yvec)\n );\n\n return camera.moveBy(offset);\n });\n }\n\n /**\n * Moves the camera's position and look at to the given screen coordinate.\n *\n * If the screen coordinate intersects with an object, the camera will track\n * the hit point so the mouse position is always under the mouse.\n *\n * If the screen coordinate doesn't intersect with an object, then ???.\n *\n * @param screenPt A point in screen coordinates.\n */\n public async panCameraToScreenPoint(screenPt: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, frame, viewport, boundingBox }) => {\n // Capture the starting state of the pan.\n if (this.panData == null) {\n const startingCamera = camera.toFrameCamera();\n const direction = startingCamera.direction;\n\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera\n );\n const hitPlane = Plane.fromNormalAndCoplanarPoint(\n direction,\n camera.lookAt\n );\n const hitPt = Ray.intersectPlane(ray, hitPlane);\n if (hitPt == null) {\n console.warn(\n 'Cannot determine fallback for pan. Ray does not intersect plane.'\n );\n return camera;\n }\n\n this.panData = { hitPt, hitPlane, startingCamera };\n }\n\n if (this.panData != null) {\n const { hitPt, hitPlane, startingCamera } = this.panData;\n\n // Use a ray that originates at the screen and intersects with the hit\n // plane to determine the move distance.\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera\n );\n const movePt = Ray.intersectPlane(ray, hitPlane);\n\n if (movePt != null) {\n const delta = Vector3.subtract(hitPt, movePt);\n\n // rotationPoint should match lookAt after a pan interaction\n const updatedLookAt = Vector3.add(startingCamera.lookAt, delta);\n return camera.update({\n lookAt: updatedLookAt,\n rotationPoint: updatedLookAt,\n });\n }\n }\n return camera;\n });\n }\n\n public async zoomCameraToPoint(\n point: Point.Point,\n delta: number\n ): Promise<void> {\n return this.transformCamera(\n ({ camera, viewport, frame, depthBuffer, boundingBox }) => {\n if (\n this.orthographicZoomData == null ||\n Point.distance(point, this.orthographicZoomData.startingScreenPt) > 2\n ) {\n const frameCam = camera.toFrameCamera();\n const dir = frameCam.direction;\n const ray = viewport.transformPointToRay(\n point,\n frame.image,\n frameCam\n );\n\n const fallbackPlane = Plane.fromNormalAndCoplanarPoint(\n dir,\n frameCam.lookAt\n );\n const fallbackPt = Ray.intersectPlane(ray, fallbackPlane);\n if (fallbackPt == null) {\n console.warn(\n 'Cannot determine fallback point for zoom. Ray does not intersect plane.'\n );\n return camera;\n }\n\n const hitPt =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, fallbackPt)\n : fallbackPt;\n const hitPlane = Plane.fromNormalAndCoplanarPoint(dir, hitPt);\n this.orthographicZoomData = {\n hitPt,\n hitPlane,\n startingScreenPt: point,\n };\n }\n\n if (this.orthographicZoomData != null) {\n const { hitPt, hitPlane } = this.orthographicZoomData;\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 4 multiplier was chosen to match the desired zoom speed.\n const relativeDeltaToViewportHeight = 4 * (delta / viewport.height);\n\n // Calculate the fovHeight after performing the zoom. zoomedFovHeight has the\n // same units of camera.fovHeight (the world units). The new fovHeight\n // has a minimum value, which is a function of the size of the bounding box,\n // which ensures the new fovHeight is a positive, non-zero number.\n const minimumFovHeight =\n Vector3.magnitude(BoundingBox.diagonal(boundingBox)) * 1e-5;\n const zoomedFovHeight = Math.max(\n minimumFovHeight,\n camera.fovHeight * (1 - relativeDeltaToViewportHeight)\n );\n\n // Calculate the vector to determine how to adjust the camera's look at point.\n // Ensure that the viewVector is scaled to the expected length in order to\n // ensure other camera calculations are correct, for example, the occlusion\n // calculations for pins.\n const projectedLookAt = Plane.projectPoint(hitPlane, camera.lookAt);\n const fovHeightRelativeChange =\n (camera.fovHeight - zoomedFovHeight) / camera.fovHeight;\n const lookAtChangeVector = Vector3.scale(\n fovHeightRelativeChange,\n Vector3.subtract(hitPt, projectedLookAt)\n );\n\n // Calculate the camera's new look at point\n const updatedLookAt = Vector3.add(camera.lookAt, lookAtChangeVector);\n\n // Return the updated camera\n // Note rotationPoint should match lookAt after a zoom interaction\n return camera.update({\n lookAt: updatedLookAt,\n rotationPoint: updatedLookAt,\n fovHeight: zoomedFovHeight,\n });\n }\n return camera;\n }\n );\n }\n\n /**\n * Performs a rotate operation of the scene around the camera's look at point,\n * and requests a new image for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async rotateCamera(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport, boundingBox }) => {\n const upVector = Vector3.normalize(camera.up);\n const directionVector = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position)\n );\n\n const crossX = Vector3.cross(upVector, directionVector);\n const crossY = Vector3.cross(directionVector, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxisDirection = Vector3.cross(\n mouseToWorld,\n directionVector\n );\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n const rotationPoint =\n camera.rotationPoint != null && camera.rotationPoint?.x != null\n ? camera.rotationPoint\n : camera.lookAt;\n const updated = camera.rotateAroundAxisAtPoint(\n angle,\n rotationPoint,\n rotationAxisDirection\n );\n\n // Update the lookAt point to take the center of the model into account\n // This change helps ensure that the lookAt point is consistent between\n // the SDK and back-end system such that the calculated depth buffer is correct.\n const newLookAt = updateLookAtRelativeToBoundingBoxCenter(\n updated.lookAt,\n updated.viewVector,\n BoundingBox.center(boundingBox)\n );\n\n // Update only the lookAt point. The rotationPoint should remain\n // constant until a different type of interaction is performed.\n return updated.update({\n lookAt: newLookAt,\n });\n });\n }\n\n protected getWorldPoint(\n point: Point.Point,\n depthBuffer: DepthBuffer,\n fallbackPoint: Vector3.Vector3\n ): Vector3.Vector3 {\n const viewport = this.getViewport();\n const framePt = viewport.transformPointToFrame(point, depthBuffer);\n const hasDepth = depthBuffer.hitTest(framePt);\n return hasDepth\n ? viewport.transformPointToWorldSpace(point, depthBuffer)\n : fallbackPoint;\n }\n}\n"]}
1
+ {"version":3,"file":"interactionApiOrthographic.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/interactionApiOrthographic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,OAA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import { EventEmitter } from '@stencil/core';\nimport { BoundingBox, Plane, Point, Ray, Vector3 } from '@vertexvis/geometry';\nimport { StreamApi } from '@vertexvis/stream-api';\n\nimport { ReceivedFrame } from '../..';\nimport { CursorManager } from '../cursors';\nimport { updateLookAtRelativeToBoundingBoxCenter } from '../rendering/vectors';\nimport { OrthographicCamera } from '../scenes';\nimport { DepthBuffer, Viewport } from '../types';\nimport { ZoomData } from './interactionApi';\nimport {\n InteractionApi,\n InteractionConfigProvider,\n SceneProvider,\n} from './interactionApi';\nimport { TapEventDetails } from './tapEventDetails';\n\ninterface OrthographicZoomData extends ZoomData {\n startingScreenPt: Point.Point;\n}\n\nexport class InteractionApiOrthographic extends InteractionApi<OrthographicCamera> {\n private orthographicZoomData?: OrthographicZoomData;\n\n public constructor(\n stream: StreamApi,\n cursors: CursorManager,\n getConfig: InteractionConfigProvider,\n getScene: SceneProvider,\n getFrame: () => ReceivedFrame | undefined,\n getViewport: () => Viewport,\n tapEmitter: EventEmitter<TapEventDetails>,\n doubleTapEmitter: EventEmitter<TapEventDetails>,\n longPressEmitter: EventEmitter<TapEventDetails>,\n interactionStartedEmitter: EventEmitter<void>,\n interactionFinishedEmitter: EventEmitter<void>,\n ) {\n super(\n stream,\n cursors,\n getConfig,\n getScene,\n getFrame,\n getViewport,\n tapEmitter,\n doubleTapEmitter,\n longPressEmitter,\n interactionStartedEmitter,\n interactionFinishedEmitter,\n );\n }\n\n /**\n * Returns a 3D point in world space for the given 2D point in viewport space.\n *\n * @param point A point in 2D viewport space to transform.\n * @returns A 3D point in world space.\n */\n public async getWorldPointFromViewport(\n point: Point.Point,\n ): Promise<Vector3.Vector3 | undefined> {\n const viewport = this.getViewport();\n const frame = this.getFrame();\n\n if (frame == null) {\n throw new Error('Cannot get world point. Frame is undefined.');\n }\n\n const depthBuffer = await frame.depthBuffer();\n return depthBuffer != null\n ? viewport.transformPointToWorldSpace(point, depthBuffer, 0.5)\n : undefined;\n }\n\n /**\n * Performs a pan operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async panCameraByDelta(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const viewVector = camera.viewVector;\n const normalizedUpVector = Vector3.normalize(camera.up);\n const normalizedViewVector = Vector3.normalize(viewVector);\n\n const throttledDelta = Point.scale(delta, 0.5, 0.5);\n const d = Vector3.magnitude(viewVector);\n const epsilonX = (throttledDelta.x * d) / viewport.width;\n const epsilonY = (throttledDelta.y * d) / viewport.height;\n\n const xvec = Vector3.cross(normalizedUpVector, normalizedViewVector);\n const yvec = Vector3.cross(normalizedViewVector, xvec);\n const offset = Vector3.add(\n Vector3.scale(epsilonX, xvec),\n Vector3.scale(epsilonY, yvec),\n );\n\n return camera.moveBy(offset);\n });\n }\n\n /**\n * Moves the camera's position and look at to the given screen coordinate.\n *\n * If the screen coordinate intersects with an object, the camera will track\n * the hit point so the mouse position is always under the mouse.\n *\n * If the screen coordinate doesn't intersect with an object, then ???.\n *\n * @param screenPt A point in screen coordinates.\n */\n public async panCameraToScreenPoint(screenPt: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, frame, viewport, boundingBox }) => {\n // Capture the starting state of the pan.\n if (this.panData == null) {\n const startingCamera = camera.toFrameCamera();\n const direction = startingCamera.direction;\n\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera,\n );\n const hitPlane = Plane.fromNormalAndCoplanarPoint(\n direction,\n camera.lookAt,\n );\n const hitPt = Ray.intersectPlane(ray, hitPlane);\n if (hitPt == null) {\n console.warn(\n 'Cannot determine fallback for pan. Ray does not intersect plane.',\n );\n return camera;\n }\n\n this.panData = { hitPt, hitPlane, startingCamera };\n }\n\n if (this.panData != null) {\n const { hitPt, hitPlane, startingCamera } = this.panData;\n\n // Use a ray that originates at the screen and intersects with the hit\n // plane to determine the move distance.\n const ray = viewport.transformPointToRay(\n screenPt,\n frame.image,\n startingCamera,\n );\n const movePt = Ray.intersectPlane(ray, hitPlane);\n\n if (movePt != null) {\n const delta = Vector3.subtract(hitPt, movePt);\n\n // rotationPoint should match lookAt after a pan interaction\n const updatedLookAt = Vector3.add(startingCamera.lookAt, delta);\n return camera.update({\n lookAt: updatedLookAt,\n rotationPoint: updatedLookAt,\n });\n }\n }\n return camera;\n });\n }\n\n public async zoomCameraToPoint(\n point: Point.Point,\n delta: number,\n ): Promise<void> {\n return this.transformCamera(\n ({ camera, viewport, frame, depthBuffer, boundingBox }) => {\n if (\n this.orthographicZoomData == null ||\n Point.distance(point, this.orthographicZoomData.startingScreenPt) > 2\n ) {\n const frameCam = camera.toFrameCamera();\n const dir = frameCam.direction;\n const ray = viewport.transformPointToRay(\n point,\n frame.image,\n frameCam,\n );\n\n const fallbackPlane = Plane.fromNormalAndCoplanarPoint(\n dir,\n frameCam.lookAt,\n );\n const fallbackPt = Ray.intersectPlane(ray, fallbackPlane);\n if (fallbackPt == null) {\n console.warn(\n 'Cannot determine fallback point for zoom. Ray does not intersect plane.',\n );\n return camera;\n }\n\n const hitPt =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, fallbackPt)\n : fallbackPt;\n const hitPlane = Plane.fromNormalAndCoplanarPoint(dir, hitPt);\n this.orthographicZoomData = {\n hitPt,\n hitPlane,\n startingScreenPt: point,\n };\n }\n\n if (this.orthographicZoomData != null) {\n const { hitPt, hitPlane } = this.orthographicZoomData;\n\n // Calculate the unit-less scalar determining the amount to zoom. The delta parameter\n // is scaled by the viewport height because if the viewport is larger, then the\n // user should have to perform a bigger action to zoom the model the same amount.\n // Note that delta and viewport.height both have units of pixels. Further, the\n // 4 multiplier was chosen to match the desired zoom speed.\n const relativeDeltaToViewportHeight = 4 * (delta / viewport.height);\n\n // Calculate the fovHeight after performing the zoom. zoomedFovHeight has the\n // same units of camera.fovHeight (the world units). The new fovHeight\n // has a minimum value, which is a function of the size of the bounding box,\n // which ensures the new fovHeight is a positive, non-zero number.\n const minimumFovHeight =\n Vector3.magnitude(BoundingBox.diagonal(boundingBox)) * 1e-5;\n const zoomedFovHeight = Math.max(\n minimumFovHeight,\n camera.fovHeight * (1 - relativeDeltaToViewportHeight),\n );\n\n // Calculate the vector to determine how to adjust the camera's look at point.\n // Ensure that the viewVector is scaled to the expected length in order to\n // ensure other camera calculations are correct, for example, the occlusion\n // calculations for pins.\n const projectedLookAt = Plane.projectPoint(hitPlane, camera.lookAt);\n const fovHeightRelativeChange =\n (camera.fovHeight - zoomedFovHeight) / camera.fovHeight;\n const lookAtChangeVector = Vector3.scale(\n fovHeightRelativeChange,\n Vector3.subtract(hitPt, projectedLookAt),\n );\n\n // Calculate the camera's new look at point\n const updatedLookAt = Vector3.add(camera.lookAt, lookAtChangeVector);\n\n // Return the updated camera\n // Note rotationPoint should match lookAt after a zoom interaction\n return camera.update({\n lookAt: updatedLookAt,\n rotationPoint: updatedLookAt,\n fovHeight: zoomedFovHeight,\n });\n }\n return camera;\n },\n );\n }\n\n /**\n * Performs a rotate operation of the scene around the camera's look at point,\n * and requests a new image for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async rotateCamera(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport, boundingBox }) => {\n const upVector = Vector3.normalize(camera.up);\n const directionVector = Vector3.normalize(\n Vector3.subtract(camera.lookAt, camera.position),\n );\n\n const crossX = Vector3.cross(upVector, directionVector);\n const crossY = Vector3.cross(directionVector, crossX);\n\n const mouseToWorld = Vector3.normalize({\n x: delta.x * crossX.x + delta.y * crossY.x,\n y: delta.x * crossX.y + delta.y * crossY.y,\n z: delta.x * crossX.z + delta.y * crossY.z,\n });\n\n const rotationAxisDirection = Vector3.cross(\n mouseToWorld,\n directionVector,\n );\n\n // The 9.5 multiplier was chosen to match the desired rotation speed\n const epsilonX = (9.5 * delta.x) / viewport.width;\n const epsilonY = (9.5 * delta.y) / viewport.height;\n const angle = Math.abs(epsilonX) + Math.abs(epsilonY);\n\n const rotationPoint =\n camera.rotationPoint != null && camera.rotationPoint?.x != null\n ? camera.rotationPoint\n : camera.lookAt;\n const updated = camera.rotateAroundAxisAtPoint(\n angle,\n rotationPoint,\n rotationAxisDirection,\n );\n\n // Update the lookAt point to take the center of the model into account\n // This change helps ensure that the lookAt point is consistent between\n // the SDK and back-end system such that the calculated depth buffer is correct.\n const newLookAt = updateLookAtRelativeToBoundingBoxCenter(\n updated.lookAt,\n updated.viewVector,\n BoundingBox.center(boundingBox),\n );\n\n // Update only the lookAt point. The rotationPoint should remain\n // constant until a different type of interaction is performed.\n return updated.update({\n lookAt: newLookAt,\n });\n });\n }\n\n protected getWorldPoint(\n point: Point.Point,\n depthBuffer: DepthBuffer,\n fallbackPoint: Vector3.Vector3,\n ): Vector3.Vector3 {\n const viewport = this.getViewport();\n const framePt = viewport.transformPointToFrame(point, depthBuffer);\n const hasDepth = depthBuffer.hitTest(framePt);\n return hasDepth\n ? viewport.transformPointToWorldSpace(point, depthBuffer)\n : fallbackPoint;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactionApiPerspective.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/interactionApiPerspective.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAO9E,OAAO,EACL,cAAc,GAIf,MAAM,kBAAkB,CAAC;AAU1B,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,MAAM,OAAO,yBAA0B,SAAQ,cAAiC;IAC9E,YACE,MAAiB,EACjB,OAAsB,EACtB,SAAoC,EACpC,QAAuB,EACvB,QAAyC,EACzC,WAA2B,EAC3B,UAAyC,EACzC,gBAA+C,EAC/C,gBAA+C,EAC/C,yBAA6C,EAC7C,0BAA8C;QAE9C,KAAK,CACH,MAAM,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,UAAU,EACV,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CACtB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAClE,CAAC;QAEF,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;QACxC,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;QACxC,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;QAExC,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;QAC7C,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;QAC7C,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;QAE7C,OAAO,CACL,CAAC,CAAC,aAAa,GAAG,aAAa,GAAG,aAAa,CAAC;YAC9C,CAAC,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC,CAAC;YAC3D,sBAAsB,CACvB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { EventEmitter } from '@stencil/core';\nimport { BoundingBox, Plane, Point, Ray, Vector3 } from '@vertexvis/geometry';\nimport { StreamApi } from '@vertexvis/stream-api';\n\nimport { ReceivedFrame } from '../..';\nimport { CursorManager } from '../cursors';\nimport { PerspectiveCamera } from '../scenes';\nimport { Viewport } from '../types';\nimport {\n InteractionApi,\n InteractionConfigProvider,\n SceneProvider,\n ZoomData,\n} from './interactionApi';\nimport { TapEventDetails } from './tapEventDetails';\n\ninterface ZoomPositionData {\n position: Vector3.Vector3;\n distance: number;\n isPastHitPlane: boolean;\n keepCurrent: boolean;\n}\n\nconst CAMERA_MIN_ZOOM_SCALAR = 0.2;\n\nexport class InteractionApiPerspective extends InteractionApi<PerspectiveCamera> {\n public constructor(\n stream: StreamApi,\n cursors: CursorManager,\n getConfig: InteractionConfigProvider,\n getScene: SceneProvider,\n getFrame: () => ReceivedFrame | undefined,\n getViewport: () => Viewport,\n tapEmitter: EventEmitter<TapEventDetails>,\n doubleTapEmitter: EventEmitter<TapEventDetails>,\n longPressEmitter: EventEmitter<TapEventDetails>,\n interactionStartedEmitter: EventEmitter<void>,\n interactionFinishedEmitter: EventEmitter<void>\n ) {\n super(\n stream,\n cursors,\n getConfig,\n getScene,\n getFrame,\n getViewport,\n tapEmitter,\n doubleTapEmitter,\n longPressEmitter,\n interactionStartedEmitter,\n interactionFinishedEmitter\n );\n }\n\n /**\n * Performs a pan operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async panCameraByDelta(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const vv = camera.viewVector;\n\n const u = Vector3.normalize(camera.up);\n const v = Vector3.normalize(vv);\n\n const throttledDelta = Point.scale(delta, 0.25, 0.25);\n const d = Vector3.magnitude(vv) * Math.tan(camera.fovY ?? 45);\n const epsilonX = (throttledDelta.x * d) / viewport.width;\n const epsilonY = (throttledDelta.y / viewport.width) * d;\n\n const xvec = Vector3.cross(u, v);\n const yvec = Vector3.cross(v, xvec);\n\n const offset = Vector3.add(\n Vector3.scale(epsilonX, xvec),\n Vector3.scale(epsilonY, yvec)\n );\n\n return camera.moveBy(offset);\n });\n }\n\n public async zoomCameraToPoint(\n point: Point.Point,\n delta: number\n ): Promise<void> {\n return this.transformCamera(\n ({ camera, viewport, frame, depthBuffer, boundingBox }) => {\n const cam = frame.scene.camera;\n const dir = cam.direction;\n\n const frameCam = camera.toFrameCamera();\n const ray = viewport.transformPointToRay(point, frame.image, frameCam);\n\n if (this.zoomData == null) {\n const fallbackPlane = Plane.fromNormalAndCoplanarPoint(\n dir,\n cam.lookAt\n );\n const fallbackPt = Ray.intersectPlane(ray, fallbackPlane);\n if (fallbackPt == null) {\n console.warn(\n 'Cannot determine fallback point for zoom. Ray does not intersect plane.'\n );\n return camera;\n }\n\n const hitPt =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, fallbackPt)\n : fallbackPt;\n const hitPlane = Plane.fromNormalAndCoplanarPoint(dir, hitPt);\n this.zoomData = { hitPt, hitPlane };\n }\n\n if (this.zoomData != null) {\n const { hitPlane } = this.zoomData;\n const { position, distance, isPastHitPlane, keepCurrent } =\n this.computeZoomDistances(\n delta,\n camera,\n viewport,\n boundingBox,\n ray,\n this.zoomData\n );\n\n if (isPastHitPlane && !keepCurrent) {\n const viewVectorRay = Ray.create({\n origin: position,\n direction: Vector3.normalize(camera.viewVector),\n });\n\n return camera.update({\n position,\n lookAt: Ray.at(viewVectorRay, distance),\n });\n } else if (!keepCurrent) {\n return camera.update({\n position,\n lookAt: Plane.projectPoint(hitPlane, position),\n });\n }\n }\n return camera;\n }\n );\n }\n\n public walk(delta: Vector3.Vector3): void {\n this.transformCamera(({ camera, boundingBox }) => {\n const { position, up, lookAt } = camera;\n\n const normalizedUp = Vector3.normalize(up);\n const normalizedViewVector = Vector3.normalize(camera.viewVector);\n\n const boundingBoxScalar = Math.min(\n ...Vector3.toArray(BoundingBox.lengths(boundingBox))\n );\n const scaledDelta = Vector3.scale(boundingBoxScalar, delta);\n const localX = Vector3.cross(normalizedUp, normalizedViewVector);\n const localZ = Vector3.cross(localX, normalizedUp);\n\n const translationX = Vector3.scale(\n scaledDelta.x,\n Vector3.normalize(localX)\n );\n const translationY = Vector3.scale(\n scaledDelta.y,\n Vector3.normalize(normalizedUp)\n );\n const translationZ = Vector3.scale(\n scaledDelta.z,\n Vector3.normalize(localZ)\n );\n const translation = Vector3.negate(\n Vector3.add(translationX, translationY, translationZ)\n );\n\n return camera.update({\n ...camera,\n position: Vector3.add(position, translation),\n lookAt: Vector3.add(lookAt, translation),\n });\n });\n }\n\n private computeZoomDistances(\n delta: number,\n camera: PerspectiveCamera,\n viewport: Viewport,\n boundingBox: BoundingBox.BoundingBox,\n pointRay: Ray.Ray,\n zoomData: ZoomData\n ): ZoomPositionData {\n const config = this.getConfig();\n const { hitPt, hitPlane } = zoomData;\n const minDistance = config.useMinimumPerspectiveZoomDistance\n ? this.computeZoomMinimumDistance(camera, boundingBox)\n : -1;\n const expectedDistance = Vector3.distance(camera.position, hitPt);\n const actualDistance = Math.max(minDistance, expectedDistance);\n const epsilon = (6 * actualDistance * delta) / viewport.height;\n\n const expectedPosition = Ray.at(pointRay, epsilon);\n const expectedViewVector = Ray.create({\n origin: expectedPosition,\n direction: Vector3.normalize(camera.viewVector),\n });\n const expectedIntersection = Ray.intersectPlane(\n expectedViewVector,\n hitPlane\n );\n\n if (\n expectedIntersection == null &&\n config.useMinimumPerspectiveZoomDistance\n ) {\n const minDistanceEpsilon = (6 * minDistance * delta) / viewport.height;\n const position = Ray.at(pointRay, minDistanceEpsilon);\n\n return {\n position,\n distance: minDistance,\n isPastHitPlane: true,\n keepCurrent: false,\n };\n } else if (expectedIntersection == null) {\n return {\n position: camera.position,\n distance: actualDistance,\n isPastHitPlane: true,\n keepCurrent: true,\n };\n }\n\n return {\n position: expectedPosition,\n distance: actualDistance,\n isPastHitPlane: false,\n keepCurrent: false,\n };\n }\n\n private computeZoomMinimumDistance(\n camera: PerspectiveCamera,\n boundingBox: BoundingBox.BoundingBox\n ): number {\n const xLength = Math.abs(boundingBox.min.x) + Math.abs(boundingBox.max.x);\n const yLength = Math.abs(boundingBox.min.y) + Math.abs(boundingBox.max.y);\n const zLength = Math.abs(boundingBox.min.z) + Math.abs(boundingBox.max.z);\n const maxLength = Math.max(xLength, yLength, zLength);\n\n const absDotX = Math.abs(\n Vector3.dot(Vector3.normalize(camera.viewVector), Vector3.right())\n );\n const absDotY = Math.abs(\n Vector3.dot(Vector3.normalize(camera.viewVector), Vector3.up())\n );\n const absDotZ = Math.abs(\n Vector3.dot(Vector3.normalize(camera.viewVector), Vector3.back())\n );\n\n const scaledLengthX = xLength * absDotX;\n const scaledLengthY = yLength * absDotY;\n const scaledLengthZ = zLength * absDotZ;\n\n const relevanceLengthX = maxLength / xLength;\n const relevanceLengthY = maxLength / yLength;\n const relevanceLengthZ = maxLength / zLength;\n\n return (\n ((scaledLengthX + scaledLengthY + scaledLengthZ) /\n (relevanceLengthX + relevanceLengthY + relevanceLengthZ)) *\n CAMERA_MIN_ZOOM_SCALAR\n );\n }\n}\n"]}
1
+ {"version":3,"file":"interactionApiPerspective.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/interactionApiPerspective.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAO9E,OAAO,EACL,cAAc,GAIf,MAAM,kBAAkB,CAAC;AAU1B,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC,MAAM,OAAO,yBAA0B,SAAQ,cAAiC;IAC9E,YACE,MAAiB,EACjB,OAAsB,EACtB,SAAoC,EACpC,QAAuB,EACvB,QAAyC,EACzC,WAA2B,EAC3B,UAAyC,EACzC,gBAA+C,EAC/C,gBAA+C,EAC/C,yBAA6C,EAC7C,0BAA8C;QAE9C,KAAK,CACH,MAAM,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,CAC3B,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,gBAAgB,CAAC,KAAkB;QAC9C,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE;;YACnD,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC;YAE7B,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACvC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YAEhC,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACtD,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAA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C;YAC3D,sBAAsB,CACvB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { EventEmitter } from '@stencil/core';\nimport { BoundingBox, Plane, Point, Ray, Vector3 } from '@vertexvis/geometry';\nimport { StreamApi } from '@vertexvis/stream-api';\n\nimport { ReceivedFrame } from '../..';\nimport { CursorManager } from '../cursors';\nimport { PerspectiveCamera } from '../scenes';\nimport { Viewport } from '../types';\nimport {\n InteractionApi,\n InteractionConfigProvider,\n SceneProvider,\n ZoomData,\n} from './interactionApi';\nimport { TapEventDetails } from './tapEventDetails';\n\ninterface ZoomPositionData {\n position: Vector3.Vector3;\n distance: number;\n isPastHitPlane: boolean;\n keepCurrent: boolean;\n}\n\nconst CAMERA_MIN_ZOOM_SCALAR = 0.2;\n\nexport class InteractionApiPerspective extends InteractionApi<PerspectiveCamera> {\n public constructor(\n stream: StreamApi,\n cursors: CursorManager,\n getConfig: InteractionConfigProvider,\n getScene: SceneProvider,\n getFrame: () => ReceivedFrame | undefined,\n getViewport: () => Viewport,\n tapEmitter: EventEmitter<TapEventDetails>,\n doubleTapEmitter: EventEmitter<TapEventDetails>,\n longPressEmitter: EventEmitter<TapEventDetails>,\n interactionStartedEmitter: EventEmitter<void>,\n interactionFinishedEmitter: EventEmitter<void>,\n ) {\n super(\n stream,\n cursors,\n getConfig,\n getScene,\n getFrame,\n getViewport,\n tapEmitter,\n doubleTapEmitter,\n longPressEmitter,\n interactionStartedEmitter,\n interactionFinishedEmitter,\n );\n }\n\n /**\n * Performs a pan operation of the scene's camera, and requests a new image\n * for the updated scene.\n *\n * @param delta A position delta `{x, y}` in the 2D coordinate space of the\n * viewer.\n */\n public async panCameraByDelta(delta: Point.Point): Promise<void> {\n return this.transformCamera(({ camera, viewport }) => {\n const vv = camera.viewVector;\n\n const u = Vector3.normalize(camera.up);\n const v = Vector3.normalize(vv);\n\n const throttledDelta = Point.scale(delta, 0.25, 0.25);\n const d = Vector3.magnitude(vv) * Math.tan(camera.fovY ?? 45);\n const epsilonX = (throttledDelta.x * d) / viewport.width;\n const epsilonY = (throttledDelta.y / viewport.width) * d;\n\n const xvec = Vector3.cross(u, v);\n const yvec = Vector3.cross(v, xvec);\n\n const offset = Vector3.add(\n Vector3.scale(epsilonX, xvec),\n Vector3.scale(epsilonY, yvec),\n );\n\n return camera.moveBy(offset);\n });\n }\n\n public async zoomCameraToPoint(\n point: Point.Point,\n delta: number,\n ): Promise<void> {\n return this.transformCamera(\n ({ camera, viewport, frame, depthBuffer, boundingBox }) => {\n const cam = frame.scene.camera;\n const dir = cam.direction;\n\n const frameCam = camera.toFrameCamera();\n const ray = viewport.transformPointToRay(point, frame.image, frameCam);\n\n if (this.zoomData == null) {\n const fallbackPlane = Plane.fromNormalAndCoplanarPoint(\n dir,\n cam.lookAt,\n );\n const fallbackPt = Ray.intersectPlane(ray, fallbackPlane);\n if (fallbackPt == null) {\n console.warn(\n 'Cannot determine fallback point for zoom. Ray does not intersect plane.',\n );\n return camera;\n }\n\n const hitPt =\n depthBuffer != null\n ? this.getWorldPoint(point, depthBuffer, fallbackPt)\n : fallbackPt;\n const hitPlane = Plane.fromNormalAndCoplanarPoint(dir, hitPt);\n this.zoomData = { hitPt, hitPlane };\n }\n\n if (this.zoomData != null) {\n const { hitPlane } = this.zoomData;\n const { position, distance, isPastHitPlane, keepCurrent } =\n this.computeZoomDistances(\n delta,\n camera,\n viewport,\n boundingBox,\n ray,\n this.zoomData,\n );\n\n if (isPastHitPlane && !keepCurrent) {\n const viewVectorRay = Ray.create({\n origin: position,\n direction: Vector3.normalize(camera.viewVector),\n });\n\n return camera.update({\n position,\n lookAt: Ray.at(viewVectorRay, distance),\n });\n } else if (!keepCurrent) {\n return camera.update({\n position,\n lookAt: Plane.projectPoint(hitPlane, position),\n });\n }\n }\n return camera;\n },\n );\n }\n\n public walk(delta: Vector3.Vector3): void {\n this.transformCamera(({ camera, boundingBox }) => {\n const { position, up, lookAt } = camera;\n\n const normalizedUp = Vector3.normalize(up);\n const normalizedViewVector = Vector3.normalize(camera.viewVector);\n\n const boundingBoxScalar = Math.min(\n ...Vector3.toArray(BoundingBox.lengths(boundingBox)),\n );\n const scaledDelta = Vector3.scale(boundingBoxScalar, delta);\n const localX = Vector3.cross(normalizedUp, normalizedViewVector);\n const localZ = Vector3.cross(localX, normalizedUp);\n\n const translationX = Vector3.scale(\n scaledDelta.x,\n Vector3.normalize(localX),\n );\n const translationY = Vector3.scale(\n scaledDelta.y,\n Vector3.normalize(normalizedUp),\n );\n const translationZ = Vector3.scale(\n scaledDelta.z,\n Vector3.normalize(localZ),\n );\n const translation = Vector3.negate(\n Vector3.add(translationX, translationY, translationZ),\n );\n\n return camera.update({\n ...camera,\n position: Vector3.add(position, translation),\n lookAt: Vector3.add(lookAt, translation),\n });\n });\n }\n\n private computeZoomDistances(\n delta: number,\n camera: PerspectiveCamera,\n viewport: Viewport,\n boundingBox: BoundingBox.BoundingBox,\n pointRay: Ray.Ray,\n zoomData: ZoomData,\n ): ZoomPositionData {\n const config = this.getConfig();\n const { hitPt, hitPlane } = zoomData;\n const minDistance = config.useMinimumPerspectiveZoomDistance\n ? this.computeZoomMinimumDistance(camera, boundingBox)\n : -1;\n const expectedDistance = Vector3.distance(camera.position, hitPt);\n const actualDistance = Math.max(minDistance, expectedDistance);\n const epsilon = (6 * actualDistance * delta) / viewport.height;\n\n const expectedPosition = Ray.at(pointRay, epsilon);\n const expectedViewVector = Ray.create({\n origin: expectedPosition,\n direction: Vector3.normalize(camera.viewVector),\n });\n const expectedIntersection = Ray.intersectPlane(\n expectedViewVector,\n hitPlane,\n );\n\n if (\n expectedIntersection == null &&\n config.useMinimumPerspectiveZoomDistance\n ) {\n const minDistanceEpsilon = (6 * minDistance * delta) / viewport.height;\n const position = Ray.at(pointRay, minDistanceEpsilon);\n\n return {\n position,\n distance: minDistance,\n isPastHitPlane: true,\n keepCurrent: false,\n };\n } else if (expectedIntersection == null) {\n return {\n position: camera.position,\n distance: actualDistance,\n isPastHitPlane: true,\n keepCurrent: true,\n };\n }\n\n return {\n position: expectedPosition,\n distance: actualDistance,\n isPastHitPlane: false,\n keepCurrent: false,\n };\n }\n\n private computeZoomMinimumDistance(\n camera: PerspectiveCamera,\n boundingBox: BoundingBox.BoundingBox,\n ): number {\n const xLength = Math.abs(boundingBox.min.x) + Math.abs(boundingBox.max.x);\n const yLength = Math.abs(boundingBox.min.y) + Math.abs(boundingBox.max.y);\n const zLength = Math.abs(boundingBox.min.z) + Math.abs(boundingBox.max.z);\n const maxLength = Math.max(xLength, yLength, zLength);\n\n const absDotX = Math.abs(\n Vector3.dot(Vector3.normalize(camera.viewVector), Vector3.right()),\n );\n const absDotY = Math.abs(\n Vector3.dot(Vector3.normalize(camera.viewVector), Vector3.up()),\n );\n const absDotZ = Math.abs(\n Vector3.dot(Vector3.normalize(camera.viewVector), Vector3.back()),\n );\n\n const scaledLengthX = xLength * absDotX;\n const scaledLengthY = yLength * absDotY;\n const scaledLengthZ = zLength * absDotZ;\n\n const relevanceLengthX = maxLength / xLength;\n const relevanceLengthY = maxLength / yLength;\n const relevanceLengthZ = maxLength / zLength;\n\n return (\n ((scaledLengthX + scaledLengthY + scaledLengthZ) /\n (relevanceLengthX + relevanceLengthY + relevanceLengthZ)) *\n CAMERA_MIN_ZOOM_SCALAR\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mouseInteractionHandler.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/mouseInteractionHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,OAAO,uBAAwB,SAAQ,sBAAsB;IACjE,YACE,SAAyB,EACzB,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,EAC3C,sBAAsB,GAAG,IAAI,sBAAsB,EAAE,EACrD,eAAe,GAAG,IAAI,eAAe,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,EACrE,cAAc,GAAG,IAAI,cAAc,EAAE,EACrC,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,EACzC,gBAAgB,GAAG,IAAI,gBAAgB,EAAE;QAEzC,KAAK,CACH,WAAW,EACX,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,CACV,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { ConfigProvider } from '../config';\nimport { BaseInteractionHandler } from './baseInteractionHandler';\nimport {\n PanInteraction,\n PivotInteraction,\n RotateInteraction,\n RotatePointInteraction,\n TwistInteraction,\n ZoomInteraction,\n} from './mouseInteractions';\n\nexport class MouseInteractionHandler extends BaseInteractionHandler {\n public constructor(\n getConfig: ConfigProvider,\n rotateInteraction = new RotateInteraction(),\n rotatePointInteraction = new RotatePointInteraction(),\n zoomInteraction = new ZoomInteraction(() => getConfig().interactions),\n panInteraction = new PanInteraction(),\n twistInteraction = new TwistInteraction(),\n pivotInteraction = new PivotInteraction()\n ) {\n super(\n 'mousedown',\n 'mouseup',\n 'mousemove',\n rotateInteraction,\n rotatePointInteraction,\n zoomInteraction,\n panInteraction,\n twistInteraction,\n pivotInteraction,\n getConfig\n );\n }\n}\n"]}
1
+ {"version":3,"file":"mouseInteractionHandler.js","sourceRoot":"","sources":["../../../../../src/lib/interactions/mouseInteractionHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,OAAO,uBAAwB,SAAQ,sBAAsB;IACjE,YACE,SAAyB,EACzB,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,EAC3C,sBAAsB,GAAG,IAAI,sBAAsB,EAAE,EACrD,eAAe,GAAG,IAAI,eAAe,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,EACrE,cAAc,GAAG,IAAI,cAAc,EAAE,EACrC,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,EACzC,gBAAgB,GAAG,IAAI,gBAAgB,EAAE;QAEzC,KAAK,CACH,WAAW,EACX,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,CACV,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { ConfigProvider } from '../config';\nimport { BaseInteractionHandler } from './baseInteractionHandler';\nimport {\n PanInteraction,\n PivotInteraction,\n RotateInteraction,\n RotatePointInteraction,\n TwistInteraction,\n ZoomInteraction,\n} from './mouseInteractions';\n\nexport class MouseInteractionHandler extends BaseInteractionHandler {\n public constructor(\n getConfig: ConfigProvider,\n rotateInteraction = new RotateInteraction(),\n rotatePointInteraction = new RotatePointInteraction(),\n zoomInteraction = new ZoomInteraction(() => getConfig().interactions),\n panInteraction = new PanInteraction(),\n twistInteraction = new TwistInteraction(),\n pivotInteraction = new PivotInteraction(),\n ) {\n super(\n 'mousedown',\n 'mouseup',\n 'mousemove',\n rotateInteraction,\n rotatePointInteraction,\n zoomInteraction,\n panInteraction,\n twistInteraction,\n pivotInteraction,\n getConfig,\n );\n }\n}\n"]}