@mapxus/mapxus-visual-jp 1.8.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (425) hide show
  1. package/bitbucket-pipelines.yml +50 -0
  2. package/config/rollup.js +33 -0
  3. package/config/rollup.serve.config.js +3 -0
  4. package/debug/circlemarker.html +444 -0
  5. package/debug/create_tags.html +474 -0
  6. package/debug/distance.html +220 -0
  7. package/debug/index.html +92 -0
  8. package/debug/integration.html +1084 -0
  9. package/debug/leaflet.html +54 -0
  10. package/debug/markers.html +115 -0
  11. package/debug/multi_monitor_sync.html +377 -0
  12. package/debug/outdoor.html +1026 -0
  13. package/debug/rect_tags.html +147 -0
  14. package/debug/rotate.html +236 -0
  15. package/debug/sample.html +324 -0
  16. package/debug/sequence.html +75 -0
  17. package/debug/tags.html +218 -0
  18. package/package.json +34 -10
  19. package/rollup.config.js +39 -0
  20. package/server.js +35 -0
  21. package/spec/api/APIv3.spec.ts +86 -0
  22. package/spec/component/Component.spec.ts +68 -0
  23. package/spec/component/StatsComponent.spec.ts +33 -0
  24. package/spec/component/direction/DirectionComponent.spec.ts +163 -0
  25. package/spec/component/direction/DirectionDOMRenderer.spec.ts +233 -0
  26. package/spec/component/keyboard/KeyZoomHandler.spec.ts +236 -0
  27. package/spec/component/marker/Marker.spec.ts +104 -0
  28. package/spec/component/marker/MarkerComponent.spec.ts +88 -0
  29. package/spec/component/marker/MarkerScene.spec.ts +223 -0
  30. package/spec/component/marker/MarkerSet.spec.ts +453 -0
  31. package/spec/component/mouse/DoubleClickZoomHandler.spec.ts +211 -0
  32. package/spec/component/popup/Popup.spec.ts +479 -0
  33. package/spec/component/popup/PopupComponent.spec.ts +414 -0
  34. package/spec/component/tag/CreateHandlerBase.spec.ts +83 -0
  35. package/spec/component/tag/CreatePointHandler.spec.ts +190 -0
  36. package/spec/component/tag/OutlineRenderTag.spec.ts +91 -0
  37. package/spec/component/tag/PointGeometry.spec.ts +131 -0
  38. package/spec/component/tag/PolygonGeometry.spec.ts +497 -0
  39. package/spec/component/tag/RectGeometry.spec.ts +1157 -0
  40. package/spec/component/tag/TagComponent.spec.ts +513 -0
  41. package/spec/component/tag/TagScene.spec.ts +346 -0
  42. package/spec/component/tag/TagSet.spec.ts +241 -0
  43. package/spec/component/utils/HandlerBase.spec.ts +203 -0
  44. package/spec/geo/Camera.spec.ts +250 -0
  45. package/spec/geo/GeoCoords.spec.ts +364 -0
  46. package/spec/geo/Spatial.spec.ts +711 -0
  47. package/spec/geo/Transform.spec.ts +850 -0
  48. package/spec/geo/ViewportCoords.spec.ts +534 -0
  49. package/spec/graph/FilterCreator.spec.ts +892 -0
  50. package/spec/graph/Graph.spec.ts +2078 -0
  51. package/spec/graph/GraphCalculator.spec.ts +263 -0
  52. package/spec/graph/GraphService.spec.ts +663 -0
  53. package/spec/graph/Node.spec.ts +373 -0
  54. package/spec/graph/NodeCache.spec.ts +206 -0
  55. package/spec/graph/Sequence.spec.ts +37 -0
  56. package/spec/graph/edge/EdgeCalculator.Pano.spec.ts +963 -0
  57. package/spec/graph/edge/EdgeCalculator.Sequence.spec.ts +108 -0
  58. package/spec/graph/edge/EdgeCalculator.Similar.spec.ts +272 -0
  59. package/spec/graph/edge/EdgeCalculator.Step.spec.ts +383 -0
  60. package/spec/graph/edge/EdgeCalculator.Turn.spec.ts +278 -0
  61. package/spec/graph/edge/EdgeCalculator.spec.ts +747 -0
  62. package/spec/helper/ContainerMockCreator.spec.ts +33 -0
  63. package/spec/helper/DOMRendererMockCreator.spec.ts +22 -0
  64. package/spec/helper/EdgeCalculatorHelper.spec.ts +96 -0
  65. package/spec/helper/EventHelper.spec.ts +92 -0
  66. package/spec/helper/GLRendererMockCreator.spec.ts +23 -0
  67. package/spec/helper/GeoHelper.spec.ts +16 -0
  68. package/spec/helper/ImageLoadingServiceMockCreator.spec.ts +24 -0
  69. package/spec/helper/KeyboardServiceMockCreator.spec.ts +21 -0
  70. package/spec/helper/LoadingServiceMockCreator.spec.ts +21 -0
  71. package/spec/helper/MockCreator.spec.ts +18 -0
  72. package/spec/helper/MockCreatorBase.spec.ts +17 -0
  73. package/spec/helper/MouseServiceMockCreator.spec.ts +38 -0
  74. package/spec/helper/NavigatorMockCreator.spec.ts +28 -0
  75. package/spec/helper/NodeHelper.spec.ts +77 -0
  76. package/spec/helper/NodeMockCreator.spec.ts +19 -0
  77. package/spec/helper/RenderServiceMockCreator.spec.ts +25 -0
  78. package/spec/helper/SpriteServiceMockCreator.spec.ts +22 -0
  79. package/spec/helper/StateServiceMockCreator.spec.ts +33 -0
  80. package/spec/helper/TouchServiceMockCreator.spec.ts +29 -0
  81. package/spec/helper/TransformHelper.spec.ts +17 -0
  82. package/spec/render/DOMRenderer.spec.ts +112 -0
  83. package/spec/render/GLRenderer.spec.ts +453 -0
  84. package/spec/render/RenderCamera.spec.ts +535 -0
  85. package/spec/render/RenderService.spec.ts +531 -0
  86. package/spec/state/StateBase.spec.ts +369 -0
  87. package/spec/state/StateService.spec.ts +9 -0
  88. package/spec/state/TraversingState.spec.ts +262 -0
  89. package/spec/state/WaitingState.spec.ts +319 -0
  90. package/spec/tiles/TextureProvider.spec.ts +653 -0
  91. package/spec/utils/EventEmitter.spec.ts +71 -0
  92. package/spec/utils/Support.spec.ts +54 -0
  93. package/spec/viewer/CacheService.spec.ts +160 -0
  94. package/spec/viewer/ComponentController.spec.ts +310 -0
  95. package/spec/viewer/LoadingService.spec.ts +19 -0
  96. package/spec/viewer/MouseService.spec.ts +1344 -0
  97. package/spec/viewer/Navigator.spec.ts +970 -0
  98. package/spec/viewer/Observer.spec.ts +96 -0
  99. package/spec/viewer/SpriteService.spec.ts +224 -0
  100. package/src/API.ts +3 -0
  101. package/src/Component.ts +77 -0
  102. package/src/Edge.ts +6 -0
  103. package/src/Error.ts +3 -0
  104. package/src/FilterRender.ts +27 -0
  105. package/src/Geo.ts +7 -0
  106. package/src/Graph.ts +19 -0
  107. package/src/MapxusVisual.ts +66 -0
  108. package/src/Render.ts +7 -0
  109. package/src/State.ts +8 -0
  110. package/src/Support.ts +35 -0
  111. package/src/Tiles.ts +5 -0
  112. package/src/Utils.ts +6 -0
  113. package/src/Viewer.ts +16 -0
  114. package/src/api/API.ts +396 -0
  115. package/src/api/Auth.ts +76 -0
  116. package/src/api/AuthStore.ts +11 -0
  117. package/src/api/GraphQLCreator.ts +100 -0
  118. package/src/api/interfaces/IAuth.ts +7 -0
  119. package/src/api/interfaces/IBuildingBase.ts +7 -0
  120. package/src/api/interfaces/IBuildingInfo.ts +19 -0
  121. package/src/api/interfaces/ICoreNode.ts +28 -0
  122. package/src/api/interfaces/IFillNode.ts +96 -0
  123. package/src/api/interfaces/IFloorInfo.ts +10 -0
  124. package/src/api/interfaces/IFullNode.ts +10 -0
  125. package/src/api/interfaces/IGPano.ts +38 -0
  126. package/src/api/interfaces/IImageTagInfo.ts +14 -0
  127. package/src/api/interfaces/IKey.ts +13 -0
  128. package/src/api/interfaces/ILatLon.ts +19 -0
  129. package/src/api/interfaces/IOutdoor.ts +14 -0
  130. package/src/api/interfaces/IPathNode.ts +37 -0
  131. package/src/api/interfaces/IProject.ts +8 -0
  132. package/src/api/interfaces/IQueryBuilding.ts +37 -0
  133. package/src/api/interfaces/IResponse.ts +7 -0
  134. package/src/api/interfaces/ISequence.ts +16 -0
  135. package/src/api/interfaces/IUser.ts +13 -0
  136. package/src/api/interfaces/interfaces.ts +17 -0
  137. package/src/component/AttributionComponent.ts +48 -0
  138. package/src/component/BackgroundComponent.ts +39 -0
  139. package/src/component/BearingComponent.ts +282 -0
  140. package/src/component/CacheComponent.ts +295 -0
  141. package/src/component/Component.ts +130 -0
  142. package/src/component/ComponentService.ts +150 -0
  143. package/src/component/CoverComponent.ts +132 -0
  144. package/src/component/DebugComponent.ts +157 -0
  145. package/src/component/ImageComponent.ts +96 -0
  146. package/src/component/LoadingComponent.ts +85 -0
  147. package/src/component/NavigationComponent.ts +233 -0
  148. package/src/component/RouteComponent.ts +354 -0
  149. package/src/component/StatsComponent.ts +100 -0
  150. package/src/component/direction/DirectionComponent.ts +254 -0
  151. package/src/component/direction/DirectionDOMCalculator.ts +243 -0
  152. package/src/component/direction/DirectionDOMRenderer.ts +631 -0
  153. package/src/component/imageplane/ImagePlaneComponent.ts +497 -0
  154. package/src/component/imageplane/ImagePlaneFactory.ts +314 -0
  155. package/src/component/imageplane/ImagePlaneGLRenderer.ts +247 -0
  156. package/src/component/imageplane/ImagePlaneScene.ts +87 -0
  157. package/src/component/imageplane/ImagePlaneShaders.ts +16 -0
  158. package/src/component/imageplane/SliderComponent.ts +697 -0
  159. package/src/component/imageplane/interfaces/IBBoxShaderMaterial.ts +10 -0
  160. package/src/component/imageplane/interfaces/IShaderMaterial.ts +9 -0
  161. package/src/component/imageplane/interfaces/interfaces.ts +2 -0
  162. package/src/component/imageplane/shaders/equirectangular.fragment.glsl.ts +26 -0
  163. package/src/component/imageplane/shaders/equirectangular.vertex.glsl.ts +15 -0
  164. package/src/component/imageplane/shaders/perspective.fragment.glsl.ts +27 -0
  165. package/src/component/imageplane/shaders/perspective.vertex.glsl.ts +15 -0
  166. package/src/component/interfaces/ICacheConfiguration.ts +72 -0
  167. package/src/component/interfaces/IComponentConfiguration.ts +5 -0
  168. package/src/component/interfaces/ICoverConfiguration.ts +15 -0
  169. package/src/component/interfaces/IDirectionConfiguration.ts +63 -0
  170. package/src/component/interfaces/IImagePlaneConfiguration.ts +17 -0
  171. package/src/component/interfaces/IKeyboardConfiguration.ts +44 -0
  172. package/src/component/interfaces/IMarkerConfiguration.ts +31 -0
  173. package/src/component/interfaces/IMouseConfiguration.ts +52 -0
  174. package/src/component/interfaces/INavigationConfiguration.ts +35 -0
  175. package/src/component/interfaces/IRouteConfiguration.ts +20 -0
  176. package/src/component/interfaces/ISequenceConfiguration.ts +72 -0
  177. package/src/component/interfaces/IShader.ts +6 -0
  178. package/src/component/interfaces/ISliderConfiguration.ts +61 -0
  179. package/src/component/interfaces/ITagConfiguration.ts +40 -0
  180. package/src/component/interfaces/interfaces.ts +17 -0
  181. package/src/component/keyboard/KeySequenceNavigationHandler.ts +86 -0
  182. package/src/component/keyboard/KeySpatialNavigationHandler.ts +216 -0
  183. package/src/component/keyboard/KeyZoomHandler.ts +106 -0
  184. package/src/component/keyboard/KeyboardComponent.ts +125 -0
  185. package/src/component/marker/Marker.ts +5 -0
  186. package/src/component/marker/MarkerComponent.ts +856 -0
  187. package/src/component/marker/MarkerScene.ts +145 -0
  188. package/src/component/marker/MarkerSet.ts +142 -0
  189. package/src/component/marker/interfaces/IArrowMarkerOptions.ts +41 -0
  190. package/src/component/marker/interfaces/ICircleMarkerOptions.ts +30 -0
  191. package/src/component/marker/interfaces/IDotMarkerOptions.ts +18 -0
  192. package/src/component/marker/interfaces/IMarkerEvent.ts +28 -0
  193. package/src/component/marker/interfaces/ISimpleMarkerOptions.ts +54 -0
  194. package/src/component/marker/interfaces/interfaces.ts +5 -0
  195. package/src/component/marker/marker/ArrowMarker.ts +84 -0
  196. package/src/component/marker/marker/CircleMarker.ts +82 -0
  197. package/src/component/marker/marker/DotMarker.ts +68 -0
  198. package/src/component/marker/marker/ImageMarker.ts +45 -0
  199. package/src/component/marker/marker/Marker.ts +99 -0
  200. package/src/component/marker/marker/SimpleMarker.ts +187 -0
  201. package/src/component/mouse/BounceHandler.ts +148 -0
  202. package/src/component/mouse/DoubleClickZoomHandler.ts +106 -0
  203. package/src/component/mouse/DragPanHandler.ts +489 -0
  204. package/src/component/mouse/HandlerTypes.ts +13 -0
  205. package/src/component/mouse/MouseComponent.ts +170 -0
  206. package/src/component/mouse/ScrollZoomHandler.ts +137 -0
  207. package/src/component/mouse/TouchZoomHandler.ts +136 -0
  208. package/src/component/path/PathComponent.ts +75 -0
  209. package/src/component/path/PathEvent.ts +245 -0
  210. package/src/component/path/PathMarker.ts +42 -0
  211. package/src/component/path/PathRender.ts +163 -0
  212. package/src/component/popup/Popup.ts +2 -0
  213. package/src/component/popup/PopupComponent.ts +244 -0
  214. package/src/component/popup/interfaces/IPopupOffset.ts +37 -0
  215. package/src/component/popup/interfaces/IPopupOptions.ts +81 -0
  216. package/src/component/popup/popup/Popup.ts +594 -0
  217. package/src/component/popup/popup/PopupAlignment.ts +3 -0
  218. package/src/component/sequence/SequenceComponent.ts +500 -0
  219. package/src/component/sequence/SequenceDOMInteraction.ts +23 -0
  220. package/src/component/sequence/SequenceDOMRenderer.ts +179 -0
  221. package/src/component/tag/Tag.ts +9 -0
  222. package/src/component/tag/TagComponent.ts +787 -0
  223. package/src/component/tag/TagCreator.ts +138 -0
  224. package/src/component/tag/TagDOMRenderer.ts +35 -0
  225. package/src/component/tag/TagMode.ts +37 -0
  226. package/src/component/tag/TagOperation.ts +7 -0
  227. package/src/component/tag/TagScene.ts +216 -0
  228. package/src/component/tag/TagSet.ts +186 -0
  229. package/src/component/tag/error/GeometryTagError.ts +11 -0
  230. package/src/component/tag/geometry/Geometry.ts +62 -0
  231. package/src/component/tag/geometry/PointGeometry.ts +89 -0
  232. package/src/component/tag/geometry/PolygonGeometry.ts +349 -0
  233. package/src/component/tag/geometry/RectGeometry.ts +759 -0
  234. package/src/component/tag/geometry/VertexGeometry.ts +185 -0
  235. package/src/component/tag/handlers/CreateHandlerBase.ts +81 -0
  236. package/src/component/tag/handlers/CreatePointHandler.ts +35 -0
  237. package/src/component/tag/handlers/CreatePolygonHandler.ts +33 -0
  238. package/src/component/tag/handlers/CreateRectDragHandler.ts +199 -0
  239. package/src/component/tag/handlers/CreateRectHandler.ts +57 -0
  240. package/src/component/tag/handlers/CreateVertexHandler.ts +165 -0
  241. package/src/component/tag/handlers/EditVertexHandler.ts +275 -0
  242. package/src/component/tag/handlers/TagHandlerBase.ts +57 -0
  243. package/src/component/tag/interfaces/IInteraction.ts +14 -0
  244. package/src/component/tag/interfaces/IOutlineCreateTagOptions.ts +15 -0
  245. package/src/component/tag/interfaces/IOutlineTagOptions.ts +89 -0
  246. package/src/component/tag/interfaces/ISpotTagOptions.ts +37 -0
  247. package/src/component/tag/interfaces/interfaces.ts +4 -0
  248. package/src/component/tag/tag/OutlineCreateTag.ts +330 -0
  249. package/src/component/tag/tag/OutlineRenderTag.ts +569 -0
  250. package/src/component/tag/tag/OutlineTag.ts +380 -0
  251. package/src/component/tag/tag/RenderTag.ts +50 -0
  252. package/src/component/tag/tag/SpotRenderTag.ts +160 -0
  253. package/src/component/tag/tag/SpotTag.ts +170 -0
  254. package/src/component/tag/tag/Tag.ts +103 -0
  255. package/src/component/utils/HandlerBase.ts +71 -0
  256. package/src/error/ArgumentBeeviewError.ts +11 -0
  257. package/src/error/BeeviewError.ts +9 -0
  258. package/src/error/GraphBeeviewError.ts +11 -0
  259. package/src/geo/Camera.ts +149 -0
  260. package/src/geo/GeoCoords.ts +280 -0
  261. package/src/geo/GeoRBush.ts +25 -0
  262. package/src/geo/Spatial.ts +259 -0
  263. package/src/geo/Transform.ts +543 -0
  264. package/src/geo/ViewportCoords.ts +518 -0
  265. package/src/geo/interfaces/ILatLonAlt.ts +7 -0
  266. package/src/geo/interfaces/interfaces.ts +1 -0
  267. package/src/graph/FilterCreator.ts +106 -0
  268. package/src/graph/FilterExpression.ts +16 -0
  269. package/src/graph/Graph.ts +1516 -0
  270. package/src/graph/GraphCalculator.ts +197 -0
  271. package/src/graph/GraphService.ts +516 -0
  272. package/src/graph/ImageLoadingService.ts +44 -0
  273. package/src/graph/MeshReader.ts +19 -0
  274. package/src/graph/Node.ts +622 -0
  275. package/src/graph/NodeCache.ts +548 -0
  276. package/src/graph/Sequence.ts +117 -0
  277. package/src/graph/edge/EdgeCalculator.ts +919 -0
  278. package/src/graph/edge/EdgeCalculatorCoefficients.ts +43 -0
  279. package/src/graph/edge/EdgeCalculatorDirections.ts +80 -0
  280. package/src/graph/edge/EdgeCalculatorSettings.ts +61 -0
  281. package/src/graph/edge/EdgeDirection.ts +63 -0
  282. package/src/graph/edge/interfaces/IEdge.ts +26 -0
  283. package/src/graph/edge/interfaces/IEdgeData.ts +22 -0
  284. package/src/graph/edge/interfaces/IPano.ts +8 -0
  285. package/src/graph/edge/interfaces/IPotentialEdge.ts +106 -0
  286. package/src/graph/edge/interfaces/IStep.ts +7 -0
  287. package/src/graph/edge/interfaces/ITurn.ts +7 -0
  288. package/src/graph/edge/interfaces/interfaces.ts +6 -0
  289. package/src/graph/interfaces/IEdgeStatus.ts +25 -0
  290. package/src/graph/interfaces/IGraphConfiguration.ts +26 -0
  291. package/src/graph/interfaces/ILoadStatus.ts +18 -0
  292. package/src/graph/interfaces/ILoadStatusObject.ts +8 -0
  293. package/src/graph/interfaces/IMesh.ts +20 -0
  294. package/src/graph/interfaces/interfaces.ts +5 -0
  295. package/src/render/DOMRenderer.ts +288 -0
  296. package/src/render/GLRenderStage.ts +6 -0
  297. package/src/render/GLRenderer.ts +436 -0
  298. package/src/render/RenderCamera.ts +212 -0
  299. package/src/render/RenderMode.ts +34 -0
  300. package/src/render/RenderService.ts +264 -0
  301. package/src/render/interfaces/IGLRender.ts +10 -0
  302. package/src/render/interfaces/IGLRenderFunction.ts +10 -0
  303. package/src/render/interfaces/IGLRenderHash.ts +8 -0
  304. package/src/render/interfaces/ISize.ts +6 -0
  305. package/src/render/interfaces/IVNodeHash.ts +8 -0
  306. package/src/render/interfaces/interfaces.ts +5 -0
  307. package/src/state/FrameGenerator.ts +36 -0
  308. package/src/state/State.ts +6 -0
  309. package/src/state/StateContext.ts +180 -0
  310. package/src/state/StateService.ts +600 -0
  311. package/src/state/StateTransitionMatrix.ts +58 -0
  312. package/src/state/interfaces/ICurrentState.ts +21 -0
  313. package/src/state/interfaces/IFrame.ts +9 -0
  314. package/src/state/interfaces/IRotation.ts +6 -0
  315. package/src/state/interfaces/IState.ts +11 -0
  316. package/src/state/interfaces/IStateContext.ts +31 -0
  317. package/src/state/interfaces/interfaces.ts +5 -0
  318. package/src/state/states/StateBase.ts +425 -0
  319. package/src/state/states/TraversingState.ts +861 -0
  320. package/src/state/states/WaitingState.ts +109 -0
  321. package/src/tiles/ImageTileLoader.ts +121 -0
  322. package/src/tiles/ImageTileStore.ts +70 -0
  323. package/src/tiles/RegionOfInterestCalculator.ts +158 -0
  324. package/src/tiles/TextureProvider.ts +609 -0
  325. package/src/tiles/interfaces/IBoundingBox.ts +28 -0
  326. package/src/tiles/interfaces/IRegionOfInterest.ts +25 -0
  327. package/src/tiles/interfaces/interfaces.ts +2 -0
  328. package/src/utils/DOM.ts +28 -0
  329. package/src/utils/EventEmitter.ts +61 -0
  330. package/src/utils/Func.ts +3 -0
  331. package/src/utils/Settings.ts +39 -0
  332. package/src/utils/Support.ts +70 -0
  333. package/src/utils/Urls.ts +43 -0
  334. package/src/viewer/Alignment.ts +53 -0
  335. package/src/viewer/CacheService.ts +75 -0
  336. package/src/viewer/ComponentController.ts +237 -0
  337. package/src/viewer/Container.ts +100 -0
  338. package/src/viewer/EventNames.ts +192 -0
  339. package/src/viewer/ImageSize.ts +28 -0
  340. package/src/viewer/KeyboardService.ts +15 -0
  341. package/src/viewer/LoadingService.ts +66 -0
  342. package/src/viewer/MouseService.ts +541 -0
  343. package/src/viewer/Navigator.ts +362 -0
  344. package/src/viewer/Observer.ts +441 -0
  345. package/src/viewer/Projection.ts +162 -0
  346. package/src/viewer/SpriteService.ts +281 -0
  347. package/src/viewer/TouchService.ts +336 -0
  348. package/src/viewer/Viewer.ts +1132 -0
  349. package/src/viewer/interfaces/IComponentOptions.ts +176 -0
  350. package/src/viewer/interfaces/IMouseClaim.ts +6 -0
  351. package/src/viewer/interfaces/IMouseDeferPixels.ts +6 -0
  352. package/src/viewer/interfaces/IPinch.ts +81 -0
  353. package/src/viewer/interfaces/ISpriteAtlas.ts +12 -0
  354. package/src/viewer/interfaces/IUnprojection.ts +9 -0
  355. package/src/viewer/interfaces/IViewerMouseEvent.ts +56 -0
  356. package/src/viewer/interfaces/IViewerOptions.ts +88 -0
  357. package/src/viewer/interfaces/PointOfView.ts +19 -0
  358. package/src/viewer/interfaces/interfaces.ts +9 -0
  359. package/styles/AttributionComponent.css +26 -0
  360. package/styles/BackgroundComponent.css +21 -0
  361. package/styles/BearingComponent.css +48 -0
  362. package/styles/CoverComponent.css +169 -0
  363. package/styles/DebugComponent.css +28 -0
  364. package/styles/DirectionComponent.css +154 -0
  365. package/styles/LoadingComponent.css +14 -0
  366. package/styles/NavigationComponent.css +64 -0
  367. package/styles/NorthBg.png +0 -0
  368. package/styles/PopupComponent.css +188 -0
  369. package/styles/RouteComponent.css +21 -0
  370. package/styles/SequenceComponent.css +120 -0
  371. package/styles/SliderComponent.css +82 -0
  372. package/styles/TagComponent.css +105 -0
  373. package/styles/cover-logo.png +0 -0
  374. package/styles/mapillary-js.css +29 -0
  375. package/styles/pano-indicator.svg +3 -0
  376. package/styles/pano.svg +20 -0
  377. package/styles/pointer-wheat.svg +3 -0
  378. package/styles/pointer-white.svg +3 -0
  379. package/styles/spinner.svg +1 -0
  380. package/styles/stepper-left.svg +1 -0
  381. package/styles/stepper-play.svg +1 -0
  382. package/styles/stepper-right.svg +1 -0
  383. package/styles/stepper-stop.svg +1 -0
  384. package/styles/turn-around.svg +3 -0
  385. package/styles/turn.svg +3 -0
  386. package/tsconfig.json +28 -0
  387. package/tslint.json +81 -0
  388. package/types/graphql/index.d.ts +28 -0
  389. package/types/graphql/language/ast/index.d.ts +7 -0
  390. package/types/images/index.d.ts +7 -0
  391. package/types/pbf/index.d.ts +16 -0
  392. package/types/rbush/index.d.ts +28 -0
  393. package/version/beeview-0.1.0.css +2 -0
  394. package/version/beeview-0.1.0.js +1 -0
  395. package/version/beeview-0.1.1.css +2 -0
  396. package/version/beeview-0.1.1.js +1 -0
  397. package/version/beeview-0.1.2.css +2 -0
  398. package/version/beeview-0.1.2.js +1 -0
  399. package/version/beeview-0.2.0.css +2 -0
  400. package/version/beeview-0.2.0.js +1 -0
  401. package/version/beeview-0.2.1.css +2 -0
  402. package/version/beeview-0.2.1.js +1 -0
  403. package/version/beeview-0.3.0.css +2 -0
  404. package/version/beeview-0.3.0.js +1 -0
  405. package/version/beeview-0.4.0.css +2 -0
  406. package/version/beeview-0.4.0.js +1 -0
  407. package/version/beeview-0.4.1.css +2 -0
  408. package/version/beeview-0.4.1.js +1 -0
  409. package/version/mapxus-visual-1.0.0.css +2 -0
  410. package/version/mapxus-visual-1.0.0.js +1 -0
  411. package/version/mapxus-visual-1.1.0.css +2 -0
  412. package/version/mapxus-visual-1.1.0.js +1 -0
  413. package/version/mapxus-visual-1.1.1.css +2 -0
  414. package/version/mapxus-visual-1.1.1.js +1 -0
  415. package/version/mapxus-visual-1.1.2.css +2 -0
  416. package/version/mapxus-visual-1.1.2.js +1 -0
  417. package/version/mapxus-visual-1.2.0.css +2 -0
  418. package/version/mapxus-visual-1.2.0.js +1 -0
  419. package/version/mapxus-visual-1.3.0.css +2 -0
  420. package/version/mapxus-visual-1.3.0.js +1 -0
  421. package/LICENSE +0 -11
  422. package/README.md +0 -28
  423. package/index.css +0 -2
  424. package/index.d.ts +0 -163
  425. package/index.js +0 -1
@@ -0,0 +1,861 @@
1
+ import * as THREE from "three";
2
+ import { MathUtils } from "three";
3
+ import type { IGPano } from "../../api/interfaces/interfaces";
4
+ import { StateBase } from "./StateBase";
5
+ import { IState, IRotation } from "../interfaces/interfaces";
6
+ import { Node } from "../../graph/Node";
7
+ import { Camera } from "../../geo/Camera";
8
+ import { Transform } from "../../geo/Transform";
9
+
10
+ class RotationDelta implements IRotation {
11
+ private _phi: number;
12
+ private _theta: number;
13
+
14
+ constructor(phi: number, theta: number) {
15
+ this._phi = phi;
16
+ this._theta = theta;
17
+ }
18
+
19
+ public get phi(): number {
20
+ return this._phi;
21
+ }
22
+
23
+ public set phi(value: number) {
24
+ this._phi = value;
25
+ }
26
+
27
+ public get theta(): number {
28
+ return this._theta;
29
+ }
30
+
31
+ public set theta(value: number) {
32
+ this._theta = value;
33
+ }
34
+
35
+ public get isZero(): boolean {
36
+ return this._phi === 0 && this._theta === 0;
37
+ }
38
+
39
+ public copy(delta: IRotation): void {
40
+ this._phi = delta.phi;
41
+ this._theta = delta.theta;
42
+ }
43
+
44
+ public lerp(other: IRotation, alpha: number): void {
45
+ this._phi = (1 - alpha) * this._phi + alpha * other.phi;
46
+ this._theta = (1 - alpha) * this._theta + alpha * other.theta;
47
+ }
48
+
49
+ public multiply(value: number): void {
50
+ this._phi *= value;
51
+ this._theta *= value;
52
+ }
53
+
54
+ public threshold(value: number): void {
55
+ this._phi = Math.abs(this._phi) > value ? this._phi : 0;
56
+ this._theta = Math.abs(this._theta) > value ? this._theta : 0;
57
+ }
58
+
59
+ public lengthSquared(): number {
60
+ return this._phi * this._phi + this._theta * this._theta;
61
+ }
62
+
63
+ public reset(): void {
64
+ this._phi = 0;
65
+ this._theta = 0;
66
+ }
67
+ }
68
+
69
+ export class TraversingState extends StateBase {
70
+ private _baseAlpha: number;
71
+ private _animationSpeed: number;
72
+
73
+ private _useBezier: boolean;
74
+
75
+ private _rotationDelta: RotationDelta;
76
+ private _requestedRotationDelta: RotationDelta;
77
+
78
+ private _basicRotation: number[];
79
+ private _requestedBasicRotation: number[];
80
+ private _requestedBasicRotationUnbounded: number[];
81
+
82
+ private _rotationAcceleration: number;
83
+ private _rotationIncreaseAlpha: number;
84
+ private _rotationDecreaseAlpha: number;
85
+ private _rotationThreshold: number;
86
+ private _unboundedRotationAlpha: number;
87
+
88
+ private _desiredZoom: number;
89
+ private _minZoom: number;
90
+ private _maxZoom: number;
91
+ private _lookatDepth: number;
92
+ private _desiredLookat: THREE.Vector3;
93
+ private _desiredCenter: number[];
94
+
95
+ constructor(state: IState) {
96
+ super(state);
97
+
98
+ this._adjustCameras();
99
+
100
+ this._motionless = this._motionlessTransition();
101
+
102
+ this._baseAlpha = this._alpha;
103
+ this._animationSpeed = 0.025;
104
+ this._useBezier = false;
105
+
106
+ this._rotationDelta = new RotationDelta(0, 0);
107
+ this._requestedRotationDelta = null;
108
+
109
+ this._basicRotation = [0, 0];
110
+ this._requestedBasicRotation = null;
111
+ this._requestedBasicRotationUnbounded = null;
112
+
113
+ this._rotationAcceleration = 0.86;
114
+ this._rotationIncreaseAlpha = 0.97;
115
+ this._rotationDecreaseAlpha = 0.9;
116
+ this._rotationThreshold = 1e-3;
117
+ this._unboundedRotationAlpha = 0.8;
118
+
119
+ this._desiredZoom = state.zoom;
120
+ this._minZoom = 0;
121
+ this._maxZoom = 3;
122
+ this._lookatDepth = 10;
123
+
124
+ this._desiredLookat = null;
125
+ this._desiredCenter = null;
126
+ }
127
+
128
+ public append(nodes: Node[]): void {
129
+ let emptyTrajectory: boolean = this._trajectory.length === 0;
130
+
131
+ if (emptyTrajectory) {
132
+ this._resetTransition();
133
+ }
134
+
135
+ super.append(nodes);
136
+
137
+ if (emptyTrajectory) {
138
+ this._setDesiredCenter();
139
+ this._setDesiredZoom();
140
+ }
141
+ }
142
+
143
+ public prepend(nodes: Node[]): void {
144
+ let emptyTrajectory: boolean = this._trajectory.length === 0;
145
+
146
+ if (emptyTrajectory) {
147
+ this._resetTransition();
148
+ }
149
+
150
+ super.prepend(nodes);
151
+
152
+ if (emptyTrajectory) {
153
+ this._setDesiredCenter();
154
+ this._setDesiredZoom();
155
+ }
156
+ }
157
+
158
+ public set(nodes: Node[]): void {
159
+ super.set(nodes);
160
+
161
+ this._desiredLookat = null;
162
+
163
+ this._resetTransition();
164
+ this._clearRotation();
165
+
166
+ this._setDesiredCenter();
167
+ this._setDesiredZoom();
168
+
169
+ if (this._trajectory.length < 3) {
170
+ this._useBezier = true;
171
+ }
172
+ }
173
+
174
+ public move(delta: number): void {
175
+ throw new Error("Not implemented");
176
+ }
177
+
178
+ public moveTo(delta: number): void {
179
+ throw new Error("Not implemented");
180
+ }
181
+
182
+ public rotate(rotationDelta: IRotation): void {
183
+ if (this._currentNode == null) {
184
+ return;
185
+ }
186
+
187
+ this._desiredZoom = this._zoom;
188
+ this._desiredLookat = null;
189
+ this._requestedBasicRotation = null;
190
+
191
+ if (this._requestedRotationDelta != null) {
192
+ this._requestedRotationDelta.phi =
193
+ this._requestedRotationDelta.phi + rotationDelta.phi;
194
+ this._requestedRotationDelta.theta =
195
+ this._requestedRotationDelta.theta + rotationDelta.theta;
196
+ } else {
197
+ this._requestedRotationDelta = new RotationDelta(
198
+ rotationDelta.phi,
199
+ rotationDelta.theta,
200
+ );
201
+ }
202
+ }
203
+
204
+ public rotateBasic(basicRotation: number[]): void {
205
+ if (this._currentNode == null) {
206
+ return;
207
+ }
208
+
209
+ this._desiredZoom = this._zoom;
210
+ this._desiredLookat = null;
211
+ this._requestedRotationDelta = null;
212
+
213
+ if (this._requestedBasicRotation != null) {
214
+ this._requestedBasicRotation[0] += basicRotation[0];
215
+ this._requestedBasicRotation[1] += basicRotation[1];
216
+
217
+ let threshold: number = 0.05 / Math.pow(2, this._zoom);
218
+
219
+ this._requestedBasicRotation[0] = this._spatial.clamp(
220
+ this._requestedBasicRotation[0],
221
+ -threshold,
222
+ threshold,
223
+ );
224
+
225
+ this._requestedBasicRotation[1] = this._spatial.clamp(
226
+ this._requestedBasicRotation[1],
227
+ -threshold,
228
+ threshold,
229
+ );
230
+ } else {
231
+ this._requestedBasicRotation = basicRotation.slice();
232
+ }
233
+ }
234
+
235
+ public rotateBasicUnbounded(basicRotation: number[]): void {
236
+ if (this._currentNode == null) {
237
+ return;
238
+ }
239
+
240
+ if (this._requestedBasicRotationUnbounded != null) {
241
+ this._requestedBasicRotationUnbounded[0] += basicRotation[0];
242
+ this._requestedBasicRotationUnbounded[1] += basicRotation[1];
243
+ } else {
244
+ this._requestedBasicRotationUnbounded = basicRotation.slice();
245
+ }
246
+ }
247
+
248
+ public rotateBasicWithoutInertia(basic: number[]): void {
249
+ if (this._currentNode == null) {
250
+ return;
251
+ }
252
+
253
+ this._desiredZoom = this._zoom;
254
+ this._desiredLookat = null;
255
+ this._requestedRotationDelta = null;
256
+ this._requestedBasicRotation = null;
257
+
258
+ const threshold: number = 0.05 / Math.pow(2, this._zoom);
259
+
260
+ const basicRotation: number[] = basic.slice();
261
+ basicRotation[0] = this._spatial.clamp(
262
+ basicRotation[0],
263
+ -threshold,
264
+ threshold,
265
+ );
266
+ basicRotation[1] = this._spatial.clamp(
267
+ basicRotation[1],
268
+ -threshold,
269
+ threshold,
270
+ );
271
+
272
+ this._applyRotationBasic(basicRotation);
273
+ }
274
+
275
+ public rotateToBasic(basic: number[]): void {
276
+ if (this._currentNode == null) {
277
+ return;
278
+ }
279
+
280
+ this._desiredZoom = this._zoom;
281
+ this._desiredLookat = null;
282
+
283
+ basic[0] = this._spatial.clamp(basic[0], 0, 1);
284
+ basic[1] = this._spatial.clamp(basic[1], 0, 1);
285
+
286
+ let lookat: number[] = this.currentTransform.unprojectBasic(
287
+ basic,
288
+ this._lookatDepth,
289
+ );
290
+ this._currentCamera.lookat.fromArray(lookat);
291
+ }
292
+
293
+ public zoomIn(delta: number, reference: number[]): void {
294
+ if (this._currentNode == null) {
295
+ return;
296
+ }
297
+
298
+ this._desiredZoom = Math.max(
299
+ this._minZoom,
300
+ Math.min(this._maxZoom, this._desiredZoom + delta),
301
+ );
302
+
303
+ let currentCenter: number[] = this.currentTransform.projectBasic(
304
+ this._currentCamera.lookat.toArray(),
305
+ );
306
+
307
+ let currentCenterX: number = currentCenter[0];
308
+ let currentCenterY: number = currentCenter[1];
309
+
310
+ let zoom0: number = Math.pow(2, this._zoom);
311
+ let zoom1: number = Math.pow(2, this._desiredZoom);
312
+
313
+ let refX: number = reference[0];
314
+ let refY: number = reference[1];
315
+
316
+ if (
317
+ this.currentTransform.gpano != null &&
318
+ this.currentTransform.gpano.CroppedAreaImageWidthPixels ===
319
+ this.currentTransform.gpano.FullPanoWidthPixels
320
+ ) {
321
+ if (refX - currentCenterX > 0.5) {
322
+ refX = refX - 1;
323
+ } else if (currentCenterX - refX > 0.5) {
324
+ refX = 1 + refX;
325
+ }
326
+ }
327
+
328
+ let newCenterX: number =
329
+ refX - (zoom0 / zoom1) * (refX - currentCenterX);
330
+ let newCenterY: number =
331
+ refY - (zoom0 / zoom1) * (refY - currentCenterY);
332
+
333
+ let gpano: IGPano = this.currentTransform.gpano;
334
+
335
+ if (this._currentNode.fullPano) {
336
+ newCenterX = this._spatial.wrap(
337
+ newCenterX + this._basicRotation[0],
338
+ 0,
339
+ 1,
340
+ );
341
+ newCenterY = this._spatial.clamp(
342
+ newCenterY + this._basicRotation[1],
343
+ 0.05,
344
+ 0.95,
345
+ );
346
+ } else if (
347
+ gpano != null &&
348
+ this.currentTransform.gpano.CroppedAreaImageWidthPixels ===
349
+ this.currentTransform.gpano.FullPanoWidthPixels
350
+ ) {
351
+ newCenterX = this._spatial.wrap(
352
+ newCenterX + this._basicRotation[0],
353
+ 0,
354
+ 1,
355
+ );
356
+ newCenterY = this._spatial.clamp(
357
+ newCenterY + this._basicRotation[1],
358
+ 0,
359
+ 1,
360
+ );
361
+ } else {
362
+ newCenterX = this._spatial.clamp(newCenterX, 0, 1);
363
+ newCenterY = this._spatial.clamp(newCenterY, 0, 1);
364
+ }
365
+
366
+ this._desiredLookat = new THREE.Vector3().fromArray(
367
+ this.currentTransform.unprojectBasic(
368
+ [newCenterX, newCenterY],
369
+ this._lookatDepth,
370
+ ),
371
+ );
372
+ }
373
+
374
+ public setCenter(center: number[]): void {
375
+ this._desiredLookat = null;
376
+ this._requestedRotationDelta = null;
377
+ this._requestedBasicRotation = null;
378
+ this._desiredZoom = this._zoom;
379
+
380
+ let clamped: number[] = [
381
+ this._spatial.clamp(center[0], 0, 1),
382
+ this._spatial.clamp(center[1], 0, 1),
383
+ ];
384
+
385
+ if (this._currentNode == null) {
386
+ this._desiredCenter = clamped;
387
+ return;
388
+ }
389
+
390
+ this._desiredCenter = null;
391
+
392
+ let currentLookat: THREE.Vector3 = new THREE.Vector3().fromArray(
393
+ this.currentTransform.unprojectBasic(clamped, this._lookatDepth),
394
+ );
395
+
396
+ let previousTransform: Transform =
397
+ this.previousTransform != null
398
+ ? this.previousTransform
399
+ : this.currentTransform;
400
+ let previousLookat: THREE.Vector3 = new THREE.Vector3().fromArray(
401
+ previousTransform.unprojectBasic(clamped, this._lookatDepth),
402
+ );
403
+
404
+ this._currentCamera.lookat.copy(currentLookat);
405
+ this._previousCamera.lookat.copy(previousLookat);
406
+ }
407
+
408
+ public setZoom(zoom: number): void {
409
+ this._desiredLookat = null;
410
+ this._requestedRotationDelta = null;
411
+ this._requestedBasicRotation = null;
412
+
413
+ this._zoom = this._spatial.clamp(zoom, this._minZoom, this._maxZoom);
414
+ this._desiredZoom = this._zoom;
415
+ }
416
+
417
+ public update(fps: number): void {
418
+ if (
419
+ this._alpha === 1 &&
420
+ this._currentIndex + this._alpha < this._trajectory.length
421
+ ) {
422
+ this._currentIndex += 1;
423
+
424
+ this._useBezier =
425
+ this._trajectory.length < 3 &&
426
+ this._currentIndex + 1 === this._trajectory.length;
427
+
428
+ this._setCurrent();
429
+ this._resetTransition();
430
+ this._clearRotation();
431
+
432
+ this._desiredZoom = this._currentNode.fullPano ? this._zoom : 0;
433
+
434
+ this._desiredLookat = null;
435
+ }
436
+
437
+ let animationSpeed: number = this._animationSpeed * (60 / fps);
438
+ this._baseAlpha = Math.min(1, this._baseAlpha + animationSpeed);
439
+ if (this._useBezier) {
440
+ this._alpha = MathUtils.smootherstep(this._baseAlpha, 0, 1);
441
+ } else {
442
+ this._alpha = this._baseAlpha;
443
+ }
444
+
445
+ this._updateRotation();
446
+ if (!this._rotationDelta.isZero) {
447
+ this._applyRotation(this._previousCamera);
448
+ this._applyRotation(this._currentCamera);
449
+ }
450
+
451
+ this._updateRotationBasic();
452
+ if (this._basicRotation[0] !== 0 || this._basicRotation[1] !== 0) {
453
+ this._applyRotationBasic(this._basicRotation);
454
+ }
455
+
456
+ this._updateZoom(animationSpeed);
457
+ this._updateLookat(animationSpeed);
458
+
459
+ this._camera.lerpCameras(
460
+ this._previousCamera,
461
+ this._currentCamera,
462
+ this.alpha,
463
+ );
464
+ }
465
+
466
+ protected _getAlpha(): number {
467
+ return this._motionless ? Math.ceil(this._alpha) : this._alpha;
468
+ }
469
+
470
+ protected _setCurrentCamera(): void {
471
+ super._setCurrentCamera();
472
+
473
+ this._adjustCameras();
474
+ }
475
+
476
+ private _adjustCameras(): void {
477
+ if (this._previousNode == null) {
478
+ return;
479
+ }
480
+
481
+ let lookat: THREE.Vector3 = this._camera.lookat
482
+ .clone()
483
+ .sub(this._camera.position);
484
+ this._previousCamera.lookat.copy(
485
+ lookat.clone().add(this._previousCamera.position),
486
+ );
487
+
488
+ if (this._currentNode.fullPano) {
489
+ this._currentCamera.lookat.copy(
490
+ lookat.clone().add(this._currentCamera.position),
491
+ );
492
+ }
493
+ }
494
+
495
+ private _resetTransition(): void {
496
+ this._alpha = 0;
497
+ this._baseAlpha = 0;
498
+
499
+ this._motionless = this._motionlessTransition();
500
+ }
501
+
502
+ private _applyRotation(camera: Camera): void {
503
+ if (camera == null) {
504
+ return;
505
+ }
506
+
507
+ let q: THREE.Quaternion = new THREE.Quaternion().setFromUnitVectors(
508
+ camera.up,
509
+ new THREE.Vector3(0, 0, 1),
510
+ );
511
+ let qInverse: THREE.Quaternion = q.clone().inverse();
512
+
513
+ let offset: THREE.Vector3 = new THREE.Vector3();
514
+ offset.copy(camera.lookat).sub(camera.position);
515
+ offset.applyQuaternion(q);
516
+ let length: number = offset.length();
517
+
518
+ let phi: number = Math.atan2(offset.y, offset.x);
519
+ phi += this._rotationDelta.phi;
520
+
521
+ let theta: number = Math.atan2(
522
+ Math.sqrt(offset.x * offset.x + offset.y * offset.y),
523
+ offset.z,
524
+ );
525
+ theta += this._rotationDelta.theta;
526
+ theta = Math.max(0.1, Math.min(Math.PI - 0.1, theta));
527
+
528
+ offset.x = Math.sin(theta) * Math.cos(phi);
529
+ offset.y = Math.sin(theta) * Math.sin(phi);
530
+ offset.z = Math.cos(theta);
531
+ offset.applyQuaternion(qInverse);
532
+
533
+ camera.lookat.copy(camera.position).add(offset.multiplyScalar(length));
534
+ }
535
+
536
+ private _applyRotationBasic(basicRotation: number[]): void {
537
+ let currentNode: Node = this._currentNode;
538
+ let previousNode: Node =
539
+ this._previousNode != null ? this.previousNode : this.currentNode;
540
+
541
+ let currentCamera: Camera = this._currentCamera;
542
+ let previousCamera: Camera = this._previousCamera;
543
+
544
+ let currentTransform: Transform = this.currentTransform;
545
+ let previousTransform: Transform =
546
+ this.previousTransform != null
547
+ ? this.previousTransform
548
+ : this.currentTransform;
549
+
550
+ let currentBasic: number[] = currentTransform.projectBasic(
551
+ currentCamera.lookat.toArray(),
552
+ );
553
+ let previousBasic: number[] = previousTransform.projectBasic(
554
+ previousCamera.lookat.toArray(),
555
+ );
556
+
557
+ let currentGPano: IGPano = currentTransform.gpano;
558
+ let previousGPano: IGPano = previousTransform.gpano;
559
+
560
+ if (currentNode.fullPano) {
561
+ currentBasic[0] = this._spatial.wrap(
562
+ currentBasic[0] + basicRotation[0],
563
+ 0,
564
+ 1,
565
+ );
566
+ currentBasic[1] = this._spatial.clamp(
567
+ currentBasic[1] + basicRotation[1],
568
+ 0.05,
569
+ 0.95,
570
+ );
571
+ } else if (
572
+ currentGPano != null &&
573
+ currentTransform.gpano.CroppedAreaImageWidthPixels ===
574
+ currentTransform.gpano.FullPanoWidthPixels
575
+ ) {
576
+ currentBasic[0] = this._spatial.wrap(
577
+ currentBasic[0] + basicRotation[0],
578
+ 0,
579
+ 1,
580
+ );
581
+ currentBasic[1] = this._spatial.clamp(
582
+ currentBasic[1] + basicRotation[1],
583
+ 0,
584
+ 1,
585
+ );
586
+ } else {
587
+ currentBasic[0] = this._spatial.clamp(
588
+ currentBasic[0] + basicRotation[0],
589
+ 0,
590
+ 1,
591
+ );
592
+ currentBasic[1] = this._spatial.clamp(
593
+ currentBasic[1] + basicRotation[1],
594
+ 0,
595
+ 1,
596
+ );
597
+ }
598
+
599
+ if (previousNode.fullPano) {
600
+ previousBasic[0] = this._spatial.wrap(
601
+ previousBasic[0] + basicRotation[0],
602
+ 0,
603
+ 1,
604
+ );
605
+ previousBasic[1] = this._spatial.clamp(
606
+ previousBasic[1] + basicRotation[1],
607
+ 0.05,
608
+ 0.95,
609
+ );
610
+ } else if (
611
+ previousGPano != null &&
612
+ previousTransform.gpano.CroppedAreaImageWidthPixels ===
613
+ previousTransform.gpano.FullPanoWidthPixels
614
+ ) {
615
+ previousBasic[0] = this._spatial.wrap(
616
+ previousBasic[0] + basicRotation[0],
617
+ 0,
618
+ 1,
619
+ );
620
+ previousBasic[1] = this._spatial.clamp(
621
+ previousBasic[1] + basicRotation[1],
622
+ 0,
623
+ 1,
624
+ );
625
+ } else {
626
+ previousBasic[0] = this._spatial.clamp(
627
+ previousBasic[0] + basicRotation[0],
628
+ 0,
629
+ 1,
630
+ );
631
+ previousBasic[1] = this._spatial.clamp(
632
+ currentBasic[1] + basicRotation[1],
633
+ 0,
634
+ 1,
635
+ );
636
+ }
637
+
638
+ let currentLookat: number[] = currentTransform.unprojectBasic(
639
+ currentBasic,
640
+ this._lookatDepth,
641
+ );
642
+ currentCamera.lookat.fromArray(currentLookat);
643
+
644
+ let previousLookat: number[] = previousTransform.unprojectBasic(
645
+ previousBasic,
646
+ this._lookatDepth,
647
+ );
648
+ previousCamera.lookat.fromArray(previousLookat);
649
+ }
650
+
651
+ private _updateZoom(animationSpeed: number): void {
652
+ let diff: number = this._desiredZoom - this._zoom;
653
+ let sign: number = diff > 0 ? 1 : diff < 0 ? -1 : 0;
654
+
655
+ if (diff === 0) {
656
+ return;
657
+ } else if (Math.abs(diff) < 2e-3) {
658
+ this._zoom = this._desiredZoom;
659
+ if (this._desiredLookat != null) {
660
+ this._desiredLookat = null;
661
+ }
662
+ } else {
663
+ this._zoom +=
664
+ sign * Math.max(Math.abs(5 * animationSpeed * diff), 2e-3);
665
+ }
666
+ }
667
+
668
+ private _updateLookat(animationSpeed: number): void {
669
+ if (this._desiredLookat === null) {
670
+ return;
671
+ }
672
+
673
+ let diff: number = this._desiredLookat.distanceToSquared(
674
+ this._currentCamera.lookat,
675
+ );
676
+
677
+ if (Math.abs(diff) < 1e-6) {
678
+ this._currentCamera.lookat.copy(this._desiredLookat);
679
+ this._desiredLookat = null;
680
+ } else {
681
+ this._currentCamera.lookat.lerp(
682
+ this._desiredLookat,
683
+ 5 * animationSpeed,
684
+ );
685
+ }
686
+ }
687
+
688
+ private _updateRotation(): void {
689
+ if (this._requestedRotationDelta != null) {
690
+ let length: number = this._rotationDelta.lengthSquared();
691
+ let requestedLength: number =
692
+ this._requestedRotationDelta.lengthSquared();
693
+
694
+ if (requestedLength > length) {
695
+ this._rotationDelta.lerp(
696
+ this._requestedRotationDelta,
697
+ this._rotationIncreaseAlpha,
698
+ );
699
+ } else {
700
+ this._rotationDelta.lerp(
701
+ this._requestedRotationDelta,
702
+ this._rotationDecreaseAlpha,
703
+ );
704
+ }
705
+
706
+ this._requestedRotationDelta = null;
707
+
708
+ return;
709
+ }
710
+
711
+ if (this._rotationDelta.isZero) {
712
+ return;
713
+ }
714
+
715
+ this._rotationDelta.multiply(this._rotationAcceleration);
716
+ this._rotationDelta.threshold(this._rotationThreshold);
717
+ }
718
+
719
+ private _updateRotationBasic(): void {
720
+ if (this._requestedBasicRotation != null) {
721
+ let x: number = this._basicRotation[0];
722
+ let y: number = this._basicRotation[1];
723
+
724
+ let reqX: number = this._requestedBasicRotation[0];
725
+ let reqY: number = this._requestedBasicRotation[1];
726
+
727
+ if (Math.abs(reqX) > Math.abs(x)) {
728
+ this._basicRotation[0] =
729
+ (1 - this._rotationIncreaseAlpha) * x +
730
+ this._rotationIncreaseAlpha * reqX;
731
+ } else {
732
+ this._basicRotation[0] =
733
+ (1 - this._rotationDecreaseAlpha) * x +
734
+ this._rotationDecreaseAlpha * reqX;
735
+ }
736
+
737
+ if (Math.abs(reqY) > Math.abs(y)) {
738
+ this._basicRotation[1] =
739
+ (1 - this._rotationIncreaseAlpha) * y +
740
+ this._rotationIncreaseAlpha * reqY;
741
+ } else {
742
+ this._basicRotation[1] =
743
+ (1 - this._rotationDecreaseAlpha) * y +
744
+ this._rotationDecreaseAlpha * reqY;
745
+ }
746
+
747
+ this._requestedBasicRotation = null;
748
+
749
+ return;
750
+ }
751
+
752
+ if (this._requestedBasicRotationUnbounded != null) {
753
+ let reqX: number = this._requestedBasicRotationUnbounded[0];
754
+ let reqY: number = this._requestedBasicRotationUnbounded[1];
755
+
756
+ if (Math.abs(reqX) > 0) {
757
+ this._basicRotation[0] =
758
+ (1 - this._unboundedRotationAlpha) *
759
+ this._basicRotation[0] +
760
+ this._unboundedRotationAlpha * reqX;
761
+ }
762
+
763
+ if (Math.abs(reqY) > 0) {
764
+ this._basicRotation[1] =
765
+ (1 - this._unboundedRotationAlpha) *
766
+ this._basicRotation[1] +
767
+ this._unboundedRotationAlpha * reqY;
768
+ }
769
+
770
+ if (this._desiredLookat != null) {
771
+ let desiredBasicLookat: number[] =
772
+ this.currentTransform.projectBasic(
773
+ this._desiredLookat.toArray(),
774
+ );
775
+
776
+ desiredBasicLookat[0] += reqX;
777
+ desiredBasicLookat[1] += reqY;
778
+
779
+ this._desiredLookat = new THREE.Vector3().fromArray(
780
+ this.currentTransform.unprojectBasic(
781
+ desiredBasicLookat,
782
+ this._lookatDepth,
783
+ ),
784
+ );
785
+ }
786
+
787
+ this._requestedBasicRotationUnbounded = null;
788
+ }
789
+
790
+ if (this._basicRotation[0] === 0 && this._basicRotation[1] === 0) {
791
+ return;
792
+ }
793
+
794
+ this._basicRotation[0] =
795
+ this._rotationAcceleration * this._basicRotation[0];
796
+ this._basicRotation[1] =
797
+ this._rotationAcceleration * this._basicRotation[1];
798
+
799
+ if (
800
+ Math.abs(this._basicRotation[0]) <
801
+ this._rotationThreshold / Math.pow(2, this._zoom) &&
802
+ Math.abs(this._basicRotation[1]) <
803
+ this._rotationThreshold / Math.pow(2, this._zoom)
804
+ ) {
805
+ this._basicRotation = [0, 0];
806
+ }
807
+ }
808
+
809
+ private _clearRotation(): void {
810
+ if (this._currentNode.fullPano) {
811
+ return;
812
+ }
813
+
814
+ if (this._requestedRotationDelta != null) {
815
+ this._requestedRotationDelta = null;
816
+ }
817
+
818
+ if (!this._rotationDelta.isZero) {
819
+ this._rotationDelta.reset();
820
+ }
821
+
822
+ if (this._requestedBasicRotation != null) {
823
+ this._requestedBasicRotation = null;
824
+ }
825
+
826
+ if (this._basicRotation[0] > 0 || this._basicRotation[1] > 0) {
827
+ this._basicRotation = [0, 0];
828
+ }
829
+ }
830
+
831
+ private _setDesiredCenter(): void {
832
+ if (this._desiredCenter == null) {
833
+ return;
834
+ }
835
+
836
+ let lookatDirection: THREE.Vector3 = new THREE.Vector3()
837
+ .fromArray(
838
+ this.currentTransform.unprojectBasic(
839
+ this._desiredCenter,
840
+ this._lookatDepth,
841
+ ),
842
+ )
843
+ .sub(this._currentCamera.position);
844
+
845
+ this._currentCamera.lookat.copy(
846
+ this._currentCamera.position.clone().add(lookatDirection),
847
+ );
848
+ this._previousCamera.lookat.copy(
849
+ this._previousCamera.position.clone().add(lookatDirection),
850
+ );
851
+
852
+ this._desiredCenter = null;
853
+ }
854
+
855
+ private _setDesiredZoom(): void {
856
+ this._desiredZoom =
857
+ this._currentNode.fullPano || this._previousNode == null
858
+ ? this._zoom
859
+ : 0;
860
+ }
861
+ }