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,1475 @@
1
+ import {Component} from '../Component.js';
2
+ import {math} from '../math/math.js';
3
+
4
+ /**
5
+ * @desc Meditates mouse, touch and keyboard events for various interaction controls.
6
+ *
7
+ * Ordinarily, you would only use this component as a utility to help manage input events and state for your
8
+ * own custom input handlers.
9
+ *
10
+ * * Located at {@link Scene#input}
11
+ * * Used by (at least) {@link CameraControl}
12
+ *
13
+ * ## Usage
14
+ *
15
+ * Subscribing to mouse events on the canvas:
16
+ *
17
+ * ````javascript
18
+ * import {Viewer} from "yjkkit-sdk.es.js";
19
+ *
20
+ * const viewer = new Viewer({
21
+ * canvasId: "myCanvas"
22
+ * });
23
+ *
24
+ * const input = viewer.scene.input;
25
+ *
26
+ * const onMouseDown = input.on("mousedown", (canvasCoords) => {
27
+ * console.log("Mouse down at: x=" + canvasCoords[0] + ", y=" + coords[1]);
28
+ * });
29
+ *
30
+ * const onMouseUp = input.on("mouseup", (canvasCoords) => {
31
+ * console.log("Mouse up at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
32
+ * });
33
+ *
34
+ * const onMouseClicked = input.on("mouseclicked", (canvasCoords) => {
35
+ * console.log("Mouse clicked at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
36
+ * });
37
+ *
38
+ * const onDblClick = input.on("dblclick", (canvasCoords) => {
39
+ * console.log("Double-click at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
40
+ * });
41
+ * ````
42
+ *
43
+ * Subscribing to keyboard events on the canvas:
44
+ *
45
+ * ````javascript
46
+ * const onKeyDown = input.on("keydown", (keyCode) => {
47
+ * switch (keyCode) {
48
+ * case this.KEY_A:
49
+ * console.log("The 'A' key is down");
50
+ * break;
51
+ *
52
+ * case this.KEY_B:
53
+ * console.log("The 'B' key is down");
54
+ * break;
55
+ *
56
+ * case this.KEY_C:
57
+ * console.log("The 'C' key is down");
58
+ * break;
59
+ *
60
+ * default:
61
+ * console.log("Some other key is down");
62
+ * }
63
+ * });
64
+ *
65
+ * const onKeyUp = input.on("keyup", (keyCode) => {
66
+ * switch (keyCode) {
67
+ * case this.KEY_A:
68
+ * console.log("The 'A' key is up");
69
+ * break;
70
+ *
71
+ * case this.KEY_B:
72
+ * console.log("The 'B' key is up");
73
+ * break;
74
+ *
75
+ * case this.KEY_C:
76
+ * console.log("The 'C' key is up");
77
+ * break;
78
+ *
79
+ * default:
80
+ * console.log("Some other key is up");
81
+ * }
82
+ * });
83
+ * ````
84
+ *
85
+ * Checking if keys are down:
86
+ *
87
+ * ````javascript
88
+ * const isCtrlDown = input.ctrlDown;
89
+ * const isAltDown = input.altDown;
90
+ * const shiftDown = input.shiftDown;
91
+ * //...
92
+ *
93
+ * const isAKeyDown = input.keyDown[input.KEY_A];
94
+ * const isBKeyDown = input.keyDown[input.KEY_B];
95
+ * const isShiftKeyDown = input.keyDown[input.KEY_SHIFT];
96
+ * //...
97
+ *
98
+ * ````
99
+ * Unsubscribing from events:
100
+ *
101
+ * ````javascript
102
+ * input.off(onMouseDown);
103
+ * input.off(onMouseUp);
104
+ * //...
105
+ * ````
106
+ *
107
+ * ## Disabling all events
108
+ *
109
+ * Event handling is enabled by default.
110
+ *
111
+ * To disable all events:
112
+ *
113
+ * ````javascript
114
+ * myViewer.scene.input.setEnabled(false);
115
+ * ````
116
+ * To enable all events again:
117
+ *
118
+ * ````javascript
119
+ * myViewer.scene.input.setEnabled(true);
120
+ * ````
121
+ *
122
+ * ## Disabling keyboard input
123
+ *
124
+ * When the mouse is over the canvas, the canvas will consume keyboard events. Therefore, sometimes we need
125
+ * to disable keyboard control, so that other UI elements can get those events.
126
+ *
127
+ * To disable keyboard events:
128
+ *
129
+ * ````javascript
130
+ * myViewer.scene.input.setKeyboardEnabled(false);
131
+ * ````
132
+ *
133
+ * To enable keyboard events again:
134
+ *
135
+ * ````javascript
136
+ * myViewer.scene.input.setKeyboardEnabled(true)
137
+ * ````
138
+ */
139
+ class Input extends Component {
140
+
141
+ /**
142
+ * @private
143
+ */
144
+ constructor(owner, cfg = {}) {
145
+
146
+ super(owner, cfg);
147
+
148
+ /**
149
+ * Code for the BACKSPACE key.
150
+ * @property KEY_BACKSPACE
151
+ * @final
152
+ * @type {Number}
153
+ */
154
+ this.KEY_BACKSPACE = 8;
155
+
156
+ /**
157
+ * Code for the TAB key.
158
+ * @property KEY_TAB
159
+ * @final
160
+ * @type {Number}
161
+ */
162
+ this.KEY_TAB = 9;
163
+
164
+ /**
165
+ * Code for the ENTER key.
166
+ * @property KEY_ENTER
167
+ * @final
168
+ * @type {Number}
169
+ */
170
+ this.KEY_ENTER = 13;
171
+
172
+ /**
173
+ * Code for the SHIFT key.
174
+ * @property KEY_SHIFT
175
+ * @final
176
+ * @type {Number}
177
+ */
178
+ this.KEY_SHIFT = 16;
179
+
180
+ /**
181
+ * Code for the CTRL key.
182
+ * @property KEY_CTRL
183
+ * @final
184
+ * @type {Number}
185
+ */
186
+ this.KEY_CTRL = 17;
187
+
188
+ /**
189
+ * Code for the ALT key.
190
+ * @property KEY_ALT
191
+ * @final
192
+ * @type {Number}
193
+ */
194
+ this.KEY_ALT = 18;
195
+
196
+ /**
197
+ * Code for the PAUSE_BREAK key.
198
+ * @property KEY_PAUSE_BREAK
199
+ * @final
200
+ * @type {Number}
201
+ */
202
+ this.KEY_PAUSE_BREAK = 19;
203
+
204
+ /**
205
+ * Code for the CAPS_LOCK key.
206
+ * @property KEY_CAPS_LOCK
207
+ * @final
208
+ * @type {Number}
209
+ */
210
+ this.KEY_CAPS_LOCK = 20;
211
+
212
+ /**
213
+ * Code for the ESCAPE key.
214
+ * @property KEY_ESCAPE
215
+ * @final
216
+ * @type {Number}
217
+ */
218
+ this.KEY_ESCAPE = 27;
219
+
220
+ /**
221
+ * Code for the PAGE_UP key.
222
+ * @property KEY_PAGE_UP
223
+ * @final
224
+ * @type {Number}
225
+ */
226
+ this.KEY_PAGE_UP = 33;
227
+
228
+ /**
229
+ * Code for the PAGE_DOWN key.
230
+ * @property KEY_PAGE_DOWN
231
+ * @final
232
+ * @type {Number}
233
+ */
234
+ this.KEY_PAGE_DOWN = 34;
235
+
236
+ /**
237
+ * Code for the END key.
238
+ * @property KEY_END
239
+ * @final
240
+ * @type {Number}
241
+ */
242
+ this.KEY_END = 35;
243
+
244
+ /**
245
+ * Code for the HOME key.
246
+ * @property KEY_HOME
247
+ * @final
248
+ * @type {Number}
249
+ */
250
+ this.KEY_HOME = 36;
251
+
252
+ /**
253
+ * Code for the LEFT_ARROW key.
254
+ * @property KEY_LEFT_ARROW
255
+ * @final
256
+ * @type {Number}
257
+ */
258
+ this.KEY_LEFT_ARROW = 37;
259
+
260
+ /**
261
+ * Code for the UP_ARROW key.
262
+ * @property KEY_UP_ARROW
263
+ * @final
264
+ * @type {Number}
265
+ */
266
+ this.KEY_UP_ARROW = 38;
267
+
268
+ /**
269
+ * Code for the RIGHT_ARROW key.
270
+ * @property KEY_RIGHT_ARROW
271
+ * @final
272
+ * @type {Number}
273
+ */
274
+ this.KEY_RIGHT_ARROW = 39;
275
+
276
+ /**
277
+ * Code for the DOWN_ARROW key.
278
+ * @property KEY_DOWN_ARROW
279
+ * @final
280
+ * @type {Number}
281
+ */
282
+ this.KEY_DOWN_ARROW = 40;
283
+
284
+ /**
285
+ * Code for the INSERT key.
286
+ * @property KEY_INSERT
287
+ * @final
288
+ * @type {Number}
289
+ */
290
+ this.KEY_INSERT = 45;
291
+
292
+ /**
293
+ * Code for the DELETE key.
294
+ * @property KEY_DELETE
295
+ * @final
296
+ * @type {Number}
297
+ */
298
+ this.KEY_DELETE = 46;
299
+
300
+ /**
301
+ * Code for the 0 key.
302
+ * @property KEY_NUM_0
303
+ * @final
304
+ * @type {Number}
305
+ */
306
+ this.KEY_NUM_0 = 48;
307
+
308
+ /**
309
+ * Code for the 1 key.
310
+ * @property KEY_NUM_1
311
+ * @final
312
+ * @type {Number}
313
+ */
314
+ this.KEY_NUM_1 = 49;
315
+
316
+ /**
317
+ * Code for the 2 key.
318
+ * @property KEY_NUM_2
319
+ * @final
320
+ * @type {Number}
321
+ */
322
+ this.KEY_NUM_2 = 50;
323
+
324
+ /**
325
+ * Code for the 3 key.
326
+ * @property KEY_NUM_3
327
+ * @final
328
+ * @type {Number}
329
+ */
330
+ this.KEY_NUM_3 = 51;
331
+
332
+ /**
333
+ * Code for the 4 key.
334
+ * @property KEY_NUM_4
335
+ * @final
336
+ * @type {Number}
337
+ */
338
+ this.KEY_NUM_4 = 52;
339
+
340
+ /**
341
+ * Code for the 5 key.
342
+ * @property KEY_NUM_5
343
+ * @final
344
+ * @type {Number}
345
+ */
346
+ this.KEY_NUM_5 = 53;
347
+
348
+ /**
349
+ * Code for the 6 key.
350
+ * @property KEY_NUM_6
351
+ * @final
352
+ * @type {Number}
353
+ */
354
+ this.KEY_NUM_6 = 54;
355
+
356
+ /**
357
+ * Code for the 7 key.
358
+ * @property KEY_NUM_7
359
+ * @final
360
+ * @type {Number}
361
+ */
362
+ this.KEY_NUM_7 = 55;
363
+
364
+ /**
365
+ * Code for the 8 key.
366
+ * @property KEY_NUM_8
367
+ * @final
368
+ * @type {Number}
369
+ */
370
+ this.KEY_NUM_8 = 56;
371
+
372
+ /**
373
+ * Code for the 9 key.
374
+ * @property KEY_NUM_9
375
+ * @final
376
+ * @type {Number}
377
+ */
378
+ this.KEY_NUM_9 = 57;
379
+
380
+ /**
381
+ * Code for the A key.
382
+ * @property KEY_A
383
+ * @final
384
+ * @type {Number}
385
+ */
386
+ this.KEY_A = 65;
387
+
388
+ /**
389
+ * Code for the B key.
390
+ * @property KEY_B
391
+ * @final
392
+ * @type {Number}
393
+ */
394
+ this.KEY_B = 66;
395
+
396
+ /**
397
+ * Code for the C key.
398
+ * @property KEY_C
399
+ * @final
400
+ * @type {Number}
401
+ */
402
+ this.KEY_C = 67;
403
+
404
+ /**
405
+ * Code for the D key.
406
+ * @property KEY_D
407
+ * @final
408
+ * @type {Number}
409
+ */
410
+ this.KEY_D = 68;
411
+
412
+ /**
413
+ * Code for the E key.
414
+ * @property KEY_E
415
+ * @final
416
+ * @type {Number}
417
+ */
418
+ this.KEY_E = 69;
419
+
420
+ /**
421
+ * Code for the F key.
422
+ * @property KEY_F
423
+ * @final
424
+ * @type {Number}
425
+ */
426
+ this.KEY_F = 70;
427
+
428
+ /**
429
+ * Code for the G key.
430
+ * @property KEY_G
431
+ * @final
432
+ * @type {Number}
433
+ */
434
+ this.KEY_G = 71;
435
+
436
+ /**
437
+ * Code for the H key.
438
+ * @property KEY_H
439
+ * @final
440
+ * @type {Number}
441
+ */
442
+ this.KEY_H = 72;
443
+
444
+ /**
445
+ * Code for the I key.
446
+ * @property KEY_I
447
+ * @final
448
+ * @type {Number}
449
+ */
450
+ this.KEY_I = 73;
451
+
452
+ /**
453
+ * Code for the J key.
454
+ * @property KEY_J
455
+ * @final
456
+ * @type {Number}
457
+ */
458
+ this.KEY_J = 74;
459
+
460
+ /**
461
+ * Code for the K key.
462
+ * @property KEY_K
463
+ * @final
464
+ * @type {Number}
465
+ */
466
+ this.KEY_K = 75;
467
+
468
+ /**
469
+ * Code for the L key.
470
+ * @property KEY_L
471
+ * @final
472
+ * @type {Number}
473
+ */
474
+ this.KEY_L = 76;
475
+
476
+ /**
477
+ * Code for the M key.
478
+ * @property KEY_M
479
+ * @final
480
+ * @type {Number}
481
+ */
482
+ this.KEY_M = 77;
483
+
484
+ /**
485
+ * Code for the N key.
486
+ * @property KEY_N
487
+ * @final
488
+ * @type {Number}
489
+ */
490
+ this.KEY_N = 78;
491
+
492
+ /**
493
+ * Code for the O key.
494
+ * @property KEY_O
495
+ * @final
496
+ * @type {Number}
497
+ */
498
+ this.KEY_O = 79;
499
+
500
+ /**
501
+ * Code for the P key.
502
+ * @property KEY_P
503
+ * @final
504
+ * @type {Number}
505
+ */
506
+ this.KEY_P = 80;
507
+
508
+ /**
509
+ * Code for the Q key.
510
+ * @property KEY_Q
511
+ * @final
512
+ * @type {Number}
513
+ */
514
+ this.KEY_Q = 81;
515
+
516
+ /**
517
+ * Code for the R key.
518
+ * @property KEY_R
519
+ * @final
520
+ * @type {Number}
521
+ */
522
+ this.KEY_R = 82;
523
+
524
+ /**
525
+ * Code for the S key.
526
+ * @property KEY_S
527
+ * @final
528
+ * @type {Number}
529
+ */
530
+ this.KEY_S = 83;
531
+
532
+ /**
533
+ * Code for the T key.
534
+ * @property KEY_T
535
+ * @final
536
+ * @type {Number}
537
+ */
538
+ this.KEY_T = 84;
539
+
540
+ /**
541
+ * Code for the U key.
542
+ * @property KEY_U
543
+ * @final
544
+ * @type {Number}
545
+ */
546
+ this.KEY_U = 85;
547
+
548
+ /**
549
+ * Code for the V key.
550
+ * @property KEY_V
551
+ * @final
552
+ * @type {Number}
553
+ */
554
+ this.KEY_V = 86;
555
+
556
+ /**
557
+ * Code for the W key.
558
+ * @property KEY_W
559
+ * @final
560
+ * @type {Number}
561
+ */
562
+ this.KEY_W = 87;
563
+
564
+ /**
565
+ * Code for the X key.
566
+ * @property KEY_X
567
+ * @final
568
+ * @type {Number}
569
+ */
570
+ this.KEY_X = 88;
571
+
572
+ /**
573
+ * Code for the Y key.
574
+ * @property KEY_Y
575
+ * @final
576
+ * @type {Number}
577
+ */
578
+ this.KEY_Y = 89;
579
+
580
+ /**
581
+ * Code for the Z key.
582
+ * @property KEY_Z
583
+ * @final
584
+ * @type {Number}
585
+ */
586
+ this.KEY_Z = 90;
587
+
588
+ /**
589
+ * Code for the LEFT_WINDOW key.
590
+ * @property KEY_LEFT_WINDOW
591
+ * @final
592
+ * @type {Number}
593
+ */
594
+ this.KEY_LEFT_WINDOW = 91;
595
+
596
+ /**
597
+ * Code for the RIGHT_WINDOW key.
598
+ * @property KEY_RIGHT_WINDOW
599
+ * @final
600
+ * @type {Number}
601
+ */
602
+ this.KEY_RIGHT_WINDOW = 92;
603
+
604
+ /**
605
+ * Code for the SELECT key.
606
+ * @property KEY_SELECT
607
+ * @final
608
+ * @type {Number}
609
+ */
610
+ this.KEY_SELECT_KEY = 93;
611
+
612
+ /**
613
+ * Code for the number pad 0 key.
614
+ * @property KEY_NUMPAD_0
615
+ * @final
616
+ * @type {Number}
617
+ */
618
+ this.KEY_NUMPAD_0 = 96;
619
+
620
+ /**
621
+ * Code for the number pad 1 key.
622
+ * @property KEY_NUMPAD_1
623
+ * @final
624
+ * @type {Number}
625
+ */
626
+ this.KEY_NUMPAD_1 = 97;
627
+
628
+ /**
629
+ * Code for the number pad 2 key.
630
+ * @property KEY_NUMPAD 2
631
+ * @final
632
+ * @type {Number}
633
+ */
634
+ this.KEY_NUMPAD_2 = 98;
635
+
636
+ /**
637
+ * Code for the number pad 3 key.
638
+ * @property KEY_NUMPAD_3
639
+ * @final
640
+ * @type {Number}
641
+ */
642
+ this.KEY_NUMPAD_3 = 99;
643
+
644
+ /**
645
+ * Code for the number pad 4 key.
646
+ * @property KEY_NUMPAD_4
647
+ * @final
648
+ * @type {Number}
649
+ */
650
+ this.KEY_NUMPAD_4 = 100;
651
+
652
+ /**
653
+ * Code for the number pad 5 key.
654
+ * @property KEY_NUMPAD_5
655
+ * @final
656
+ * @type {Number}
657
+ */
658
+ this.KEY_NUMPAD_5 = 101;
659
+
660
+ /**
661
+ * Code for the number pad 6 key.
662
+ * @property KEY_NUMPAD_6
663
+ * @final
664
+ * @type {Number}
665
+ */
666
+ this.KEY_NUMPAD_6 = 102;
667
+
668
+ /**
669
+ * Code for the number pad 7 key.
670
+ * @property KEY_NUMPAD_7
671
+ * @final
672
+ * @type {Number}
673
+ */
674
+ this.KEY_NUMPAD_7 = 103;
675
+
676
+ /**
677
+ * Code for the number pad 8 key.
678
+ * @property KEY_NUMPAD_8
679
+ * @final
680
+ * @type {Number}
681
+ */
682
+ this.KEY_NUMPAD_8 = 104;
683
+
684
+ /**
685
+ * Code for the number pad 9 key.
686
+ * @property KEY_NUMPAD_9
687
+ * @final
688
+ * @type {Number}
689
+ */
690
+ this.KEY_NUMPAD_9 = 105;
691
+
692
+ /**
693
+ * Code for the MULTIPLY key.
694
+ * @property KEY_MULTIPLY
695
+ * @final
696
+ * @type {Number}
697
+ */
698
+ this.KEY_MULTIPLY = 106;
699
+
700
+ /**
701
+ * Code for the ADD key.
702
+ * @property KEY_ADD
703
+ * @final
704
+ * @type {Number}
705
+ */
706
+ this.KEY_ADD = 107;
707
+
708
+ /**
709
+ * Code for the SUBTRACT key.
710
+ * @property KEY_SUBTRACT
711
+ * @final
712
+ * @type {Number}
713
+ */
714
+ this.KEY_SUBTRACT = 109;
715
+
716
+ /**
717
+ * Code for the DECIMAL POINT key.
718
+ * @property KEY_DECIMAL_POINT
719
+ * @final
720
+ * @type {Number}
721
+ */
722
+ this.KEY_DECIMAL_POINT = 110;
723
+
724
+ /**
725
+ * Code for the DIVIDE key.
726
+ * @property KEY_DIVIDE
727
+ * @final
728
+ * @type {Number}
729
+ */
730
+ this.KEY_DIVIDE = 111;
731
+
732
+ /**
733
+ * Code for the F1 key.
734
+ * @property KEY_F1
735
+ * @final
736
+ * @type {Number}
737
+ */
738
+ this.KEY_F1 = 112;
739
+
740
+ /**
741
+ * Code for the F2 key.
742
+ * @property KEY_F2
743
+ * @final
744
+ * @type {Number}
745
+ */
746
+ this.KEY_F2 = 113;
747
+
748
+ /**
749
+ * Code for the F3 key.
750
+ * @property KEY_F3
751
+ * @final
752
+ * @type {Number}
753
+ */
754
+ this.KEY_F3 = 114;
755
+
756
+ /**
757
+ * Code for the F4 key.
758
+ * @property KEY_F4
759
+ * @final
760
+ * @type {Number}
761
+ */
762
+ this.KEY_F4 = 115;
763
+
764
+ /**
765
+ * Code for the F5 key.
766
+ * @property KEY_F5
767
+ * @final
768
+ * @type {Number}
769
+ */
770
+ this.KEY_F5 = 116;
771
+
772
+ /**
773
+ * Code for the F6 key.
774
+ * @property KEY_F6
775
+ * @final
776
+ * @type {Number}
777
+ */
778
+ this.KEY_F6 = 117;
779
+
780
+ /**
781
+ * Code for the F7 key.
782
+ * @property KEY_F7
783
+ * @final
784
+ * @type {Number}
785
+ */
786
+ this.KEY_F7 = 118;
787
+
788
+ /**
789
+ * Code for the F8 key.
790
+ * @property KEY_F8
791
+ * @final
792
+ * @type {Number}
793
+ */
794
+ this.KEY_F8 = 119;
795
+
796
+ /**
797
+ * Code for the F9 key.
798
+ * @property KEY_F9
799
+ * @final
800
+ * @type {Number}
801
+ */
802
+ this.KEY_F9 = 120;
803
+
804
+ /**
805
+ * Code for the F10 key.
806
+ * @property KEY_F10
807
+ * @final
808
+ * @type {Number}
809
+ */
810
+ this.KEY_F10 = 121;
811
+
812
+ /**
813
+ * Code for the F11 key.
814
+ * @property KEY_F11
815
+ * @final
816
+ * @type {Number}
817
+ */
818
+ this.KEY_F11 = 122;
819
+
820
+ /**
821
+ * Code for the F12 key.
822
+ * @property KEY_F12
823
+ * @final
824
+ * @type {Number}
825
+ */
826
+ this.KEY_F12 = 123;
827
+
828
+ /**
829
+ * Code for the NUM_LOCK key.
830
+ * @property KEY_NUM_LOCK
831
+ * @final
832
+ * @type {Number}
833
+ */
834
+ this.KEY_NUM_LOCK = 144;
835
+
836
+ /**
837
+ * Code for the SCROLL_LOCK key.
838
+ * @property KEY_SCROLL_LOCK
839
+ * @final
840
+ * @type {Number}
841
+ */
842
+ this.KEY_SCROLL_LOCK = 145;
843
+
844
+ /**
845
+ * Code for the SEMI_COLON key.
846
+ * @property KEY_SEMI_COLON
847
+ * @final
848
+ * @type {Number}
849
+ */
850
+ this.KEY_SEMI_COLON = 186;
851
+
852
+ /**
853
+ * Code for the EQUAL_SIGN key.
854
+ * @property KEY_EQUAL_SIGN
855
+ * @final
856
+ * @type {Number}
857
+ */
858
+ this.KEY_EQUAL_SIGN = 187;
859
+
860
+ /**
861
+ * Code for the COMMA key.
862
+ * @property KEY_COMMA
863
+ * @final
864
+ * @type {Number}
865
+ */
866
+ this.KEY_COMMA = 188;
867
+
868
+ /**
869
+ * Code for the DASH key.
870
+ * @property KEY_DASH
871
+ * @final
872
+ * @type {Number}
873
+ */
874
+ this.KEY_DASH = 189;
875
+
876
+ /**
877
+ * Code for the PERIOD key.
878
+ * @property KEY_PERIOD
879
+ * @final
880
+ * @type {Number}
881
+ */
882
+ this.KEY_PERIOD = 190;
883
+
884
+ /**
885
+ * Code for the FORWARD_SLASH key.
886
+ * @property KEY_FORWARD_SLASH
887
+ * @final
888
+ * @type {Number}
889
+ */
890
+ this.KEY_FORWARD_SLASH = 191;
891
+
892
+ /**
893
+ * Code for the GRAVE_ACCENT key.
894
+ * @property KEY_GRAVE_ACCENT
895
+ * @final
896
+ * @type {Number}
897
+ */
898
+ this.KEY_GRAVE_ACCENT = 192;
899
+
900
+ /**
901
+ * Code for the OPEN_BRACKET key.
902
+ * @property KEY_OPEN_BRACKET
903
+ * @final
904
+ * @type {Number}
905
+ */
906
+ this.KEY_OPEN_BRACKET = 219;
907
+
908
+ /**
909
+ * Code for the BACK_SLASH key.
910
+ * @property KEY_BACK_SLASH
911
+ * @final
912
+ * @type {Number}
913
+ */
914
+ this.KEY_BACK_SLASH = 220;
915
+
916
+ /**
917
+ * Code for the CLOSE_BRACKET key.
918
+ * @property KEY_CLOSE_BRACKET
919
+ * @final
920
+ * @type {Number}
921
+ */
922
+ this.KEY_CLOSE_BRACKET = 221;
923
+
924
+ /**
925
+ * Code for the SINGLE_QUOTE key.
926
+ * @property KEY_SINGLE_QUOTE
927
+ * @final
928
+ * @type {Number}
929
+ */
930
+ this.KEY_SINGLE_QUOTE = 222;
931
+
932
+ /**
933
+ * Code for the SPACE key.
934
+ * @property KEY_SPACE
935
+ * @final
936
+ * @type {Number}
937
+ */
938
+ this.KEY_SPACE = 32;
939
+
940
+ /**
941
+ * The canvas element that mouse and keyboards are bound to.
942
+ *
943
+ * @final
944
+ * @type {HTMLCanvasElement}
945
+ */
946
+ this.element = cfg.element;
947
+
948
+ /** True whenever ALT key is down.
949
+ *
950
+ * @type {boolean}
951
+ */
952
+ this.altDown = false;
953
+
954
+ /** True whenever CTRL key is down.
955
+ *
956
+ * @type {boolean}
957
+ */
958
+ this.ctrlDown = false;
959
+
960
+ /** True whenever left mouse button is down.
961
+ *
962
+ * @type {boolean}
963
+ */
964
+ this.mouseDownLeft = false;
965
+
966
+ /**
967
+ * True whenever middle mouse button is down.
968
+ *
969
+ * @type {boolean}
970
+ */
971
+ this.mouseDownMiddle = false;
972
+
973
+ /**
974
+ * True whenever the right mouse button is down.
975
+ *
976
+ * @type {boolean}
977
+ */
978
+ this.mouseDownRight = false;
979
+
980
+ /**
981
+ * Flag for each key that's down.
982
+ *
983
+ * @type {boolean[]}
984
+ */
985
+ this.keyDown = [];
986
+
987
+ /** True while input enabled
988
+ *
989
+ * @type {boolean}
990
+ */
991
+ this.enabled = true;
992
+
993
+ /** True while keyboard input is enabled.
994
+ *
995
+ * Default value is ````true````.
996
+ *
997
+ * {@link CameraControl} will not respond to keyboard events while this is ````false````.
998
+ *
999
+ * @type {boolean}
1000
+ */
1001
+ this.keyboardEnabled = true;
1002
+
1003
+ /** True while the mouse is over the canvas.
1004
+ *
1005
+ * @type {boolean}
1006
+ */
1007
+ this.mouseover = false;
1008
+
1009
+ /**
1010
+ * Current mouse position within the canvas.
1011
+ * @type {Number[]}
1012
+ */
1013
+ this.mouseCanvasPos = math.vec2();
1014
+
1015
+ this._bindEvents();
1016
+ }
1017
+
1018
+ _bindEvents() {
1019
+
1020
+ if (this._eventsBound) {
1021
+ return;
1022
+ }
1023
+
1024
+ document.addEventListener("keydown", this._keyDownListener = (e) => {
1025
+ if (!this.enabled || (!this.keyboardEnabled)) {
1026
+ return;
1027
+ }
1028
+ if (e.target.tagName !== "INPUT" && e.target.tagName !== "TEXTAREA") {
1029
+ if (e.keyCode === this.KEY_CTRL) {
1030
+ this.ctrlDown = true;
1031
+ } else if (e.keyCode === this.KEY_ALT) {
1032
+ this.altDown = true;
1033
+ } else if (e.keyCode === this.KEY_SHIFT) {
1034
+ this.shiftDown = true;
1035
+ }
1036
+ this.keyDown[e.keyCode] = true;
1037
+ this.fire("keydown", e.keyCode, true);
1038
+ }
1039
+ }, false);
1040
+
1041
+ document.addEventListener("keyup", this._keyUpListener = (e) => {
1042
+ if (!this.enabled || (!this.keyboardEnabled)) {
1043
+ return;
1044
+ }
1045
+ if (e.target.tagName !== "INPUT" && e.target.tagName !== "TEXTAREA") {
1046
+ if (e.keyCode === this.KEY_CTRL) {
1047
+ this.ctrlDown = false;
1048
+ } else if (e.keyCode === this.KEY_ALT) {
1049
+ this.altDown = false;
1050
+ } else if (e.keyCode === this.KEY_SHIFT) {
1051
+ this.shiftDown = false;
1052
+ }
1053
+ this.keyDown[e.keyCode] = false;
1054
+ this.fire("keyup", e.keyCode, true);
1055
+ }
1056
+ });
1057
+
1058
+ this.element.addEventListener("mouseenter", this._mouseEnterListener = (e) => {
1059
+ if (!this.enabled) {
1060
+ return;
1061
+ }
1062
+ this.mouseover = true;
1063
+ this._getMouseCanvasPos(e);
1064
+ this.fire("mouseenter", this.mouseCanvasPos, true);
1065
+ });
1066
+
1067
+ this.element.addEventListener("mouseleave", this._mouseLeaveListener = (e) => {
1068
+ if (!this.enabled) {
1069
+ return;
1070
+ }
1071
+ this.mouseover = false;
1072
+ this._getMouseCanvasPos(e);
1073
+ this.fire("mouseleave", this.mouseCanvasPos, true);
1074
+ });
1075
+
1076
+ this.element.addEventListener("mousedown", this._mouseDownListener = (e) => {
1077
+ if (!this.enabled) {
1078
+ return;
1079
+ }
1080
+ switch (e.which) {
1081
+ case 1:// Left button
1082
+ this.mouseDownLeft = true;
1083
+ break;
1084
+ case 2:// Middle/both buttons
1085
+ this.mouseDownMiddle = true;
1086
+ break;
1087
+ case 3:// Right button
1088
+ this.mouseDownRight = true;
1089
+ break;
1090
+ default:
1091
+ break;
1092
+ }
1093
+ this._getMouseCanvasPos(e);
1094
+ this.element.focus();
1095
+ this.fire("mousedown", this.mouseCanvasPos, true);
1096
+ if (this.mouseover) {
1097
+ e.preventDefault();
1098
+ }
1099
+ });
1100
+
1101
+ document.addEventListener("mouseup", this._mouseUpListener = (e) => {
1102
+ if (!this.enabled) {
1103
+ return;
1104
+ }
1105
+ switch (e.which) {
1106
+ case 1:// Left button
1107
+ this.mouseDownLeft = false;
1108
+ break;
1109
+ case 2:// Middle/both buttons
1110
+ this.mouseDownMiddle = false;
1111
+ break;
1112
+ case 3:// Right button
1113
+ this.mouseDownRight = false;
1114
+ break;
1115
+ default:
1116
+ break;
1117
+ }
1118
+ this.fire("mouseup", this.mouseCanvasPos, true);
1119
+ // if (this.mouseover) {
1120
+ // e.preventDefault();
1121
+ // }
1122
+ }, true);
1123
+
1124
+ document.addEventListener("click", this._clickListener = (e) => {
1125
+ if (!this.enabled) {
1126
+ return;
1127
+ }
1128
+ switch (e.which) {
1129
+ case 1:// Left button
1130
+ this.mouseDownLeft = false;
1131
+ this.mouseDownRight = false;
1132
+ break;
1133
+ case 2:// Middle/both buttons
1134
+ this.mouseDownMiddle = false;
1135
+ break;
1136
+ case 3:// Right button
1137
+ this.mouseDownLeft = false;
1138
+ this.mouseDownRight = false;
1139
+ break;
1140
+ default:
1141
+ break;
1142
+ }
1143
+ this._getMouseCanvasPos(e);
1144
+ this.fire("click", this.mouseCanvasPos, true);
1145
+ if (this.mouseover) {
1146
+ e.preventDefault();
1147
+ }
1148
+ });
1149
+
1150
+ document.addEventListener("dblclick", this._dblClickListener = (e) => {
1151
+ if (!this.enabled) {
1152
+ return;
1153
+ }
1154
+ switch (e.which) {
1155
+ case 1:// Left button
1156
+ this.mouseDownLeft = false;
1157
+ this.mouseDownRight = false;
1158
+ break;
1159
+ case 2:// Middle/both buttons
1160
+ this.mouseDownMiddle = false;
1161
+ break;
1162
+ case 3:// Right button
1163
+ this.mouseDownLeft = false;
1164
+ this.mouseDownRight = false;
1165
+ break;
1166
+ default:
1167
+ break;
1168
+ }
1169
+ // this._getMousePagePos(e);
1170
+ this._getMouseCanvasPos(e);
1171
+ this.fire("dblclick", this.mouseCanvasPos, true);
1172
+ if (this.mouseover) {
1173
+ e.preventDefault();
1174
+ }
1175
+ });
1176
+
1177
+ this.element.addEventListener("mousemove", this._mouseMoveListener = (e) => {
1178
+ if (!this.enabled) {
1179
+ return;
1180
+ }
1181
+ this._getMouseCanvasPos(e);
1182
+ this.fire("mousemove", this.mouseCanvasPos, true);
1183
+ if (this.mouseover) {
1184
+ e.preventDefault();
1185
+ }
1186
+ });
1187
+
1188
+ this.element.addEventListener("wheel", this._mouseWheelListener = (e, d) => {
1189
+ if (!this.enabled) {
1190
+ return;
1191
+ }
1192
+ const delta = Math.max(-1, Math.min(1, -e.deltaY * 40));
1193
+ this.fire("mousewheel", delta, true);
1194
+ }, {passive: true});
1195
+
1196
+ // mouseclicked
1197
+
1198
+ {
1199
+ let downX;
1200
+ let downY;
1201
+ // Tolerance between down and up positions for a mouse click
1202
+ const tolerance = 2;
1203
+ this.on("mousedown", (params) => {
1204
+ downX = params[0];
1205
+ downY = params[1];
1206
+ });
1207
+ this.on("mouseup", (params) => {
1208
+ if (downX >= (params[0] - tolerance) &&
1209
+ downX <= (params[0] + tolerance) &&
1210
+ downY >= (params[1] - tolerance) &&
1211
+ downY <= (params[1] + tolerance)) {
1212
+ this.fire("mouseclicked", params, true);
1213
+ }
1214
+ });
1215
+ }
1216
+
1217
+ // VR
1218
+
1219
+ {
1220
+
1221
+ const orientationAngleLookup = {
1222
+ 'landscape-primary': 90,
1223
+ 'landscape-secondary': -90,
1224
+ 'portrait-secondary': 180,
1225
+ 'portrait-primary': 0
1226
+ };
1227
+
1228
+ let orientation;
1229
+ let orientationAngle;
1230
+ const acceleration = math.vec3();
1231
+ const accelerationIncludingGravity = math.vec3();
1232
+
1233
+ const orientationChangeEvent = {
1234
+ orientation: null,
1235
+ orientationAngle: 0
1236
+ };
1237
+
1238
+ const deviceMotionEvent = {
1239
+ orientationAngle: 0,
1240
+ acceleration: null,
1241
+ accelerationIncludingGravity: accelerationIncludingGravity,
1242
+ rotationRate: math.vec3(),
1243
+ interval: 0
1244
+ };
1245
+
1246
+ const deviceOrientationEvent = {
1247
+ alpha: 0,
1248
+ beta: 0,
1249
+ gamma: 0,
1250
+ absolute: false
1251
+ };
1252
+
1253
+ if (window.OrientationChangeEvent) {
1254
+ window.addEventListener('orientationchange', this._orientationchangedListener = () => {
1255
+
1256
+ orientation = window.screen.orientation || window.screen.mozOrientation || window.msOrientation || null;
1257
+ orientationAngle = orientation ? (orientationAngleLookup[orientation] || 0) : 0;
1258
+
1259
+ orientationChangeEvent.orientation = orientation;
1260
+ orientationChangeEvent.orientationAngle = orientationAngle;
1261
+
1262
+ /**
1263
+ * Fired when the orientation of the device has changed.
1264
+ *
1265
+ * @event orientationchange
1266
+ * @param orientation The orientation: "landscape-primary", "landscape-secondary", "portrait-secondary" or "portrait-primary"
1267
+ * @param orientationAngle The orientation angle in degrees: 90 for landscape-primary, -90 for landscape-secondary, 180 for portrait-secondary or 0 for portrait-primary.
1268
+ */
1269
+ this.fire("orientationchange", orientationChangeEvent);
1270
+ },
1271
+ false);
1272
+ }
1273
+
1274
+ if (window.DeviceMotionEvent) {
1275
+ window.addEventListener('devicemotion', this._deviceMotionListener = (e) => {
1276
+
1277
+ deviceMotionEvent.interval = e.interval;
1278
+ deviceMotionEvent.orientationAngle = orientationAngle;
1279
+
1280
+ const accel = e.acceleration;
1281
+
1282
+ if (accel) {
1283
+ acceleration[0] = accel.x;
1284
+ acceleration[1] = accel.y;
1285
+ acceleration[2] = accel.z;
1286
+ deviceMotionEvent.acceleration = acceleration;
1287
+ } else {
1288
+ deviceMotionEvent.acceleration = null;
1289
+ }
1290
+
1291
+ const accelGrav = e.accelerationIncludingGravity;
1292
+
1293
+ if (accelGrav) {
1294
+ accelerationIncludingGravity[0] = accelGrav.x;
1295
+ accelerationIncludingGravity[1] = accelGrav.y;
1296
+ accelerationIncludingGravity[2] = accelGrav.z;
1297
+ deviceMotionEvent.accelerationIncludingGravity = accelerationIncludingGravity;
1298
+ } else {
1299
+ deviceMotionEvent.accelerationIncludingGravity = null;
1300
+ }
1301
+
1302
+ deviceMotionEvent.rotationRate = e.rotationRate;
1303
+
1304
+ /**
1305
+ * Fires on a regular interval and returns data about the rotation
1306
+ * (in degrees per second) and acceleration (in meters per second squared) of the device, at that moment in
1307
+ * time. Some devices do not have the hardware to exclude the effect of gravity.
1308
+ *
1309
+ * @event devicemotion
1310
+ * @param Float32Array acceleration The acceleration of the device, in meters per second squared, as a 3-element vector. This value has taken into account the effect of gravity and removed it from the figures. This value may not exist if the hardware doesn't know how to remove gravity from the acceleration data.
1311
+ * @param Float32Array accelerationIncludingGravity The acceleration of the device, in meters per second squared, as a 3-element vector. This value includes the effect of gravity, and may be the only value available on devices that don't have a gyroscope to allow them to properly remove gravity from the data.
1312
+ * @param, Number interval The interval, in milliseconds, at which this event is fired. The next event will be fired in approximately this amount of time.
1313
+ * @param Float32Array rotationRate The rates of rotation of the device about each axis, in degrees per second.
1314
+ */
1315
+ this.fire("devicemotion", deviceMotionEvent);
1316
+ },
1317
+ false);
1318
+ }
1319
+
1320
+ if (window.DeviceOrientationEvent) {
1321
+ window.addEventListener("deviceorientation", this._deviceOrientListener = (e) => {
1322
+
1323
+ deviceOrientationEvent.gamma = e.gamma;
1324
+ deviceOrientationEvent.beta = e.beta;
1325
+ deviceOrientationEvent.alpha = e.alpha;
1326
+ deviceOrientationEvent.absolute = e.absolute;
1327
+
1328
+ /**
1329
+ * Fired when fresh data is available from an orientation sensor about the current orientation
1330
+ * of the device as compared to the Earth coordinate frame. This data is gathered from a
1331
+ * magnetometer inside the device. See
1332
+ * <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Orientation_and_motion_data_explained">Orientation and motion data explained</a> for more info.
1333
+ *
1334
+ * @event deviceorientation
1335
+ * @param Number alpha The current orientation of the device around the Z axis in degrees; that is, how far the device is rotated around a line perpendicular to the device.
1336
+ * @param Number beta The current orientation of the device around the X axis in degrees; that is, how far the device is tipped forward or backward.
1337
+ * @param Number gamma The current orientation of the device around the Y axis in degrees; that is, how far the device is turned left or right.
1338
+ * @param Boolean absolute This value is true if the orientation is provided as a difference between the device coordinate frame and the Earth coordinate frame; if the device can't detect the Earth coordinate frame, this value is false.
1339
+ */
1340
+ this.fire("deviceorientation", deviceOrientationEvent);
1341
+ },
1342
+ false);
1343
+ }
1344
+ }
1345
+ this._eventsBound = true;
1346
+ }
1347
+
1348
+ _unbindEvents() {
1349
+ if (!this._eventsBound) {
1350
+ return;
1351
+ }
1352
+ document.removeEventListener("keydown", this._keyDownListener);
1353
+ document.removeEventListener("keyup", this._keyUpListener);
1354
+ this.element.removeEventListener("mouseenter", this._mouseEnterListener);
1355
+ this.element.removeEventListener("mouseleave", this._mouseLeaveListener);
1356
+ this.element.removeEventListener("mousedown", this._mouseDownListener);
1357
+ document.removeEventListener("mouseup", this._mouseDownListener);
1358
+ document.removeEventListener("click", this._clickListener);
1359
+ document.removeEventListener("dblclick", this._dblClickListener);
1360
+ this.element.removeEventListener("mousemove", this._mouseMoveListener);
1361
+ this.element.removeEventListener("wheel", this._mouseWheelListener);
1362
+ if (window.OrientationChangeEvent) {
1363
+ window.removeEventListener('orientationchange', this._orientationchangedListener);
1364
+ }
1365
+ if (window.DeviceMotionEvent) {
1366
+ window.removeEventListener('devicemotion', this._deviceMotionListener);
1367
+ }
1368
+ if (window.DeviceOrientationEvent) {
1369
+ window.removeEventListener("deviceorientation", this._deviceOrientListener);
1370
+ }
1371
+ this._eventsBound = false;
1372
+ }
1373
+
1374
+ _getMouseCanvasPos(event) {
1375
+ if (!event) {
1376
+ event = window.event;
1377
+ this.mouseCanvasPos[0] = event.x;
1378
+ this.mouseCanvasPos[1] = event.y;
1379
+ } else {
1380
+ let element = event.target;
1381
+ let totalOffsetLeft = 0;
1382
+ let totalOffsetTop = 0;
1383
+ while (element.offsetParent) {
1384
+ totalOffsetLeft += element.offsetLeft;
1385
+ totalOffsetTop += element.offsetTop;
1386
+ element = element.offsetParent;
1387
+ }
1388
+ this.mouseCanvasPos[0] = event.pageX - totalOffsetLeft;
1389
+ this.mouseCanvasPos[1] = event.pageY - totalOffsetTop;
1390
+ }
1391
+ }
1392
+ // 获取page位置
1393
+ _getMousePagePos(event) {
1394
+ if (!event) {
1395
+ event = window.event;
1396
+ this.mousePagePos[0] = event.x;
1397
+ this.mousePagePos[1] = event.y;
1398
+ } else {
1399
+ // console.log("x:"+ event.pageX+" y:"+event.pageY)
1400
+ let element = event.target;
1401
+ let totalOffsetLeft = 0;
1402
+ let totalOffsetTop = 0;
1403
+ while (element.offsetParent) {
1404
+ totalOffsetLeft += element.offsetLeft;
1405
+ totalOffsetTop += element.offsetTop;
1406
+ element = element.offsetParent;
1407
+ }
1408
+ this.mousePagePos[0] = event.pageX - totalOffsetLeft;
1409
+ this.mousePagePos[1] = event.pageY - totalOffsetTop;
1410
+ this.mousePagePos[2] = event.pageX;
1411
+ this.mousePagePos[3] = event.pageY;
1412
+ }
1413
+ }
1414
+
1415
+
1416
+ /**
1417
+ * Sets whether input handlers are enabled.
1418
+ *
1419
+ * Default value is ````true````.
1420
+ *
1421
+ * @param {Boolean} enable Indicates if input handlers are enabled.
1422
+ */
1423
+ setEnabled(enable) {
1424
+ if (this.enabled !== enable) {
1425
+ this.fire("enabled", this.enabled = enable);
1426
+ }
1427
+ }
1428
+
1429
+ /**
1430
+ * Gets whether input handlers are enabled.
1431
+ *
1432
+ * Default value is ````true````.
1433
+ *
1434
+ * @returns {Boolean} Indicates if input handlers are enabled.
1435
+ */
1436
+ getEnabled() {
1437
+ return this.enabled;
1438
+ }
1439
+
1440
+ /**
1441
+ * Sets whether or not keyboard input is enabled.
1442
+ *
1443
+ * Default value is ````true````.
1444
+ *
1445
+ * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
1446
+ *
1447
+ * @param {Boolean} value Indicates whether keyboard input is enabled.
1448
+ */
1449
+ setKeyboardEnabled(value) {
1450
+ this.keyboardEnabled = value;
1451
+ }
1452
+
1453
+ /**
1454
+ * Gets whether keyboard input is enabled.
1455
+ *
1456
+ * Default value is ````true````.
1457
+ *
1458
+ * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
1459
+ *
1460
+ * @returns {Boolean} Returns whether keyboard input is enabled.
1461
+ */
1462
+ getKeyboardEnabled() {
1463
+ return this.keyboardEnabled;
1464
+ }
1465
+
1466
+ /**
1467
+ * @private
1468
+ */
1469
+ destroy() {
1470
+ super.destroy();
1471
+ this._unbindEvents();
1472
+ }
1473
+ }
1474
+
1475
+ export {Input};