csyjk 1.1.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. package/.babelrc +7 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/xx.iml +12 -0
  4. package/dist/app.js +43 -0
  5. package/{index.html → dist/index.html} +0 -0
  6. package/{style.css → dist/style.css} +1 -1
  7. package/package.json +40 -5
  8. package/public/gltf.js +2241 -0
  9. package/public/index.html +10 -0
  10. package/src/index.js +3 -0
  11. package/src/lib/gltf/assets/check.jpg +0 -0
  12. package/src/lib/gltf/assets/iconfont/iconfont.css +358 -0
  13. package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
  14. package/src/lib/gltf/assets/iconfont/iconfont.js +1 -0
  15. package/src/lib/gltf/assets/iconfont/iconfont.json +604 -0
  16. package/src/lib/gltf/assets/iconfont/iconfont.svg +189 -0
  17. package/src/lib/gltf/assets/iconfont/iconfont.ttf +0 -0
  18. package/src/lib/gltf/assets/iconfont/iconfont.woff +0 -0
  19. package/src/lib/gltf/assets/iconfont/iconfont.woff2 +0 -0
  20. package/src/lib/gltf/assets/yjkkit-sdk/index.js +0 -0
  21. package/src/lib/gltf/assets/yjkkit-sdk/package.json +15 -0
  22. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +863 -0
  23. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +1 -0
  24. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +1 -0
  25. package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +3 -0
  26. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +462 -0
  27. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +279 -0
  28. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +262 -0
  29. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
  30. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +362 -0
  31. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +575 -0
  32. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +1 -0
  33. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
  34. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +1 -0
  35. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +777 -0
  36. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +1 -0
  37. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +525 -0
  38. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +242 -0
  39. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +297 -0
  40. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
  41. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +345 -0
  42. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +1 -0
  43. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +122 -0
  44. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +462 -0
  45. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +508 -0
  46. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +922 -0
  47. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +2 -0
  48. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +273 -0
  49. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +687 -0
  50. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +1 -0
  51. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
  52. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
  53. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +1 -0
  54. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
  55. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +273 -0
  56. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
  57. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +2 -0
  58. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
  59. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
  60. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
  61. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +403 -0
  62. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +1 -0
  63. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
  64. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +1 -0
  65. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
  66. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
  67. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
  68. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +822 -0
  69. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +1 -0
  70. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +888 -0
  71. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +88 -0
  72. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +624 -0
  73. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +1 -0
  74. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +87 -0
  75. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
  76. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +1 -0
  77. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +78 -0
  78. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +847 -0
  79. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +2 -0
  80. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +167 -0
  81. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +228 -0
  82. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +220 -0
  83. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +279 -0
  84. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +244 -0
  85. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
  86. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +426 -0
  87. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +479 -0
  88. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +6818 -0
  89. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
  90. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
  91. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +1 -0
  92. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
  93. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
  94. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
  95. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
  96. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
  97. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
  98. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
  99. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
  100. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
  101. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
  102. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +17 -0
  103. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +205 -0
  104. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +78 -0
  105. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +97 -0
  106. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +95 -0
  107. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +112 -0
  108. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +372 -0
  109. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +3 -0
  110. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
  111. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +39 -0
  112. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +145 -0
  113. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +215 -0
  114. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +311 -0
  115. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +1669 -0
  116. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/cc.js +0 -0
  117. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
  118. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
  119. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +193 -0
  120. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +289 -0
  121. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/cu.js +0 -0
  122. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
  123. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +186 -0
  124. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
  125. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +439 -0
  126. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +361 -0
  127. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +258 -0
  128. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +197 -0
  129. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +498 -0
  130. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +908 -0
  131. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +475 -0
  132. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
  133. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +1 -0
  134. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +2623 -0
  135. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +1 -0
  136. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +21 -0
  137. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +262 -0
  138. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +697 -0
  139. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +34 -0
  140. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +63 -0
  141. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +183 -0
  142. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +33 -0
  143. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +736 -0
  144. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +68 -0
  145. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +295 -0
  146. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +327 -0
  147. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +698 -0
  148. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +68 -0
  149. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +364 -0
  150. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +356 -0
  151. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +33 -0
  152. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +776 -0
  153. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +113 -0
  154. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +340 -0
  155. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +312 -0
  156. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +343 -0
  157. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +331 -0
  158. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +242 -0
  159. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +348 -0
  160. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +737 -0
  161. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +143 -0
  162. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +373 -0
  163. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +366 -0
  164. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +370 -0
  165. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +386 -0
  166. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +376 -0
  167. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +293 -0
  168. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +382 -0
  169. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +37 -0
  170. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +1017 -0
  171. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +246 -0
  172. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +809 -0
  173. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +504 -0
  174. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +297 -0
  175. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +300 -0
  176. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +322 -0
  177. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +311 -0
  178. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +291 -0
  179. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +319 -0
  180. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +305 -0
  181. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +300 -0
  182. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +242 -0
  183. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +323 -0
  184. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +969 -0
  185. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +246 -0
  186. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +859 -0
  187. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +557 -0
  188. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +341 -0
  189. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +338 -0
  190. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +356 -0
  191. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +354 -0
  192. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +329 -0
  193. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +358 -0
  194. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +349 -0
  195. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +363 -0
  196. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +284 -0
  197. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +354 -0
  198. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +880 -0
  199. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
  200. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +194 -0
  201. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
  202. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +149 -0
  203. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +316 -0
  204. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +286 -0
  205. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +302 -0
  206. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +2 -0
  207. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +464 -0
  208. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +323 -0
  209. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +234 -0
  210. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +33 -0
  211. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +689 -0
  212. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +327 -0
  213. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
  214. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
  215. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
  216. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
  217. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
  218. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
  219. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
  220. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
  221. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +8 -0
  222. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +4 -0
  223. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +2 -0
  224. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
  225. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
  226. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +18 -0
  227. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +1475 -0
  228. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +218 -0
  229. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +1032 -0
  230. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +175 -0
  231. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +156 -0
  232. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +314 -0
  233. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +29 -0
  234. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +77 -0
  235. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +395 -0
  236. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +79 -0
  237. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +138 -0
  238. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +5 -0
  239. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +382 -0
  240. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +1 -0
  241. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +359 -0
  242. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +577 -0
  243. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +222 -0
  244. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +378 -0
  245. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +169 -0
  246. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +39 -0
  247. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +820 -0
  248. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +860 -0
  249. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +320 -0
  250. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +807 -0
  251. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +522 -0
  252. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +8 -0
  253. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +118 -0
  254. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +162 -0
  255. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +353 -0
  256. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +1 -0
  257. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +5302 -0
  258. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +132 -0
  259. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +200 -0
  260. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +272 -0
  261. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
  262. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +3 -0
  263. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +2165 -0
  264. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +978 -0
  265. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +1566 -0
  266. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
  267. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +163 -0
  268. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
  269. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +269 -0
  270. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +1 -0
  271. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
  272. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
  273. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
  274. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +146 -0
  275. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
  276. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +120 -0
  277. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
  278. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +96 -0
  279. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +259 -0
  280. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +1356 -0
  281. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +1 -0
  282. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
  283. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +183 -0
  284. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +239 -0
  285. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
  286. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +133 -0
  287. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +5 -0
  288. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +547 -0
  289. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +2481 -0
  290. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
  291. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +1 -0
  292. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +119 -0
  293. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +1 -0
  294. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +45 -0
  295. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +45 -0
  296. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +56 -0
  297. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +2 -0
  298. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +452 -0
  299. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +212 -0
  300. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +121 -0
  301. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +23 -0
  302. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +270 -0
  303. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +259 -0
  304. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +317 -0
  305. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +69 -0
  306. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +179 -0
  307. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +315 -0
  308. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +203 -0
  309. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +40 -0
  310. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +1300 -0
  311. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +18 -0
  312. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +49 -0
  313. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +217 -0
  314. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
  315. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +432 -0
  316. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +326 -0
  317. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +375 -0
  318. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +61 -0
  319. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +48 -0
  320. package/src/lib/gltf/gltf.css +392 -0
  321. package/src/lib/gltf/gltf.js +2241 -0
  322. package/webpack.config.js +70 -0
  323. package/app.js +0 -43
@@ -0,0 +1,1669 @@
1
+ import {Component} from '../Component.js';
2
+
3
+ import {CameraFlightAnimation} from './../camera/CameraFlightAnimation.js';
4
+ import {PanController} from "./lib/controllers/PanController.js";
5
+ import {PivotController} from "./lib/controllers/PivotController.js";
6
+ import {PickController} from "./lib/controllers/PickController.js";
7
+ import {MousePanRotateDollyHandler} from "./lib/handlers/MousePanRotateDollyHandler.js";
8
+ import {KeyboardAxisViewHandler} from "./lib/handlers/KeyboardAxisViewHandler.js";
9
+ import {MousePickHandler} from "./lib/handlers/MousePickHandler.js";
10
+ import {KeyboardPanRotateDollyHandler} from "./lib/handlers/KeyboardPanRotateDollyHandler.js";
11
+ import {CameraUpdater} from "./lib/CameraUpdater.js";
12
+ import {MouseMiscHandler} from "./lib/handlers/MouseMiscHandler.js";
13
+ import {TouchPanRotateAndDollyHandler} from "./lib/handlers/TouchPanRotateAndDollyHandler.js";
14
+ import {utils} from "../utils.js";
15
+ import {math} from "../math/math.js";
16
+ import {TouchPickHandler} from "./lib/handlers/TouchPickHandler.js";
17
+
18
+ /**
19
+ * @desc Controls the {@link Camera} with user input, and fires events when the user interacts with pickable {@link Entity}s.
20
+ *
21
+ * # Contents
22
+ *
23
+ * * [Overview](#overview)
24
+ * * [Examples](#examples)
25
+ * * [Orbit Mode](#orbit-mode)
26
+ * + [Following the Pointer in Orbit Mode](#--following-the-pointer-in-orbit-mode--)
27
+ * + [Showing the Pivot Position](#--showing-the-pivot-position--)
28
+ * + [Axis-Aligned Views in Orbit Mode](#--axis-aligned-views-in-orbit-mode--)
29
+ * + [View-Fitting Entitys in Orbit Mode](#--view-fitting-entitys-in-orbit-mode--)
30
+ * * [First-Person Mode](#first-person-mode)
31
+ * + [Following the Pointer in First-Person Mode](#--following-the-pointer-in-first-person-mode--)
32
+ * + [Constraining Vertical Position in First-Person Mode](#--constraining-vertical-position-in-first-person-mode--)
33
+ * + [Axis-Aligned Views in First-Person Mode](#--axis-aligned-views-in-first-person-mode--)
34
+ * + [View-Fitting Entitys in First-Person Mode](#--view-fitting-entitys-in-first-person-mode--)
35
+ * * [Plan-View Mode](#plan-view-mode)
36
+ * + [Following the Pointer in Plan-View Mode](#--following-the-pointer-in-plan-view-mode--)
37
+ * + [Axis-Aligned Views in Plan-View Mode](#--axis-aligned-views-in-plan-view-mode--)
38
+ * * [CameraControl Events](#cameracontrol-events)
39
+ * + ["hover"](#---hover---)
40
+ * + ["hoverOff"](#---hoveroff---)
41
+ * + ["hoverEnter"](#---hoverenter---)
42
+ * + ["hoverOut"](#---hoverout---)
43
+ * + ["picked"](#---picked---)
44
+ * + ["pickedSurface"](#---pickedsurface---)
45
+ * + ["pickedNothing"](#---pickednothing---)
46
+ * + ["doublePicked"](#---doublepicked---)
47
+ * + ["doublePickedSurface"](#---doublepickedsurface---)
48
+ * + ["doublePickedNothing"](#---doublepickednothing---)
49
+ * + ["rightClick"](#---rightclick---)
50
+ * * [Custom Keyboard Mappings](#custom-keyboard-mappings)
51
+ *
52
+ * <br><br>
53
+ *
54
+ * # Overview
55
+ *
56
+ * * Each {@link Viewer} has a ````CameraControl````, located at {@link Viewer#cameraControl}.
57
+ * * {@link CameraControl#navMode} selects the navigation mode:
58
+ * * ````"orbit"```` rotates the {@link Camera} position about the target.
59
+ * * ````"firstPerson"```` rotates the World about the Camera position.
60
+ * * ````"planView"```` never rotates, but still allows to pan and dolly, typically for an axis-aligned view.
61
+ * * {@link CameraControl#followPointer} makes the Camera follow the mouse or touch pointer.
62
+ * * {@link CameraControl#constrainVertical} locks the Camera to its current height when in first-person mode.
63
+ * * ````CameraControl```` fires pick events when we hover, click or tap on an {@link Entity}.
64
+ * <br><br>
65
+ *
66
+ * # Examples
67
+ *
68
+ * * [Orbit Navigation - Duplex Model](https://yjkkit.github.io/yjkkit-sdk/examples/#CameraControl_orbit_Duplex)
69
+ * * [Orbit Navigation - Holter Tower Model](https://yjkkit.github.io/yjkkit-sdk/examples/#CameraControl_orbit_HolterTower)
70
+ * * [First-Person Navigation - Duplex Model](https://yjkkit.github.io/yjkkit-sdk/examples/#CameraControl_firstPerson_Duplex)
71
+ * * [First-Person Navigation - Holter Tower Model](https://yjkkit.github.io/yjkkit-sdk/examples/#CameraControl_firstPerson_HolterTower)
72
+ * * [Plan-view Navigation - Schependomlaan Model](https://yjkkit.github.io/yjkkit-sdk/examples/#CameraControl_planView_Schependomlaan)
73
+ * * [Custom Keyboard Mapping](https://yjkkit.github.io/yjkkit-sdk/examples/#CameraControl_keyMap)
74
+ * <br><br>
75
+ *
76
+ * # Orbit Mode
77
+ *
78
+ * In orbit mode, ````CameraControl```` orbits the {@link Camera} about the target.
79
+ *
80
+ * To enable orbit mode:
81
+ *
82
+ * ````javascript
83
+ * const cameraControl = myViewer.cameraControl;
84
+ * cameraControl.navMode = "orbit";
85
+ * ````
86
+ *
87
+ * Then orbit by:
88
+ *
89
+ * * left-dragging the mouse,
90
+ * * tap-dragging the touch pad, and
91
+ * * pressing arrow keys, or ````Q```` and ````E```` on a QWERTY keyboard, or ````A```` and ````E```` on an AZERTY keyboard.
92
+ * <br><br>
93
+ *
94
+ * Dolly forwards and backwards by:
95
+ *
96
+ * * spinning the mouse wheel,
97
+ * * pinching on the touch pad, and
98
+ * * pressing the ````+```` and ````-```` keys, or ````W```` and ````S```` on a QWERTY keyboard, or ````Z```` and ````S```` for AZERTY.
99
+ * <br><br>
100
+ *
101
+ * Pan horizontally and vertically by:
102
+ *
103
+ * * right-dragging the mouse,
104
+ * * left-dragging the mouse with the SHIFT key down,
105
+ * * tap-dragging the touch pad with SHIFT down,
106
+ * * pressing the ````A````, ````D````, ````Z```` and ````X```` keys on a QWERTY keyboard, and
107
+ * * pressing the ````Q````, ````D````, ````W```` and ````X```` keys on an AZERTY keyboard,
108
+ * <br><br>
109
+ *
110
+ * ## Following the Pointer in Orbit Mode
111
+ *
112
+ * When {@link CameraControl#followPointer} is ````true````in orbiting mode, the mouse or touch pointer will dynamically
113
+ * indicate the target that the {@link Camera} will orbit, as well as dolly to and from.
114
+ *
115
+ * Lets ensure that we're in orbit mode, then enable the {@link Camera} to follow the pointer:
116
+ *
117
+ * ````javascript
118
+ * cameraControl.navMode = "orbit";
119
+ * cameraControl.followPointer = true;
120
+ * ````
121
+ *
122
+ * ## Smart Pivoting
123
+ *
124
+ * TODO
125
+ *
126
+ * ## Showing the Pivot Position
127
+ *
128
+ * We can configure {@link CameraControl#pivotElement} with an HTML element to indicate the current
129
+ * pivot position. The indicator will appear momentarily each time we move the {@link Camera} while in orbit mode with
130
+ * {@link CameraControl#followPointer} set ````true````.
131
+ *
132
+ * First we'll define some CSS to style our pivot indicator as a black dot with a white border:
133
+ *
134
+ * ````css
135
+ * .camera-pivot-marker {
136
+ * color: #ffffff;
137
+ * position: absolute;
138
+ * width: 25px;
139
+ * height: 25px;
140
+ * border-radius: 15px;
141
+ * border: 2px solid #ebebeb;
142
+ * background: black;
143
+ * visibility: hidden;
144
+ * box-shadow: 5px 5px 15px 1px #000000;
145
+ * z-index: 10000;
146
+ * pointer-events: none;
147
+ * }
148
+ * ````
149
+ *
150
+ * Then we'll attach our pivot indicator's HTML element to the ````CameraControl````:
151
+ *
152
+ * ````javascript
153
+ * const pivotElement = document.createRange().createContextualFragment("<div class='camera-pivot-marker'></div>").firstChild;
154
+ *
155
+ * document.body.appendChild(pivotElement);
156
+ *
157
+ * cameraControl.pivotElement = pivotElement;
158
+ * ````
159
+ *
160
+ * ## Axis-Aligned Views in Orbit Mode
161
+ *
162
+ * In orbit mode, we can use keys 1-6 to position the {@link Camera} to look at the center of the {@link Scene} from along each of the
163
+ * six World-space axis. Pressing one of these keys will fly the {@link Camera} to the corresponding axis-aligned view.
164
+ *
165
+ * ## View-Fitting Entitys in Orbit Mode
166
+ *
167
+ * When {@link CameraControl#doublePickFlyTo} is ````true````, we can left-double-click or
168
+ * double-tap (ie. "double-pick") an {@link Entity} to fit it to view. This will cause the {@link Camera}
169
+ * to fly to that Entity. Our target then becomes the center of that Entity. If we are currently pivoting,
170
+ * then our pivot position is then also set to the Entity center.
171
+ *
172
+ * Disable that behaviour by setting {@link CameraControl#doublePickFlyTo} ````false````.
173
+ *
174
+ * # First-Person Mode
175
+ *
176
+ * In first-person mode, ````CameraControl```` rotates the World about the {@link Camera} position.
177
+ *
178
+ * To enable first-person mode:
179
+ *
180
+ * ````javascript
181
+ * cameraControl.navMode = "firstPerson";
182
+ * ````
183
+ *
184
+ * Then rotate by:
185
+ *
186
+ * * left-dragging the mouse,
187
+ * * tap-dragging the touch pad,
188
+ * * pressing arrow keys, or ````Q```` and ````E```` on a QWERTY keyboard, or ````A```` and ````E```` on an AZERTY keyboard.
189
+ * <br><br>
190
+ *
191
+ * Dolly forwards and backwards by:
192
+ *
193
+ * * spinning the mouse wheel,
194
+ * * pinching on the touch pad, and
195
+ * * pressing the ````+```` and ````-```` keys, or ````W```` and ````S```` on a QWERTY keyboard, or ````Z```` and ````S```` for AZERTY.
196
+ * <br><br>
197
+ *
198
+ * Pan left, right, up and down by:
199
+ *
200
+ * * left-dragging or right-dragging the mouse, and
201
+ * * tap-dragging the touch pad with SHIFT down.
202
+ *
203
+ * Pan forwards, backwards, left, right, up and down by pressing the ````WSADZX```` keys on a QWERTY keyboard,
204
+ * or ````WSQDWX```` keys on an AZERTY keyboard.
205
+ * <br><br>
206
+ *
207
+ * ## Following the Pointer in First-Person Mode
208
+ *
209
+ * When {@link CameraControl#followPointer} is ````true```` in first-person mode, the mouse or touch pointer will dynamically
210
+ * indicate the target to which the {@link Camera} will dolly to and from. In first-person mode, however, the World will always rotate
211
+ * about the {@link Camera} position.
212
+ *
213
+ * Lets ensure that we're in first-person mode, then enable the {@link Camera} to follow the pointer:
214
+ *
215
+ * ````javascript
216
+ * cameraControl.navMode = "firstPerson";
217
+ * cameraControl.followPointer = true;
218
+ * ````
219
+ *
220
+ * When the pointer is over empty space, the target will remain the last object that the pointer was over.
221
+ *
222
+ * ## Constraining Vertical Position in First-Person Mode
223
+ *
224
+ * In first-person mode, we can lock the {@link Camera} to its current position on the vertical World axis, which is useful for walk-through navigation:
225
+ *
226
+ * ````javascript
227
+ * cameraControl.constrainVertical = true;
228
+ * ````
229
+ *
230
+ * ## Axis-Aligned Views in First-Person Mode
231
+ *
232
+ * In first-person mode we can use keys 1-6 to position the {@link Camera} to look at the center of
233
+ * the {@link Scene} from along each of the six World-space axis. Pressing one of these keys will fly the {@link Camera} to the
234
+ * corresponding axis-aligned view.
235
+ *
236
+ * ## View-Fitting Entitys in First-Person Mode
237
+ *
238
+ * As in orbit mode, when in first-person mode and {@link CameraControl#doublePickFlyTo} is ````true````, we can double-click
239
+ * or double-tap an {@link Entity} (ie. "double-picking") to fit it in view. This will cause the {@link Camera} to fly to
240
+ * that Entity. Our target then becomes the center of that Entity.
241
+ *
242
+ * Disable that behaviour by setting {@link CameraControl#doublePickFlyTo} ````false````.
243
+ *
244
+ * # Plan-View Mode
245
+ *
246
+ * In plan-view mode, ````CameraControl```` pans and rotates the {@link Camera}, without rotating it.
247
+ *
248
+ * To enable plan-view mode:
249
+ *
250
+ * ````javascript
251
+ * cameraControl.navMode = "planView";
252
+ * ````
253
+ *
254
+ * Dolly forwards and backwards by:
255
+ *
256
+ * * spinning the mouse wheel,
257
+ * * pinching on the touch pad, and
258
+ * * pressing the ````+```` and ````-```` keys.
259
+ *
260
+ * <br>
261
+ * Pan left, right, up and down by:
262
+ *
263
+ * * left-dragging or right-dragging the mouse, and
264
+ * * tap-dragging the touch pad with SHIFT down.
265
+ *
266
+ * Pan forwards, backwards, left, right, up and down by pressing the ````WSADZX```` keys on a QWERTY keyboard,
267
+ * or ````WSQDWX```` keys on an AZERTY keyboard.
268
+ * <br><br>
269
+ *
270
+ * ## Following the Pointer in Plan-View Mode
271
+ *
272
+ * When {@link CameraControl#followPointer} is ````true```` in plan-view mode, the mouse or touch pointer will dynamically
273
+ * indicate the target to which the {@link Camera} will dolly to and from. In plan-view mode, however, the {@link Camera} cannot rotate.
274
+ *
275
+ * Lets ensure that we're in plan-view mode, then enable the {@link Camera} to follow the pointer:
276
+ *
277
+ * ````javascript
278
+ * cameraControl.navMode = "planView";
279
+ * cameraControl.followPointer = true; // Default
280
+ * ````
281
+ *
282
+ * When the pointer is over empty space, the target will remain the last object that the pointer was over.
283
+ *
284
+ * ## Axis-Aligned Views in Plan-View Mode
285
+ *
286
+ * As in orbit and first-person modes, in plan-view mode we can use keys 1-6 to position the {@link Camera} to look at the center of
287
+ * the {@link Scene} from along each of the six World-space axis. Pressing one of these keys will fly the {@link Camera} to the
288
+ * corresponding axis-aligned view.
289
+ *
290
+ * # CameraControl Events
291
+ *
292
+ * ````CameraControl```` fires events as we interact with {@link Entity}s using mouse or touch input.
293
+ *
294
+ * The following examples demonstrate how to subscribe to those events.
295
+ *
296
+ * The first example shows how to save a handle to a subscription, which we can later use to unsubscribe.
297
+ *
298
+ * ## "hover"
299
+ *
300
+ * Event fired when the pointer moves while hovering over an Entity.
301
+ *
302
+ * ````javascript
303
+ * const onHover = cameraControl.on("hover", (e) => {
304
+ * const entity = e.entity; // Entity
305
+ * const canvasPos = e.canvasPos; // 2D canvas position
306
+ * });
307
+ * ````
308
+ *
309
+ * To unsubscribe from the event:
310
+ *
311
+ * ````javascript
312
+ * cameraControl.off(onHover);
313
+ * ````
314
+ *
315
+ * ## "hoverOff"
316
+ *
317
+ * Event fired when the pointer moves while hovering over empty space.
318
+ *
319
+ * ````javascript
320
+ * cameraControl.on("hoverOff", (e) => {
321
+ * const canvasPos = e.canvasPos;
322
+ * });
323
+ * ````
324
+ *
325
+ * ## "hoverEnter"
326
+ *
327
+ * Event fired when the pointer moves onto an Entity.
328
+ *
329
+ * ````javascript
330
+ * cameraControl.on("hoverEnter", (e) => {
331
+ * const entity = e.entity;
332
+ * const canvasPos = e.canvasPos;
333
+ * });
334
+ * ````
335
+ *
336
+ * ## "hoverOut"
337
+ *
338
+ * Event fired when the pointer moves off an Entity.
339
+ *
340
+ * ````javascript
341
+ * cameraControl.on("hoverOut", (e) => {
342
+ * const entity = e.entity;
343
+ * const canvasPos = e.canvasPos;
344
+ * });
345
+ * ````
346
+ *
347
+ * ## "picked"
348
+ *
349
+ * Event fired when we left-click or tap on an Entity.
350
+ *
351
+ * ````javascript
352
+ * cameraControl.on("picked", (e) => {
353
+ * const entity = e.entity;
354
+ * const canvasPos = e.canvasPos;
355
+ * });
356
+ * ````
357
+ *
358
+ * ## "pickedSurface"
359
+ *
360
+ * Event fired when we left-click or tap on the surface of an Entity.
361
+ *
362
+ * ````javascript
363
+ * cameraControl.on("picked", (e) => {
364
+ * const entity = e.entity;
365
+ * const canvasPos = e.canvasPos;
366
+ * const worldPos = e.worldPos; // 3D World-space position
367
+ * const viewPos = e.viewPos; // 3D View-space position
368
+ * const worldNormal = e.worldNormal; // 3D World-space normal vector
369
+ * });
370
+ * ````
371
+ *
372
+ * ## "pickedNothing"
373
+ *
374
+ * Event fired when we left-click or tap on empty space.
375
+ *
376
+ * ````javascript
377
+ * cameraControl.on("pickedNothing", (e) => {
378
+ * const canvasPos = e.canvasPos;
379
+ * });
380
+ * ````
381
+ *
382
+ * ## "doublePicked"
383
+ *
384
+ * Event fired wwhen we left-double-click or double-tap on an Entity.
385
+ *
386
+ * ````javascript
387
+ * cameraControl.on("doublePicked", (e) => {
388
+ * const entity = e.entity;
389
+ * const canvasPos = e.canvasPos;
390
+ * });
391
+ * ````
392
+ *
393
+ * ## "doublePickedSurface"
394
+ *
395
+ * Event fired when we left-double-click or double-tap on the surface of an Entity.
396
+ *
397
+ * ````javascript
398
+ * cameraControl.on("doublePickedSurface", (e) => {
399
+ * const entity = e.entity;
400
+ * const canvasPos = e.canvasPos;
401
+ * const worldPos = e.worldPos;
402
+ * const viewPos = e.viewPos;
403
+ * const worldNormal = e.worldNormal;
404
+ * });
405
+ * ````
406
+ *
407
+ * ## "doublePickedNothing"
408
+ *
409
+ * Event fired when we left-double-click or double-tap on empty space.
410
+ *
411
+ * ````javascript
412
+ * cameraControl.on("doublePickedNothing", (e) => {
413
+ * const canvasPos = e.canvasPos;
414
+ * });
415
+ * ````
416
+ *
417
+ * ## "rightClick"
418
+ *
419
+ * Event fired when we right-click on the canvas.
420
+ *
421
+ * ````javascript
422
+ * cameraControl.on("rightClick", (e) => {
423
+ * const event = e.event; // Mouse event
424
+ * const canvasPos = e.canvasPos;
425
+ * });
426
+ * ````
427
+ *
428
+ * ## Custom Keyboard Mappings
429
+ *
430
+ * We can customize````CameraControl```` key bindings as shown below.
431
+ *
432
+ * In this example, we'll just set the default bindings for a QWERTY keyboard.
433
+ *
434
+ * ````javascript
435
+ * const input = myViewer.scene.input;
436
+ *
437
+ * cameraControl.navMode = "orbit";
438
+ * cameraControl.followPointer = true;
439
+ *
440
+ * const keyMap = {};
441
+ *
442
+ * keyMap[cameraControl.PAN_LEFT] = [input.KEY_A];
443
+ * keyMap[cameraControl.PAN_RIGHT] = [input.KEY_D];
444
+ * keyMap[cameraControl.PAN_UP] = [input.KEY_Z];
445
+ * keyMap[cameraControl.PAN_DOWN] = [input.KEY_X];
446
+ * keyMap[cameraControl.DOLLY_FORWARDS] = [input.KEY_W, input.KEY_ADD];
447
+ * keyMap[cameraControl.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];
448
+ * keyMap[cameraControl.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
449
+ * keyMap[cameraControl.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
450
+ * keyMap[cameraControl.ROTATE_Y_POS] = [input.KEY_LEFT_ARROW];
451
+ * keyMap[cameraControl.ROTATE_Y_NEG] = [input.KEY_RIGHT_ARROW];
452
+ * keyMap[cameraControl.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];
453
+ * keyMap[cameraControl.AXIS_VIEW_BACK] = [input.KEY_NUM_2];
454
+ * keyMap[cameraControl.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];
455
+ * keyMap[cameraControl.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
456
+ * keyMap[cameraControl.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
457
+ * keyMap[cameraControl.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
458
+ *
459
+ * cameraControl.keyMap = keyMap;
460
+ * ````
461
+ *
462
+ * We can also just configure default bindings for a specified keyboard layout, like this:
463
+ *
464
+ * ````javascript
465
+ * cameraControl.keyMap = "qwerty";
466
+ * ````
467
+ *
468
+ * Then, ````CameraControl```` will internally set {@link CameraControl#keyMap} to the default key map for the QWERTY
469
+ * layout (which is the same set of mappings we set in the previous example). In other words, if we subsequently
470
+ * read {@link CameraControl#keyMap}, it will now be a key map, instead of the "qwerty" string value we set it to.
471
+ *
472
+ * Supported layouts are, so far:
473
+ *
474
+ * * ````"qwerty"````
475
+ * * ````"azerty"````
476
+ */
477
+ class CameraControl extends Component {
478
+
479
+ /**
480
+ * @private
481
+ * @constructor
482
+ */
483
+ constructor(owner, cfg = {}) {
484
+
485
+ super(owner, cfg);
486
+
487
+ /**
488
+ * Identifies the XX action.
489
+ * @final
490
+ * @type {Number}
491
+ */
492
+ this.PAN_LEFT = 0;
493
+
494
+ /**
495
+ * Identifies the XX action.
496
+ * @final
497
+ * @type {Number}
498
+ */
499
+ this.PAN_RIGHT = 1;
500
+
501
+ /**
502
+ * Identifies the XX action.
503
+ * @final
504
+ * @type {Number}
505
+ */
506
+ this.PAN_UP = 2;
507
+
508
+ /**
509
+ * Identifies the XX action.
510
+ * @final
511
+ * @type {Number}
512
+ */
513
+ this.PAN_DOWN = 3;
514
+
515
+ /**
516
+ * Identifies the XX action.
517
+ * @final
518
+ * @type {Number}
519
+ */
520
+ this.PAN_FORWARDS = 4;
521
+
522
+ /**
523
+ * Identifies the XX action.
524
+ * @final
525
+ * @type {Number}
526
+ */
527
+ this.PAN_BACKWARDS = 5;
528
+
529
+ /**
530
+ * Identifies the XX action.
531
+ * @final
532
+ * @type {Number}
533
+ */
534
+ this.ROTATE_X_POS = 6;
535
+
536
+ /**
537
+ * Identifies the XX action.
538
+ * @final
539
+ * @type {Number}
540
+ */
541
+ this.ROTATE_X_NEG = 7;
542
+
543
+ /**
544
+ * Identifies the XX action.
545
+ * @final
546
+ * @type {Number}
547
+ */
548
+ this.ROTATE_Y_POS = 8;
549
+
550
+ /**
551
+ * Identifies the XX action.
552
+ * @final
553
+ * @type {Number}
554
+ */
555
+ this.ROTATE_Y_NEG = 9;
556
+
557
+ /**
558
+ * Identifies the XX action.
559
+ * @final
560
+ * @type {Number}
561
+ */
562
+ this.DOLLY_FORWARDS = 10;
563
+
564
+ /**
565
+ * Identifies the XX action.
566
+ * @final
567
+ * @type {Number}
568
+ */
569
+ this.DOLLY_BACKWARDS = 11;
570
+
571
+ /**
572
+ * Identifies the XX action.
573
+ * @final
574
+ * @type {Number}
575
+ */
576
+ this.AXIS_VIEW_RIGHT = 12;
577
+
578
+ /**
579
+ * Identifies the XX action.
580
+ * @final
581
+ * @type {Number}
582
+ */
583
+ this.AXIS_VIEW_BACK = 13;
584
+
585
+ /**
586
+ * Identifies the XX action.
587
+ * @final
588
+ * @type {Number}
589
+ */
590
+ this.AXIS_VIEW_LEFT = 14;
591
+
592
+ /**
593
+ * Identifies the XX action.
594
+ * @final
595
+ * @type {Number}
596
+ */
597
+ this.AXIS_VIEW_FRONT = 15;
598
+
599
+ /**
600
+ * Identifies the XX action.
601
+ * @final
602
+ * @type {Number}
603
+ */
604
+ this.AXIS_VIEW_TOP = 16;
605
+
606
+ /**
607
+ * Identifies the XX action.
608
+ * @final
609
+ * @type {Number}
610
+ */
611
+ this.AXIS_VIEW_BOTTOM = 17;
612
+
613
+ this._keyMap = {}; // Maps key codes to the above actions
614
+
615
+ this.scene.canvas.canvas.oncontextmenu = (e) => {
616
+ e.preventDefault();
617
+ };
618
+
619
+ // User-settable CameraControl configurations
620
+
621
+ this._configs = {
622
+
623
+ // Private
624
+
625
+ tapInterval: 150, // Millisecs
626
+ doubleTapInterval: 325, // Millisecs
627
+ tapDistanceThreshold: 4, // Pixels
628
+
629
+ // General
630
+
631
+ active: true,
632
+ keyboardLayout: "qwerty",
633
+ navMode: "orbit",
634
+ planView: false,
635
+ firstPerson: false,
636
+ followPointer: true,
637
+ doublePickFlyTo: true,
638
+ panRightClick: true,
639
+ showPivot: false,
640
+ pointerEnabled: true,
641
+ constrainVertical: false,
642
+ smartPivot: false,
643
+
644
+ // Rotation
645
+
646
+ dragRotationRate: 360.0,
647
+ keyboardRotationRate: 90.0,
648
+ rotationInertia: 0.0,
649
+
650
+ // Panning
651
+
652
+ keyboardPanRate: 1.0,
653
+ touchPanRate: 1.0,
654
+ panInertia: 0.5,
655
+
656
+ // Dollying
657
+
658
+ keyboardDollyRate: 10,
659
+ mouseWheelDollyRate: 100,
660
+ touchDollyRate: 0.2,
661
+ dollyInertia: 0,
662
+ dollyProximityThreshold: 30.0,
663
+ dollyMinSpeed: 0.04,
664
+ yjkLeft: 1
665
+ };
666
+
667
+ // Current runtime state of the CameraControl
668
+
669
+ this._states = {
670
+ pointerCanvasPos: math.vec2(),
671
+ mouseover: false,
672
+ followPointerDirty: true,
673
+ mouseDownClientX: 0,
674
+ mouseDownClientY: 0,
675
+ mouseDownCursorX: 0,
676
+ mouseDownCursorY: 0,
677
+ touchStartTime: null,
678
+ activeTouches: [],
679
+ tapStartPos: math.vec2(),
680
+ tapStartTime: -1,
681
+ lastTapTime: -1
682
+ };
683
+
684
+ // Updates for CameraUpdater to process on next Scene "tick" event
685
+
686
+ this._updates = {
687
+ rotateDeltaX: 0,
688
+ rotateDeltaY: 0,
689
+ panDeltaX: 0,
690
+ panDeltaY: 0,
691
+ panDeltaZ: 0,
692
+ dollyDelta: 0
693
+ };
694
+
695
+ // Controllers to assist input event handlers with controlling the Camera
696
+
697
+ const scene = this.scene;
698
+
699
+ this._controllers = {
700
+ cameraControl: this,
701
+ pickController: new PickController(this, this._configs),
702
+ pivotController: new PivotController(scene, this._configs),
703
+ panController: new PanController(scene),
704
+ cameraFlight: new CameraFlightAnimation(this, {
705
+ duration: 0.5
706
+ })
707
+ };
708
+
709
+ // Input event handlers
710
+
711
+ this._handlers = [
712
+ new MouseMiscHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
713
+ new TouchPanRotateAndDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
714
+ new MousePanRotateDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
715
+ new KeyboardAxisViewHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
716
+ new MousePickHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
717
+ new TouchPickHandler(this.scene, this._controllers, this._configs, this._states, this._updates),
718
+ new KeyboardPanRotateDollyHandler(this.scene, this._controllers, this._configs, this._states, this._updates)
719
+ ];
720
+
721
+ // Applies scheduled updates to the Camera on each Scene "tick" event
722
+
723
+ this._cameraUpdater = new CameraUpdater(this.scene, this._controllers, this._configs, this._states, this._updates);
724
+
725
+ // Set initial user configurations
726
+
727
+ this.navMode = cfg.navMode;
728
+ if (cfg.planView) {
729
+ this.planView = cfg.planView;
730
+ }
731
+ this.constrainVertical = cfg.constrainVertical;
732
+ if (cfg.keyboardLayout) {
733
+ this.keyboardLayout = cfg.keyboardLayout; // Deprecated
734
+ } else {
735
+ this.keyMap = cfg.keyMap;
736
+ }
737
+ this.doublePickFlyTo = cfg.doublePickFlyTo;
738
+ this.panRightClick = cfg.panRightClick;
739
+ this.active = cfg.active;
740
+ this.followPointer = cfg.followPointer;
741
+ this.rotationInertia = cfg.rotationInertia;
742
+ this.keyboardPanRate = cfg.keyboardPanRate;
743
+ this.touchPanRate = cfg.touchPanRate;
744
+ this.keyboardRotationRate = cfg.keyboardRotationRate;
745
+ this.dragRotationRate = cfg.dragRotationRate;
746
+ this.touchDollyRate = cfg.touchDollyRate;
747
+ this.dollyInertia = cfg.dollyInertia;
748
+ this.dollyProximityThreshold = cfg.dollyProximityThreshold;
749
+ this.dollyMinSpeed = cfg.dollyMinSpeed;
750
+ this.panInertia = cfg.panInertia;
751
+ this.pointerEnabled = true;
752
+ this.keyboardDollyRate = cfg.keyboardDollyRate;
753
+ this.mouseWheelDollyRate = cfg.mouseWheelDollyRate;
754
+ }
755
+
756
+ /**
757
+ * Sets custom mappings of keys to ````CameraControl```` actions.
758
+ *
759
+ * See class docs for usage.
760
+ *
761
+ * @param {{Number:Number}|String} value Either a set of new key mappings, or a string to select a keyboard layout,
762
+ * which causes ````CameraControl```` to use the default key mappings for that layout.
763
+ */
764
+ set keyMap(value) {
765
+ value = value || "qwerty";
766
+ if (utils.isString(value)) {
767
+ const input = this.scene.input;
768
+ const keyMap = {};
769
+
770
+ switch (value) {
771
+
772
+ default:
773
+ this.error("Unsupported value for 'keyMap': " + value + " defaulting to 'qwerty'");
774
+ // Intentional fall-through to "qwerty"
775
+ case "qwerty":
776
+ keyMap[this.PAN_LEFT] = [input.KEY_A];
777
+ keyMap[this.PAN_RIGHT] = [input.KEY_D];
778
+ keyMap[this.PAN_UP] = [input.KEY_Z];
779
+ keyMap[this.PAN_DOWN] = [input.KEY_X];
780
+ keyMap[this.PAN_BACKWARDS] = [];
781
+ keyMap[this.PAN_FORWARDS] = [];
782
+ keyMap[this.DOLLY_FORWARDS] = [input.KEY_W, input.KEY_ADD];
783
+ keyMap[this.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];
784
+ keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
785
+ keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
786
+ keyMap[this.ROTATE_Y_POS] = [input.KEY_Q, input.KEY_LEFT_ARROW];
787
+ keyMap[this.ROTATE_Y_NEG] = [input.KEY_E, input.KEY_RIGHT_ARROW];
788
+ keyMap[this.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];
789
+ keyMap[this.AXIS_VIEW_BACK] = [input.KEY_NUM_2];
790
+ keyMap[this.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];
791
+ keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
792
+ keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
793
+ keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
794
+ // keyMap[this.PAN_LEFT] = [input.KEY_D];
795
+ // keyMap[this.PAN_RIGHT] = [input.KEY_A];
796
+ // keyMap[this.PAN_UP] = [input.KEY_W];
797
+ // keyMap[this.PAN_DOWN] = [input.KEY_S];
798
+ // keyMap[this.PAN_BACKWARDS] = [];
799
+ // keyMap[this.PAN_FORWARDS] = [];
800
+ // keyMap[this.DOLLY_FORWARDS] = [input.KEY_Z, input.KEY_ADD];
801
+ // keyMap[this.DOLLY_BACKWARDS] = [input.KEY_X, input.KEY_SUBTRACT];
802
+ // keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
803
+ // keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
804
+ // keyMap[this.ROTATE_Y_POS] = [input.KEY_E, input.KEY_LEFT_ARROW];
805
+ // keyMap[this.ROTATE_Y_NEG] = [input.KEY_Q, input.KEY_RIGHT_ARROW];
806
+ // keyMap[this.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];
807
+ // keyMap[this.AXIS_VIEW_BACK] = [input.KEY_NUM_2];
808
+ // keyMap[this.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];
809
+ // keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
810
+ // keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
811
+ // keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
812
+ break;
813
+
814
+ case "azerty":
815
+ keyMap[this.PAN_LEFT] = [input.KEY_Q];
816
+ keyMap[this.PAN_RIGHT] = [input.KEY_D];
817
+ keyMap[this.PAN_UP] = [input.KEY_W];
818
+ keyMap[this.PAN_DOWN] = [input.KEY_X];
819
+ keyMap[this.PAN_BACKWARDS] = [];
820
+ keyMap[this.PAN_FORWARDS] = [];
821
+ keyMap[this.DOLLY_FORWARDS] = [input.KEY_Z, input.KEY_ADD];
822
+ keyMap[this.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];
823
+ keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
824
+ keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
825
+ keyMap[this.ROTATE_Y_POS] = [input.KEY_A, input.KEY_LEFT_ARROW];
826
+ keyMap[this.ROTATE_Y_NEG] = [input.KEY_E, input.KEY_RIGHT_ARROW];
827
+ keyMap[this.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];
828
+ keyMap[this.AXIS_VIEW_BACK] = [input.KEY_NUM_2];
829
+ keyMap[this.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];
830
+ keyMap[this.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
831
+ keyMap[this.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
832
+ keyMap[this.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
833
+ break;
834
+ }
835
+
836
+ this._keyMap = keyMap;
837
+ } else {
838
+ const keyMap = value;
839
+ this._keyMap = keyMap;
840
+ }
841
+ }
842
+
843
+ /**
844
+ * Gets custom mappings of keys to {@link CameraControl} actions.
845
+ *
846
+ * @returns {{Number:Number}} Current key mappings.
847
+ */
848
+ get keyMap() {
849
+ return this._keyMap;
850
+ }
851
+
852
+ /**
853
+ * Returns true if any keys configured for the given action are down.
854
+ * @param action
855
+ * @param keyDownMap
856
+ * @private
857
+ */
858
+ _isKeyDownForAction(action, keyDownMap) {
859
+ const keys = this._keyMap[action];
860
+ if (!keys) {
861
+ return false;
862
+ }
863
+ if (!keyDownMap) {
864
+ keyDownMap = this.scene.input.keyDown;
865
+ }
866
+ for (let i = 0, len = keys.length; i < len; i++) {
867
+ const key = keys[i];
868
+ if (keyDownMap[key]) {
869
+ return true;
870
+ }
871
+ }
872
+ return false;
873
+ }
874
+
875
+ /**
876
+ * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
877
+ *
878
+ * See class comments for an example.
879
+ *
880
+ * @param {HTMLElement} element HTML element representing the pivot point.
881
+ */
882
+ set pivotElement(element) {
883
+ this._controllers.pivotController.setPivotElement(element);
884
+ }
885
+
886
+ /**
887
+ * Sets if this ````CameraControl```` is active or not.
888
+ *
889
+ * When inactive, the ````CameraControl```` will not react to input.
890
+ *
891
+ * Default is ````true````.
892
+ *
893
+ * @param {Boolean} value Set ````true```` to activate this ````CameraControl````.
894
+ */
895
+ set active(value) {
896
+ this._configs.active = value !== false;
897
+ }
898
+
899
+ /**
900
+ * Gets if this ````CameraControl```` is active or not.
901
+ *
902
+ * When inactive, the ````CameraControl```` will not react to input.
903
+ *
904
+ * Default is ````true````.
905
+ *
906
+ * @returns {Boolean} Returns ````true```` if this ````CameraControl```` is active.
907
+ */
908
+ get active() {
909
+ return this._configs.active;
910
+ }
911
+
912
+ /**
913
+ * Sets the current navigation mode.
914
+ *
915
+ * Accepted values are:
916
+ *
917
+ * * "orbit" - rotation orbits about the current target or pivot point,
918
+ * * "firstPerson" - rotation is about the current eye position,
919
+ * * "planView" - rotation is disabled.
920
+ *
921
+ * See class comments for more info.
922
+ *
923
+ * @param {String} navMode The navigation mode: "orbit", "firstPerson" or "planView".
924
+ */
925
+ set navMode(navMode) {
926
+ navMode = navMode || "orbit";
927
+ if (navMode !== "firstPerson" && navMode !== "orbit" && navMode !== "planView") {
928
+ this.error("Unsupported value for navMode: " + navMode + " - supported values are 'orbit', 'firstPerson' and 'planView' - defaulting to 'orbit'");
929
+ navMode = "orbit";
930
+ }
931
+ this._configs.firstPerson = (navMode === "firstPerson");
932
+ this._configs.planView = (navMode === "planView");
933
+ if (this._configs.firstPerson || this._configs.planView) {
934
+ this._controllers.pivotController.hidePivot();
935
+ this._controllers.pivotController.endPivot();
936
+ }
937
+ this._configs.navMode = navMode;
938
+ }
939
+
940
+ /**
941
+ * Gets the current navigation mode.
942
+ *
943
+ * @returns {String} The navigation mode: "orbit", "firstPerson" or "planView".
944
+ */
945
+ get navMode() {
946
+ return this._configs.navMode;
947
+ }
948
+ set yjkLeft(yjkLeft) {
949
+ this._configs.yjkLeft = (yjkLeft !== null && yjkLeft !== undefined) ? yjkLeft : 1;
950
+ }
951
+
952
+ /**
953
+ * Gets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
954
+ *
955
+ * Default is ````15.0````.
956
+ *
957
+ * @returns {Number} The current mouseWheel dolly rate.
958
+ */
959
+ get yjkLeft() {
960
+ return this._configs.yjkLeft;
961
+ }
962
+ /**
963
+ * Sets whether mouse and touch input is enabled.
964
+ *
965
+ * Default is ````true````.
966
+ *
967
+ * Disabling mouse and touch input on ````CameraControl```` is useful when we want to temporarily use mouse or
968
+ * touch input to interact with some other 3D control, without disturbing the {@link Camera}.
969
+ *
970
+ * @param {Boolean} value Set ````true```` to enable mouse and touch input.
971
+ */
972
+ set pointerEnabled(value) {
973
+ this._reset();
974
+ this._configs.pointerEnabled = !!value;
975
+ }
976
+
977
+ _reset() {
978
+ for (let i = 0, len = this._handlers.length; i < len; i++) {
979
+ const handler = this._handlers[i];
980
+ if (handler.reset) {
981
+ handler.reset();
982
+ }
983
+ }
984
+
985
+ this._updates.panDeltaX = 0;
986
+ this._updates.panDeltaY = 0;
987
+ this._updates.rotateDeltaX = 0;
988
+ this._updates.rotateDeltaY = 0;
989
+ this._updates.dolyDelta = 0;
990
+ }
991
+
992
+ /**
993
+ * Gets whether mouse and touch input is enabled.
994
+ *
995
+ * Default is ````true````.
996
+ *
997
+ * Disabling mouse and touch input on ````CameraControl```` is desirable when we want to temporarily use mouse or
998
+ * touch input to interact with some other 3D control, without interfering with the {@link Camera}.
999
+ *
1000
+ * @returns {Boolean} Returns ````true```` if mouse and touch input is enabled.
1001
+ */
1002
+ get pointerEnabled() {
1003
+ return this._configs.pointerEnabled;
1004
+ }
1005
+
1006
+ /**
1007
+ * Sets whether the {@link Camera} follows the mouse/touch pointer.
1008
+ *
1009
+ * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
1010
+ *
1011
+ * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
1012
+ *
1013
+ * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
1014
+ *
1015
+ * Default is ````true````.
1016
+ *
1017
+ * See class comments for more info.
1018
+ *
1019
+ * @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
1020
+ */
1021
+ set followPointer(value) {
1022
+ this._configs.followPointer = (value !== false);
1023
+ }
1024
+
1025
+ /**
1026
+ * Sets whether the {@link Camera} follows the mouse/touch pointer.
1027
+ *
1028
+ * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
1029
+ *
1030
+ * In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
1031
+ *
1032
+ * In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
1033
+ *
1034
+ * Default is ````true````.
1035
+ *
1036
+ * See class comments for more info.
1037
+ *
1038
+ * @returns {Boolean} Returns ````true```` if the Camera follows the pointer.
1039
+ */
1040
+ get followPointer() {
1041
+ return this._configs.followPointer;
1042
+ }
1043
+
1044
+ /**
1045
+ * Sets the current World-space 3D target position.
1046
+ *
1047
+ * Only applies when {@link CameraControl#followPointer} is ````true````.
1048
+ *
1049
+ * @param {Number[]} worldPos The new World-space 3D target position.
1050
+ */
1051
+ set pivotPos(worldPos) {
1052
+ this._controllers.pivotController.setPivotPos(worldPos);
1053
+ }
1054
+
1055
+ /**
1056
+ * Gets the current World-space 3D pivot position.
1057
+ *
1058
+ * Only applies when {@link CameraControl#followPointer} is ````true````.
1059
+ *
1060
+ * @return {Number[]} worldPos The current World-space 3D pivot position.
1061
+ */
1062
+ get pivotPos() {
1063
+ return this._controllers.pivotController.getPivotPos();
1064
+ }
1065
+
1066
+ /**
1067
+ * @deprecated
1068
+ * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
1069
+ */
1070
+ set dollyToPointer(value) {
1071
+ this.warn("dollyToPointer property is deprecated - replaced with followPointer");
1072
+ this.followPointer = value;
1073
+ }
1074
+
1075
+ /**
1076
+ * @deprecated
1077
+ * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
1078
+ */
1079
+ get dollyToPointer() {
1080
+ this.warn("dollyToPointer property is deprecated - replaced with followPointer");
1081
+ return this.followPointer;
1082
+ }
1083
+
1084
+ /**
1085
+ * @deprecated
1086
+ * @param {Boolean} value Set ````true```` to enable dolly-to-pointer behaviour.
1087
+ */
1088
+ set panToPointer(value) {
1089
+ this.warn("panToPointer property is deprecated - replaced with followPointer");
1090
+ }
1091
+
1092
+ /**
1093
+ * @deprecated
1094
+ * @returns {Boolean} Returns ````true```` if dolly-to-pointer behaviour is enabled.
1095
+ */
1096
+ get panToPointer() {
1097
+ this.warn("panToPointer property is deprecated - replaced with followPointer");
1098
+ return false;
1099
+ }
1100
+
1101
+ /**
1102
+ * Sets whether this ````CameraControl```` is in plan-view mode.
1103
+ *
1104
+ * When in plan-view mode, rotation is disabled.
1105
+ *
1106
+ * Default is ````false````.
1107
+ *
1108
+ * Deprecated - use {@link CameraControl#navMode} instead.
1109
+ *
1110
+ * @param {Boolean} value Set ````true```` to enable plan-view mode.
1111
+ * @deprecated
1112
+ */
1113
+ set planView(value) {
1114
+ this._configs.planView = !!value;
1115
+ this._configs.firstPerson = false;
1116
+ if (this._configs.planView) {
1117
+ this._controllers.pivotController.hidePivot();
1118
+ this._controllers.pivotController.endPivot();
1119
+ }
1120
+ this.warn("planView property is deprecated - replaced with navMode");
1121
+ }
1122
+
1123
+ /**
1124
+ * Gets whether this ````CameraControl```` is in plan-view mode.
1125
+ *
1126
+ * When in plan-view mode, rotation is disabled.
1127
+ *
1128
+ * Default is ````false````.
1129
+ *
1130
+ * Deprecated - use {@link CameraControl#navMode} instead.
1131
+ *
1132
+ * @returns {Boolean} Returns ````true```` if plan-view mode is enabled.
1133
+ * @deprecated
1134
+ */
1135
+ get planView() {
1136
+ this.warn("planView property is deprecated - replaced with navMode");
1137
+ return this._configs.planView;
1138
+ }
1139
+
1140
+ /**
1141
+ * Sets whether this ````CameraControl```` is in first-person mode.
1142
+ *
1143
+ * In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
1144
+ *
1145
+ * Default is ````false````.
1146
+ *
1147
+ * Deprecated - use {@link CameraControl#navMode} instead.
1148
+ *
1149
+ * @param {Boolean} value Set ````true```` to enable first-person mode.
1150
+ * @deprecated
1151
+ */
1152
+ set firstPerson(value) {
1153
+ this.warn("firstPerson property is deprecated - replaced with navMode");
1154
+ this._configs.firstPerson = !!value;
1155
+ this._configs.planView = false;
1156
+ if (this._configs.firstPerson) {
1157
+ this._controllers.pivotController.hidePivot();
1158
+ this._controllers.pivotController.endPivot();
1159
+ }
1160
+ }
1161
+
1162
+ /**
1163
+ * Gets whether this ````CameraControl```` is in first-person mode.
1164
+ *
1165
+ * In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, {@link Camera#eye} rotates about {@link Camera#look}.
1166
+ *
1167
+ * Default is ````false````.
1168
+ *
1169
+ * Deprecated - use {@link CameraControl#navMode} instead.
1170
+ *
1171
+ * @returns {Boolean} Returns ````true```` if first-person mode is enabled.
1172
+ * @deprecated
1173
+ */
1174
+ get firstPerson() {
1175
+ this.warn("firstPerson property is deprecated - replaced with navMode");
1176
+ return this._configs.firstPerson;
1177
+ }
1178
+
1179
+ /**
1180
+ * Sets whether to vertically constrain the {@link Camera} position for first-person navigation.
1181
+ *
1182
+ * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
1183
+ *
1184
+ * Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
1185
+ *
1186
+ * Default is ````false````.
1187
+ *
1188
+ * @param {Boolean} value Set ````true```` to vertically constrain the Camera.
1189
+ */
1190
+ set constrainVertical(value) {
1191
+ this._configs.constrainVertical = !!value;
1192
+ }
1193
+
1194
+ /**
1195
+ * Gets whether to vertically constrain the {@link Camera} position for first-person navigation.
1196
+ *
1197
+ * When set ````true````, this constrains {@link Camera#eye} to its current vertical position.
1198
+ *
1199
+ * Only applies when {@link CameraControl#navMode} is ````"firstPerson"````.
1200
+ *
1201
+ * Default is ````false````.
1202
+ *
1203
+ * @returns {Boolean} ````true```` when Camera is vertically constrained.
1204
+ */
1205
+ get constrainVertical() {
1206
+ return this._configs.constrainVertical;
1207
+ }
1208
+
1209
+ /**
1210
+ * Sets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
1211
+ *
1212
+ * Default is ````false````.
1213
+ *
1214
+ * @param {Boolean} value Set ````true```` to enable double-pick-fly-to mode.
1215
+ */
1216
+ set doublePickFlyTo(value) {
1217
+ this._configs.doublePickFlyTo = value !== false;
1218
+ }
1219
+
1220
+ /**
1221
+ * Gets whether double-picking an {@link Entity} causes the {@link Camera} to fly to its boundary.
1222
+ *
1223
+ * Default is ````false````.
1224
+ *
1225
+ * @returns {Boolean} Returns ````true```` when double-pick-fly-to mode is enabled.
1226
+ */
1227
+ get doublePickFlyTo() {
1228
+ return this._configs.doublePickFlyTo;
1229
+ }
1230
+
1231
+ /**
1232
+ * Sets whether either right-clicking (true) or middle-clicking (false) pans the {@link Camera}.
1233
+ *
1234
+ * Default is ````true````.
1235
+ *
1236
+ * @param {Boolean} value Set ````false```` to disable pan on right-click.
1237
+ */
1238
+ set panRightClick(value) {
1239
+ this._configs.panRightClick = value !== false;
1240
+ }
1241
+
1242
+ /**
1243
+ * Gets whether right-clicking pans the {@link Camera}.
1244
+ *
1245
+ * Default is ````true````.
1246
+ *
1247
+ * @returns {Boolean} Returns ````false```` when pan on right-click is disabled.
1248
+ */
1249
+ get panRightClick() {
1250
+ return this._configs.panRightClick;
1251
+ }
1252
+
1253
+ /**
1254
+ * Sets a factor in range ````[0..1]```` indicating how much the {@link Camera} keeps moving after you finish rotating it.
1255
+ *
1256
+ * A value of ````0.0```` causes it to immediately stop, ````0.5```` causes its movement to decay 50% on each tick,
1257
+ * while ````1.0```` causes no decay, allowing it continue moving, by the current rate of rotation.
1258
+ *
1259
+ * You may choose an inertia of zero when you want be able to precisely rotate the Camera,
1260
+ * without interference from inertia. Zero inertia can also mean that less frames are rendered while
1261
+ * you are rotating the Camera.
1262
+ *
1263
+ * Default is ````0.0````.
1264
+ *
1265
+ * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
1266
+ *
1267
+ * @param {Number} rotationInertia New inertial factor.
1268
+ */
1269
+ set rotationInertia(rotationInertia) {
1270
+ this._configs.rotationInertia = (rotationInertia !== undefined && rotationInertia !== null) ? rotationInertia : 0.0;
1271
+ }
1272
+
1273
+ /**
1274
+ * Gets the rotation inertia factor.
1275
+ *
1276
+ * Default is ````0.0````.
1277
+ *
1278
+ * Does not apply when {@link CameraControl#navMode} is ````"planView"````, which disallows rotation.
1279
+ *
1280
+ * @returns {Number} The inertia factor.
1281
+ */
1282
+ get rotationInertia() {
1283
+ return this._configs.rotationInertia;
1284
+ }
1285
+
1286
+ /**
1287
+ * Sets how much the {@link Camera} pans each second with keyboard input.
1288
+ *
1289
+ * Default is ````5.0````, to pan the Camera ````5.0```` World-space units every second that
1290
+ * a panning key is depressed. See the ````CameraControl```` class documentation for which keys control
1291
+ * panning.
1292
+ *
1293
+ * Panning direction is aligned to our Camera's orientation. When we pan horizontally, we pan
1294
+ * to our left and right, when we pan vertically, we pan upwards and downwards, and when we pan forwards
1295
+ * and backwards, we pan along the direction the Camera is pointing.
1296
+ *
1297
+ * Unlike dollying when {@link followPointer} is ````true````, panning does not follow the pointer.
1298
+ *
1299
+ * @param {Number} keyboardPanRate The new keyboard pan rate.
1300
+ */
1301
+ set keyboardPanRate(keyboardPanRate) {
1302
+ this._configs.keyboardPanRate = (keyboardPanRate !== null && keyboardPanRate !== undefined) ? keyboardPanRate : 5.0;
1303
+ }
1304
+
1305
+
1306
+ /**
1307
+ * Sets how fast the camera pans on touch panning
1308
+ *
1309
+ * @param {Number} touchPanRate The new touch pan rate.
1310
+ */
1311
+ set touchPanRate(touchPanRate) {
1312
+ this._configs.touchPanRate = (touchPanRate !== null && touchPanRate !== undefined) ? touchPanRate : 1.0;
1313
+ }
1314
+
1315
+ /**
1316
+ * Gets how fast the {@link Camera} pans on touch panning
1317
+ *
1318
+ * Default is ````1.0````.
1319
+ *
1320
+ * @returns {Number} The current touch pan rate.
1321
+ */
1322
+ get touchPanRate() {
1323
+ return this._configs.touchPanRate;
1324
+ }
1325
+
1326
+ /**
1327
+ * Gets how much the {@link Camera} pans each second with keyboard input.
1328
+ *
1329
+ * Default is ````5.0````.
1330
+ *
1331
+ * @returns {Number} The current keyboard pan rate.
1332
+ */
1333
+ get keyboardPanRate() {
1334
+ return this._configs.keyboardPanRate;
1335
+ }
1336
+
1337
+ /**
1338
+ * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
1339
+ *
1340
+ * Default is ````90.0````, to rotate/orbit the Camera ````90.0```` degrees every second that
1341
+ * a rotation key is depressed. See the ````CameraControl```` class documentation for which keys control
1342
+ * rotation/orbit.
1343
+ *
1344
+ * @param {Number} keyboardRotationRate The new keyboard rotation rate.
1345
+ */
1346
+ set keyboardRotationRate(keyboardRotationRate) {
1347
+ this._configs.keyboardRotationRate = (keyboardRotationRate !== null && keyboardRotationRate !== undefined) ? keyboardRotationRate : 90.0;
1348
+ }
1349
+
1350
+ /**
1351
+ * Sets how many degrees per second the {@link Camera} rotates/orbits with keyboard input.
1352
+ *
1353
+ * Default is ````90.0````.
1354
+ *
1355
+ * @returns {Number} The current keyboard rotation rate.
1356
+ */
1357
+ get keyboardRotationRate() {
1358
+ return this._configs.keyboardRotationRate;
1359
+ }
1360
+
1361
+ /**
1362
+ * Sets the current drag rotation rate.
1363
+ *
1364
+ * This configures how many degrees the {@link Camera} rotates/orbits for a full sweep of the canvas by mouse or touch dragging.
1365
+ *
1366
+ * For example, a value of ````360.0```` indicates that the ````Camera```` rotates/orbits ````360.0```` degrees horizontally
1367
+ * when we sweep the entire width of the canvas.
1368
+ *
1369
+ * ````CameraControl```` makes vertical rotation half as sensitive as horizontal rotation, so that we don't tend to
1370
+ * flip upside-down. Therefore, a value of ````360.0```` rotates/orbits the ````Camera```` through ````180.0```` degrees
1371
+ * vertically when we sweep the entire height of the canvas.
1372
+ *
1373
+ * Default is ````360.0````.
1374
+ *
1375
+ * @param {Number} dragRotationRate The new drag rotation rate.
1376
+ */
1377
+ set dragRotationRate(dragRotationRate) {
1378
+ this._configs.dragRotationRate = (dragRotationRate !== null && dragRotationRate !== undefined) ? dragRotationRate : 360.0;
1379
+ }
1380
+
1381
+ /**
1382
+ * Gets the current drag rotation rate.
1383
+ *
1384
+ * Default is ````360.0````.
1385
+ *
1386
+ * @returns {Number} The current drag rotation rate.
1387
+ */
1388
+ get dragRotationRate() {
1389
+ return this._configs.dragRotationRate;
1390
+ }
1391
+
1392
+ /**
1393
+ * Sets how much the {@link Camera} dollys each second with keyboard input.
1394
+ *
1395
+ * Default is ````15.0````, to dolly the {@link Camera} ````15.0```` World-space units per second while we hold down
1396
+ * the ````+```` and ````-```` keys.
1397
+ *
1398
+ * @param {Number} keyboardDollyRate The new keyboard dolly rate.
1399
+ */
1400
+ set keyboardDollyRate(keyboardDollyRate) {
1401
+ this._configs.keyboardDollyRate = (keyboardDollyRate !== null && keyboardDollyRate !== undefined) ? keyboardDollyRate : 15.0;
1402
+ }
1403
+
1404
+ /**
1405
+ * Gets how much the {@link Camera} dollys each second with keyboard input.
1406
+ *
1407
+ * Default is ````15.0````.
1408
+ *
1409
+ * @returns {Number} The current keyboard dolly rate.
1410
+ */
1411
+ get keyboardDollyRate() {
1412
+ return this._configs.keyboardDollyRate;
1413
+ }
1414
+
1415
+ /**
1416
+ * Sets how much the {@link Camera} dollys with touch input.
1417
+ *
1418
+ * Default is ````0.2````
1419
+ *
1420
+ * @param {Number} touchDollyRate The new touch dolly rate.
1421
+ */
1422
+ set touchDollyRate(touchDollyRate) {
1423
+ this._configs.touchDollyRate = (touchDollyRate !== null && touchDollyRate !== undefined) ? touchDollyRate : 0.2;
1424
+ }
1425
+
1426
+ /**
1427
+ * Gets how much the {@link Camera} dollys each second with touch input.
1428
+ *
1429
+ * Default is ````0.2````.
1430
+ *
1431
+ * @returns {Number} The current touch dolly rate.
1432
+ */
1433
+ get touchDollyRate() {
1434
+ return this._configs.touchDollyRate;
1435
+ }
1436
+
1437
+ /**
1438
+ * Sets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
1439
+ *
1440
+ * Default is ````100.0````, to dolly the {@link Camera} ````10.0```` World-space units per second as we spin
1441
+ * the mouse wheel.
1442
+ *
1443
+ * @param {Number} mouseWheelDollyRate The new mouse wheel dolly rate.
1444
+ */
1445
+ set mouseWheelDollyRate(mouseWheelDollyRate) {
1446
+ this._configs.mouseWheelDollyRate = (mouseWheelDollyRate !== null && mouseWheelDollyRate !== undefined) ? mouseWheelDollyRate : 100.0;
1447
+ }
1448
+
1449
+ /**
1450
+ * Gets how much the {@link Camera} dollys each second while the mouse wheel is spinning.
1451
+ *
1452
+ * Default is ````100.0````.
1453
+ *
1454
+ * @returns {Number} The current mouseWheel dolly rate.
1455
+ */
1456
+ get mouseWheelDollyRate() {
1457
+ return this._configs.mouseWheelDollyRate;
1458
+ }
1459
+
1460
+ /**
1461
+ * Sets the dolly inertia factor.
1462
+ *
1463
+ * This factor configures how much the {@link Camera} keeps moving after you finish dollying it.
1464
+ *
1465
+ * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes dollying to immediately stop,
1466
+ * ````0.5```` causes dollying to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows dollying
1467
+ * to continue until further input stops it.
1468
+ *
1469
+ * You might set ````dollyInertia```` to zero when you want be able to precisely position or rotate the Camera,
1470
+ * without interference from inertia. This also means that yjkkit renders less frames while dollying the Camera,
1471
+ * which can improve rendering performance.
1472
+ *
1473
+ * Default is ````0````.
1474
+ *
1475
+ * @param {Number} dollyInertia New dolly inertia factor.
1476
+ */
1477
+ set dollyInertia(dollyInertia) {
1478
+ this._configs.dollyInertia = (dollyInertia !== undefined && dollyInertia !== null) ? dollyInertia : 0;
1479
+ }
1480
+
1481
+ /**
1482
+ * Gets the dolly inertia factor.
1483
+ *
1484
+ * Default is ````0````.
1485
+ *
1486
+ * @returns {Number} The current dolly inertia factor.
1487
+ */
1488
+ get dollyInertia() {
1489
+ return this._configs.dollyInertia;
1490
+ }
1491
+
1492
+ /**
1493
+ * Sets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
1494
+ *
1495
+ * Default is ````35.0````.
1496
+ *
1497
+ * @param {Number} dollyProximityThreshold New dolly proximity threshold.
1498
+ */
1499
+ set dollyProximityThreshold(dollyProximityThreshold) {
1500
+ this._configs.dollyProximityThreshold = (dollyProximityThreshold !== undefined && dollyProximityThreshold !== null) ? dollyProximityThreshold : 35.0;
1501
+ }
1502
+
1503
+ /**
1504
+ * Gets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
1505
+ *
1506
+ * Default is ````35.0````.
1507
+ *
1508
+ * @returns {Number} The current dolly proximity threshold.
1509
+ */
1510
+ get dollyProximityThreshold() {
1511
+ return this._configs.dollyProximityThreshold;
1512
+ }
1513
+
1514
+ /**
1515
+ * Sets the minimum dolly speed.
1516
+ *
1517
+ * Default is ````0.04````.
1518
+ *
1519
+ * @param {Number} dollyMinSpeed New dolly minimum speed.
1520
+ */
1521
+ set dollyMinSpeed(dollyMinSpeed) {
1522
+ this._configs.dollyMinSpeed = (dollyMinSpeed !== undefined && dollyMinSpeed !== null) ? dollyMinSpeed : 0.04;
1523
+ }
1524
+
1525
+ /**
1526
+ * Gets the minimum dolly speed.
1527
+ *
1528
+ * Default is ````0.04````.
1529
+ *
1530
+ * @returns {Number} The current minimum dolly speed.
1531
+ */
1532
+ get dollyMinSpeed() {
1533
+ return this._configs.dollyMinSpeed;
1534
+ }
1535
+
1536
+ /**
1537
+ * Sets the pan inertia factor.
1538
+ *
1539
+ * This factor configures how much the {@link Camera} keeps moving after you finish panning it.
1540
+ *
1541
+ * This factor is a value in range ````[0..1]````. A value of ````0.0```` causes panning to immediately stop,
1542
+ * ````0.5```` causes panning to decay 50% on each animation frame, while ````1.0```` causes no decay, which allows panning
1543
+ * to continue until further input stops it.
1544
+ *
1545
+ * You might set ````panInertia```` to zero when you want be able to precisely position or rotate the Camera,
1546
+ * without interference from inertia. This also means that yjkkit renders less frames while panning the Camera,
1547
+ * wich can improve rendering performance.
1548
+ *
1549
+ * Default is ````0.5````.
1550
+ *
1551
+ * @param {Number} panInertia New pan inertia factor.
1552
+ */
1553
+ set panInertia(panInertia) {
1554
+ this._configs.panInertia = (panInertia !== undefined && panInertia !== null) ? panInertia : 0.5;
1555
+ }
1556
+
1557
+ /**
1558
+ * Gets the pan inertia factor.
1559
+ *
1560
+ * Default is ````0.5````.
1561
+ *
1562
+ * @returns {Number} The current pan inertia factor.
1563
+ */
1564
+ get panInertia() {
1565
+ return this._configs.panInertia;
1566
+ }
1567
+
1568
+ /**
1569
+ * Sets the keyboard layout.
1570
+ *
1571
+ * Supported layouts are:
1572
+ *
1573
+ * * ````"qwerty"```` (default)
1574
+ * * ````"azerty"````
1575
+ *
1576
+ * @deprecated
1577
+ * @param {String} value Selects the keyboard layout.
1578
+ */
1579
+ set keyboardLayout(value) {
1580
+ // this.warn("keyboardLayout property is deprecated - use keyMap property instead");
1581
+ value = value || "qwerty";
1582
+ if (value !== "qwerty" && value !== "azerty") {
1583
+ this.error("Unsupported value for keyboardLayout - defaulting to 'qwerty'");
1584
+ value = "qwerty";
1585
+ }
1586
+ this._configs.keyboardLayout = value;
1587
+ this.keyMap = this._configs.keyboardLayout;
1588
+ }
1589
+
1590
+ /**
1591
+ * Gets the keyboard layout.
1592
+ *
1593
+ * Supported layouts are:
1594
+ *
1595
+ * * ````"qwerty"```` (default)
1596
+ * * ````"azerty"````
1597
+ *
1598
+ * @deprecated
1599
+ * @returns {String} The current keyboard layout.
1600
+ */
1601
+ get keyboardLayout() {
1602
+ return this._configs.keyboardLayout;
1603
+ }
1604
+
1605
+ /**
1606
+ * Sets whether smart default pivoting is enabled.
1607
+ *
1608
+ * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
1609
+ * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
1610
+ *
1611
+ * When ````false````, we'll pivot by default about {@link Camera#look}.
1612
+ *
1613
+ * Default is ````false````.
1614
+ *
1615
+ * @param {Boolean} enabled Set ````true```` to pivot by default about the selected point on the virtual sphere, or ````false```` to pivot by default about {@link Camera#look}.
1616
+ */
1617
+ set smartPivot(enabled) {
1618
+ this._configs.smartPivot = (enabled !== false);
1619
+ }
1620
+
1621
+ /**
1622
+ * Gets whether smart default pivoting is enabled.
1623
+ *
1624
+ * When ````true````, we'll pivot by default about the 3D position of the mouse/touch pointer on an
1625
+ * imaginary sphere that's centered at {@link Camera#eye} and sized to the {@link Scene} boundary.
1626
+ *
1627
+ * When ````false````, we'll pivot by default about {@link Camera#look}.
1628
+ *
1629
+ * Default is ````false````.
1630
+ *
1631
+ * @returns {Boolean} Returns ````true```` when pivoting by default about the selected point on the virtual sphere, or ````false```` when pivoting by default about {@link Camera#look}.
1632
+ */
1633
+ get smartPivot() {
1634
+ return this._configs.smartPivot;
1635
+ }
1636
+
1637
+ /**
1638
+ * Destroys this ````CameraControl````.
1639
+ * @private
1640
+ */
1641
+ destroy() {
1642
+ this._destroyHandlers();
1643
+ this._destroyControllers();
1644
+ this._cameraUpdater.destroy();
1645
+ super.destroy();
1646
+ }
1647
+
1648
+ _destroyHandlers() {
1649
+ for (let i = 0, len = this._handlers.length; i < len; i++) {
1650
+ const handler = this._handlers[i];
1651
+ if (handler.destroy) {
1652
+ handler.destroy();
1653
+ }
1654
+ }
1655
+ }
1656
+
1657
+ _destroyControllers() {
1658
+ for (let i = 0, len = this._controllers.length; i < len; i++) {
1659
+ const controller = this._controllers[i];
1660
+ if (controller.destroy) {
1661
+ controller.destroy();
1662
+ }
1663
+ }
1664
+ }
1665
+ }
1666
+
1667
+ export {
1668
+ CameraControl
1669
+ };