@aibee/owlly 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (500) hide show
  1. package/README.external.md +75 -0
  2. package/README.md +28 -0
  3. package/lib/src/external/lines/line-geometry.d.ts +9 -0
  4. package/lib/src/external/lines/line-geometry.js +52 -0
  5. package/lib/src/external/lines/line-geometry.js.map +1 -0
  6. package/lib/src/external/lines/line-material.d.ts +10 -0
  7. package/lib/src/external/lines/line-material.js +377 -0
  8. package/lib/src/external/lines/line-material.js.map +1 -0
  9. package/lib/src/external/lines/line-segments-2.d.ts +7 -0
  10. package/lib/src/external/lines/line-segments-2.js +144 -0
  11. package/lib/src/external/lines/line-segments-2.js.map +1 -0
  12. package/lib/src/external/lines/line-segments-geometry.d.ts +15 -0
  13. package/lib/src/external/lines/line-segments-geometry.js +141 -0
  14. package/lib/src/external/lines/line-segments-geometry.js.map +1 -0
  15. package/lib/src/external/loaders/gltf-loader.d.ts +77 -0
  16. package/lib/src/external/loaders/gltf-loader.js +2319 -0
  17. package/lib/src/external/loaders/gltf-loader.js.map +1 -0
  18. package/lib/src/external/orbit-controls.d.ts +44 -0
  19. package/lib/src/external/orbit-controls.js +746 -0
  20. package/lib/src/external/orbit-controls.js.map +1 -0
  21. package/lib/src/external/renderers/css-2d-renderer.d.ts +16 -0
  22. package/lib/src/external/renderers/css-2d-renderer.js +122 -0
  23. package/lib/src/external/renderers/css-2d-renderer.js.map +1 -0
  24. package/lib/src/external/renderers/css-3d-renderer.d.ts +18 -0
  25. package/lib/src/external/renderers/css-3d-renderer.js +139 -0
  26. package/lib/src/external/renderers/css-3d-renderer.js.map +1 -0
  27. package/lib/src/external/transform-controls.d.ts +106 -0
  28. package/lib/src/external/transform-controls.js +1113 -0
  29. package/lib/src/external/transform-controls.js.map +1 -0
  30. package/lib/src/external/util/buffer-geometry-utils.d.ts +45 -0
  31. package/lib/src/external/util/buffer-geometry-utils.js +569 -0
  32. package/lib/src/external/util/buffer-geometry-utils.js.map +1 -0
  33. package/lib/src/owlly/controller/aerial-element-controller.d.ts +65 -0
  34. package/lib/src/owlly/controller/aerial-element-controller.js +236 -0
  35. package/lib/src/owlly/controller/aerial-element-controller.js.map +1 -0
  36. package/lib/src/owlly/controller/basic-controller.d.ts +324 -0
  37. package/lib/src/owlly/controller/basic-controller.js +1239 -0
  38. package/lib/src/owlly/controller/basic-controller.js.map +1 -0
  39. package/lib/src/owlly/controller/camera-controller.d.ts +37 -0
  40. package/lib/src/owlly/controller/camera-controller.js +138 -0
  41. package/lib/src/owlly/controller/camera-controller.js.map +1 -0
  42. package/lib/src/owlly/controller/controller.d.ts +61 -0
  43. package/lib/src/owlly/controller/controller.js +24 -0
  44. package/lib/src/owlly/controller/controller.js.map +1 -0
  45. package/lib/src/owlly/controller/index.d.ts +2 -0
  46. package/lib/src/owlly/controller/index.js +14 -0
  47. package/lib/src/owlly/controller/index.js.map +1 -0
  48. package/lib/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
  49. package/lib/src/owlly/controller/mouse-indicator-controller.js +119 -0
  50. package/lib/src/owlly/controller/mouse-indicator-controller.js.map +1 -0
  51. package/lib/src/owlly/controller/orbit-control.d.ts +147 -0
  52. package/lib/src/owlly/controller/orbit-control.js +265 -0
  53. package/lib/src/owlly/controller/orbit-control.js.map +1 -0
  54. package/lib/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
  55. package/lib/src/owlly/controller/panorama-adjust-controller.js +158 -0
  56. package/lib/src/owlly/controller/panorama-adjust-controller.js.map +1 -0
  57. package/lib/src/owlly/controller/panorama-controller.d.ts +441 -0
  58. package/lib/src/owlly/controller/panorama-controller.js +1944 -0
  59. package/lib/src/owlly/controller/panorama-controller.js.map +1 -0
  60. package/lib/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
  61. package/lib/src/owlly/controller/panorama-transform-controller.js +137 -0
  62. package/lib/src/owlly/controller/panorama-transform-controller.js.map +1 -0
  63. package/lib/src/owlly/controller/plane-controller.d.ts +43 -0
  64. package/lib/src/owlly/controller/plane-controller.js +174 -0
  65. package/lib/src/owlly/controller/plane-controller.js.map +1 -0
  66. package/lib/src/owlly/controller/texture-controller.d.ts +181 -0
  67. package/lib/src/owlly/controller/texture-controller.js +876 -0
  68. package/lib/src/owlly/controller/texture-controller.js.map +1 -0
  69. package/lib/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
  70. package/lib/src/owlly/controller/tile-panorama-controller.js +1354 -0
  71. package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -0
  72. package/lib/src/owlly/controller/transform-controller.d.ts +106 -0
  73. package/lib/src/owlly/controller/transform-controller.js +546 -0
  74. package/lib/src/owlly/controller/transform-controller.js.map +1 -0
  75. package/lib/src/owlly/element/bottom-nav-element.d.ts +65 -0
  76. package/lib/src/owlly/element/bottom-nav-element.js +258 -0
  77. package/lib/src/owlly/element/bottom-nav-element.js.map +1 -0
  78. package/lib/src/owlly/element/camera.d.ts +82 -0
  79. package/lib/src/owlly/element/camera.js +284 -0
  80. package/lib/src/owlly/element/camera.js.map +1 -0
  81. package/lib/src/owlly/element/dom-2d-element.d.ts +35 -0
  82. package/lib/src/owlly/element/dom-2d-element.js +49 -0
  83. package/lib/src/owlly/element/dom-2d-element.js.map +1 -0
  84. package/lib/src/owlly/element/dom-3d-element.d.ts +27 -0
  85. package/lib/src/owlly/element/dom-3d-element.js +34 -0
  86. package/lib/src/owlly/element/dom-3d-element.js.map +1 -0
  87. package/lib/src/owlly/element/dom-label-2d.d.ts +116 -0
  88. package/lib/src/owlly/element/dom-label-2d.js +383 -0
  89. package/lib/src/owlly/element/dom-label-2d.js.map +1 -0
  90. package/lib/src/owlly/element/element.d.ts +53 -0
  91. package/lib/src/owlly/element/element.js +76 -0
  92. package/lib/src/owlly/element/element.js.map +1 -0
  93. package/lib/src/owlly/element/floor-model.d.ts +83 -0
  94. package/lib/src/owlly/element/floor-model.js +228 -0
  95. package/lib/src/owlly/element/floor-model.js.map +1 -0
  96. package/lib/src/owlly/element/gif-kit/Gif.d.ts +96 -0
  97. package/lib/src/owlly/element/gif-kit/Gif.js +433 -0
  98. package/lib/src/owlly/element/gif-kit/Gif.js.map +1 -0
  99. package/lib/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
  100. package/lib/src/owlly/element/gif-kit/GifColor.js +38 -0
  101. package/lib/src/owlly/element/gif-kit/GifColor.js.map +1 -0
  102. package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
  103. package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +51 -0
  104. package/lib/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js.map +1 -0
  105. package/lib/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
  106. package/lib/src/owlly/element/gif-kit/GifFrame.js +97 -0
  107. package/lib/src/owlly/element/gif-kit/GifFrame.js.map +1 -0
  108. package/lib/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
  109. package/lib/src/owlly/element/gif-kit/GifImage.js +8 -0
  110. package/lib/src/owlly/element/gif-kit/GifImage.js.map +1 -0
  111. package/lib/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
  112. package/lib/src/owlly/element/gif-kit/GifParser.js +197 -0
  113. package/lib/src/owlly/element/gif-kit/GifParser.js.map +1 -0
  114. package/lib/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
  115. package/lib/src/owlly/element/gif-kit/GifPresenter.js +44 -0
  116. package/lib/src/owlly/element/gif-kit/GifPresenter.js.map +1 -0
  117. package/lib/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
  118. package/lib/src/owlly/element/gif-kit/GifVersion.js +13 -0
  119. package/lib/src/owlly/element/gif-kit/GifVersion.js.map +1 -0
  120. package/lib/src/owlly/element/gltf-mesh-element.d.ts +31 -0
  121. package/lib/src/owlly/element/gltf-mesh-element.js +137 -0
  122. package/lib/src/owlly/element/gltf-mesh-element.js.map +1 -0
  123. package/lib/src/owlly/element/index.d.ts +20 -0
  124. package/lib/src/owlly/element/index.js +25 -0
  125. package/lib/src/owlly/element/index.js.map +1 -0
  126. package/lib/src/owlly/element/map-kit/area.d.ts +24 -0
  127. package/lib/src/owlly/element/map-kit/area.js +218 -0
  128. package/lib/src/owlly/element/map-kit/area.js.map +1 -0
  129. package/lib/src/owlly/element/map-kit/block-set.d.ts +39 -0
  130. package/lib/src/owlly/element/map-kit/block-set.js +91 -0
  131. package/lib/src/owlly/element/map-kit/block-set.js.map +1 -0
  132. package/lib/src/owlly/element/map-kit/block.d.ts +77 -0
  133. package/lib/src/owlly/element/map-kit/block.js +339 -0
  134. package/lib/src/owlly/element/map-kit/block.js.map +1 -0
  135. package/lib/src/owlly/element/map-kit/index.d.ts +4 -0
  136. package/lib/src/owlly/element/map-kit/index.js +7 -0
  137. package/lib/src/owlly/element/map-kit/index.js.map +1 -0
  138. package/lib/src/owlly/element/map-kit/shape.d.ts +131 -0
  139. package/lib/src/owlly/element/map-kit/shape.js +190 -0
  140. package/lib/src/owlly/element/map-kit/shape.js.map +1 -0
  141. package/lib/src/owlly/element/mesh-element.d.ts +22 -0
  142. package/lib/src/owlly/element/mesh-element.js +64 -0
  143. package/lib/src/owlly/element/mesh-element.js.map +1 -0
  144. package/lib/src/owlly/element/mesh-line-2d.d.ts +82 -0
  145. package/lib/src/owlly/element/mesh-line-2d.js +888 -0
  146. package/lib/src/owlly/element/mesh-line-2d.js.map +1 -0
  147. package/lib/src/owlly/element/meshline-o.d.ts +64 -0
  148. package/lib/src/owlly/element/meshline-o.js +679 -0
  149. package/lib/src/owlly/element/meshline-o.js.map +1 -0
  150. package/lib/src/owlly/element/panorama-group.d.ts +241 -0
  151. package/lib/src/owlly/element/panorama-group.js +967 -0
  152. package/lib/src/owlly/element/panorama-group.js.map +1 -0
  153. package/lib/src/owlly/element/panorama.d.ts +132 -0
  154. package/lib/src/owlly/element/panorama.js +813 -0
  155. package/lib/src/owlly/element/panorama.js.map +1 -0
  156. package/lib/src/owlly/element/path-group.d.ts +69 -0
  157. package/lib/src/owlly/element/path-group.js +172 -0
  158. package/lib/src/owlly/element/path-group.js.map +1 -0
  159. package/lib/src/owlly/element/path.d.ts +99 -0
  160. package/lib/src/owlly/element/path.js +532 -0
  161. package/lib/src/owlly/element/path.js.map +1 -0
  162. package/lib/src/owlly/element/placeable-2d.d.ts +158 -0
  163. package/lib/src/owlly/element/placeable-2d.js +471 -0
  164. package/lib/src/owlly/element/placeable-2d.js.map +1 -0
  165. package/lib/src/owlly/element/polygon-mesh.d.ts +107 -0
  166. package/lib/src/owlly/element/polygon-mesh.js +308 -0
  167. package/lib/src/owlly/element/polygon-mesh.js.map +1 -0
  168. package/lib/src/owlly/element/ring-element.d.ts +79 -0
  169. package/lib/src/owlly/element/ring-element.js +384 -0
  170. package/lib/src/owlly/element/ring-element.js.map +1 -0
  171. package/lib/src/owlly/element/sphere-mesh.d.ts +28 -0
  172. package/lib/src/owlly/element/sphere-mesh.js +70 -0
  173. package/lib/src/owlly/element/sphere-mesh.js.map +1 -0
  174. package/lib/src/owlly/element/svg-floor-model.d.ts +22 -0
  175. package/lib/src/owlly/element/svg-floor-model.js +185 -0
  176. package/lib/src/owlly/element/svg-floor-model.js.map +1 -0
  177. package/lib/src/owlly/element/svg-floors.d.ts +27 -0
  178. package/lib/src/owlly/element/svg-floors.js +110 -0
  179. package/lib/src/owlly/element/svg-floors.js.map +1 -0
  180. package/lib/src/owlly/element/tile-panorama-group.d.ts +335 -0
  181. package/lib/src/owlly/element/tile-panorama-group.js +1007 -0
  182. package/lib/src/owlly/element/tile-panorama-group.js.map +1 -0
  183. package/lib/src/owlly/element/tile-panorama.d.ts +161 -0
  184. package/lib/src/owlly/element/tile-panorama.js +511 -0
  185. package/lib/src/owlly/element/tile-panorama.js.map +1 -0
  186. package/lib/src/owlly/element/tile-plane.d.ts +105 -0
  187. package/lib/src/owlly/element/tile-plane.js +361 -0
  188. package/lib/src/owlly/element/tile-plane.js.map +1 -0
  189. package/lib/src/owlly/element/video-element.d.ts +33 -0
  190. package/lib/src/owlly/element/video-element.js +160 -0
  191. package/lib/src/owlly/element/video-element.js.map +1 -0
  192. package/lib/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
  193. package/lib/src/owlly/geometries/ExtrudeGeometry2.js +211 -0
  194. package/lib/src/owlly/geometries/ExtrudeGeometry2.js.map +1 -0
  195. package/lib/src/owlly/index.d.ts +13 -0
  196. package/lib/src/owlly/index.js +17 -0
  197. package/lib/src/owlly/index.js.map +1 -0
  198. package/lib/src/owlly/overlay/canvas-overlay.d.ts +96 -0
  199. package/lib/src/owlly/overlay/canvas-overlay.js +511 -0
  200. package/lib/src/owlly/overlay/canvas-overlay.js.map +1 -0
  201. package/lib/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
  202. package/lib/src/owlly/overlay/css-2d-overlay.js +36 -0
  203. package/lib/src/owlly/overlay/css-2d-overlay.js.map +1 -0
  204. package/lib/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
  205. package/lib/src/owlly/overlay/css-3d-overlay.js +37 -0
  206. package/lib/src/owlly/overlay/css-3d-overlay.js.map +1 -0
  207. package/lib/src/owlly/overlay/index.d.ts +6 -0
  208. package/lib/src/owlly/overlay/index.js +12 -0
  209. package/lib/src/owlly/overlay/index.js.map +1 -0
  210. package/lib/src/owlly/overlay/label-overlay.d.ts +62 -0
  211. package/lib/src/owlly/overlay/label-overlay.js +329 -0
  212. package/lib/src/owlly/overlay/label-overlay.js.map +1 -0
  213. package/lib/src/owlly/overlay/overlay.d.ts +14 -0
  214. package/lib/src/owlly/overlay/overlay.js +5 -0
  215. package/lib/src/owlly/overlay/overlay.js.map +1 -0
  216. package/lib/src/owlly/overlay/path-overlay.d.ts +39 -0
  217. package/lib/src/owlly/overlay/path-overlay.js +125 -0
  218. package/lib/src/owlly/overlay/path-overlay.js.map +1 -0
  219. package/lib/src/owlly/overlay/path-overlay2.d.ts +35 -0
  220. package/lib/src/owlly/overlay/path-overlay2.js +119 -0
  221. package/lib/src/owlly/overlay/path-overlay2.js.map +1 -0
  222. package/lib/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
  223. package/lib/src/owlly/overlay/poi-overlay-3d.js +1433 -0
  224. package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -0
  225. package/lib/src/owlly/overlay/poi-overlay.d.ts +277 -0
  226. package/lib/src/owlly/overlay/poi-overlay.js +1412 -0
  227. package/lib/src/owlly/overlay/poi-overlay.js.map +1 -0
  228. package/lib/src/owlly/owlly-2d/index.d.ts +28 -0
  229. package/lib/src/owlly/owlly-2d/index.js +93 -0
  230. package/lib/src/owlly/owlly-2d/index.js.map +1 -0
  231. package/lib/src/owlly/screen/index.d.ts +1 -0
  232. package/lib/src/owlly/screen/index.js +2 -0
  233. package/lib/src/owlly/screen/index.js.map +1 -0
  234. package/lib/src/owlly/screen/screen.d.ts +73 -0
  235. package/lib/src/owlly/screen/screen.js +237 -0
  236. package/lib/src/owlly/screen/screen.js.map +1 -0
  237. package/lib/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
  238. package/lib/src/owlly/stage/__test__/stage.spec.js +15 -0
  239. package/lib/src/owlly/stage/__test__/stage.spec.js.map +1 -0
  240. package/lib/src/owlly/stage/externals.d.ts +19 -0
  241. package/lib/src/owlly/stage/externals.js +25 -0
  242. package/lib/src/owlly/stage/externals.js.map +1 -0
  243. package/lib/src/owlly/stage/index.d.ts +4 -0
  244. package/lib/src/owlly/stage/index.js +7 -0
  245. package/lib/src/owlly/stage/index.js.map +1 -0
  246. package/lib/src/owlly/stage/owlly.d.ts +38 -0
  247. package/lib/src/owlly/stage/owlly.js +168 -0
  248. package/lib/src/owlly/stage/owlly.js.map +1 -0
  249. package/lib/src/owlly/stage/stage.d.ts +108 -0
  250. package/lib/src/owlly/stage/stage.js +235 -0
  251. package/lib/src/owlly/stage/stage.js.map +1 -0
  252. package/lib/src/owlly/utils/alignment-utils.d.ts +20 -0
  253. package/lib/src/owlly/utils/alignment-utils.js +64 -0
  254. package/lib/src/owlly/utils/alignment-utils.js.map +1 -0
  255. package/lib/src/owlly/utils/basic-calc.d.ts +18 -0
  256. package/lib/src/owlly/utils/basic-calc.js +130 -0
  257. package/lib/src/owlly/utils/basic-calc.js.map +1 -0
  258. package/lib/src/owlly/utils/basic-tools.d.ts +71 -0
  259. package/lib/src/owlly/utils/basic-tools.js +236 -0
  260. package/lib/src/owlly/utils/basic-tools.js.map +1 -0
  261. package/lib/src/owlly/utils/bvh-tree.d.ts +105 -0
  262. package/lib/src/owlly/utils/bvh-tree.js +540 -0
  263. package/lib/src/owlly/utils/bvh-tree.js.map +1 -0
  264. package/lib/src/owlly/utils/camera.d.ts +37 -0
  265. package/lib/src/owlly/utils/camera.js +51 -0
  266. package/lib/src/owlly/utils/camera.js.map +1 -0
  267. package/lib/src/owlly/utils/cube-texture-cache.d.ts +25 -0
  268. package/lib/src/owlly/utils/cube-texture-cache.js +144 -0
  269. package/lib/src/owlly/utils/cube-texture-cache.js.map +1 -0
  270. package/lib/src/owlly/utils/device-utils.d.ts +18 -0
  271. package/lib/src/owlly/utils/device-utils.js +42 -0
  272. package/lib/src/owlly/utils/device-utils.js.map +1 -0
  273. package/lib/src/owlly/utils/environment-utils.d.ts +37 -0
  274. package/lib/src/owlly/utils/environment-utils.js +74 -0
  275. package/lib/src/owlly/utils/environment-utils.js.map +1 -0
  276. package/lib/src/owlly/utils/event-hub.d.ts +50 -0
  277. package/lib/src/owlly/utils/event-hub.js +107 -0
  278. package/lib/src/owlly/utils/event-hub.js.map +1 -0
  279. package/lib/src/owlly/utils/events.d.ts +219 -0
  280. package/lib/src/owlly/utils/events.js +220 -0
  281. package/lib/src/owlly/utils/events.js.map +1 -0
  282. package/lib/src/owlly/utils/geometry-utils.d.ts +119 -0
  283. package/lib/src/owlly/utils/geometry-utils.js +623 -0
  284. package/lib/src/owlly/utils/geometry-utils.js.map +1 -0
  285. package/lib/src/owlly/utils/helper.d.ts +6 -0
  286. package/lib/src/owlly/utils/helper.js +25 -0
  287. package/lib/src/owlly/utils/helper.js.map +1 -0
  288. package/lib/src/owlly/utils/index.d.ts +14 -0
  289. package/lib/src/owlly/utils/index.js +18 -0
  290. package/lib/src/owlly/utils/index.js.map +1 -0
  291. package/lib/src/owlly/utils/lru-cache.d.ts +26 -0
  292. package/lib/src/owlly/utils/lru-cache.js +110 -0
  293. package/lib/src/owlly/utils/lru-cache.js.map +1 -0
  294. package/lib/src/owlly/utils/map-utils.d.ts +7 -0
  295. package/lib/src/owlly/utils/map-utils.js +53 -0
  296. package/lib/src/owlly/utils/map-utils.js.map +1 -0
  297. package/lib/src/owlly/utils/number-utils.d.ts +8 -0
  298. package/lib/src/owlly/utils/number-utils.js +73 -0
  299. package/lib/src/owlly/utils/number-utils.js.map +1 -0
  300. package/lib/src/owlly/utils/panorama-model-util.d.ts +46 -0
  301. package/lib/src/owlly/utils/panorama-model-util.js +246 -0
  302. package/lib/src/owlly/utils/panorama-model-util.js.map +1 -0
  303. package/lib/src/owlly/utils/path-utils.d.ts +80 -0
  304. package/lib/src/owlly/utils/path-utils.js +729 -0
  305. package/lib/src/owlly/utils/path-utils.js.map +1 -0
  306. package/lib/src/owlly/utils/svgutils.d.ts +138 -0
  307. package/lib/src/owlly/utils/svgutils.js +562 -0
  308. package/lib/src/owlly/utils/svgutils.js.map +1 -0
  309. package/lib/src/owlly/utils/texture-cache.d.ts +29 -0
  310. package/lib/src/owlly/utils/texture-cache.js +116 -0
  311. package/lib/src/owlly/utils/texture-cache.js.map +1 -0
  312. package/lib/src/owlly/utils/tile-util.d.ts +187 -0
  313. package/lib/src/owlly/utils/tile-util.js +457 -0
  314. package/lib/src/owlly/utils/tile-util.js.map +1 -0
  315. package/lib/src/owlly/utils/time-profiler.d.ts +21 -0
  316. package/lib/src/owlly/utils/time-profiler.js +49 -0
  317. package/lib/src/owlly/utils/time-profiler.js.map +1 -0
  318. package/lib/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
  319. package/lib/src/owlly/view/__test__/perspective-view.spec.js +22 -0
  320. package/lib/src/owlly/view/__test__/perspective-view.spec.js.map +1 -0
  321. package/lib/src/owlly/view/camera-view.d.ts +35 -0
  322. package/lib/src/owlly/view/camera-view.js +102 -0
  323. package/lib/src/owlly/view/camera-view.js.map +1 -0
  324. package/lib/src/owlly/view/index.d.ts +3 -0
  325. package/lib/src/owlly/view/index.js +6 -0
  326. package/lib/src/owlly/view/index.js.map +1 -0
  327. package/lib/src/owlly/view/orthographic-view.d.ts +40 -0
  328. package/lib/src/owlly/view/orthographic-view.js +95 -0
  329. package/lib/src/owlly/view/orthographic-view.js.map +1 -0
  330. package/lib/src/owlly/view/perspective-view.d.ts +40 -0
  331. package/lib/src/owlly/view/perspective-view.js +96 -0
  332. package/lib/src/owlly/view/perspective-view.js.map +1 -0
  333. package/lib/src/owlly/view/svg-map-view.d.ts +46 -0
  334. package/lib/src/owlly/view/svg-map-view.js +145 -0
  335. package/lib/src/owlly/view/svg-map-view.js.map +1 -0
  336. package/lib/src/owlly/view/view.d.ts +146 -0
  337. package/lib/src/owlly/view/view.js +318 -0
  338. package/lib/src/owlly/view/view.js.map +1 -0
  339. package/lib/src/web/main.centroid.d.ts +0 -0
  340. package/lib/src/web/main.centroid.js +74 -0
  341. package/lib/src/web/main.centroid.js.map +1 -0
  342. package/lib/src/web/main.hyma.meshline2d.d.ts +1 -0
  343. package/lib/src/web/main.hyma.meshline2d.js +76 -0
  344. package/lib/src/web/main.hyma.meshline2d.js.map +1 -0
  345. package/lib/src/web/main.jyfang.sample.d.ts +0 -0
  346. package/lib/src/web/main.jyfang.sample.js +122 -0
  347. package/lib/src/web/main.jyfang.sample.js.map +1 -0
  348. package/lib/src/web/main.rpeng.extrude.d.ts +1 -0
  349. package/lib/src/web/main.rpeng.extrude.js +180 -0
  350. package/lib/src/web/main.rpeng.extrude.js.map +1 -0
  351. package/lib/src/web/main.rpeng.mes.plane.d.ts +1 -0
  352. package/lib/src/web/main.rpeng.mes.plane.js +135 -0
  353. package/lib/src/web/main.rpeng.mes.plane.js.map +1 -0
  354. package/lib/src/web/main.rpeng.sample.d.ts +0 -0
  355. package/lib/src/web/main.rpeng.sample.js +318 -0
  356. package/lib/src/web/main.rpeng.sample.js.map +1 -0
  357. package/lib/src/web/main.rpeng.vr.d.ts +1 -0
  358. package/lib/src/web/main.rpeng.vr.js +141 -0
  359. package/lib/src/web/main.rpeng.vr.js.map +1 -0
  360. package/lib/src/web/main.sample.d.ts +1 -0
  361. package/lib/src/web/main.sample.js +52 -0
  362. package/lib/src/web/main.sample.js.map +1 -0
  363. package/lib/src/web/quattree.hyma.d.ts +0 -0
  364. package/lib/src/web/quattree.hyma.js +150 -0
  365. package/lib/src/web/quattree.hyma.js.map +1 -0
  366. package/lib/src/web/sensor-vr-plugin.d.ts +0 -0
  367. package/lib/src/web/sensor-vr-plugin.js +166 -0
  368. package/lib/src/web/sensor-vr-plugin.js.map +1 -0
  369. package/package.json +142 -0
  370. package/src/@types/SceneUtils.d.ts +9 -0
  371. package/src/@types/chaikin-smooth.d.ts +5 -0
  372. package/src/@types/global.d.ts +3 -0
  373. package/src/@types/snapsvg.d.ts +11 -0
  374. package/src/@types/svgson.d.ts +30 -0
  375. package/src/assets/favicon.ico +0 -0
  376. package/src/external/lines/line-geometry.ts +70 -0
  377. package/src/external/lines/line-material.ts +453 -0
  378. package/src/external/lines/line-segments-2.ts +194 -0
  379. package/src/external/lines/line-segments-geometry.ts +197 -0
  380. package/src/external/loaders/gltf-loader.ts +3004 -0
  381. package/src/external/orbit-controls.ts +1070 -0
  382. package/src/external/renderers/css-2d-renderer.ts +185 -0
  383. package/src/external/renderers/css-3d-renderer.ts +245 -0
  384. package/src/external/transform-controls.ts +1532 -0
  385. package/src/external/util/buffer-geometry-utils.ts +783 -0
  386. package/src/owlly/controller/aerial-element-controller.ts +277 -0
  387. package/src/owlly/controller/basic-controller.ts +1509 -0
  388. package/src/owlly/controller/camera-controller.ts +155 -0
  389. package/src/owlly/controller/controller.ts +76 -0
  390. package/src/owlly/controller/index.ts +15 -0
  391. package/src/owlly/controller/mouse-indicator-controller.ts +157 -0
  392. package/src/owlly/controller/orbit-control.ts +310 -0
  393. package/src/owlly/controller/panorama-adjust-controller.ts +183 -0
  394. package/src/owlly/controller/panorama-controller.ts +2234 -0
  395. package/src/owlly/controller/panorama-transform-controller.ts +151 -0
  396. package/src/owlly/controller/plane-controller.ts +222 -0
  397. package/src/owlly/controller/texture-controller.ts +949 -0
  398. package/src/owlly/controller/tile-panorama-controller.ts +1633 -0
  399. package/src/owlly/controller/transform-controller.ts +684 -0
  400. package/src/owlly/element/bottom-nav-element.ts +352 -0
  401. package/src/owlly/element/camera.ts +389 -0
  402. package/src/owlly/element/dom-2d-element.ts +88 -0
  403. package/src/owlly/element/dom-3d-element.ts +87 -0
  404. package/src/owlly/element/dom-label-2d.ts +497 -0
  405. package/src/owlly/element/element.ts +117 -0
  406. package/src/owlly/element/floor-model.ts +290 -0
  407. package/src/owlly/element/gif-kit/Gif.ts +509 -0
  408. package/src/owlly/element/gif-kit/GifColor.ts +44 -0
  409. package/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.ts +56 -0
  410. package/src/owlly/element/gif-kit/GifFrame.ts +207 -0
  411. package/src/owlly/element/gif-kit/GifImage.ts +26 -0
  412. package/src/owlly/element/gif-kit/GifParser.ts +254 -0
  413. package/src/owlly/element/gif-kit/GifPresenter.ts +46 -0
  414. package/src/owlly/element/gif-kit/GifVersion.ts +12 -0
  415. package/src/owlly/element/gltf-mesh-element.ts +184 -0
  416. package/src/owlly/element/index.ts +25 -0
  417. package/src/owlly/element/map-kit/area.ts +232 -0
  418. package/src/owlly/element/map-kit/block-set.ts +102 -0
  419. package/src/owlly/element/map-kit/block.ts +417 -0
  420. package/src/owlly/element/map-kit/index.ts +6 -0
  421. package/src/owlly/element/map-kit/shape.ts +285 -0
  422. package/src/owlly/element/mesh-element.ts +94 -0
  423. package/src/owlly/element/mesh-line-2d.ts +1032 -0
  424. package/src/owlly/element/meshline-o.ts +802 -0
  425. package/src/owlly/element/panorama-group.ts +1250 -0
  426. package/src/owlly/element/panorama.ts +1044 -0
  427. package/src/owlly/element/path-group.ts +212 -0
  428. package/src/owlly/element/path.ts +727 -0
  429. package/src/owlly/element/placeable-2d.ts +627 -0
  430. package/src/owlly/element/polygon-mesh.ts +344 -0
  431. package/src/owlly/element/ring-element.ts +517 -0
  432. package/src/owlly/element/sphere-mesh.ts +96 -0
  433. package/src/owlly/element/svg-floor-model.ts +200 -0
  434. package/src/owlly/element/svg-floors.ts +121 -0
  435. package/src/owlly/element/tile-panorama-group.ts +1314 -0
  436. package/src/owlly/element/tile-panorama.ts +636 -0
  437. package/src/owlly/element/tile-plane.ts +430 -0
  438. package/src/owlly/element/video-element.ts +190 -0
  439. package/src/owlly/geometries/ExtrudeGeometry2.ts +255 -0
  440. package/src/owlly/index.ts +19 -0
  441. package/src/owlly/overlay/canvas-overlay.ts +642 -0
  442. package/src/owlly/overlay/css-2d-overlay.ts +48 -0
  443. package/src/owlly/overlay/css-3d-overlay.ts +50 -0
  444. package/src/owlly/overlay/index.ts +11 -0
  445. package/src/owlly/overlay/label-overlay.ts +419 -0
  446. package/src/owlly/overlay/overlay.ts +17 -0
  447. package/src/owlly/overlay/path-overlay.ts +170 -0
  448. package/src/owlly/overlay/path-overlay2.ts +149 -0
  449. package/src/owlly/overlay/poi-overlay-3d.ts +1759 -0
  450. package/src/owlly/overlay/poi-overlay.ts +1739 -0
  451. package/src/owlly/owlly-2d/index.ts +108 -0
  452. package/src/owlly/screen/index.ts +1 -0
  453. package/src/owlly/screen/screen.ts +323 -0
  454. package/src/owlly/stage/__test__/stage.spec.ts +15 -0
  455. package/src/owlly/stage/externals.ts +45 -0
  456. package/src/owlly/stage/index.ts +12 -0
  457. package/src/owlly/stage/owlly.ts +223 -0
  458. package/src/owlly/stage/stage.ts +274 -0
  459. package/src/owlly/utils/alignment-utils.ts +84 -0
  460. package/src/owlly/utils/basic-calc.ts +141 -0
  461. package/src/owlly/utils/basic-tools.ts +286 -0
  462. package/src/owlly/utils/bvh-tree.ts +695 -0
  463. package/src/owlly/utils/camera.ts +72 -0
  464. package/src/owlly/utils/cube-texture-cache.ts +155 -0
  465. package/src/owlly/utils/device-utils.ts +53 -0
  466. package/src/owlly/utils/environment-utils.ts +81 -0
  467. package/src/owlly/utils/event-hub.ts +120 -0
  468. package/src/owlly/utils/events.ts +266 -0
  469. package/src/owlly/utils/geometry-utils.ts +749 -0
  470. package/src/owlly/utils/helper.ts +33 -0
  471. package/src/owlly/utils/index.ts +17 -0
  472. package/src/owlly/utils/lru-cache.ts +126 -0
  473. package/src/owlly/utils/map-utils.ts +55 -0
  474. package/src/owlly/utils/number-utils.ts +75 -0
  475. package/src/owlly/utils/panorama-model-util.ts +255 -0
  476. package/src/owlly/utils/path-utils.ts +837 -0
  477. package/src/owlly/utils/svgutils.ts +732 -0
  478. package/src/owlly/utils/texture-cache.ts +132 -0
  479. package/src/owlly/utils/tile-util.ts +563 -0
  480. package/src/owlly/utils/time-profiler.ts +57 -0
  481. package/src/owlly/view/__test__/perspective-view.spec.ts +23 -0
  482. package/src/owlly/view/camera-view.ts +114 -0
  483. package/src/owlly/view/index.ts +5 -0
  484. package/src/owlly/view/orthographic-view.ts +124 -0
  485. package/src/owlly/view/perspective-view.ts +125 -0
  486. package/src/owlly/view/svg-map-view.ts +187 -0
  487. package/src/owlly/view/view.ts +409 -0
  488. package/src/public/js/jsmpeg.min.js +3129 -0
  489. package/src/web/index.html +52 -0
  490. package/src/web/main.centroid.ts +85 -0
  491. package/src/web/main.hyma.meshline2d.ts +84 -0
  492. package/src/web/main.jyfang.sample.ts +139 -0
  493. package/src/web/main.rpeng.extrude.ts +194 -0
  494. package/src/web/main.rpeng.mes.plane.ts +161 -0
  495. package/src/web/main.rpeng.sample.ts +345 -0
  496. package/src/web/main.rpeng.vr.ts +159 -0
  497. package/src/web/main.sample.ts +59 -0
  498. package/src/web/quattree.hyma.ts +163 -0
  499. package/src/web/sensor-vr-plugin.ts +201 -0
  500. package/src/web/testPixel.png +0 -0
@@ -0,0 +1,1113 @@
1
+ /* eslint-disable max-len, no-continue, @typescript-eslint/no-explicit-any, no-underscore-dangle, func-names, @typescript-eslint/no-this-alias, no-console */
2
+ import { Externals, NS_THREE } from '../owlly/stage/externals';
3
+ class TransformControlsGizmo extends NS_THREE.Object3D {
4
+ constructor() {
5
+ super();
6
+ this.isTransformControlsGizmo = true;
7
+ this.type = 'TransformControlsGizmo';
8
+ const { THREE } = Externals.getInstance();
9
+ // shared materials
10
+ const gizmoMaterial = new THREE.MeshBasicMaterial({
11
+ depthTest: false,
12
+ depthWrite: false,
13
+ transparent: true,
14
+ side: THREE.DoubleSide,
15
+ fog: false,
16
+ toneMapped: false,
17
+ });
18
+ const gizmoLineMaterial = new THREE.LineBasicMaterial({
19
+ depthTest: false,
20
+ depthWrite: false,
21
+ transparent: true,
22
+ linewidth: 1,
23
+ fog: false,
24
+ toneMapped: false,
25
+ });
26
+ // Make unique material for each axis/color
27
+ const matInvisible = gizmoMaterial.clone();
28
+ matInvisible.opacity = 0.15;
29
+ const matHelper = gizmoMaterial.clone();
30
+ matHelper.opacity = 0.33;
31
+ const matRed = gizmoMaterial.clone();
32
+ matRed.color.set(0xff0000);
33
+ const matGreen = gizmoMaterial.clone();
34
+ matGreen.color.set(0x00ff00);
35
+ const matBlue = gizmoMaterial.clone();
36
+ matBlue.color.set(0x0000ff);
37
+ const matWhiteTransparent = gizmoMaterial.clone();
38
+ matWhiteTransparent.opacity = 0.25;
39
+ const matYellowTransparent = matWhiteTransparent.clone();
40
+ matYellowTransparent.color.set(0xffff00);
41
+ const matCyanTransparent = matWhiteTransparent.clone();
42
+ matCyanTransparent.color.set(0x00ffff);
43
+ const matMagentaTransparent = matWhiteTransparent.clone();
44
+ matMagentaTransparent.color.set(0xff00ff);
45
+ const matYellow = gizmoMaterial.clone();
46
+ matYellow.color.set(0xffff00);
47
+ const matLineRed = gizmoLineMaterial.clone();
48
+ matLineRed.color.set(0xff0000);
49
+ const matLineGreen = gizmoLineMaterial.clone();
50
+ matLineGreen.color.set(0x00ff00);
51
+ const matLineBlue = gizmoLineMaterial.clone();
52
+ matLineBlue.color.set(0x0000ff);
53
+ const matLineCyan = gizmoLineMaterial.clone();
54
+ matLineCyan.color.set(0x00ffff);
55
+ const matLineMagenta = gizmoLineMaterial.clone();
56
+ matLineMagenta.color.set(0xff00ff);
57
+ const matLineYellow = gizmoLineMaterial.clone();
58
+ matLineYellow.color.set(0xffff00);
59
+ const matLineGray = gizmoLineMaterial.clone();
60
+ matLineGray.color.set(0x787878);
61
+ const matLineYellowTransparent = matLineYellow.clone();
62
+ matLineYellowTransparent.opacity = 0.25;
63
+ // reusable geometry
64
+ const arrowGeometry = new THREE.CylinderGeometry(0, 0.05, 0.2, 12, 1, false);
65
+ const scaleHandleGeometry = new THREE.BoxGeometry(0.125, 0.125, 0.125);
66
+ const lineGeometry = new THREE.BufferGeometry();
67
+ lineGeometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
68
+ const CircleGeometry = function (radius, arc) {
69
+ const geometry = new THREE.BufferGeometry();
70
+ const vertices = [];
71
+ for (let i = 0; i <= 64 * arc; ++i) {
72
+ vertices.push(0, Math.cos(i / 32 * Math.PI) * radius, Math.sin(i / 32 * Math.PI) * radius);
73
+ }
74
+ geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3));
75
+ return geometry;
76
+ };
77
+ // Special geometry for transform helper. If scaled with position vector it spans from [0,0,0] to position
78
+ const TranslateHelperGeometry = function () {
79
+ const geometry = new THREE.BufferGeometry();
80
+ geometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));
81
+ return geometry;
82
+ };
83
+ // Gizmo definitions - custom hierarchy definitions for setupGizmo() function
84
+ const gizmoTranslate = {
85
+ X: [
86
+ [new THREE.Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, -Math.PI / 2], null, 'fwd'],
87
+ [new THREE.Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, Math.PI / 2], null, 'bwd'],
88
+ [new THREE.Line(lineGeometry, matLineRed)],
89
+ ],
90
+ Y: [
91
+ [new THREE.Mesh(arrowGeometry, matGreen), [0, 1, 0], null, null, 'fwd'],
92
+ [new THREE.Mesh(arrowGeometry, matGreen), [0, 1, 0], [Math.PI, 0, 0], null, 'bwd'],
93
+ [new THREE.Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2]],
94
+ ],
95
+ Z: [
96
+ [new THREE.Mesh(arrowGeometry, matBlue), [0, 0, 1], [Math.PI / 2, 0, 0], null, 'fwd'],
97
+ [new THREE.Mesh(arrowGeometry, matBlue), [0, 0, 1], [-Math.PI / 2, 0, 0], null, 'bwd'],
98
+ [new THREE.Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0]],
99
+ ],
100
+ XYZ: [
101
+ [new THREE.Mesh(new THREE.OctahedronGeometry(0.1, 0), matWhiteTransparent.clone()), [0, 0, 0], [0, 0, 0]],
102
+ ],
103
+ XY: [
104
+ [new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matYellowTransparent.clone()), [0.15, 0.15, 0]],
105
+ [new THREE.Line(lineGeometry, matLineYellow), [0.18, 0.3, 0], null, [0.125, 1, 1]],
106
+ [new THREE.Line(lineGeometry, matLineYellow), [0.3, 0.18, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]],
107
+ ],
108
+ YZ: [
109
+ [new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matCyanTransparent.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]],
110
+ [new THREE.Line(lineGeometry, matLineCyan), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]],
111
+ [new THREE.Line(lineGeometry, matLineCyan), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
112
+ ],
113
+ XZ: [
114
+ [new THREE.Mesh(new THREE.PlaneGeometry(0.295, 0.295), matMagentaTransparent.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]],
115
+ [new THREE.Line(lineGeometry, matLineMagenta), [0.18, 0, 0.3], null, [0.125, 1, 1]],
116
+ [new THREE.Line(lineGeometry, matLineMagenta), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
117
+ ],
118
+ };
119
+ const pickerTranslate = {
120
+ X: [
121
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0.6, 0, 0], [0, 0, -Math.PI / 2]],
122
+ ],
123
+ Y: [
124
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0.6, 0]],
125
+ ],
126
+ Z: [
127
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0, 0.6], [Math.PI / 2, 0, 0]],
128
+ ],
129
+ XYZ: [
130
+ [new THREE.Mesh(new THREE.OctahedronGeometry(0.2, 0), matInvisible)],
131
+ ],
132
+ XY: [
133
+ [new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0.2, 0]],
134
+ ],
135
+ YZ: [
136
+ [new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0, 0.2, 0.2], [0, Math.PI / 2, 0]],
137
+ ],
138
+ XZ: [
139
+ [new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]],
140
+ ],
141
+ };
142
+ const helperTranslate = {
143
+ START: [
144
+ [new THREE.Mesh(new THREE.OctahedronGeometry(0.01, 2), matHelper), null, null, null, 'helper'],
145
+ ],
146
+ END: [
147
+ [new THREE.Mesh(new THREE.OctahedronGeometry(0.01, 2), matHelper), null, null, null, 'helper'],
148
+ ],
149
+ DELTA: [
150
+ [new THREE.Line(TranslateHelperGeometry(), matHelper), null, null, null, 'helper'],
151
+ ],
152
+ X: [
153
+ [new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
154
+ ],
155
+ Y: [
156
+ [new THREE.Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], 'helper'],
157
+ ],
158
+ Z: [
159
+ [new THREE.Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], 'helper'],
160
+ ],
161
+ };
162
+ const gizmoRotate = {
163
+ X: [
164
+ [new THREE.Line(CircleGeometry(1, 0.5), matLineRed)],
165
+ [new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matRed), [0, 0, 0.99], null, [1, 3, 1]],
166
+ ],
167
+ Y: [
168
+ [new THREE.Line(CircleGeometry(1, 0.5), matLineGreen), null, [0, 0, -Math.PI / 2]],
169
+ [new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matGreen), [0, 0, 0.99], null, [3, 1, 1]],
170
+ ],
171
+ Z: [
172
+ [new THREE.Line(CircleGeometry(1, 0.5), matLineBlue), null, [0, Math.PI / 2, 0]],
173
+ [new THREE.Mesh(new THREE.OctahedronGeometry(0.04, 0), matBlue), [0.99, 0, 0], null, [1, 3, 1]],
174
+ ],
175
+ E: [
176
+ [new THREE.Line(CircleGeometry(1.25, 1), matLineYellowTransparent), null, [0, Math.PI / 2, 0]],
177
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, 0.001]],
178
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, 0.001]],
179
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, 0.001]],
180
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent), [0, 1.17, 0], [0, 0, 0], [1, 1, 0.001]],
181
+ ],
182
+ XYZE: [
183
+ [new THREE.Line(CircleGeometry(1, 1), matLineGray), null, [0, Math.PI / 2, 0]],
184
+ ],
185
+ };
186
+ const helperRotate = {
187
+ AXIS: [
188
+ [new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
189
+ ],
190
+ };
191
+ const pickerRotate = {
192
+ X: [
193
+ [new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]],
194
+ ],
195
+ Y: [
196
+ [new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [Math.PI / 2, 0, 0]],
197
+ ],
198
+ Z: [
199
+ [new THREE.Mesh(new THREE.TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, 0, -Math.PI / 2]],
200
+ ],
201
+ E: [
202
+ [new THREE.Mesh(new THREE.TorusGeometry(1.25, 0.1, 2, 24), matInvisible)],
203
+ ],
204
+ XYZE: [
205
+ [new THREE.Mesh(new THREE.SphereGeometry(0.7, 10, 8), matInvisible)],
206
+ ],
207
+ };
208
+ const gizmoScale = {
209
+ X: [
210
+ [new THREE.Mesh(scaleHandleGeometry, matRed), [0.8, 0, 0], [0, 0, -Math.PI / 2]],
211
+ [new THREE.Line(lineGeometry, matLineRed), null, null, [0.8, 1, 1]],
212
+ ],
213
+ Y: [
214
+ [new THREE.Mesh(scaleHandleGeometry, matGreen), [0, 0.8, 0]],
215
+ [new THREE.Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2], [0.8, 1, 1]],
216
+ ],
217
+ Z: [
218
+ [new THREE.Mesh(scaleHandleGeometry, matBlue), [0, 0, 0.8], [Math.PI / 2, 0, 0]],
219
+ [new THREE.Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]],
220
+ ],
221
+ XY: [
222
+ [new THREE.Mesh(scaleHandleGeometry, matYellowTransparent), [0.85, 0.85, 0], null, [2, 2, 0.2]],
223
+ [new THREE.Line(lineGeometry, matLineYellow), [0.855, 0.98, 0], null, [0.125, 1, 1]],
224
+ [new THREE.Line(lineGeometry, matLineYellow), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]],
225
+ ],
226
+ YZ: [
227
+ [new THREE.Mesh(scaleHandleGeometry, matCyanTransparent), [0, 0.85, 0.85], null, [0.2, 2, 2]],
228
+ [new THREE.Line(lineGeometry, matLineCyan), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]],
229
+ [new THREE.Line(lineGeometry, matLineCyan), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
230
+ ],
231
+ XZ: [
232
+ [new THREE.Mesh(scaleHandleGeometry, matMagentaTransparent), [0.85, 0, 0.85], null, [2, 0.2, 2]],
233
+ [new THREE.Line(lineGeometry, matLineMagenta), [0.855, 0, 0.98], null, [0.125, 1, 1]],
234
+ [new THREE.Line(lineGeometry, matLineMagenta), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]],
235
+ ],
236
+ XYZX: [
237
+ [new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [1.1, 0, 0]],
238
+ ],
239
+ XYZY: [
240
+ [new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 1.1, 0]],
241
+ ],
242
+ XYZZ: [
243
+ [new THREE.Mesh(new THREE.BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 0, 1.1]],
244
+ ],
245
+ };
246
+ const pickerScale = {
247
+ X: [
248
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
249
+ ],
250
+ Y: [
251
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0.5, 0]],
252
+ ],
253
+ Z: [
254
+ [new THREE.Mesh(new THREE.CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
255
+ ],
256
+ XY: [
257
+ [new THREE.Mesh(scaleHandleGeometry, matInvisible), [0.85, 0.85, 0], null, [3, 3, 0.2]],
258
+ ],
259
+ YZ: [
260
+ [new THREE.Mesh(scaleHandleGeometry, matInvisible), [0, 0.85, 0.85], null, [0.2, 3, 3]],
261
+ ],
262
+ XZ: [
263
+ [new THREE.Mesh(scaleHandleGeometry, matInvisible), [0.85, 0, 0.85], null, [3, 0.2, 3]],
264
+ ],
265
+ XYZX: [
266
+ [new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [1.1, 0, 0]],
267
+ ],
268
+ XYZY: [
269
+ [new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 1.1, 0]],
270
+ ],
271
+ XYZZ: [
272
+ [new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 0, 1.1]],
273
+ ],
274
+ };
275
+ const helperScale = {
276
+ X: [
277
+ [new THREE.Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], 'helper'],
278
+ ],
279
+ Y: [
280
+ [new THREE.Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], 'helper'],
281
+ ],
282
+ Z: [
283
+ [new THREE.Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], 'helper'],
284
+ ],
285
+ };
286
+ // Creates an Object3D with gizmos described in custom hierarchy definition.
287
+ const setupGizmo = function (gizmoMap) {
288
+ const gizmo = new THREE.Object3D();
289
+ /* eslint-disable guard-for-in, no-restricted-syntax */
290
+ for (const name in gizmoMap) {
291
+ for (let i = gizmoMap[name].length; i--;) {
292
+ const object = gizmoMap[name][i][0].clone();
293
+ const position = gizmoMap[name][i][1];
294
+ const rotation = gizmoMap[name][i][2];
295
+ const scale = gizmoMap[name][i][3];
296
+ const tag = gizmoMap[name][i][4];
297
+ // name and tag properties are essential for picking and updating logic.
298
+ object.name = name;
299
+ object.tag = tag;
300
+ if (position) {
301
+ object.position.set(position[0], position[1], position[2]);
302
+ }
303
+ if (rotation) {
304
+ object.rotation.set(rotation[0], rotation[1], rotation[2]);
305
+ }
306
+ if (scale) {
307
+ object.scale.set(scale[0], scale[1], scale[2]);
308
+ }
309
+ object.updateMatrix();
310
+ const tempGeometry = object.geometry.clone();
311
+ tempGeometry.applyMatrix4(object.matrix);
312
+ object.geometry = tempGeometry;
313
+ object.renderOrder = Infinity;
314
+ object.position.set(0, 0, 0);
315
+ object.rotation.set(0, 0, 0);
316
+ object.scale.set(1, 1, 1);
317
+ gizmo.add(object);
318
+ }
319
+ }
320
+ return gizmo;
321
+ };
322
+ // Reusable utility variables
323
+ const tempVector = new THREE.Vector3(0, 0, 0);
324
+ const tempEuler = new THREE.Euler();
325
+ const alignVector = new THREE.Vector3(0, 1, 0);
326
+ const zeroVector = new THREE.Vector3(0, 0, 0);
327
+ const lookAtMatrix = new THREE.Matrix4();
328
+ const tempQuaternion = new THREE.Quaternion();
329
+ const tempQuaternion2 = new THREE.Quaternion();
330
+ const identityQuaternion = new THREE.Quaternion();
331
+ const unitX = new THREE.Vector3(1, 0, 0);
332
+ const unitY = new THREE.Vector3(0, 1, 0);
333
+ const unitZ = new THREE.Vector3(0, 0, 1);
334
+ // Gizmo creation
335
+ this.gizmo = {};
336
+ this.picker = {};
337
+ this.helper = {};
338
+ this.add(this.gizmo.translate = setupGizmo(gizmoTranslate));
339
+ this.add(this.gizmo.rotate = setupGizmo(gizmoRotate));
340
+ this.add(this.gizmo.scale = setupGizmo(gizmoScale));
341
+ this.add(this.picker.translate = setupGizmo(pickerTranslate));
342
+ this.add(this.picker.rotate = setupGizmo(pickerRotate));
343
+ this.add(this.picker.scale = setupGizmo(pickerScale));
344
+ this.add(this.helper.translate = setupGizmo(helperTranslate));
345
+ this.add(this.helper.rotate = setupGizmo(helperRotate));
346
+ this.add(this.helper.scale = setupGizmo(helperScale));
347
+ // Pickers should be hidden always
348
+ this.picker.translate.visible = false;
349
+ this.picker.rotate.visible = false;
350
+ this.picker.scale.visible = false;
351
+ // updateMatrixWorld will update transformations and appearance of individual handles
352
+ this.updateMatrixWorld = function () {
353
+ let { space } = this;
354
+ if (this.mode === 'scale')
355
+ space = 'local'; // scale always oriented to local rotation
356
+ const quaternion = space === 'local' ? this.worldQuaternion : identityQuaternion;
357
+ // Show only gizmos for current transform mode
358
+ this.gizmo.translate.visible = this.mode === 'translate';
359
+ this.gizmo.rotate.visible = this.mode === 'rotate';
360
+ this.gizmo.scale.visible = this.mode === 'scale';
361
+ this.helper.translate.visible = this.mode === 'translate';
362
+ this.helper.rotate.visible = this.mode === 'rotate';
363
+ this.helper.scale.visible = this.mode === 'scale';
364
+ let handles = [];
365
+ handles = handles.concat(this.picker[this.mode].children);
366
+ handles = handles.concat(this.gizmo[this.mode].children);
367
+ handles = handles.concat(this.helper[this.mode].children);
368
+ for (let i = 0; i < handles.length; i++) {
369
+ const handle = handles[i];
370
+ // hide aligned to camera
371
+ handle.visible = true;
372
+ handle.rotation.set(0, 0, 0);
373
+ handle.position.copy(this.worldPosition);
374
+ let factor;
375
+ if (this.camera.isOrthographicCamera) {
376
+ const camera = this.camera;
377
+ factor = (camera.top - camera.bottom) / camera.zoom;
378
+ }
379
+ else {
380
+ const camera = this.camera;
381
+ factor = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * camera.fov / 360) / camera.zoom, 7);
382
+ }
383
+ handle.scale.set(1, 1, 1).multiplyScalar(factor * this.size / 7);
384
+ // TODO: simplify helpers and consider decoupling from gizmo
385
+ if (handle.tag === 'helper') {
386
+ handle.visible = false;
387
+ if (handle.name === 'AXIS') {
388
+ handle.position.copy(this.worldPositionStart);
389
+ handle.visible = !!this.axis;
390
+ if (this.axis === 'X') {
391
+ tempQuaternion.setFromEuler(tempEuler.set(0, 0, 0));
392
+ handle.quaternion.copy(quaternion).multiply(tempQuaternion);
393
+ if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
394
+ handle.visible = false;
395
+ }
396
+ }
397
+ if (this.axis === 'Y') {
398
+ tempQuaternion.setFromEuler(tempEuler.set(0, 0, Math.PI / 2));
399
+ handle.quaternion.copy(quaternion).multiply(tempQuaternion);
400
+ if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
401
+ handle.visible = false;
402
+ }
403
+ }
404
+ if (this.axis === 'Z') {
405
+ tempQuaternion.setFromEuler(tempEuler.set(0, Math.PI / 2, 0));
406
+ handle.quaternion.copy(quaternion).multiply(tempQuaternion);
407
+ if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
408
+ handle.visible = false;
409
+ }
410
+ }
411
+ if (this.axis === 'XYZE') {
412
+ tempQuaternion.setFromEuler(tempEuler.set(0, Math.PI / 2, 0));
413
+ alignVector.copy(this.rotationAxis);
414
+ handle.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(zeroVector, alignVector, unitY));
415
+ handle.quaternion.multiply(tempQuaternion);
416
+ handle.visible = this.dragging;
417
+ }
418
+ if (this.axis === 'E') {
419
+ handle.visible = false;
420
+ }
421
+ }
422
+ else if (handle.name === 'START') {
423
+ handle.position.copy(this.worldPositionStart);
424
+ handle.visible = this.dragging;
425
+ }
426
+ else if (handle.name === 'END') {
427
+ handle.position.copy(this.worldPosition);
428
+ handle.visible = this.dragging;
429
+ }
430
+ else if (handle.name === 'DELTA') {
431
+ handle.position.copy(this.worldPositionStart);
432
+ handle.quaternion.copy(this.worldQuaternionStart);
433
+ tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1);
434
+ tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert());
435
+ handle.scale.copy(tempVector);
436
+ handle.visible = this.dragging;
437
+ }
438
+ else {
439
+ handle.quaternion.copy(quaternion);
440
+ if (this.dragging) {
441
+ handle.position.copy(this.worldPositionStart);
442
+ }
443
+ else {
444
+ handle.position.copy(this.worldPosition);
445
+ }
446
+ if (this.axis) {
447
+ handle.visible = this.axis.search(handle.name) !== -1;
448
+ }
449
+ }
450
+ // If updating helper, skip rest of the loop
451
+ continue;
452
+ }
453
+ // Align handles to current local or world rotation
454
+ handle.quaternion.copy(quaternion);
455
+ if (this.mode === 'translate' || this.mode === 'scale') {
456
+ // Hide translate and scale axis facing the camera
457
+ const AXIS_HIDE_TRESHOLD = 0.99;
458
+ const PLANE_HIDE_TRESHOLD = 0.2;
459
+ const AXIS_FLIP_TRESHOLD = 0.0;
460
+ if (handle.name === 'X' || handle.name === 'XYZX') {
461
+ if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
462
+ handle.scale.set(1e-10, 1e-10, 1e-10);
463
+ handle.visible = false;
464
+ }
465
+ }
466
+ if (handle.name === 'Y' || handle.name === 'XYZY') {
467
+ if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
468
+ handle.scale.set(1e-10, 1e-10, 1e-10);
469
+ handle.visible = false;
470
+ }
471
+ }
472
+ if (handle.name === 'Z' || handle.name === 'XYZZ') {
473
+ if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
474
+ handle.scale.set(1e-10, 1e-10, 1e-10);
475
+ handle.visible = false;
476
+ }
477
+ }
478
+ if (handle.name === 'XY') {
479
+ if (Math.abs(alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
480
+ handle.scale.set(1e-10, 1e-10, 1e-10);
481
+ handle.visible = false;
482
+ }
483
+ }
484
+ if (handle.name === 'YZ') {
485
+ if (Math.abs(alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
486
+ handle.scale.set(1e-10, 1e-10, 1e-10);
487
+ handle.visible = false;
488
+ }
489
+ }
490
+ if (handle.name === 'XZ') {
491
+ if (Math.abs(alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
492
+ handle.scale.set(1e-10, 1e-10, 1e-10);
493
+ handle.visible = false;
494
+ }
495
+ }
496
+ // Flip translate and scale axis ocluded behind another axis
497
+ if (handle.name.search('X') !== -1) {
498
+ if (alignVector.copy(unitX).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
499
+ if (handle.tag === 'fwd') {
500
+ handle.visible = false;
501
+ }
502
+ else {
503
+ handle.scale.x *= -1;
504
+ }
505
+ }
506
+ else if (handle.tag === 'bwd') {
507
+ handle.visible = false;
508
+ }
509
+ }
510
+ if (handle.name.search('Y') !== -1) {
511
+ if (alignVector.copy(unitY).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
512
+ if (handle.tag === 'fwd') {
513
+ handle.visible = false;
514
+ }
515
+ else {
516
+ handle.scale.y *= -1;
517
+ }
518
+ }
519
+ else if (handle.tag === 'bwd') {
520
+ handle.visible = false;
521
+ }
522
+ }
523
+ if (handle.name.search('Z') !== -1) {
524
+ if (alignVector.copy(unitZ).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
525
+ if (handle.tag === 'fwd') {
526
+ handle.visible = false;
527
+ }
528
+ else {
529
+ handle.scale.z *= -1;
530
+ }
531
+ }
532
+ else if (handle.tag === 'bwd') {
533
+ handle.visible = false;
534
+ }
535
+ }
536
+ }
537
+ else if (this.mode === 'rotate') {
538
+ // Align handles to current local or world rotation
539
+ tempQuaternion2.copy(quaternion);
540
+ alignVector.copy(this.eye).applyQuaternion(tempQuaternion.copy(quaternion).invert());
541
+ if (handle.name.search('E') !== -1) {
542
+ handle.quaternion.setFromRotationMatrix(lookAtMatrix.lookAt(this.eye, zeroVector, unitY));
543
+ }
544
+ if (handle.name === 'X') {
545
+ tempQuaternion.setFromAxisAngle(unitX, Math.atan2(-alignVector.y, alignVector.z));
546
+ tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
547
+ handle.quaternion.copy(tempQuaternion);
548
+ }
549
+ if (handle.name === 'Y') {
550
+ tempQuaternion.setFromAxisAngle(unitY, Math.atan2(alignVector.x, alignVector.z));
551
+ tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
552
+ handle.quaternion.copy(tempQuaternion);
553
+ }
554
+ if (handle.name === 'Z') {
555
+ tempQuaternion.setFromAxisAngle(unitZ, Math.atan2(alignVector.y, alignVector.x));
556
+ tempQuaternion.multiplyQuaternions(tempQuaternion2, tempQuaternion);
557
+ handle.quaternion.copy(tempQuaternion);
558
+ }
559
+ }
560
+ // Hide disabled axes
561
+ handle.visible = handle.visible && (handle.name.indexOf('X') === -1 || this.showX);
562
+ handle.visible = handle.visible && (handle.name.indexOf('Y') === -1 || this.showY);
563
+ handle.visible = handle.visible && (handle.name.indexOf('Z') === -1 || this.showZ);
564
+ handle.visible = handle.visible && (handle.name.indexOf('E') === -1 || (this.showX && this.showY && this.showZ));
565
+ // highlight selected axis
566
+ handle.material._opacity = handle.material._opacity || handle.material.opacity;
567
+ handle.material._color = handle.material._color || handle.material.color.clone();
568
+ handle.material.color.copy(handle.material._color);
569
+ handle.material.opacity = handle.material._opacity;
570
+ if (!this.enabled) {
571
+ handle.material.opacity *= 0.5;
572
+ handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
573
+ }
574
+ else if (this.axis) {
575
+ if (handle.name === this.axis) {
576
+ handle.material.opacity = 1.0;
577
+ handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
578
+ }
579
+ else if (this.axis.split('').some((a) => handle.name === a)) {
580
+ handle.material.opacity = 1.0;
581
+ handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
582
+ }
583
+ else {
584
+ handle.material.opacity *= 0.25;
585
+ handle.material.color.lerp(new THREE.Color(1, 1, 1), 0.5);
586
+ }
587
+ }
588
+ }
589
+ THREE.Object3D.prototype.updateMatrixWorld.call(this);
590
+ };
591
+ }
592
+ }
593
+ class TransformControlsPlane extends NS_THREE.Mesh {
594
+ constructor() {
595
+ super(new (Externals.getInstance().THREE).PlaneGeometry(100000, 100000, 2, 2), new (Externals.getInstance().THREE).MeshBasicMaterial({
596
+ visible: false, wireframe: true, side: (Externals.getInstance().THREE).DoubleSide, transparent: true, opacity: 0.1, toneMapped: false,
597
+ }));
598
+ this.isTransformControlsPlane = true;
599
+ const { THREE } = Externals.getInstance();
600
+ const unitX = new THREE.Vector3(1, 0, 0);
601
+ const unitY = new THREE.Vector3(0, 1, 0);
602
+ const unitZ = new THREE.Vector3(0, 0, 1);
603
+ const tempVector = new THREE.Vector3();
604
+ const dirVector = new THREE.Vector3();
605
+ const alignVector = new THREE.Vector3();
606
+ const tempMatrix = new THREE.Matrix4();
607
+ const identityQuaternion = new THREE.Quaternion();
608
+ this.updateMatrixWorld = function () {
609
+ let { space } = this;
610
+ this.position.copy(this.worldPosition);
611
+ if (this.mode === 'scale')
612
+ space = 'local'; // scale always oriented to local rotation
613
+ unitX.set(1, 0, 0).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
614
+ unitY.set(0, 1, 0).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
615
+ unitZ.set(0, 0, 1).applyQuaternion(space === 'local' ? this.worldQuaternion : identityQuaternion);
616
+ // Align the plane for current transform mode, axis and space.
617
+ alignVector.copy(unitY);
618
+ switch (this.mode) {
619
+ case 'translate':
620
+ case 'scale':
621
+ switch (this.axis) {
622
+ case 'X':
623
+ alignVector.copy(this.eye).cross(unitX);
624
+ dirVector.copy(unitX).cross(alignVector);
625
+ break;
626
+ case 'Y':
627
+ alignVector.copy(this.eye).cross(unitY);
628
+ dirVector.copy(unitY).cross(alignVector);
629
+ break;
630
+ case 'Z':
631
+ alignVector.copy(this.eye).cross(unitZ);
632
+ dirVector.copy(unitZ).cross(alignVector);
633
+ break;
634
+ case 'XY':
635
+ dirVector.copy(unitZ);
636
+ break;
637
+ case 'YZ':
638
+ dirVector.copy(unitX);
639
+ break;
640
+ case 'XZ':
641
+ alignVector.copy(unitZ);
642
+ dirVector.copy(unitY);
643
+ break;
644
+ case 'XYZ':
645
+ case 'E':
646
+ dirVector.set(0, 0, 0);
647
+ break;
648
+ default:
649
+ break;
650
+ }
651
+ break;
652
+ case 'rotate':
653
+ default:
654
+ // special case for rotate
655
+ dirVector.set(0, 0, 0);
656
+ }
657
+ if (dirVector.length() === 0) {
658
+ // If in rotate mode, make the plane parallel to camera
659
+ this.quaternion.copy(this.cameraQuaternion);
660
+ }
661
+ else {
662
+ tempMatrix.lookAt(tempVector.set(0, 0, 0), dirVector, alignVector);
663
+ this.quaternion.setFromRotationMatrix(tempMatrix);
664
+ }
665
+ THREE.Object3D.prototype.updateMatrixWorld.call(this);
666
+ };
667
+ }
668
+ }
669
+ class TransformControls extends NS_THREE.Object3D {
670
+ constructor(camera, domElement) {
671
+ super();
672
+ if (domElement === undefined) {
673
+ console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.');
674
+ domElement = document; // eslint-disable-line no-param-reassign
675
+ }
676
+ this.visible = false;
677
+ this.domElement = domElement;
678
+ const _gizmo = new TransformControlsGizmo();
679
+ this.add(_gizmo);
680
+ const _plane = new TransformControlsPlane();
681
+ this.add(_plane);
682
+ const scope = this;
683
+ const changeEvent = { type: 'change' };
684
+ const mouseDownEvent = { type: 'mouseDown' };
685
+ const mouseUpEvent = { type: 'mouseUp', mode: scope.mode };
686
+ const objectChangeEvent = { type: 'objectChange' };
687
+ // Defined getter, setter and store for a property
688
+ function defineProperty(propName, defaultValue) {
689
+ let propValue = defaultValue;
690
+ Object.defineProperty(scope, propName, {
691
+ get() {
692
+ return propValue !== undefined ? propValue : defaultValue;
693
+ },
694
+ set(value) {
695
+ if (propValue !== value) {
696
+ propValue = value;
697
+ _plane[propName] = value;
698
+ _gizmo[propName] = value;
699
+ scope.dispatchEvent({ type: `${propName}-changed`, value });
700
+ scope.dispatchEvent(changeEvent);
701
+ }
702
+ },
703
+ });
704
+ scope[propName] = defaultValue;
705
+ _plane[propName] = defaultValue;
706
+ _gizmo[propName] = defaultValue;
707
+ }
708
+ const { THREE } = Externals.getInstance();
709
+ // Define properties with getters/setter
710
+ // Setting the defined property will automatically trigger change event
711
+ // Defined properties are passed down to gizmo and plane
712
+ defineProperty('camera', camera);
713
+ defineProperty('object', undefined);
714
+ defineProperty('enabled', true);
715
+ defineProperty('axis', null);
716
+ defineProperty('mode', 'translate');
717
+ defineProperty('translationSnap', null);
718
+ defineProperty('rotationSnap', null);
719
+ defineProperty('scaleSnap', null);
720
+ defineProperty('space', 'world');
721
+ defineProperty('size', 1);
722
+ defineProperty('dragging', false);
723
+ defineProperty('showX', true);
724
+ defineProperty('showY', true);
725
+ defineProperty('showZ', true);
726
+ // Reusable utility variables
727
+ function intersectObjectWithRay(object, raycaster, includeInvisible) {
728
+ const allIntersections = raycaster.intersectObject(object, true);
729
+ for (let i = 0; i < allIntersections.length; i++) {
730
+ if (allIntersections[i].object.visible || includeInvisible) {
731
+ return allIntersections[i];
732
+ }
733
+ }
734
+ return false;
735
+ }
736
+ const raycaster = new THREE.Raycaster();
737
+ const _tempVector = new THREE.Vector3();
738
+ const _tempVector2 = new THREE.Vector3();
739
+ const _tempQuaternion = new THREE.Quaternion();
740
+ const _unit = {
741
+ X: new THREE.Vector3(1, 0, 0),
742
+ Y: new THREE.Vector3(0, 1, 0),
743
+ Z: new THREE.Vector3(0, 0, 1),
744
+ };
745
+ const pointStart = new THREE.Vector3();
746
+ const pointEnd = new THREE.Vector3();
747
+ const offset = new THREE.Vector3();
748
+ const rotationAxis = new THREE.Vector3();
749
+ const startNorm = new THREE.Vector3();
750
+ const endNorm = new THREE.Vector3();
751
+ let rotationAngle = 0;
752
+ const cameraPosition = new THREE.Vector3();
753
+ const cameraQuaternion = new THREE.Quaternion();
754
+ const cameraScale = new THREE.Vector3();
755
+ const parentPosition = new THREE.Vector3();
756
+ const parentQuaternion = new THREE.Quaternion();
757
+ const parentQuaternionInv = new THREE.Quaternion();
758
+ const parentScale = new THREE.Vector3();
759
+ const worldPositionStart = new THREE.Vector3();
760
+ const worldQuaternionStart = new THREE.Quaternion();
761
+ const worldScaleStart = new THREE.Vector3();
762
+ const worldPosition = new THREE.Vector3();
763
+ const worldQuaternion = new THREE.Quaternion();
764
+ const worldQuaternionInv = new THREE.Quaternion();
765
+ const worldScale = new THREE.Vector3();
766
+ const eye = new THREE.Vector3();
767
+ const positionStart = new THREE.Vector3();
768
+ const quaternionStart = new THREE.Quaternion();
769
+ const scaleStart = new THREE.Vector3();
770
+ // TODO: remove properties unused in plane and gizmo
771
+ defineProperty('worldPosition', worldPosition);
772
+ defineProperty('worldPositionStart', worldPositionStart);
773
+ defineProperty('worldQuaternion', worldQuaternion);
774
+ defineProperty('worldQuaternionStart', worldQuaternionStart);
775
+ defineProperty('cameraPosition', cameraPosition);
776
+ defineProperty('cameraQuaternion', cameraQuaternion);
777
+ defineProperty('pointStart', pointStart);
778
+ defineProperty('pointEnd', pointEnd);
779
+ defineProperty('rotationAxis', rotationAxis);
780
+ defineProperty('rotationAngle', rotationAngle);
781
+ defineProperty('eye', eye);
782
+ // normalize mouse / touch pointer and remap {x,y} to view space.
783
+ function getPointer(event) {
784
+ if (scope.domElement.ownerDocument.pointerLockElement) {
785
+ return {
786
+ x: 0,
787
+ y: 0,
788
+ button: event.button,
789
+ };
790
+ }
791
+ const pointer = event.changedTouches ? event.changedTouches[0] : event;
792
+ const rect = domElement.getBoundingClientRect();
793
+ return {
794
+ x: (pointer.clientX - rect.left) / rect.width * 2 - 1,
795
+ y: -(pointer.clientY - rect.top) / rect.height * 2 + 1,
796
+ button: event.button,
797
+ };
798
+ }
799
+ // mouse / touch event handlers
800
+ function onPointerHover(event) {
801
+ if (!scope.enabled)
802
+ return;
803
+ switch (event.pointerType) {
804
+ case 'mouse':
805
+ case 'pen':
806
+ scope.pointerHover(getPointer(event));
807
+ break;
808
+ default: break;
809
+ }
810
+ }
811
+ function onPointerMove(event) {
812
+ if (!scope.enabled)
813
+ return;
814
+ scope.pointerMove(getPointer(event));
815
+ }
816
+ function onPointerDown(event) {
817
+ if (!scope.enabled)
818
+ return;
819
+ scope.domElement.style.touchAction = 'none'; // disable touch scroll
820
+ scope.domElement.ownerDocument.addEventListener('pointermove', onPointerMove);
821
+ scope.pointerHover(getPointer(event));
822
+ scope.pointerDown(getPointer(event));
823
+ }
824
+ function onPointerUp(event) {
825
+ if (!scope.enabled)
826
+ return;
827
+ scope.domElement.style.touchAction = '';
828
+ scope.domElement.ownerDocument.removeEventListener('pointermove', onPointerMove);
829
+ scope.pointerUp(getPointer(event));
830
+ }
831
+ domElement.addEventListener('pointerdown', onPointerDown);
832
+ domElement.addEventListener('pointermove', onPointerHover);
833
+ scope.domElement.ownerDocument.addEventListener('pointerup', onPointerUp);
834
+ this.dispose = function () {
835
+ domElement.removeEventListener('pointerdown', onPointerDown);
836
+ domElement.removeEventListener('pointermove', onPointerHover);
837
+ scope.domElement.ownerDocument.removeEventListener('pointermove', onPointerMove);
838
+ scope.domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);
839
+ this.traverse((child) => {
840
+ if (child.geometry)
841
+ child.geometry.dispose();
842
+ if (child.material)
843
+ child.material.dispose();
844
+ });
845
+ scope.domElement = null;
846
+ };
847
+ // Set current object
848
+ this.attach = function (object) {
849
+ this.object = object;
850
+ this.visible = true;
851
+ return this;
852
+ };
853
+ // Detatch from object
854
+ this.detach = function () {
855
+ this.object = undefined;
856
+ this.visible = false;
857
+ this.axis = null;
858
+ return this;
859
+ };
860
+ // updateMatrixWorld updates key transformation variables
861
+ this.updateMatrixWorld = function () {
862
+ if (this.object !== undefined) {
863
+ this.object.updateMatrixWorld();
864
+ if (this.object.parent === null) {
865
+ console.error('TransformControls: The attached 3D object must be a part of the scene graph.');
866
+ }
867
+ else {
868
+ this.object.parent.matrixWorld.decompose(parentPosition, parentQuaternion, parentScale);
869
+ }
870
+ this.object.matrixWorld.decompose(worldPosition, worldQuaternion, worldScale);
871
+ parentQuaternionInv.copy(parentQuaternion).invert();
872
+ worldQuaternionInv.copy(worldQuaternion).invert();
873
+ }
874
+ this.camera.updateMatrixWorld();
875
+ this.camera.matrixWorld.decompose(cameraPosition, cameraQuaternion, cameraScale);
876
+ eye.copy(cameraPosition).sub(worldPosition).normalize();
877
+ THREE.Object3D.prototype.updateMatrixWorld.call(this);
878
+ };
879
+ this.pointerHover = function (pointer) {
880
+ if (this.object === undefined || this.dragging === true)
881
+ return;
882
+ raycaster.setFromCamera(pointer, this.camera);
883
+ const intersect = intersectObjectWithRay(_gizmo.picker[this.mode], raycaster);
884
+ if (intersect) {
885
+ this.axis = intersect.object.name;
886
+ }
887
+ else {
888
+ this.axis = null;
889
+ }
890
+ };
891
+ this.pointerDown = function (pointer) {
892
+ if (this.object === undefined || this.dragging === true || pointer.button !== 0)
893
+ return;
894
+ if (this.axis !== null) {
895
+ raycaster.setFromCamera(pointer, this.camera);
896
+ const planeIntersect = intersectObjectWithRay(_plane, raycaster, true);
897
+ if (planeIntersect) {
898
+ let { space } = this;
899
+ if (this.mode === 'scale') {
900
+ space = 'local';
901
+ }
902
+ else if (this.axis === 'E' || this.axis === 'XYZE' || this.axis === 'XYZ') {
903
+ space = 'world';
904
+ }
905
+ if (space === 'local' && this.mode === 'rotate') {
906
+ const snap = this.rotationSnap;
907
+ if (this.axis === 'X' && snap)
908
+ this.object.rotation.x = Math.round(this.object.rotation.x / snap) * snap;
909
+ if (this.axis === 'Y' && snap)
910
+ this.object.rotation.y = Math.round(this.object.rotation.y / snap) * snap;
911
+ if (this.axis === 'Z' && snap)
912
+ this.object.rotation.z = Math.round(this.object.rotation.z / snap) * snap;
913
+ }
914
+ this.object.updateMatrixWorld();
915
+ this.object.parent.updateMatrixWorld();
916
+ positionStart.copy(this.object.position);
917
+ quaternionStart.copy(this.object.quaternion);
918
+ scaleStart.copy(this.object.scale);
919
+ this.object.matrixWorld.decompose(worldPositionStart, worldQuaternionStart, worldScaleStart);
920
+ pointStart.copy(planeIntersect.point).sub(worldPositionStart);
921
+ }
922
+ this.dragging = true;
923
+ mouseDownEvent.mode = this.mode;
924
+ this.dispatchEvent(mouseDownEvent);
925
+ }
926
+ };
927
+ this.pointerMove = function (pointer) {
928
+ const { axis } = this;
929
+ const { mode } = this;
930
+ const { object } = this;
931
+ let { space } = this;
932
+ if (mode === 'scale') {
933
+ space = 'local';
934
+ }
935
+ else if (axis === 'E' || axis === 'XYZE' || axis === 'XYZ') {
936
+ space = 'world';
937
+ }
938
+ if (object === undefined || axis === null || this.dragging === false || pointer.button !== -1)
939
+ return;
940
+ raycaster.setFromCamera(pointer, this.camera);
941
+ const planeIntersect = intersectObjectWithRay(_plane, raycaster, true);
942
+ if (!planeIntersect)
943
+ return;
944
+ pointEnd.copy(planeIntersect.point).sub(worldPositionStart);
945
+ if (mode === 'translate') {
946
+ // Apply translate
947
+ offset.copy(pointEnd).sub(pointStart);
948
+ if (space === 'local' && axis !== 'XYZ') {
949
+ offset.applyQuaternion(worldQuaternionInv);
950
+ }
951
+ if (axis.indexOf('X') === -1)
952
+ offset.x = 0;
953
+ if (axis.indexOf('Y') === -1)
954
+ offset.y = 0;
955
+ if (axis.indexOf('Z') === -1)
956
+ offset.z = 0;
957
+ if (space === 'local' && axis !== 'XYZ') {
958
+ offset.applyQuaternion(quaternionStart).divide(parentScale);
959
+ }
960
+ else {
961
+ offset.applyQuaternion(parentQuaternionInv).divide(parentScale);
962
+ }
963
+ object.position.copy(offset).add(positionStart);
964
+ // Apply translation snap
965
+ if (this.translationSnap) {
966
+ if (space === 'local') {
967
+ object.position.applyQuaternion(_tempQuaternion.copy(quaternionStart).invert());
968
+ if (axis.search('X') !== -1) {
969
+ object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
970
+ }
971
+ if (axis.search('Y') !== -1) {
972
+ object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
973
+ }
974
+ if (axis.search('Z') !== -1) {
975
+ object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
976
+ }
977
+ object.position.applyQuaternion(quaternionStart);
978
+ }
979
+ if (space === 'world') {
980
+ if (object.parent) {
981
+ object.position.add(_tempVector.setFromMatrixPosition(object.parent.matrixWorld));
982
+ }
983
+ if (axis.search('X') !== -1) {
984
+ object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
985
+ }
986
+ if (axis.search('Y') !== -1) {
987
+ object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
988
+ }
989
+ if (axis.search('Z') !== -1) {
990
+ object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
991
+ }
992
+ if (object.parent) {
993
+ object.position.sub(_tempVector.setFromMatrixPosition(object.parent.matrixWorld));
994
+ }
995
+ }
996
+ }
997
+ }
998
+ else if (mode === 'scale') {
999
+ if (axis.search('XYZ') !== -1) {
1000
+ let d = pointEnd.length() / pointStart.length();
1001
+ if (pointEnd.dot(pointStart) < 0)
1002
+ d *= -1;
1003
+ _tempVector2.set(d, d, d);
1004
+ }
1005
+ else {
1006
+ _tempVector.copy(pointStart);
1007
+ _tempVector2.copy(pointEnd);
1008
+ _tempVector.applyQuaternion(worldQuaternionInv);
1009
+ _tempVector2.applyQuaternion(worldQuaternionInv);
1010
+ _tempVector2.divide(_tempVector);
1011
+ if (axis.search('X') === -1) {
1012
+ _tempVector2.x = 1;
1013
+ }
1014
+ if (axis.search('Y') === -1) {
1015
+ _tempVector2.y = 1;
1016
+ }
1017
+ if (axis.search('Z') === -1) {
1018
+ _tempVector2.z = 1;
1019
+ }
1020
+ }
1021
+ // Apply scale
1022
+ object.scale.copy(scaleStart).multiply(_tempVector2);
1023
+ if (this.scaleSnap) {
1024
+ if (axis.search('X') !== -1) {
1025
+ object.scale.x = Math.round(object.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
1026
+ }
1027
+ if (axis.search('Y') !== -1) {
1028
+ object.scale.y = Math.round(object.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
1029
+ }
1030
+ if (axis.search('Z') !== -1) {
1031
+ object.scale.z = Math.round(object.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
1032
+ }
1033
+ }
1034
+ }
1035
+ else if (mode === 'rotate') {
1036
+ offset.copy(pointEnd).sub(pointStart);
1037
+ const ROTATION_SPEED = 20 / worldPosition.distanceTo(_tempVector.setFromMatrixPosition(this.camera.matrixWorld));
1038
+ if (axis === 'E') {
1039
+ rotationAxis.copy(eye);
1040
+ rotationAngle = pointEnd.angleTo(pointStart);
1041
+ startNorm.copy(pointStart).normalize();
1042
+ endNorm.copy(pointEnd).normalize();
1043
+ rotationAngle *= (endNorm.cross(startNorm).dot(eye) < 0 ? 1 : -1);
1044
+ }
1045
+ else if (axis === 'XYZE') {
1046
+ rotationAxis.copy(offset).cross(eye).normalize();
1047
+ rotationAngle = offset.dot(_tempVector.copy(rotationAxis).cross(this.eye)) * ROTATION_SPEED;
1048
+ }
1049
+ else if (axis === 'X' || axis === 'Y' || axis === 'Z') {
1050
+ rotationAxis.copy(_unit[axis]);
1051
+ _tempVector.copy(_unit[axis]);
1052
+ if (space === 'local') {
1053
+ _tempVector.applyQuaternion(worldQuaternion);
1054
+ }
1055
+ rotationAngle = offset.dot(_tempVector.cross(eye).normalize()) * ROTATION_SPEED;
1056
+ }
1057
+ // Apply rotation snap
1058
+ if (this.rotationSnap)
1059
+ rotationAngle = Math.round(rotationAngle / this.rotationSnap) * this.rotationSnap;
1060
+ this.rotationAngle = rotationAngle;
1061
+ // Apply rotate
1062
+ if (space === 'local' && axis !== 'E' && axis !== 'XYZE') {
1063
+ object.quaternion.copy(quaternionStart);
1064
+ object.quaternion.multiply(_tempQuaternion.setFromAxisAngle(rotationAxis, rotationAngle)).normalize();
1065
+ }
1066
+ else {
1067
+ rotationAxis.applyQuaternion(parentQuaternionInv);
1068
+ object.quaternion.copy(_tempQuaternion.setFromAxisAngle(rotationAxis, rotationAngle));
1069
+ object.quaternion.multiply(quaternionStart).normalize();
1070
+ }
1071
+ }
1072
+ this.dispatchEvent(changeEvent);
1073
+ this.dispatchEvent(objectChangeEvent);
1074
+ };
1075
+ this.pointerUp = function (pointer) {
1076
+ if (pointer.button !== 0)
1077
+ return;
1078
+ if (this.dragging && (this.axis !== null)) {
1079
+ mouseUpEvent.mode = this.mode;
1080
+ this.dispatchEvent(mouseUpEvent);
1081
+ }
1082
+ this.dragging = false;
1083
+ this.axis = null;
1084
+ };
1085
+ // TODO: deprecate
1086
+ this.getMode = function () {
1087
+ return scope.mode;
1088
+ };
1089
+ this.setMode = function (mode) {
1090
+ scope.mode = mode;
1091
+ };
1092
+ this.setTranslationSnap = function (translationSnap) {
1093
+ scope.translationSnap = translationSnap;
1094
+ };
1095
+ this.setScaleSnap = function (scaleSnap) {
1096
+ scope.scaleSnap = scaleSnap;
1097
+ };
1098
+ this.setRotationSnap = function (rotationSnap) {
1099
+ scope.rotationSnap = rotationSnap;
1100
+ };
1101
+ this.setSize = function (size) {
1102
+ scope.size = size;
1103
+ };
1104
+ this.setSpace = function (space) {
1105
+ scope.space = space;
1106
+ };
1107
+ this.update = function () {
1108
+ console.warn('THREE.TransformControls: update function has no more functionality and therefore has been deprecated.');
1109
+ };
1110
+ }
1111
+ }
1112
+ export { TransformControls, TransformControlsGizmo, TransformControlsPlane };
1113
+ //# sourceMappingURL=transform-controls.js.map