kitchen-simulator 5.0.0-test.2 → 5.0.0-test.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (697) hide show
  1. package/es/KitchenConfigurator.js +1 -1
  2. package/es/KitchenConfigurator.js.map +1 -1
  3. package/es/index.js +2 -2
  4. package/es/index.js.map +1 -1
  5. package/package.json +8 -16
  6. package/src/KitchenConfigurator.jsx +1 -1
  7. package/src/index.js +3 -3
  8. package/lib/@history.js +0 -11
  9. package/lib/@history.js.map +0 -1
  10. package/lib/AppContext.js +0 -11
  11. package/lib/AppContext.js.map +0 -1
  12. package/lib/KitchenConfigurator.js +0 -1353
  13. package/lib/KitchenConfigurator.js.map +0 -1
  14. package/lib/KitchenConfiguratorApp.js +0 -539
  15. package/lib/KitchenConfiguratorApp.js.map +0 -1
  16. package/lib/actions/area-actions.js +0 -22
  17. package/lib/actions/area-actions.js.map +0 -1
  18. package/lib/actions/export.js +0 -44
  19. package/lib/actions/export.js.map +0 -1
  20. package/lib/actions/groups-actions.js +0 -108
  21. package/lib/actions/groups-actions.js.map +0 -1
  22. package/lib/actions/holes-actions.js +0 -141
  23. package/lib/actions/holes-actions.js.map +0 -1
  24. package/lib/actions/items-actions.js +0 -365
  25. package/lib/actions/items-actions.js.map +0 -1
  26. package/lib/actions/lines-actions.js +0 -98
  27. package/lib/actions/lines-actions.js.map +0 -1
  28. package/lib/actions/project-actions.js +0 -333
  29. package/lib/actions/project-actions.js.map +0 -1
  30. package/lib/actions/scene-actions.js +0 -44
  31. package/lib/actions/scene-actions.js.map +0 -1
  32. package/lib/actions/user-actions.js +0 -69
  33. package/lib/actions/user-actions.js.map +0 -1
  34. package/lib/actions/vertices-actions.js +0 -36
  35. package/lib/actions/vertices-actions.js.map +0 -1
  36. package/lib/actions/viewer2d-actions.js +0 -74
  37. package/lib/actions/viewer2d-actions.js.map +0 -1
  38. package/lib/actions/viewer3d-actions.js +0 -33
  39. package/lib/actions/viewer3d-actions.js.map +0 -1
  40. package/lib/catalog/areas/area/planner-element.js +0 -47
  41. package/lib/catalog/areas/area/planner-element.js.map +0 -1
  42. package/lib/catalog/catalog.js +0 -283
  43. package/lib/catalog/catalog.js.map +0 -1
  44. package/lib/catalog/factories/area-factory-3d.js +0 -192
  45. package/lib/catalog/factories/area-factory-3d.js.map +0 -1
  46. package/lib/catalog/factories/area-factory.js +0 -90
  47. package/lib/catalog/factories/area-factory.js.map +0 -1
  48. package/lib/catalog/factories/export.js +0 -26
  49. package/lib/catalog/factories/export.js.map +0 -1
  50. package/lib/catalog/factories/wall-factory-3d.js +0 -213
  51. package/lib/catalog/factories/wall-factory-3d.js.map +0 -1
  52. package/lib/catalog/factories/wall-factory.js +0 -279
  53. package/lib/catalog/factories/wall-factory.js.map +0 -1
  54. package/lib/catalog/holes/door-closet/planner-element.js +0 -232
  55. package/lib/catalog/holes/door-closet/planner-element.js.map +0 -1
  56. package/lib/catalog/holes/door-double/planner-element.js +0 -325
  57. package/lib/catalog/holes/door-double/planner-element.js.map +0 -1
  58. package/lib/catalog/holes/door-exterior/planner-element.js +0 -225
  59. package/lib/catalog/holes/door-exterior/planner-element.js.map +0 -1
  60. package/lib/catalog/holes/door-interior/planner-element.js +0 -237
  61. package/lib/catalog/holes/door-interior/planner-element.js.map +0 -1
  62. package/lib/catalog/holes/door-panic/planner-element.js +0 -513
  63. package/lib/catalog/holes/door-panic/planner-element.js.map +0 -1
  64. package/lib/catalog/holes/door-panic-double/planner-element.js +0 -473
  65. package/lib/catalog/holes/door-panic-double/planner-element.js.map +0 -1
  66. package/lib/catalog/holes/door-sliding/planner-element.js +0 -235
  67. package/lib/catalog/holes/door-sliding/planner-element.js.map +0 -1
  68. package/lib/catalog/holes/doorway-framed/planner-element.js +0 -155
  69. package/lib/catalog/holes/doorway-framed/planner-element.js.map +0 -1
  70. package/lib/catalog/holes/doorway-frameless/planner-element.js +0 -114
  71. package/lib/catalog/holes/doorway-frameless/planner-element.js.map +0 -1
  72. package/lib/catalog/holes/window-clear/planner-element.js +0 -176
  73. package/lib/catalog/holes/window-clear/planner-element.js.map +0 -1
  74. package/lib/catalog/holes/window-cross/planner-element.js +0 -175
  75. package/lib/catalog/holes/window-cross/planner-element.js.map +0 -1
  76. package/lib/catalog/holes/window-double-hung/planner-element.js +0 -313
  77. package/lib/catalog/holes/window-double-hung/planner-element.js.map +0 -1
  78. package/lib/catalog/holes/window-vertical/planner-element.js +0 -286
  79. package/lib/catalog/holes/window-vertical/planner-element.js.map +0 -1
  80. package/lib/catalog/lines/wall/planner-element.js +0 -77
  81. package/lib/catalog/lines/wall/planner-element.js.map +0 -1
  82. package/lib/catalog/molding/molding-dcm/planner-element.js +0 -39
  83. package/lib/catalog/molding/molding-dcm/planner-element.js.map +0 -1
  84. package/lib/catalog/molding/molding-fbm/planner-element.js +0 -39
  85. package/lib/catalog/molding/molding-fbm/planner-element.js.map +0 -1
  86. package/lib/catalog/molding/molding-lrm/planner-element.js +0 -39
  87. package/lib/catalog/molding/molding-lrm/planner-element.js.map +0 -1
  88. package/lib/catalog/properties/export.js +0 -82
  89. package/lib/catalog/properties/export.js.map +0 -1
  90. package/lib/catalog/properties/property-checkbox.js +0 -79
  91. package/lib/catalog/properties/property-checkbox.js.map +0 -1
  92. package/lib/catalog/properties/property-color.js +0 -47
  93. package/lib/catalog/properties/property-color.js.map +0 -1
  94. package/lib/catalog/properties/property-enum.js +0 -63
  95. package/lib/catalog/properties/property-enum.js.map +0 -1
  96. package/lib/catalog/properties/property-hidden.js +0 -27
  97. package/lib/catalog/properties/property-hidden.js.map +0 -1
  98. package/lib/catalog/properties/property-lenght-measure.js +0 -109
  99. package/lib/catalog/properties/property-lenght-measure.js.map +0 -1
  100. package/lib/catalog/properties/property-length-measure.js +0 -93
  101. package/lib/catalog/properties/property-length-measure.js.map +0 -1
  102. package/lib/catalog/properties/property-length-measure_hole.js +0 -109
  103. package/lib/catalog/properties/property-length-measure_hole.js.map +0 -1
  104. package/lib/catalog/properties/property-number.js +0 -56
  105. package/lib/catalog/properties/property-number.js.map +0 -1
  106. package/lib/catalog/properties/property-read-only.js +0 -34
  107. package/lib/catalog/properties/property-read-only.js.map +0 -1
  108. package/lib/catalog/properties/property-string.js +0 -56
  109. package/lib/catalog/properties/property-string.js.map +0 -1
  110. package/lib/catalog/properties/property-toggle.js +0 -47
  111. package/lib/catalog/properties/property-toggle.js.map +0 -1
  112. package/lib/catalog/properties/shared-property-style.js +0 -21
  113. package/lib/catalog/properties/shared-property-style.js.map +0 -1
  114. package/lib/catalog/utils/FuseUtils.js +0 -89
  115. package/lib/catalog/utils/FuseUtils.js.map +0 -1
  116. package/lib/catalog/utils/exporter.js +0 -156
  117. package/lib/catalog/utils/exporter.js.map +0 -1
  118. package/lib/catalog/utils/geom-utils.js +0 -206
  119. package/lib/catalog/utils/geom-utils.js.map +0 -1
  120. package/lib/catalog/utils/item-loader.js +0 -1534
  121. package/lib/catalog/utils/item-loader.js.map +0 -1
  122. package/lib/catalog/utils/load-obj.js +0 -100
  123. package/lib/catalog/utils/load-obj.js.map +0 -1
  124. package/lib/catalog/utils/mtl-loader.js +0 -360
  125. package/lib/catalog/utils/mtl-loader.js.map +0 -1
  126. package/lib/catalog/utils/obj-loader.js +0 -479
  127. package/lib/catalog/utils/obj-loader.js.map +0 -1
  128. package/lib/class/FuseUtils.js +0 -89
  129. package/lib/class/FuseUtils.js.map +0 -1
  130. package/lib/class/area.js +0 -151
  131. package/lib/class/area.js.map +0 -1
  132. package/lib/class/export.js +0 -97
  133. package/lib/class/export.js.map +0 -1
  134. package/lib/class/group.js +0 -446
  135. package/lib/class/group.js.map +0 -1
  136. package/lib/class/guide.js +0 -68
  137. package/lib/class/guide.js.map +0 -1
  138. package/lib/class/hole.js +0 -935
  139. package/lib/class/hole.js.map +0 -1
  140. package/lib/class/item.js +0 -1894
  141. package/lib/class/item.js.map +0 -1
  142. package/lib/class/layer.js +0 -673
  143. package/lib/class/layer.js.map +0 -1
  144. package/lib/class/line.js +0 -1296
  145. package/lib/class/line.js.map +0 -1
  146. package/lib/class/project.js +0 -829
  147. package/lib/class/project.js.map +0 -1
  148. package/lib/class/vertex.js +0 -272
  149. package/lib/class/vertex.js.map +0 -1
  150. package/lib/components/atoms/Snackbar/index.js +0 -57
  151. package/lib/components/atoms/Snackbar/index.js.map +0 -1
  152. package/lib/components/atoms/radio-button/index.js +0 -33
  153. package/lib/components/atoms/radio-button/index.js.map +0 -1
  154. package/lib/components/atoms/radio-button/styles.js +0 -12
  155. package/lib/components/atoms/radio-button/styles.js.map +0 -1
  156. package/lib/components/button/MainButton.js +0 -98
  157. package/lib/components/button/MainButton.js.map +0 -1
  158. package/lib/components/button/ToggleMeasureButton.js +0 -63
  159. package/lib/components/button/ToggleMeasureButton.js.map +0 -1
  160. package/lib/components/catalog-view/catalog-breadcrumb.js +0 -61
  161. package/lib/components/catalog-view/catalog-breadcrumb.js.map +0 -1
  162. package/lib/components/catalog-view/catalog-item.js +0 -233
  163. package/lib/components/catalog-view/catalog-item.js.map +0 -1
  164. package/lib/components/catalog-view/catalog-list.js +0 -189
  165. package/lib/components/catalog-view/catalog-list.js.map +0 -1
  166. package/lib/components/catalog-view/catalog-page-item.js +0 -137
  167. package/lib/components/catalog-view/catalog-page-item.js.map +0 -1
  168. package/lib/components/catalog-view/catalog-turn-back-page-item.js +0 -113
  169. package/lib/components/catalog-view/catalog-turn-back-page-item.js.map +0 -1
  170. package/lib/components/configurator/custom-configurator.js +0 -101
  171. package/lib/components/configurator/custom-configurator.js.map +0 -1
  172. package/lib/components/configurator/project-configurator.js +0 -138
  173. package/lib/components/configurator/project-configurator.js.map +0 -1
  174. package/lib/components/content.js +0 -132
  175. package/lib/components/content.js.map +0 -1
  176. package/lib/components/export.js +0 -90
  177. package/lib/components/export.js.map +0 -1
  178. package/lib/components/firstsetting/button/styles.js +0 -34
  179. package/lib/components/firstsetting/button/styles.js.map +0 -1
  180. package/lib/components/firstsetting/export.js +0 -16
  181. package/lib/components/firstsetting/export.js.map +0 -1
  182. package/lib/components/firstsetting/firstsetting-content-button.js +0 -224
  183. package/lib/components/firstsetting/firstsetting-content-button.js.map +0 -1
  184. package/lib/components/firstsetting/firstsetting-toggle-button.js +0 -133
  185. package/lib/components/firstsetting/firstsetting-toggle-button.js.map +0 -1
  186. package/lib/components/firstsetting/firstsetting.js +0 -633
  187. package/lib/components/firstsetting/firstsetting.js.map +0 -1
  188. package/lib/components/footerbar/button/ControlButton.js +0 -79
  189. package/lib/components/footerbar/button/ControlButton.js.map +0 -1
  190. package/lib/components/footerbar/button/DirectionButton.js +0 -76
  191. package/lib/components/footerbar/button/DirectionButton.js.map +0 -1
  192. package/lib/components/footerbar/button/DirectionPanSpinButton.js +0 -57
  193. package/lib/components/footerbar/button/DirectionPanSpinButton.js.map +0 -1
  194. package/lib/components/footerbar/button/ToggleButton.js +0 -83
  195. package/lib/components/footerbar/button/ToggleButton.js.map +0 -1
  196. package/lib/components/footerbar/button/ToggleConvertButton.js +0 -80
  197. package/lib/components/footerbar/button/ToggleConvertButton.js.map +0 -1
  198. package/lib/components/footerbar/button/ToggleMeasureButton.js +0 -59
  199. package/lib/components/footerbar/button/ToggleMeasureButton.js.map +0 -1
  200. package/lib/components/footerbar/button/styles.js +0 -29
  201. package/lib/components/footerbar/button/styles.js.map +0 -1
  202. package/lib/components/footerbar/export.js +0 -16
  203. package/lib/components/footerbar/export.js.map +0 -1
  204. package/lib/components/footerbar/footer-content-button.js +0 -224
  205. package/lib/components/footerbar/footer-content-button.js.map +0 -1
  206. package/lib/components/footerbar/footer-toggle-button.js +0 -133
  207. package/lib/components/footerbar/footer-toggle-button.js.map +0 -1
  208. package/lib/components/footerbar/footerbar.js +0 -808
  209. package/lib/components/footerbar/footerbar.js.map +0 -1
  210. package/lib/components/footerbar/styles.js +0 -41
  211. package/lib/components/footerbar/styles.js.map +0 -1
  212. package/lib/components/header/button/MenuButton.js +0 -77
  213. package/lib/components/header/button/MenuButton.js.map +0 -1
  214. package/lib/components/header/button/SaveButton.js +0 -57
  215. package/lib/components/header/button/SaveButton.js.map +0 -1
  216. package/lib/components/header/button/styles.js +0 -68
  217. package/lib/components/header/button/styles.js.map +0 -1
  218. package/lib/components/header/export.js +0 -12
  219. package/lib/components/header/export.js.map +0 -1
  220. package/lib/components/header/header.js +0 -556
  221. package/lib/components/header/header.js.map +0 -1
  222. package/lib/components/header/styles.js +0 -47
  223. package/lib/components/header/styles.js.map +0 -1
  224. package/lib/components/login/Login.js +0 -94
  225. package/lib/components/login/Login.js.map +0 -1
  226. package/lib/components/login/LoginForm/index.js +0 -140
  227. package/lib/components/login/LoginForm/index.js.map +0 -1
  228. package/lib/components/login/Register.js +0 -104
  229. package/lib/components/login/Register.js.map +0 -1
  230. package/lib/components/login/RegisterForm/index.js +0 -237
  231. package/lib/components/login/RegisterForm/index.js.map +0 -1
  232. package/lib/components/login/jwtService.js +0 -239
  233. package/lib/components/login/jwtService.js.map +0 -1
  234. package/lib/components/molecules/slider/index.js +0 -22
  235. package/lib/components/molecules/slider/index.js.map +0 -1
  236. package/lib/components/molecules/slider/styles.js +0 -2
  237. package/lib/components/molecules/slider/styles.js.map +0 -1
  238. package/lib/components/myprojects/export.js +0 -12
  239. package/lib/components/myprojects/export.js.map +0 -1
  240. package/lib/components/myprojects/index.js +0 -453
  241. package/lib/components/myprojects/index.js.map +0 -1
  242. package/lib/components/myprojects/styles.js +0 -31
  243. package/lib/components/myprojects/styles.js.map +0 -1
  244. package/lib/components/sidebar/custom-accordion.js +0 -45
  245. package/lib/components/sidebar/custom-accordion.js.map +0 -1
  246. package/lib/components/sidebar/export.js +0 -50
  247. package/lib/components/sidebar/export.js.map +0 -1
  248. package/lib/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.js +0 -74
  249. package/lib/components/sidebar/panel-element-editor/attributes-editor/attributes-editor.js.map +0 -1
  250. package/lib/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.js +0 -124
  251. package/lib/components/sidebar/panel-element-editor/attributes-editor/confirm-popup.js.map +0 -1
  252. package/lib/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.js +0 -135
  253. package/lib/components/sidebar/panel-element-editor/attributes-editor/hole-attributes-editor.js.map +0 -1
  254. package/lib/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.js +0 -260
  255. package/lib/components/sidebar/panel-element-editor/attributes-editor/item-attributes-editor.js.map +0 -1
  256. package/lib/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.js +0 -84
  257. package/lib/components/sidebar/panel-element-editor/attributes-editor/line-attributes-editor.js.map +0 -1
  258. package/lib/components/sidebar/panel-element-editor/element-editor.js +0 -884
  259. package/lib/components/sidebar/panel-element-editor/element-editor.js.map +0 -1
  260. package/lib/components/sidebar/panel-element-editor/multi-elements-editor.js +0 -2
  261. package/lib/components/sidebar/panel-element-editor/multi-elements-editor.js.map +0 -1
  262. package/lib/components/sidebar/panel-element-editor/panel-element-editor.js +0 -56
  263. package/lib/components/sidebar/panel-element-editor/panel-element-editor.js.map +0 -1
  264. package/lib/components/sidebar/panel-element-editor/panel-multi-elements-editor.js +0 -125
  265. package/lib/components/sidebar/panel-element-editor/panel-multi-elements-editor.js.map +0 -1
  266. package/lib/components/sidebar/panel-group-editor.js +0 -218
  267. package/lib/components/sidebar/panel-group-editor.js.map +0 -1
  268. package/lib/components/sidebar/panel-groups.js +0 -274
  269. package/lib/components/sidebar/panel-groups.js.map +0 -1
  270. package/lib/components/sidebar/panel-guides.js +0 -192
  271. package/lib/components/sidebar/panel-guides.js.map +0 -1
  272. package/lib/components/sidebar/panel-layer-elements.js +0 -258
  273. package/lib/components/sidebar/panel-layer-elements.js.map +0 -1
  274. package/lib/components/sidebar/panel-layers.js +0 -347
  275. package/lib/components/sidebar/panel-layers.js.map +0 -1
  276. package/lib/components/sidebar/panel.js +0 -110
  277. package/lib/components/sidebar/panel.js.map +0 -1
  278. package/lib/components/sidebar/sidebar.js +0 -117
  279. package/lib/components/sidebar/sidebar.js.map +0 -1
  280. package/lib/components/sidebar/toolbar-panel.js +0 -171
  281. package/lib/components/sidebar/toolbar-panel.js.map +0 -1
  282. package/lib/components/sign/export.js +0 -18
  283. package/lib/components/sign/export.js.map +0 -1
  284. package/lib/components/sign/main/index.js +0 -567
  285. package/lib/components/sign/main/index.js.map +0 -1
  286. package/lib/components/sign/main/styles.js +0 -27
  287. package/lib/components/sign/main/styles.js.map +0 -1
  288. package/lib/components/style/button.js +0 -121
  289. package/lib/components/style/button.js.map +0 -1
  290. package/lib/components/style/cancel-button.js +0 -30
  291. package/lib/components/style/cancel-button.js.map +0 -1
  292. package/lib/components/style/content-container.js +0 -41
  293. package/lib/components/style/content-container.js.map +0 -1
  294. package/lib/components/style/content-title.js +0 -38
  295. package/lib/components/style/content-title.js.map +0 -1
  296. package/lib/components/style/delete-button.js +0 -35
  297. package/lib/components/style/delete-button.js.map +0 -1
  298. package/lib/components/style/export.js +0 -122
  299. package/lib/components/style/export.js.map +0 -1
  300. package/lib/components/style/form-block.js +0 -32
  301. package/lib/components/style/form-block.js.map +0 -1
  302. package/lib/components/style/form-color-input.js +0 -35
  303. package/lib/components/style/form-color-input.js.map +0 -1
  304. package/lib/components/style/form-label.js +0 -34
  305. package/lib/components/style/form-label.js.map +0 -1
  306. package/lib/components/style/form-number-input.js +0 -197
  307. package/lib/components/style/form-number-input.js.map +0 -1
  308. package/lib/components/style/form-number-input_2.js +0 -214
  309. package/lib/components/style/form-number-input_2.js.map +0 -1
  310. package/lib/components/style/form-select.js +0 -30
  311. package/lib/components/style/form-select.js.map +0 -1
  312. package/lib/components/style/form-slider.js +0 -53
  313. package/lib/components/style/form-slider.js.map +0 -1
  314. package/lib/components/style/form-submit-button.js +0 -36
  315. package/lib/components/style/form-submit-button.js.map +0 -1
  316. package/lib/components/style/form-text-input.js +0 -84
  317. package/lib/components/style/form-text-input.js.map +0 -1
  318. package/lib/components/toolbar/button/ControlButton.js +0 -76
  319. package/lib/components/toolbar/button/ControlButton.js.map +0 -1
  320. package/lib/components/toolbar/button/DirectionButton.js +0 -57
  321. package/lib/components/toolbar/button/DirectionButton.js.map +0 -1
  322. package/lib/components/toolbar/button/RightButton.js +0 -140
  323. package/lib/components/toolbar/button/RightButton.js.map +0 -1
  324. package/lib/components/toolbar/button/ToggleButton.js +0 -66
  325. package/lib/components/toolbar/button/ToggleButton.js.map +0 -1
  326. package/lib/components/toolbar/button/index.js +0 -94
  327. package/lib/components/toolbar/button/index.js.map +0 -1
  328. package/lib/components/toolbar/button/styles.js +0 -21
  329. package/lib/components/toolbar/button/styles.js.map +0 -1
  330. package/lib/components/toolbar/components/DoorStyleMenu.js +0 -112
  331. package/lib/components/toolbar/components/DoorStyleMenu.js.map +0 -1
  332. package/lib/components/toolbar/components/Pricing.js +0 -110
  333. package/lib/components/toolbar/components/Pricing.js.map +0 -1
  334. package/lib/components/toolbar/components/ReviewForQuote.js +0 -485
  335. package/lib/components/toolbar/components/ReviewForQuote.js.map +0 -1
  336. package/lib/components/toolbar/export.js +0 -50
  337. package/lib/components/toolbar/export.js.map +0 -1
  338. package/lib/components/toolbar/main/Alert.js +0 -132
  339. package/lib/components/toolbar/main/Alert.js.map +0 -1
  340. package/lib/components/toolbar/main/TakePictureModal.js +0 -109
  341. package/lib/components/toolbar/main/TakePictureModal.js.map +0 -1
  342. package/lib/components/toolbar/main/confirm-popup.js +0 -95
  343. package/lib/components/toolbar/main/confirm-popup.js.map +0 -1
  344. package/lib/components/toolbar/main/index.js +0 -4619
  345. package/lib/components/toolbar/main/index.js.map +0 -1
  346. package/lib/components/toolbar/main/myComponents.js +0 -125
  347. package/lib/components/toolbar/main/myComponents.js.map +0 -1
  348. package/lib/components/toolbar/main/styles.js +0 -73
  349. package/lib/components/toolbar/main/styles.js.map +0 -1
  350. package/lib/components/toolbar/plugin-item.js +0 -156
  351. package/lib/components/toolbar/plugin-item.js.map +0 -1
  352. package/lib/components/toolbar/popup/appliance/appliance-category/index.js +0 -86
  353. package/lib/components/toolbar/popup/appliance/appliance-category/index.js.map +0 -1
  354. package/lib/components/toolbar/popup/appliance/choose-appliance/index.js +0 -85
  355. package/lib/components/toolbar/popup/appliance/choose-appliance/index.js.map +0 -1
  356. package/lib/components/toolbar/popup/appliance/index.js +0 -89
  357. package/lib/components/toolbar/popup/appliance/index.js.map +0 -1
  358. package/lib/components/toolbar/popup/autosaveprompt/index.js +0 -99
  359. package/lib/components/toolbar/popup/autosaveprompt/index.js.map +0 -1
  360. package/lib/components/toolbar/popup/autosaveprompt/styles.js +0 -16
  361. package/lib/components/toolbar/popup/autosaveprompt/styles.js.map +0 -1
  362. package/lib/components/toolbar/popup/cabinet/cabinet-category/index.js +0 -86
  363. package/lib/components/toolbar/popup/cabinet/cabinet-category/index.js.map +0 -1
  364. package/lib/components/toolbar/popup/cabinet/choose-product/index.js +0 -107
  365. package/lib/components/toolbar/popup/cabinet/choose-product/index.js.map +0 -1
  366. package/lib/components/toolbar/popup/cabinet/index.js +0 -91
  367. package/lib/components/toolbar/popup/cabinet/index.js.map +0 -1
  368. package/lib/components/toolbar/popup/doorStyle/choose-style/index.js +0 -59
  369. package/lib/components/toolbar/popup/doorStyle/choose-style/index.js.map +0 -1
  370. package/lib/components/toolbar/popup/doorStyle/index.js +0 -68
  371. package/lib/components/toolbar/popup/doorStyle/index.js.map +0 -1
  372. package/lib/components/toolbar/popup/doorStyle/style-category/index.js +0 -152
  373. package/lib/components/toolbar/popup/doorStyle/style-category/index.js.map +0 -1
  374. package/lib/components/toolbar/popup/downloadsummary/downloadSummaryContext.js +0 -9
  375. package/lib/components/toolbar/popup/downloadsummary/downloadSummaryContext.js.map +0 -1
  376. package/lib/components/toolbar/popup/downloadsummary/downloadSummaryTemp.js +0 -128
  377. package/lib/components/toolbar/popup/downloadsummary/downloadSummaryTemp.js.map +0 -1
  378. package/lib/components/toolbar/popup/downloadsummary/index.js +0 -572
  379. package/lib/components/toolbar/popup/downloadsummary/index.js.map +0 -1
  380. package/lib/components/toolbar/popup/downloadsummary/show2D/show2DView.js +0 -60
  381. package/lib/components/toolbar/popup/downloadsummary/show2D/show2DView.js.map +0 -1
  382. package/lib/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.js +0 -200
  383. package/lib/components/toolbar/popup/downloadsummary/show2D/viewer2DDownLoad.js.map +0 -1
  384. package/lib/components/toolbar/popup/downloadsummary/show3D/show3DView.js +0 -254
  385. package/lib/components/toolbar/popup/downloadsummary/show3D/show3DView.js.map +0 -1
  386. package/lib/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.js +0 -1762
  387. package/lib/components/toolbar/popup/downloadsummary/show3D/viewer3DDownLoad.js.map +0 -1
  388. package/lib/components/toolbar/popup/downloadsummary/showCabinetInfo.js +0 -96
  389. package/lib/components/toolbar/popup/downloadsummary/showCabinetInfo.js.map +0 -1
  390. package/lib/components/toolbar/popup/downloadsummary/showElevation/showElevationView.js +0 -125
  391. package/lib/components/toolbar/popup/downloadsummary/showElevation/showElevationView.js.map +0 -1
  392. package/lib/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.js +0 -1713
  393. package/lib/components/toolbar/popup/downloadsummary/showElevation/viewer3DElevationDownload.js.map +0 -1
  394. package/lib/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.js +0 -184
  395. package/lib/components/toolbar/popup/downloadsummary/showElevation/viewerElevationDownload.js.map +0 -1
  396. package/lib/components/toolbar/popup/downloadsummary/showWarranty.js +0 -115
  397. package/lib/components/toolbar/popup/downloadsummary/showWarranty.js.map +0 -1
  398. package/lib/components/toolbar/popup/downloadsummary/styles.js +0 -47
  399. package/lib/components/toolbar/popup/downloadsummary/styles.js.map +0 -1
  400. package/lib/components/toolbar/popup/finishingtouch/category/index.js +0 -44
  401. package/lib/components/toolbar/popup/finishingtouch/category/index.js.map +0 -1
  402. package/lib/components/toolbar/popup/finishingtouch/index.js +0 -54
  403. package/lib/components/toolbar/popup/finishingtouch/index.js.map +0 -1
  404. package/lib/components/toolbar/popup/finishingtouch/material-edit.js +0 -163
  405. package/lib/components/toolbar/popup/finishingtouch/material-edit.js.map +0 -1
  406. package/lib/components/toolbar/popup/finishingtouch/product/index.js +0 -65
  407. package/lib/components/toolbar/popup/finishingtouch/product/index.js.map +0 -1
  408. package/lib/components/toolbar/popup/floorplan/choose-floor/confirm-popup.js +0 -124
  409. package/lib/components/toolbar/popup/floorplan/choose-floor/confirm-popup.js.map +0 -1
  410. package/lib/components/toolbar/popup/floorplan/choose-floor/index.js +0 -255
  411. package/lib/components/toolbar/popup/floorplan/choose-floor/index.js.map +0 -1
  412. package/lib/components/toolbar/popup/floorplan/choose-floor/styles.js +0 -20
  413. package/lib/components/toolbar/popup/floorplan/choose-floor/styles.js.map +0 -1
  414. package/lib/components/toolbar/popup/floorplan/floor-category/index.js +0 -99
  415. package/lib/components/toolbar/popup/floorplan/floor-category/index.js.map +0 -1
  416. package/lib/components/toolbar/popup/floorplan/index.js +0 -56
  417. package/lib/components/toolbar/popup/floorplan/index.js.map +0 -1
  418. package/lib/components/toolbar/popup/index.js +0 -195
  419. package/lib/components/toolbar/popup/index.js.map +0 -1
  420. package/lib/components/toolbar/popup/newproject/index.js +0 -75
  421. package/lib/components/toolbar/popup/newproject/index.js.map +0 -1
  422. package/lib/components/toolbar/popup/newproject/styles.js +0 -16
  423. package/lib/components/toolbar/popup/newproject/styles.js.map +0 -1
  424. package/lib/components/toolbar/popup/product/appliance.js +0 -73
  425. package/lib/components/toolbar/popup/product/appliance.js.map +0 -1
  426. package/lib/components/toolbar/popup/product/cabinetproduct.js +0 -33
  427. package/lib/components/toolbar/popup/product/cabinetproduct.js.map +0 -1
  428. package/lib/components/toolbar/popup/product/doorstyle.js +0 -59
  429. package/lib/components/toolbar/popup/product/doorstyle.js.map +0 -1
  430. package/lib/components/toolbar/popup/product/doorstyleproduct.js +0 -59
  431. package/lib/components/toolbar/popup/product/doorstyleproduct.js.map +0 -1
  432. package/lib/components/toolbar/popup/product/floor.js +0 -59
  433. package/lib/components/toolbar/popup/product/floor.js.map +0 -1
  434. package/lib/components/toolbar/popup/product/floorproduct.js +0 -68
  435. package/lib/components/toolbar/popup/product/floorproduct.js.map +0 -1
  436. package/lib/components/toolbar/popup/product/index.js +0 -59
  437. package/lib/components/toolbar/popup/product/index.js.map +0 -1
  438. package/lib/components/toolbar/popup/product/primary.js +0 -71
  439. package/lib/components/toolbar/popup/product/primary.js.map +0 -1
  440. package/lib/components/toolbar/popup/product/productline.js +0 -128
  441. package/lib/components/toolbar/popup/product/productline.js.map +0 -1
  442. package/lib/components/toolbar/popup/product/reviewItem.js +0 -346
  443. package/lib/components/toolbar/popup/product/reviewItem.js.map +0 -1
  444. package/lib/components/toolbar/popup/product/reviewMolding.js +0 -291
  445. package/lib/components/toolbar/popup/product/reviewMolding.js.map +0 -1
  446. package/lib/components/toolbar/popup/product/styles.js +0 -79
  447. package/lib/components/toolbar/popup/product/styles.js.map +0 -1
  448. package/lib/components/toolbar/popup/savedesign/FullPictureForm.js +0 -169
  449. package/lib/components/toolbar/popup/savedesign/FullPictureForm.js.map +0 -1
  450. package/lib/components/toolbar/popup/savedesign/index.js +0 -516
  451. package/lib/components/toolbar/popup/savedesign/index.js.map +0 -1
  452. package/lib/components/toolbar/popup/savedesign/styles.js +0 -26
  453. package/lib/components/toolbar/popup/savedesign/styles.js.map +0 -1
  454. package/lib/components/toolbar/popup/setDoorStyleOption/index.js +0 -64
  455. package/lib/components/toolbar/popup/setDoorStyleOption/index.js.map +0 -1
  456. package/lib/components/toolbar/popup/styles.js +0 -104
  457. package/lib/components/toolbar/popup/styles.js.map +0 -1
  458. package/lib/components/toolbar/popup/submitforquote/AddToCartOptions.js +0 -166
  459. package/lib/components/toolbar/popup/submitforquote/AddToCartOptions.js.map +0 -1
  460. package/lib/components/toolbar/popup/submitforquote/CustomerRequestsForm.js +0 -93
  461. package/lib/components/toolbar/popup/submitforquote/CustomerRequestsForm.js.map +0 -1
  462. package/lib/components/toolbar/popup/submitforquote/SkipDesignerReview.js +0 -45
  463. package/lib/components/toolbar/popup/submitforquote/SkipDesignerReview.js.map +0 -1
  464. package/lib/components/toolbar/popup/submitforquote/StepDots.js +0 -40
  465. package/lib/components/toolbar/popup/submitforquote/StepDots.js.map +0 -1
  466. package/lib/components/toolbar/popup/submitforquote/cart-choice.js +0 -141
  467. package/lib/components/toolbar/popup/submitforquote/cart-choice.js.map +0 -1
  468. package/lib/components/toolbar/popup/submitforquote/doorstyle-menus.js +0 -50
  469. package/lib/components/toolbar/popup/submitforquote/doorstyle-menus.js.map +0 -1
  470. package/lib/components/toolbar/popup/submitforquote/index.js +0 -698
  471. package/lib/components/toolbar/popup/submitforquote/index.js.map +0 -1
  472. package/lib/components/toolbar/popup/submitforquote/styles.js +0 -38
  473. package/lib/components/toolbar/popup/submitforquote/styles.js.map +0 -1
  474. package/lib/components/toolbar/popup/submitprompt/index.js +0 -79
  475. package/lib/components/toolbar/popup/submitprompt/index.js.map +0 -1
  476. package/lib/components/toolbar/popup/submitprompt/styles.js +0 -16
  477. package/lib/components/toolbar/popup/submitprompt/styles.js.map +0 -1
  478. package/lib/components/toolbar/toolbar-button.js +0 -111
  479. package/lib/components/toolbar/toolbar-button.js.map +0 -1
  480. package/lib/components/toolbar/toolbar-load-button.js +0 -36
  481. package/lib/components/toolbar/toolbar-load-button.js.map +0 -1
  482. package/lib/components/toolbar/toolbar-save-button.js +0 -34
  483. package/lib/components/toolbar/toolbar-save-button.js.map +0 -1
  484. package/lib/components/tutorial-view/Modal.js +0 -503
  485. package/lib/components/tutorial-view/Modal.js.map +0 -1
  486. package/lib/components/tutorial-view/styles.js +0 -13
  487. package/lib/components/tutorial-view/styles.js.map +0 -1
  488. package/lib/components/viewer2d/area.js +0 -90
  489. package/lib/components/viewer2d/area.js.map +0 -1
  490. package/lib/components/viewer2d/export.js +0 -122
  491. package/lib/components/viewer2d/export.js.map +0 -1
  492. package/lib/components/viewer2d/grids/grid-horizontal-streak.js +0 -45
  493. package/lib/components/viewer2d/grids/grid-horizontal-streak.js.map +0 -1
  494. package/lib/components/viewer2d/grids/grid-streak.js +0 -45
  495. package/lib/components/viewer2d/grids/grid-streak.js.map +0 -1
  496. package/lib/components/viewer2d/grids/grid-vertical-streak.js +0 -45
  497. package/lib/components/viewer2d/grids/grid-vertical-streak.js.map +0 -1
  498. package/lib/components/viewer2d/grids/grids.js +0 -45
  499. package/lib/components/viewer2d/grids/grids.js.map +0 -1
  500. package/lib/components/viewer2d/group.js +0 -63
  501. package/lib/components/viewer2d/group.js.map +0 -1
  502. package/lib/components/viewer2d/item.js +0 -522
  503. package/lib/components/viewer2d/item.js.map +0 -1
  504. package/lib/components/viewer2d/layer.js +0 -172
  505. package/lib/components/viewer2d/layer.js.map +0 -1
  506. package/lib/components/viewer2d/line.js +0 -899
  507. package/lib/components/viewer2d/line.js.map +0 -1
  508. package/lib/components/viewer2d/ruler.js +0 -108
  509. package/lib/components/viewer2d/ruler.js.map +0 -1
  510. package/lib/components/viewer2d/rulerDist.js +0 -154
  511. package/lib/components/viewer2d/rulerDist.js.map +0 -1
  512. package/lib/components/viewer2d/rulerX.js +0 -159
  513. package/lib/components/viewer2d/rulerX.js.map +0 -1
  514. package/lib/components/viewer2d/rulerY.js +0 -161
  515. package/lib/components/viewer2d/rulerY.js.map +0 -1
  516. package/lib/components/viewer2d/scene.js +0 -148
  517. package/lib/components/viewer2d/scene.js.map +0 -1
  518. package/lib/components/viewer2d/snap.js +0 -84
  519. package/lib/components/viewer2d/snap.js.map +0 -1
  520. package/lib/components/viewer2d/state.js +0 -88
  521. package/lib/components/viewer2d/state.js.map +0 -1
  522. package/lib/components/viewer2d/utils.js +0 -174
  523. package/lib/components/viewer2d/utils.js.map +0 -1
  524. package/lib/components/viewer2d/vertex.js +0 -76
  525. package/lib/components/viewer2d/vertex.js.map +0 -1
  526. package/lib/components/viewer2d/viewer2d.js +0 -1409
  527. package/lib/components/viewer2d/viewer2d.js.map +0 -1
  528. package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +0 -2598
  529. package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js.map +0 -1
  530. package/lib/components/viewer3d/dcm.js +0 -408
  531. package/lib/components/viewer3d/dcm.js.map +0 -1
  532. package/lib/components/viewer3d/fbm.js +0 -421
  533. package/lib/components/viewer3d/fbm.js.map +0 -1
  534. package/lib/components/viewer3d/front3D.js +0 -76
  535. package/lib/components/viewer3d/front3D.js.map +0 -1
  536. package/lib/components/viewer3d/grid-creator.js +0 -35
  537. package/lib/components/viewer3d/grid-creator.js.map +0 -1
  538. package/lib/components/viewer3d/grids/grid-horizontal-streak.js +0 -45
  539. package/lib/components/viewer3d/grids/grid-horizontal-streak.js.map +0 -1
  540. package/lib/components/viewer3d/grids/grid-streak.js +0 -36
  541. package/lib/components/viewer3d/grids/grid-streak.js.map +0 -1
  542. package/lib/components/viewer3d/grids/grid-vertical-streak.js +0 -45
  543. package/lib/components/viewer3d/grids/grid-vertical-streak.js.map +0 -1
  544. package/lib/components/viewer3d/libs/first-person-controls.js +0 -75
  545. package/lib/components/viewer3d/libs/first-person-controls.js.map +0 -1
  546. package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js +0 -1288
  547. package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js.map +0 -1
  548. package/lib/components/viewer3d/libs/mtl-loader.js +0 -360
  549. package/lib/components/viewer3d/libs/mtl-loader.js.map +0 -1
  550. package/lib/components/viewer3d/libs/obj-loader.js +0 -465
  551. package/lib/components/viewer3d/libs/obj-loader.js.map +0 -1
  552. package/lib/components/viewer3d/libs/orbit-controls.js +0 -701
  553. package/lib/components/viewer3d/libs/orbit-controls.js.map +0 -1
  554. package/lib/components/viewer3d/libs/pointer-lock-controls.js +0 -48
  555. package/lib/components/viewer3d/libs/pointer-lock-controls.js.map +0 -1
  556. package/lib/components/viewer3d/lrm.js +0 -312
  557. package/lib/components/viewer3d/lrm.js.map +0 -1
  558. package/lib/components/viewer3d/model.js +0 -715
  559. package/lib/components/viewer3d/model.js.map +0 -1
  560. package/lib/components/viewer3d/pointer-lock-navigation.js +0 -123
  561. package/lib/components/viewer3d/pointer-lock-navigation.js.map +0 -1
  562. package/lib/components/viewer3d/ruler-utils/itemRect.js +0 -69
  563. package/lib/components/viewer3d/ruler-utils/itemRect.js.map +0 -1
  564. package/lib/components/viewer3d/ruler-utils/layer3D.js +0 -503
  565. package/lib/components/viewer3d/ruler-utils/layer3D.js.map +0 -1
  566. package/lib/components/viewer3d/ruler-utils/ruler3D.js +0 -235
  567. package/lib/components/viewer3d/ruler-utils/ruler3D.js.map +0 -1
  568. package/lib/components/viewer3d/ruler-utils/scene3D.js +0 -70
  569. package/lib/components/viewer3d/ruler-utils/scene3D.js.map +0 -1
  570. package/lib/components/viewer3d/ruler-utils/state3D.js +0 -26
  571. package/lib/components/viewer3d/ruler-utils/state3D.js.map +0 -1
  572. package/lib/components/viewer3d/scene-creator.js +0 -3641
  573. package/lib/components/viewer3d/scene-creator.js.map +0 -1
  574. package/lib/components/viewer3d/three-memory-cleaner.js +0 -61
  575. package/lib/components/viewer3d/three-memory-cleaner.js.map +0 -1
  576. package/lib/components/viewer3d/viewer3d-first-person.js +0 -321
  577. package/lib/components/viewer3d/viewer3d-first-person.js.map +0 -1
  578. package/lib/components/viewer3d/viewer3d.js +0 -2508
  579. package/lib/components/viewer3d/viewer3d.js.map +0 -1
  580. package/lib/components/wizardstep/button/styles.js +0 -67
  581. package/lib/components/wizardstep/button/styles.js.map +0 -1
  582. package/lib/components/wizardstep/export.js +0 -12
  583. package/lib/components/wizardstep/export.js.map +0 -1
  584. package/lib/components/wizardstep/index.js +0 -978
  585. package/lib/components/wizardstep/index.js.map +0 -1
  586. package/lib/components/wizardstep/styles.js +0 -68
  587. package/lib/components/wizardstep/styles.js.map +0 -1
  588. package/lib/components/wizardstep/wizardstep-content-button.js +0 -224
  589. package/lib/components/wizardstep/wizardstep-content-button.js.map +0 -1
  590. package/lib/components/wizardstep/wizardstep-toggle-button.js +0 -133
  591. package/lib/components/wizardstep/wizardstep-toggle-button.js.map +0 -1
  592. package/lib/constants.js +0 -646
  593. package/lib/constants.js.map +0 -1
  594. package/lib/hooks/useCheckCart.js +0 -60
  595. package/lib/hooks/useCheckCart.js.map +0 -1
  596. package/lib/hooks/useGetPricesBySku.js +0 -81
  597. package/lib/hooks/useGetPricesBySku.js.map +0 -1
  598. package/lib/hooks/useValidateToken.js +0 -207
  599. package/lib/hooks/useValidateToken.js.map +0 -1
  600. package/lib/index.js +0 -102
  601. package/lib/index.js.map +0 -1
  602. package/lib/models.js +0 -518
  603. package/lib/models.js.map +0 -1
  604. package/lib/plugins/SVGLoader.js +0 -1418
  605. package/lib/plugins/SVGLoader.js.map +0 -1
  606. package/lib/plugins/autosave.js +0 -40
  607. package/lib/plugins/autosave.js.map +0 -1
  608. package/lib/plugins/console-debugger.js +0 -45
  609. package/lib/plugins/console-debugger.js.map +0 -1
  610. package/lib/plugins/export.js +0 -34
  611. package/lib/plugins/export.js.map +0 -1
  612. package/lib/plugins/keyboard.js +0 -108
  613. package/lib/plugins/keyboard.js.map +0 -1
  614. package/lib/reducers/areas-reducer.js +0 -19
  615. package/lib/reducers/areas-reducer.js.map +0 -1
  616. package/lib/reducers/export.js +0 -98
  617. package/lib/reducers/export.js.map +0 -1
  618. package/lib/reducers/groups-reducer.js +0 -45
  619. package/lib/reducers/groups-reducer.js.map +0 -1
  620. package/lib/reducers/holes-reducer.js +0 -69
  621. package/lib/reducers/holes-reducer.js.map +0 -1
  622. package/lib/reducers/items-reducer.js +0 -147
  623. package/lib/reducers/items-reducer.js.map +0 -1
  624. package/lib/reducers/lines-reducer.js +0 -52
  625. package/lib/reducers/lines-reducer.js.map +0 -1
  626. package/lib/reducers/project-reducer.js +0 -136
  627. package/lib/reducers/project-reducer.js.map +0 -1
  628. package/lib/reducers/reducer.js +0 -27
  629. package/lib/reducers/reducer.js.map +0 -1
  630. package/lib/reducers/scene-reducer.js +0 -35
  631. package/lib/reducers/scene-reducer.js.map +0 -1
  632. package/lib/reducers/user-reducer.js +0 -48
  633. package/lib/reducers/user-reducer.js.map +0 -1
  634. package/lib/reducers/vertices-reducer.js +0 -26
  635. package/lib/reducers/vertices-reducer.js.map +0 -1
  636. package/lib/reducers/viewer2d-reducer.js +0 -83
  637. package/lib/reducers/viewer2d-reducer.js.map +0 -1
  638. package/lib/reducers/viewer3d-reducer.js +0 -64
  639. package/lib/reducers/viewer3d-reducer.js.map +0 -1
  640. package/lib/shared-style.js +0 -73
  641. package/lib/shared-style.js.map +0 -1
  642. package/lib/styles/export.js +0 -14
  643. package/lib/styles/export.js.map +0 -1
  644. package/lib/translator/en.js +0 -111
  645. package/lib/translator/en.js.map +0 -1
  646. package/lib/translator/it.js +0 -86
  647. package/lib/translator/it.js.map +0 -1
  648. package/lib/translator/ru.js +0 -86
  649. package/lib/translator/ru.js.map +0 -1
  650. package/lib/translator/translator.js +0 -91
  651. package/lib/translator/translator.js.map +0 -1
  652. package/lib/utils/browser.js +0 -41
  653. package/lib/utils/browser.js.map +0 -1
  654. package/lib/utils/email-validator.js +0 -11
  655. package/lib/utils/email-validator.js.map +0 -1
  656. package/lib/utils/export.js +0 -57
  657. package/lib/utils/export.js.map +0 -1
  658. package/lib/utils/geometry.js +0 -2329
  659. package/lib/utils/geometry.js.map +0 -1
  660. package/lib/utils/get-edges-of-subgraphs.js +0 -29
  661. package/lib/utils/get-edges-of-subgraphs.js.map +0 -1
  662. package/lib/utils/graph-cycles.js +0 -241
  663. package/lib/utils/graph-cycles.js.map +0 -1
  664. package/lib/utils/graph-inner-cycles.js +0 -55
  665. package/lib/utils/graph-inner-cycles.js.map +0 -1
  666. package/lib/utils/graph.js +0 -152
  667. package/lib/utils/graph.js.map +0 -1
  668. package/lib/utils/helper.js +0 -360
  669. package/lib/utils/helper.js.map +0 -1
  670. package/lib/utils/history.js +0 -37
  671. package/lib/utils/history.js.map +0 -1
  672. package/lib/utils/id-broker.js +0 -26
  673. package/lib/utils/id-broker.js.map +0 -1
  674. package/lib/utils/logger.js +0 -15
  675. package/lib/utils/logger.js.map +0 -1
  676. package/lib/utils/math.js +0 -58
  677. package/lib/utils/math.js.map +0 -1
  678. package/lib/utils/molding.js +0 -864
  679. package/lib/utils/molding.js.map +0 -1
  680. package/lib/utils/name-generator.js +0 -24
  681. package/lib/utils/name-generator.js.map +0 -1
  682. package/lib/utils/objects-utils.js +0 -61
  683. package/lib/utils/objects-utils.js.map +0 -1
  684. package/lib/utils/phone-validator.js +0 -11
  685. package/lib/utils/phone-validator.js.map +0 -1
  686. package/lib/utils/process-black-list.js +0 -25
  687. package/lib/utils/process-black-list.js.map +0 -1
  688. package/lib/utils/react-if.js +0 -25
  689. package/lib/utils/react-if.js.map +0 -1
  690. package/lib/utils/snap-scene.js +0 -106
  691. package/lib/utils/snap-scene.js.map +0 -1
  692. package/lib/utils/snap.js +0 -250
  693. package/lib/utils/snap.js.map +0 -1
  694. package/lib/utils/threeCSG.es6.js +0 -504
  695. package/lib/utils/threeCSG.es6.js.map +0 -1
  696. package/lib/version.js +0 -8
  697. package/lib/version.js.map +0 -1
@@ -1,2598 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.EventDispatcher = void 0;
7
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
9
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
10
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
- function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
12
- function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
13
- function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
14
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
15
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
16
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
18
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
19
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
20
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
21
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
22
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
- /*!
24
- * camera-controls
25
- * https://github.com/yomotsu/camera-controls
26
- * (c) 2017 @yomotsu
27
- * Released under the MIT License.
28
- */
29
- // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#value
30
- var MOUSE_BUTTON = {
31
- LEFT: 1,
32
- RIGHT: 2,
33
- MIDDLE: 4
34
- };
35
- var ACTION = Object.freeze({
36
- NONE: 0,
37
- ROTATE: 1,
38
- TRUCK: 2,
39
- OFFSET: 4,
40
- DOLLY: 8,
41
- ZOOM: 16,
42
- TOUCH_ROTATE: 32,
43
- TOUCH_TRUCK: 64,
44
- TOUCH_OFFSET: 128,
45
- TOUCH_DOLLY: 256,
46
- TOUCH_ZOOM: 512,
47
- TOUCH_DOLLY_TRUCK: 1024,
48
- TOUCH_DOLLY_OFFSET: 2048,
49
- TOUCH_DOLLY_ROTATE: 4096,
50
- TOUCH_ZOOM_TRUCK: 8192,
51
- TOUCH_ZOOM_OFFSET: 16384,
52
- TOUCH_ZOOM_ROTATE: 32768
53
- });
54
- var DOLLY_DIRECTION = {
55
- NONE: 0,
56
- IN: 1,
57
- OUT: -1
58
- };
59
- function isPerspectiveCamera(camera) {
60
- return camera.isPerspectiveCamera;
61
- }
62
- function isOrthographicCamera(camera) {
63
- return camera.isOrthographicCamera;
64
- }
65
- var PI_2 = Math.PI * 2;
66
- var PI_HALF = Math.PI / 2;
67
- var EPSILON = 1e-5;
68
- var DEG2RAD = Math.PI / 180;
69
- function clamp(value, min, max) {
70
- return Math.max(min, Math.min(max, value));
71
- }
72
- function approxZero(number) {
73
- var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EPSILON;
74
- return Math.abs(number) < error;
75
- }
76
- function approxEquals(a, b) {
77
- var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EPSILON;
78
- return approxZero(a - b, error);
79
- }
80
- function roundToStep(value, step) {
81
- return Math.round(value / step) * step;
82
- }
83
- function infinityToMaxNumber(value) {
84
- if (isFinite(value)) return value;
85
- if (value < 0) return -Number.MAX_VALUE;
86
- return Number.MAX_VALUE;
87
- }
88
- function maxNumberToInfinity(value) {
89
- if (Math.abs(value) < Number.MAX_VALUE) return value;
90
- return value * Infinity;
91
- }
92
- // https://docs.unity3d.com/ScriptReference/Mathf.SmoothDamp.html
93
- // https://github.com/Unity-Technologies/UnityCsReference/blob/a2bdfe9b3c4cd4476f44bf52f848063bfaf7b6b9/Runtime/Export/Math/Mathf.cs#L308
94
- function smoothDamp(current, target, currentVelocityRef, smoothTime) {
95
- var maxSpeed = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Infinity;
96
- var deltaTime = arguments.length > 5 ? arguments[5] : undefined;
97
- // Based on Game Programming Gems 4 Chapter 1.10
98
- smoothTime = Math.max(0.0001, smoothTime);
99
- var omega = 2 / smoothTime;
100
- var x = omega * deltaTime;
101
- var exp = 1 / (1 + x + 0.48 * x * x + 0.235 * x * x * x);
102
- var change = current - target;
103
- var originalTo = target;
104
- // Clamp maximum speed
105
- var maxChange = maxSpeed * smoothTime;
106
- change = clamp(change, -maxChange, maxChange);
107
- target = current - change;
108
- var temp = (currentVelocityRef.value + omega * change) * deltaTime;
109
- currentVelocityRef.value = (currentVelocityRef.value - omega * temp) * exp;
110
- var output = target + (change + temp) * exp;
111
- // Prevent overshooting
112
- if (originalTo - current > 0.0 === output > originalTo) {
113
- output = originalTo;
114
- currentVelocityRef.value = (output - originalTo) / deltaTime;
115
- }
116
- return output;
117
- }
118
- // https://docs.unity3d.com/ScriptReference/Vector3.SmoothDamp.html
119
- // https://github.com/Unity-Technologies/UnityCsReference/blob/a2bdfe9b3c4cd4476f44bf52f848063bfaf7b6b9/Runtime/Export/Math/Vector3.cs#L97
120
- function smoothDampVec3(current, target, currentVelocityRef, smoothTime) {
121
- var maxSpeed = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Infinity;
122
- var deltaTime = arguments.length > 5 ? arguments[5] : undefined;
123
- var out = arguments.length > 6 ? arguments[6] : undefined;
124
- // Based on Game Programming Gems 4 Chapter 1.10
125
- smoothTime = Math.max(0.0001, smoothTime);
126
- var omega = 2 / smoothTime;
127
- var x = omega * deltaTime;
128
- var exp = 1 / (1 + x + 0.48 * x * x + 0.235 * x * x * x);
129
- var targetX = target.x;
130
- var targetY = target.y;
131
- var targetZ = target.z;
132
- var changeX = current.x - targetX;
133
- var changeY = current.y - targetY;
134
- var changeZ = current.z - targetZ;
135
- var originalToX = targetX;
136
- var originalToY = targetY;
137
- var originalToZ = targetZ;
138
- // Clamp maximum speed
139
- var maxChange = maxSpeed * smoothTime;
140
- var maxChangeSq = maxChange * maxChange;
141
- var magnitudeSq = changeX * changeX + changeY * changeY + changeZ * changeZ;
142
- if (magnitudeSq > maxChangeSq) {
143
- var magnitude = Math.sqrt(magnitudeSq);
144
- changeX = changeX / magnitude * maxChange;
145
- changeY = changeY / magnitude * maxChange;
146
- changeZ = changeZ / magnitude * maxChange;
147
- }
148
- targetX = current.x - changeX;
149
- targetY = current.y - changeY;
150
- targetZ = current.z - changeZ;
151
- var tempX = (currentVelocityRef.x + omega * changeX) * deltaTime;
152
- var tempY = (currentVelocityRef.y + omega * changeY) * deltaTime;
153
- var tempZ = (currentVelocityRef.z + omega * changeZ) * deltaTime;
154
- currentVelocityRef.x = (currentVelocityRef.x - omega * tempX) * exp;
155
- currentVelocityRef.y = (currentVelocityRef.y - omega * tempY) * exp;
156
- currentVelocityRef.z = (currentVelocityRef.z - omega * tempZ) * exp;
157
- out.x = targetX + (changeX + tempX) * exp;
158
- out.y = targetY + (changeY + tempY) * exp;
159
- out.z = targetZ + (changeZ + tempZ) * exp;
160
- // Prevent overshooting
161
- var origMinusCurrentX = originalToX - current.x;
162
- var origMinusCurrentY = originalToY - current.y;
163
- var origMinusCurrentZ = originalToZ - current.z;
164
- var outMinusOrigX = out.x - originalToX;
165
- var outMinusOrigY = out.y - originalToY;
166
- var outMinusOrigZ = out.z - originalToZ;
167
- if (origMinusCurrentX * outMinusOrigX + origMinusCurrentY * outMinusOrigY + origMinusCurrentZ * outMinusOrigZ > 0) {
168
- out.x = originalToX;
169
- out.y = originalToY;
170
- out.z = originalToZ;
171
- currentVelocityRef.x = (out.x - originalToX) / deltaTime;
172
- currentVelocityRef.y = (out.y - originalToY) / deltaTime;
173
- currentVelocityRef.z = (out.z - originalToZ) / deltaTime;
174
- }
175
- return out;
176
- }
177
- function extractClientCoordFromEvent(pointers, out) {
178
- out.set(0, 0);
179
- pointers.forEach(function (pointer) {
180
- out.x += pointer.clientX;
181
- out.y += pointer.clientY;
182
- });
183
- out.x /= pointers.length;
184
- out.y /= pointers.length;
185
- }
186
- function notSupportedInOrthographicCamera(camera, message) {
187
- if (isOrthographicCamera(camera)) {
188
- console.warn("".concat(message, " is not supported in OrthographicCamera"));
189
- return true;
190
- }
191
- return false;
192
- }
193
- var EventDispatcher = exports.EventDispatcher = /*#__PURE__*/function () {
194
- function EventDispatcher() {
195
- _classCallCheck(this, EventDispatcher);
196
- this._listeners = {};
197
- }
198
- /**
199
- * Adds the specified event listener.
200
- * @param type event name
201
- * @param listener handler function
202
- * @category Methods
203
- */
204
- return _createClass(EventDispatcher, [{
205
- key: "addEventListener",
206
- value: function addEventListener(type, listener) {
207
- var listeners = this._listeners;
208
- if (listeners[type] === undefined) listeners[type] = [];
209
- if (listeners[type].indexOf(listener) === -1) listeners[type].push(listener);
210
- }
211
- /**
212
- * Presence of the specified event listener.
213
- * @param type event name
214
- * @param listener handler function
215
- * @category Methods
216
- */
217
- }, {
218
- key: "hasEventListener",
219
- value: function hasEventListener(type, listener) {
220
- var listeners = this._listeners;
221
- return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;
222
- }
223
- /**
224
- * Removes the specified event listener
225
- * @param type event name
226
- * @param listener handler function
227
- * @category Methods
228
- */
229
- }, {
230
- key: "removeEventListener",
231
- value: function removeEventListener(type, listener) {
232
- var listeners = this._listeners;
233
- var listenerArray = listeners[type];
234
- if (listenerArray !== undefined) {
235
- var index = listenerArray.indexOf(listener);
236
- if (index !== -1) listenerArray.splice(index, 1);
237
- }
238
- }
239
- /**
240
- * Removes all event listeners
241
- * @param type event name
242
- * @category Methods
243
- */
244
- }, {
245
- key: "removeAllEventListeners",
246
- value: function removeAllEventListeners(type) {
247
- if (!type) {
248
- this._listeners = {};
249
- return;
250
- }
251
- if (Array.isArray(this._listeners[type])) this._listeners[type].length = 0;
252
- }
253
- /**
254
- * Fire an event type.
255
- * @param event DispatcherEvent
256
- * @category Methods
257
- */
258
- }, {
259
- key: "dispatchEvent",
260
- value: function dispatchEvent(event) {
261
- var listeners = this._listeners;
262
- var listenerArray = listeners[event.type];
263
- if (listenerArray !== undefined) {
264
- event.target = this;
265
- var array = listenerArray.slice(0);
266
- for (var i = 0, l = array.length; i < l; i++) {
267
- array[i].call(this, event);
268
- }
269
- }
270
- }
271
- }]);
272
- }();
273
- var _a;
274
- var VERSION = '2.8.4'; // will be replaced with `version` in package.json during the build process.
275
- var TOUCH_DOLLY_FACTOR = 1 / 8;
276
- var isMac = /Mac/.test((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _a === void 0 ? void 0 : _a.platform);
277
- var THREE;
278
- var _ORIGIN;
279
- var _AXIS_Y;
280
- var _AXIS_Z;
281
- var _v2;
282
- var _v3A;
283
- var _v3B;
284
- var _v3C;
285
- var _cameraDirection;
286
- var _xColumn;
287
- var _yColumn;
288
- var _zColumn;
289
- var _deltaTarget;
290
- var _deltaOffset;
291
- var _sphericalA;
292
- var _sphericalB;
293
- var _box3A;
294
- var _box3B;
295
- var _sphere;
296
- var _quaternionA;
297
- var _quaternionB;
298
- var _rotationMatrix;
299
- var _raycaster;
300
- var CameraControls = exports["default"] = /*#__PURE__*/function (_EventDispatcher) {
301
- /**
302
- * Creates a `CameraControls` instance.
303
- *
304
- * Note:
305
- * You **must install** three.js before using camera-controls. see [#install](#install)
306
- * Not doing so will lead to runtime errors (`undefined` references to THREE).
307
- *
308
- * e.g.
309
- * ```
310
- * CameraControls.install( { THREE } );
311
- * const cameraControls = new CameraControls( camera, domElement );
312
- * ```
313
- *
314
- * @param camera A `THREE.PerspectiveCamera` or `THREE.OrthographicCamera` to be controlled.
315
- * @param domElement A `HTMLElement` for the draggable area, usually `renderer.domElement`.
316
- * @category Constructor
317
- */
318
- function CameraControls(camera, domElement) {
319
- var _this;
320
- _classCallCheck(this, CameraControls);
321
- _this = _callSuper(this, CameraControls);
322
- /**
323
- * Minimum vertical angle in radians.
324
- * The angle has to be between `0` and `.maxPolarAngle` inclusive.
325
- * The default value is `0`.
326
- *
327
- * e.g.
328
- * ```
329
- * cameraControls.maxPolarAngle = 0;
330
- * ```
331
- * @category Properties
332
- */
333
- _this.minPolarAngle = 0; // radians
334
- /**
335
- * Maximum vertical angle in radians.
336
- * The angle has to be between `.maxPolarAngle` and `Math.PI` inclusive.
337
- * The default value is `Math.PI`.
338
- *
339
- * e.g.
340
- * ```
341
- * cameraControls.maxPolarAngle = Math.PI;
342
- * ```
343
- * @category Properties
344
- */
345
- _this.maxPolarAngle = Math.PI; // radians
346
- /**
347
- * Minimum horizontal angle in radians.
348
- * The angle has to be less than `.maxAzimuthAngle`.
349
- * The default value is `- Infinity`.
350
- *
351
- * e.g.
352
- * ```
353
- * cameraControls.minAzimuthAngle = - Infinity;
354
- * ```
355
- * @category Properties
356
- */
357
- _this.minAzimuthAngle = -Infinity; // radians
358
- /**
359
- * Maximum horizontal angle in radians.
360
- * The angle has to be greater than `.minAzimuthAngle`.
361
- * The default value is `Infinity`.
362
- *
363
- * e.g.
364
- * ```
365
- * cameraControls.maxAzimuthAngle = Infinity;
366
- * ```
367
- * @category Properties
368
- */
369
- _this.maxAzimuthAngle = Infinity; // radians
370
- // How far you can dolly in and out ( PerspectiveCamera only )
371
- /**
372
- * Minimum distance for dolly. The value must be higher than `0`. Default is `Number.EPSILON`.
373
- * PerspectiveCamera only.
374
- * @category Properties
375
- */
376
- _this.minDistance = Number.EPSILON;
377
- /**
378
- * Maximum distance for dolly. The value must be higher than `minDistance`. Default is `Infinity`.
379
- * PerspectiveCamera only.
380
- * @category Properties
381
- */
382
- _this.maxDistance = Infinity;
383
- /**
384
- * `true` to enable Infinity Dolly for wheel and pinch. Use this with `minDistance` and `maxDistance`
385
- * If the Dolly distance is less (or over) than the `minDistance` (or `maxDistance`), `infinityDolly` will keep the distance and pushes the target position instead.
386
- * @category Properties
387
- */
388
- _this.infinityDolly = false;
389
- /**
390
- * Minimum camera zoom.
391
- * @category Properties
392
- */
393
- _this.minZoom = 0.01;
394
- /**
395
- * Maximum camera zoom.
396
- * @category Properties
397
- */
398
- _this.maxZoom = Infinity;
399
- /**
400
- * Approximate time in seconds to reach the target. A smaller value will reach the target faster.
401
- * @category Properties
402
- */
403
- _this.smoothTime = 0.25;
404
- /**
405
- * the smoothTime while dragging
406
- * @category Properties
407
- */
408
- _this.draggingSmoothTime = 0.125;
409
- /**
410
- * Max transition speed in unit-per-seconds
411
- * @category Properties
412
- */
413
- _this.maxSpeed = Infinity;
414
- /**
415
- * Speed of azimuth (horizontal) rotation.
416
- * @category Properties
417
- */
418
- _this.azimuthRotateSpeed = 1.0;
419
- /**
420
- * Speed of polar (vertical) rotation.
421
- * @category Properties
422
- */
423
- _this.polarRotateSpeed = 1.0;
424
- /**
425
- * Speed of mouse-wheel dollying.
426
- * @category Properties
427
- */
428
- _this.dollySpeed = 1.0;
429
- /**
430
- * `true` to invert direction when dollying or zooming via drag
431
- * @category Properties
432
- */
433
- _this.dollyDragInverted = false;
434
- /**
435
- * Speed of drag for truck and pedestal.
436
- * @category Properties
437
- */
438
- _this.truckSpeed = 2.0;
439
- /**
440
- * `true` to enable Dolly-in to the mouse cursor coords.
441
- * @category Properties
442
- */
443
- _this.dollyToCursor = false;
444
- /**
445
- * @category Properties
446
- */
447
- _this.dragToOffset = false;
448
- /**
449
- * The same as `.screenSpacePanning` in three.js's OrbitControls.
450
- * @category Properties
451
- */
452
- _this.verticalDragToForward = false;
453
- /**
454
- * Friction ratio of the boundary.
455
- * @category Properties
456
- */
457
- _this.boundaryFriction = 0.0;
458
- /**
459
- * Controls how soon the `rest` event fires as the camera slows.
460
- * @category Properties
461
- */
462
- _this.restThreshold = 0.01;
463
- /**
464
- * An array of Meshes to collide with camera.
465
- * Be aware colliderMeshes may decrease performance. The collision test uses 4 raycasters from the camera since the near plane has 4 corners.
466
- * @category Properties
467
- */
468
- _this.colliderMeshes = [];
469
- /**
470
- * Force cancel user dragging.
471
- * @category Methods
472
- */
473
- // cancel will be overwritten in the constructor.
474
- _this.cancel = function () {};
475
- _this._enabled = true;
476
- _this._state = ACTION.NONE;
477
- _this._viewport = null;
478
- _this._changedDolly = 0;
479
- _this._changedZoom = 0;
480
- _this._hasRested = true;
481
- _this._boundaryEnclosesCamera = false;
482
- _this._needsUpdate = true;
483
- _this._updatedLastTime = false;
484
- _this._elementRect = new DOMRect();
485
- _this._isDragging = false;
486
- _this._dragNeedsUpdate = true;
487
- _this._activePointers = [];
488
- _this._lockedPointer = null;
489
- _this._interactiveArea = new DOMRect(0, 0, 1, 1);
490
- // Use draggingSmoothTime over smoothTime while true.
491
- // set automatically true on user-dragging start.
492
- // set automatically false on programmable methods call.
493
- _this._isUserControllingRotate = false;
494
- _this._isUserControllingDolly = false;
495
- _this._isUserControllingTruck = false;
496
- _this._isUserControllingOffset = false;
497
- _this._isUserControllingZoom = false;
498
- _this._lastDollyDirection = DOLLY_DIRECTION.NONE;
499
- // velocities for smoothDamp
500
- _this._thetaVelocity = {
501
- value: 0
502
- };
503
- _this._phiVelocity = {
504
- value: 0
505
- };
506
- _this._radiusVelocity = {
507
- value: 0
508
- };
509
- _this._targetVelocity = new THREE.Vector3();
510
- _this._focalOffsetVelocity = new THREE.Vector3();
511
- _this._zoomVelocity = {
512
- value: 0
513
- };
514
- _this._truckInternal = function (deltaX, deltaY, dragToOffset) {
515
- var truckX;
516
- var pedestalY;
517
- if (isPerspectiveCamera(_this._camera)) {
518
- var offset = _v3A.copy(_this._camera.position).sub(_this._target);
519
- // half of the fov is center to top of screen
520
- var fov = _this._camera.getEffectiveFOV() * DEG2RAD;
521
- var targetDistance = offset.length() * Math.tan(fov * 0.5);
522
- truckX = _this.truckSpeed * deltaX * targetDistance / _this._elementRect.height;
523
- pedestalY = _this.truckSpeed * deltaY * targetDistance / _this._elementRect.height;
524
- } else if (isOrthographicCamera(_this._camera)) {
525
- var _camera = _this._camera;
526
- truckX = deltaX * (_camera.right - _camera.left) / _camera.zoom / _this._elementRect.width;
527
- pedestalY = deltaY * (_camera.top - _camera.bottom) / _camera.zoom / _this._elementRect.height;
528
- } else {
529
- return;
530
- }
531
- if (_this.verticalDragToForward) {
532
- dragToOffset ? _this.setFocalOffset(_this._focalOffsetEnd.x + truckX, _this._focalOffsetEnd.y, _this._focalOffsetEnd.z, true) : _this.truck(truckX, 0, true);
533
- _this.forward(-pedestalY, true);
534
- } else {
535
- dragToOffset ? _this.setFocalOffset(_this._focalOffsetEnd.x + truckX, _this._focalOffsetEnd.y + pedestalY, _this._focalOffsetEnd.z, true) : _this.truck(truckX, pedestalY, true);
536
- }
537
- };
538
- _this._rotateInternal = function (deltaX, deltaY) {
539
- var theta = PI_2 * _this.azimuthRotateSpeed * deltaX / _this._elementRect.height; // divide by *height* to refer the resolution
540
- var phi = PI_2 * _this.polarRotateSpeed * deltaY / _this._elementRect.height;
541
- _this.rotate(theta, phi, true);
542
- };
543
- _this._dollyInternal = function (delta, x, y) {
544
- var dollyScale = Math.pow(0.95, -delta * _this.dollySpeed);
545
- var lastDistance = _this._sphericalEnd.radius;
546
- var distance = _this._sphericalEnd.radius * dollyScale;
547
- var clampedDistance = clamp(distance, _this.minDistance, _this.maxDistance);
548
- var overflowedDistance = clampedDistance - distance;
549
- if (_this.infinityDolly && _this.dollyToCursor) {
550
- _this._dollyToNoClamp(distance, true);
551
- } else if (_this.infinityDolly && !_this.dollyToCursor) {
552
- _this.dollyInFixed(overflowedDistance, true);
553
- _this._dollyToNoClamp(clampedDistance, true);
554
- } else {
555
- _this._dollyToNoClamp(clampedDistance, true);
556
- }
557
- if (_this.dollyToCursor) {
558
- _this._changedDolly += (_this.infinityDolly ? distance : clampedDistance) - lastDistance;
559
- _this._dollyControlCoord.set(x, y);
560
- }
561
- _this._lastDollyDirection = Math.sign(-delta);
562
- };
563
- _this._zoomInternal = function (delta, x, y) {
564
- var zoomScale = Math.pow(0.95, delta * _this.dollySpeed);
565
- var lastZoom = _this._zoom;
566
- var zoom = _this._zoom * zoomScale;
567
- // for both PerspectiveCamera and OrthographicCamera
568
- _this.zoomTo(zoom, true);
569
- if (_this.dollyToCursor) {
570
- _this._changedZoom += zoom - lastZoom;
571
- _this._dollyControlCoord.set(x, y);
572
- }
573
- };
574
- // Check if the user has installed THREE
575
- if (typeof THREE === 'undefined') {
576
- console.error('camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information.');
577
- }
578
- _this._camera = camera;
579
- _this._yAxisUpSpace = new THREE.Quaternion().setFromUnitVectors(_this._camera.up, _AXIS_Y);
580
- // this._yAxisUpSpaceInverse = this._yAxisUpSpace.clone().invert();
581
- _this._yAxisUpSpaceInverse = _this._yAxisUpSpace.clone();
582
- _this._state = ACTION.NONE;
583
- // the location
584
- _this._target = new THREE.Vector3();
585
- _this._targetEnd = _this._target.clone();
586
- _this._focalOffset = new THREE.Vector3();
587
- _this._focalOffsetEnd = _this._focalOffset.clone();
588
- // rotation
589
- _this._spherical = new THREE.Spherical().setFromVector3(_v3A.copy(_this._camera.position).applyQuaternion(_this._yAxisUpSpace));
590
- _this._sphericalEnd = _this._spherical.clone();
591
- _this._lastDistance = _this._spherical.radius;
592
- _this._zoom = _this._camera.zoom;
593
- _this._zoomEnd = _this._zoom;
594
- _this._lastZoom = _this._zoom;
595
- // collisionTest uses nearPlane.s
596
- _this._nearPlaneCorners = [new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3()];
597
- _this._updateNearPlaneCorners();
598
- // Target cannot move outside of this box
599
- _this._boundary = new THREE.Box3(new THREE.Vector3(-Infinity, -Infinity, -Infinity), new THREE.Vector3(Infinity, Infinity, Infinity));
600
- // reset
601
- _this._cameraUp0 = _this._camera.up.clone();
602
- _this._target0 = _this._target.clone();
603
- _this._position0 = _this._camera.position.clone();
604
- _this._zoom0 = _this._zoom;
605
- _this._focalOffset0 = _this._focalOffset.clone();
606
- _this._dollyControlCoord = new THREE.Vector2();
607
- // configs
608
- _this.mouseButtons = {
609
- left: ACTION.ROTATE,
610
- middle: ACTION.DOLLY,
611
- right: ACTION.TRUCK,
612
- wheel: isPerspectiveCamera(_this._camera) ? ACTION.DOLLY : isOrthographicCamera(_this._camera) ? ACTION.ZOOM : ACTION.NONE
613
- };
614
- _this.touches = {
615
- one: ACTION.TOUCH_ROTATE,
616
- two: isPerspectiveCamera(_this._camera) ? ACTION.TOUCH_DOLLY_TRUCK : isOrthographicCamera(_this._camera) ? ACTION.TOUCH_ZOOM_TRUCK : ACTION.NONE,
617
- three: ACTION.TOUCH_TRUCK
618
- };
619
- var dragStartPosition = new THREE.Vector2();
620
- var lastDragPosition = new THREE.Vector2();
621
- var dollyStart = new THREE.Vector2();
622
- var onPointerDown = function onPointerDown(event) {
623
- if (!_this._enabled || !_this._domElement) return;
624
- if (_this._interactiveArea.left !== 0 || _this._interactiveArea.top !== 0 || _this._interactiveArea.width !== 1 || _this._interactiveArea.height !== 1) {
625
- var elRect = _this._domElement.getBoundingClientRect();
626
- var left = event.clientX / elRect.width;
627
- var top = event.clientY / elRect.height;
628
- // check if the interactiveArea contains the drag start position.
629
- if (left < _this._interactiveArea.left || left > _this._interactiveArea.right || top < _this._interactiveArea.top || top > _this._interactiveArea.bottom) return;
630
- }
631
- // Don't call `event.preventDefault()` on the pointerdown event
632
- // to keep receiving pointermove evens outside dragging iframe
633
- // https://taye.me/blog/tips/2015/11/16/mouse-drag-outside-iframe/
634
- var mouseButton = event.pointerType !== 'mouse' ? null : (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.LEFT : (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE ? MOUSE_BUTTON.MIDDLE : (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT ? MOUSE_BUTTON.RIGHT : null;
635
- if (mouseButton !== null) {
636
- var zombiePointer = _this._findPointerByMouseButton(mouseButton);
637
- zombiePointer && _this._disposePointer(zombiePointer);
638
- }
639
- if ((event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT && _this._lockedPointer) return;
640
- var pointer = {
641
- pointerId: event.pointerId,
642
- clientX: event.clientX,
643
- clientY: event.clientY,
644
- deltaX: 0,
645
- deltaY: 0,
646
- mouseButton: mouseButton
647
- };
648
- _this._activePointers.push(pointer);
649
- // eslint-disable-next-line no-undef
650
- _this._domElement.ownerDocument.removeEventListener('pointermove', onPointerMove, {
651
- passive: false
652
- });
653
- _this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);
654
- _this._domElement.ownerDocument.addEventListener('pointermove', onPointerMove, {
655
- passive: false
656
- });
657
- _this._domElement.ownerDocument.addEventListener('pointerup', onPointerUp);
658
- _this._isDragging = true;
659
- startDragging(event);
660
- };
661
- var onPointerMove = function onPointerMove(event) {
662
- if (event.cancelable) event.preventDefault();
663
- var pointerId = event.pointerId;
664
- var pointer = _this._lockedPointer || _this._findPointerById(pointerId);
665
- if (!pointer) return;
666
- pointer.clientX = event.clientX;
667
- pointer.clientY = event.clientY;
668
- pointer.deltaX = event.movementX;
669
- pointer.deltaY = event.movementY;
670
- _this._state = 0;
671
- if (event.pointerType === 'touch') {
672
- switch (_this._activePointers.length) {
673
- case 1:
674
- _this._state = _this.touches.one;
675
- break;
676
- case 2:
677
- _this._state = _this.touches.two;
678
- break;
679
- case 3:
680
- _this._state = _this.touches.three;
681
- break;
682
- }
683
- } else {
684
- if (!_this._isDragging && _this._lockedPointer || _this._isDragging && (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT) {
685
- _this._state = _this._state | _this.mouseButtons.left;
686
- }
687
- if (_this._isDragging && (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE) {
688
- _this._state = _this._state | _this.mouseButtons.middle;
689
- }
690
- if (_this._isDragging && (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT) {
691
- _this._state = _this._state | _this.mouseButtons.right;
692
- }
693
- }
694
- dragging();
695
- };
696
- var onPointerUp = function onPointerUp(event) {
697
- var pointer = _this._findPointerById(event.pointerId);
698
- if (pointer && pointer === _this._lockedPointer) return;
699
- pointer && _this._disposePointer(pointer);
700
- if (event.pointerType === 'touch') {
701
- switch (_this._activePointers.length) {
702
- case 0:
703
- _this._state = ACTION.NONE;
704
- break;
705
- case 1:
706
- _this._state = _this.touches.one;
707
- break;
708
- case 2:
709
- _this._state = _this.touches.two;
710
- break;
711
- case 3:
712
- _this._state = _this.touches.three;
713
- break;
714
- }
715
- } else {
716
- _this._state = ACTION.NONE;
717
- }
718
- endDragging();
719
- };
720
- var lastScrollTimeStamp = -1;
721
- var onMouseWheel = function onMouseWheel(event) {
722
- if (!_this._domElement) return;
723
- if (!_this._enabled || _this.mouseButtons.wheel === ACTION.NONE) return;
724
- if (_this._interactiveArea.left !== 0 || _this._interactiveArea.top !== 0 || _this._interactiveArea.width !== 1 || _this._interactiveArea.height !== 1) {
725
- var elRect = _this._domElement.getBoundingClientRect();
726
- var left = event.clientX / elRect.width;
727
- var top = event.clientY / elRect.height;
728
- // check if the interactiveArea contains the drag start position.
729
- if (left < _this._interactiveArea.left || left > _this._interactiveArea.right || top < _this._interactiveArea.top || top > _this._interactiveArea.bottom) return;
730
- }
731
- event.preventDefault();
732
- if (_this.dollyToCursor || _this.mouseButtons.wheel === ACTION.ROTATE || _this.mouseButtons.wheel === ACTION.TRUCK) {
733
- var now = performance.now();
734
- // only need to fire this at scroll start.
735
- if (lastScrollTimeStamp - now < 1000) _this._getClientRect(_this._elementRect);
736
- lastScrollTimeStamp = now;
737
- }
738
- // Ref: https://github.com/cedricpinson/osgjs/blob/00e5a7e9d9206c06fdde0436e1d62ab7cb5ce853/sources/osgViewer/input/source/InputSourceMouse.js#L89-L103
739
- var deltaYFactor = isMac ? -1 : -3;
740
- var delta = event.deltaMode === 1 ? event.deltaY / deltaYFactor : event.deltaY / (deltaYFactor * 10);
741
- var x = _this.dollyToCursor ? (event.clientX - _this._elementRect.x) / _this._elementRect.width * 2 - 1 : 0;
742
- var y = _this.dollyToCursor ? (event.clientY - _this._elementRect.y) / _this._elementRect.height * -2 + 1 : 0;
743
- switch (_this.mouseButtons.wheel) {
744
- case ACTION.ROTATE:
745
- {
746
- _this._rotateInternal(event.deltaX, event.deltaY);
747
- _this._isUserControllingRotate = true;
748
- break;
749
- }
750
- case ACTION.TRUCK:
751
- {
752
- _this._truckInternal(event.deltaX, event.deltaY, false);
753
- _this._isUserControllingTruck = true;
754
- break;
755
- }
756
- case ACTION.OFFSET:
757
- {
758
- _this._truckInternal(event.deltaX, event.deltaY, true);
759
- _this._isUserControllingOffset = true;
760
- break;
761
- }
762
- case ACTION.DOLLY:
763
- {
764
- _this._dollyInternal(-delta, x, y);
765
- _this._isUserControllingDolly = true;
766
- break;
767
- }
768
- case ACTION.ZOOM:
769
- {
770
- _this._zoomInternal(-delta, x, y);
771
- _this._isUserControllingZoom = true;
772
- break;
773
- }
774
- }
775
- _this.dispatchEvent({
776
- type: 'control'
777
- });
778
- };
779
- var onContextMenu = function onContextMenu(event) {
780
- if (!_this._domElement || !_this._enabled) return;
781
- // contextmenu event is fired right after pointerdown
782
- // remove attached handlers and active pointer, if interrupted by contextmenu.
783
- if (_this.mouseButtons.right === CameraControls.ACTION.NONE) {
784
- var pointerId = event instanceof PointerEvent ? event.pointerId : 0;
785
- var pointer = _this._findPointerById(pointerId);
786
- pointer && _this._disposePointer(pointer);
787
- // eslint-disable-next-line no-undef
788
- _this._domElement.ownerDocument.removeEventListener('pointermove', onPointerMove, {
789
- passive: false
790
- });
791
- _this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);
792
- return;
793
- }
794
- event.preventDefault();
795
- };
796
- var startDragging = function startDragging(event) {
797
- if (!_this._enabled) return;
798
- extractClientCoordFromEvent(_this._activePointers, _v2);
799
- _this._getClientRect(_this._elementRect);
800
- dragStartPosition.copy(_v2);
801
- lastDragPosition.copy(_v2);
802
- var isMultiTouch = _this._activePointers.length >= 2;
803
- if (isMultiTouch) {
804
- // 2 finger pinch
805
- var dx = _v2.x - _this._activePointers[1].clientX;
806
- var dy = _v2.y - _this._activePointers[1].clientY;
807
- var distance = Math.sqrt(dx * dx + dy * dy);
808
- dollyStart.set(0, distance);
809
- // center coords of 2 finger truck
810
- var x = (_this._activePointers[0].clientX + _this._activePointers[1].clientX) * 0.5;
811
- var y = (_this._activePointers[0].clientY + _this._activePointers[1].clientY) * 0.5;
812
- lastDragPosition.set(x, y);
813
- }
814
- _this._state = 0;
815
- if (!event) {
816
- if (_this._lockedPointer) _this._state = _this._state | _this.mouseButtons.left;
817
- } else if ('pointerType' in event && event.pointerType === 'touch') {
818
- switch (_this._activePointers.length) {
819
- case 1:
820
- _this._state = _this.touches.one;
821
- break;
822
- case 2:
823
- _this._state = _this.touches.two;
824
- break;
825
- case 3:
826
- _this._state = _this.touches.three;
827
- break;
828
- }
829
- } else {
830
- if (!_this._lockedPointer && (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT) {
831
- _this._state = _this._state | _this.mouseButtons.left;
832
- }
833
- if ((event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE) {
834
- _this._state = _this._state | _this.mouseButtons.middle;
835
- }
836
- if ((event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT) {
837
- _this._state = _this._state | _this.mouseButtons.right;
838
- }
839
- }
840
- // stop current movement on drag start
841
- if ((_this._state & ACTION.ROTATE) === ACTION.ROTATE || (_this._state & ACTION.TOUCH_ROTATE) === ACTION.TOUCH_ROTATE || (_this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE || (_this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {
842
- _this._sphericalEnd.theta = _this._spherical.theta;
843
- _this._sphericalEnd.phi = _this._spherical.phi;
844
- _this._thetaVelocity.value = 0;
845
- _this._phiVelocity.value = 0;
846
- }
847
- if ((_this._state & ACTION.TRUCK) === ACTION.TRUCK || (_this._state & ACTION.TOUCH_TRUCK) === ACTION.TOUCH_TRUCK || (_this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (_this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK) {
848
- _this._targetEnd.copy(_this._target);
849
- _this._targetVelocity.set(0, 0, 0);
850
- }
851
- if ((_this._state & ACTION.DOLLY) === ACTION.DOLLY || (_this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (_this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (_this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET || (_this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE) {
852
- _this._sphericalEnd.radius = _this._spherical.radius;
853
- _this._radiusVelocity.value = 0;
854
- }
855
- if ((_this._state & ACTION.ZOOM) === ACTION.ZOOM || (_this._state & ACTION.TOUCH_ZOOM) === ACTION.TOUCH_ZOOM || (_this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK || (_this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET || (_this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {
856
- _this._zoomEnd = _this._zoom;
857
- _this._zoomVelocity.value = 0;
858
- }
859
- if ((_this._state & ACTION.OFFSET) === ACTION.OFFSET || (_this._state & ACTION.TOUCH_OFFSET) === ACTION.TOUCH_OFFSET || (_this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET || (_this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET) {
860
- _this._focalOffsetEnd.copy(_this._focalOffset);
861
- _this._focalOffsetVelocity.set(0, 0, 0);
862
- }
863
- _this.dispatchEvent({
864
- type: 'controlstart'
865
- });
866
- };
867
- var dragging = function dragging() {
868
- if (!_this._enabled || !_this._dragNeedsUpdate) return;
869
- _this._dragNeedsUpdate = false;
870
- extractClientCoordFromEvent(_this._activePointers, _v2);
871
- // When pointer lock is enabled clientX, clientY, screenX, and screenY remain 0.
872
- // If pointer lock is enabled, use the Delta directory, and assume active-pointer is not multiple.
873
- var isPointerLockActive = _this._domElement && _this._domElement.ownerDocument.pointerLockElement === _this._domElement;
874
- var lockedPointer = isPointerLockActive ? _this._lockedPointer || _this._activePointers[0] : null;
875
- var deltaX = lockedPointer ? -lockedPointer.deltaX : lastDragPosition.x - _v2.x;
876
- var deltaY = lockedPointer ? -lockedPointer.deltaY : lastDragPosition.y - _v2.y;
877
- lastDragPosition.copy(_v2);
878
- if ((_this._state & ACTION.ROTATE) === ACTION.ROTATE || (_this._state & ACTION.TOUCH_ROTATE) === ACTION.TOUCH_ROTATE || (_this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE || (_this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {
879
- _this._rotateInternal(deltaX, deltaY);
880
- _this._isUserControllingRotate = true;
881
- }
882
- if ((_this._state & ACTION.DOLLY) === ACTION.DOLLY || (_this._state & ACTION.ZOOM) === ACTION.ZOOM) {
883
- var dollyX = _this.dollyToCursor ? (dragStartPosition.x - _this._elementRect.x) / _this._elementRect.width * 2 - 1 : 0;
884
- var dollyY = _this.dollyToCursor ? (dragStartPosition.y - _this._elementRect.y) / _this._elementRect.height * -2 + 1 : 0;
885
- var dollyDirection = _this.dollyDragInverted ? -1 : 1;
886
- if ((_this._state & ACTION.DOLLY) === ACTION.DOLLY) {
887
- _this._dollyInternal(dollyDirection * deltaY * TOUCH_DOLLY_FACTOR, dollyX, dollyY);
888
- _this._isUserControllingDolly = true;
889
- } else {
890
- _this._zoomInternal(dollyDirection * deltaY * TOUCH_DOLLY_FACTOR, dollyX, dollyY);
891
- _this._isUserControllingZoom = true;
892
- }
893
- }
894
- if ((_this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (_this._state & ACTION.TOUCH_ZOOM) === ACTION.TOUCH_ZOOM || (_this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (_this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK || (_this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET || (_this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET || (_this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE || (_this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {
895
- var dx = _v2.x - _this._activePointers[1].clientX;
896
- var dy = _v2.y - _this._activePointers[1].clientY;
897
- var distance = Math.sqrt(dx * dx + dy * dy);
898
- var dollyDelta = dollyStart.y - distance;
899
- dollyStart.set(0, distance);
900
- var _dollyX = _this.dollyToCursor ? (lastDragPosition.x - _this._elementRect.x) / _this._elementRect.width * 2 - 1 : 0;
901
- var _dollyY = _this.dollyToCursor ? (lastDragPosition.y - _this._elementRect.y) / _this._elementRect.height * -2 + 1 : 0;
902
- if ((_this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY || (_this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE || (_this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (_this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET) {
903
- _this._dollyInternal(dollyDelta * TOUCH_DOLLY_FACTOR, _dollyX, _dollyY);
904
- _this._isUserControllingDolly = true;
905
- } else {
906
- _this._zoomInternal(dollyDelta * TOUCH_DOLLY_FACTOR, _dollyX, _dollyY);
907
- _this._isUserControllingZoom = true;
908
- }
909
- }
910
- if ((_this._state & ACTION.TRUCK) === ACTION.TRUCK || (_this._state & ACTION.TOUCH_TRUCK) === ACTION.TOUCH_TRUCK || (_this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK || (_this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK) {
911
- _this._truckInternal(deltaX, deltaY, false);
912
- _this._isUserControllingTruck = true;
913
- }
914
- if ((_this._state & ACTION.OFFSET) === ACTION.OFFSET || (_this._state & ACTION.TOUCH_OFFSET) === ACTION.TOUCH_OFFSET || (_this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET || (_this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET) {
915
- _this._truckInternal(deltaX, deltaY, true);
916
- _this._isUserControllingOffset = true;
917
- }
918
- _this.dispatchEvent({
919
- type: 'control'
920
- });
921
- };
922
- var endDragging = function endDragging() {
923
- extractClientCoordFromEvent(_this._activePointers, _v2);
924
- lastDragPosition.copy(_v2);
925
- _this._dragNeedsUpdate = false;
926
- if (_this._activePointers.length === 0 || _this._activePointers.length === 1 && _this._activePointers[0] === _this._lockedPointer) {
927
- _this._isDragging = false;
928
- }
929
- if (_this._activePointers.length === 0 && _this._domElement) {
930
- // eslint-disable-next-line no-undef
931
- _this._domElement.ownerDocument.removeEventListener('pointermove', onPointerMove, {
932
- passive: false
933
- });
934
- _this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);
935
- _this.dispatchEvent({
936
- type: 'controlend'
937
- });
938
- }
939
- };
940
- _this.lockPointer = function () {
941
- if (!_this._enabled || !_this._domElement) return;
942
- _this.cancel();
943
- // Element.requestPointerLock is allowed to happen without any pointer active - create a faux one for compatibility with controls
944
- _this._lockedPointer = {
945
- pointerId: -1,
946
- clientX: 0,
947
- clientY: 0,
948
- deltaX: 0,
949
- deltaY: 0,
950
- mouseButton: null
951
- };
952
- _this._activePointers.push(_this._lockedPointer);
953
- // eslint-disable-next-line no-undef
954
- _this._domElement.ownerDocument.removeEventListener('pointermove', onPointerMove, {
955
- passive: false
956
- });
957
- _this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);
958
- _this._domElement.requestPointerLock();
959
- _this._domElement.ownerDocument.addEventListener('pointerlockchange', onPointerLockChange);
960
- _this._domElement.ownerDocument.addEventListener('pointerlockerror', onPointerLockError);
961
- _this._domElement.ownerDocument.addEventListener('pointermove', onPointerMove, {
962
- passive: false
963
- });
964
- _this._domElement.ownerDocument.addEventListener('pointerup', onPointerUp);
965
- startDragging();
966
- };
967
- _this.unlockPointer = function () {
968
- var _a, _b, _c;
969
- if (_this._lockedPointer !== null) {
970
- _this._disposePointer(_this._lockedPointer);
971
- _this._lockedPointer = null;
972
- }
973
- (_a = _this._domElement) === null || _a === void 0 ? void 0 : _a.ownerDocument.exitPointerLock();
974
- (_b = _this._domElement) === null || _b === void 0 ? void 0 : _b.ownerDocument.removeEventListener('pointerlockchange', onPointerLockChange);
975
- (_c = _this._domElement) === null || _c === void 0 ? void 0 : _c.ownerDocument.removeEventListener('pointerlockerror', onPointerLockError);
976
- _this.cancel();
977
- };
978
- var onPointerLockChange = function onPointerLockChange() {
979
- var isPointerLockActive = _this._domElement && _this._domElement.ownerDocument.pointerLockElement === _this._domElement;
980
- if (!isPointerLockActive) _this.unlockPointer();
981
- };
982
- var onPointerLockError = function onPointerLockError() {
983
- _this.unlockPointer();
984
- };
985
- _this._addAllEventListeners = function (domElement) {
986
- _this._domElement = domElement;
987
- _this._domElement.style.touchAction = 'none';
988
- _this._domElement.style.userSelect = 'none';
989
- _this._domElement.style.webkitUserSelect = 'none';
990
- _this._domElement.addEventListener('pointerdown', onPointerDown);
991
- _this._domElement.addEventListener('pointercancel', onPointerUp);
992
- _this._domElement.addEventListener('wheel', onMouseWheel, {
993
- passive: false
994
- });
995
- _this._domElement.addEventListener('contextmenu', onContextMenu);
996
- };
997
- _this._removeAllEventListeners = function () {
998
- if (!_this._domElement) return;
999
- _this._domElement.style.touchAction = '';
1000
- _this._domElement.style.userSelect = '';
1001
- _this._domElement.style.webkitUserSelect = '';
1002
- _this._domElement.removeEventListener('pointerdown', onPointerDown);
1003
- _this._domElement.removeEventListener('pointercancel', onPointerUp);
1004
- // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#matching_event_listeners_for_removal
1005
- // > it's probably wise to use the same values used for the call to `addEventListener()` when calling `removeEventListener()`
1006
- // see https://github.com/microsoft/TypeScript/issues/32912#issuecomment-522142969
1007
- // eslint-disable-next-line no-undef
1008
- _this._domElement.removeEventListener('wheel', onMouseWheel, {
1009
- passive: false
1010
- });
1011
- _this._domElement.removeEventListener('contextmenu', onContextMenu);
1012
- // eslint-disable-next-line no-undef
1013
- _this._domElement.ownerDocument.removeEventListener('pointermove', onPointerMove, {
1014
- passive: false
1015
- });
1016
- _this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);
1017
- _this._domElement.ownerDocument.removeEventListener('pointerlockchange', onPointerLockChange);
1018
- _this._domElement.ownerDocument.removeEventListener('pointerlockerror', onPointerLockError);
1019
- };
1020
- _this.cancel = function () {
1021
- if (_this._state === ACTION.NONE) return;
1022
- _this._state = ACTION.NONE;
1023
- _this._activePointers.length = 0;
1024
- endDragging();
1025
- };
1026
- if (domElement) _this.connect(domElement);
1027
- _this.update(0);
1028
- return _this;
1029
- }
1030
- /**
1031
- * The camera to be controlled
1032
- * @category Properties
1033
- */
1034
- _inherits(CameraControls, _EventDispatcher);
1035
- return _createClass(CameraControls, [{
1036
- key: "camera",
1037
- get: function get() {
1038
- return this._camera;
1039
- },
1040
- set: function set(camera) {
1041
- this._camera = camera;
1042
- this.updateCameraUp();
1043
- this._camera.updateProjectionMatrix();
1044
- this._updateNearPlaneCorners();
1045
- this._needsUpdate = true;
1046
- }
1047
- /**
1048
- * Whether or not the controls are enabled.
1049
- * `false` to disable user dragging/touch-move, but all methods works.
1050
- * @category Properties
1051
- */
1052
- }, {
1053
- key: "enabled",
1054
- get: function get() {
1055
- return this._enabled;
1056
- },
1057
- set: function set(enabled) {
1058
- this._enabled = enabled;
1059
- if (!this._domElement) return;
1060
- if (enabled) {
1061
- this._domElement.style.touchAction = 'none';
1062
- this._domElement.style.userSelect = 'none';
1063
- this._domElement.style.webkitUserSelect = 'none';
1064
- } else {
1065
- this.cancel();
1066
- this._domElement.style.touchAction = '';
1067
- this._domElement.style.userSelect = '';
1068
- this._domElement.style.webkitUserSelect = '';
1069
- }
1070
- }
1071
- /**
1072
- * Returns `true` if the controls are active updating.
1073
- * readonly value.
1074
- * @category Properties
1075
- */
1076
- }, {
1077
- key: "active",
1078
- get: function get() {
1079
- return !this._hasRested;
1080
- }
1081
- /**
1082
- * Getter for the current `ACTION`.
1083
- * readonly value.
1084
- * @category Properties
1085
- */
1086
- }, {
1087
- key: "currentAction",
1088
- get: function get() {
1089
- return this._state;
1090
- }
1091
- /**
1092
- * get/set Current distance.
1093
- * @category Properties
1094
- */
1095
- }, {
1096
- key: "distance",
1097
- get: function get() {
1098
- return this._spherical.radius;
1099
- },
1100
- set: function set(distance) {
1101
- if (this._spherical.radius === distance && this._sphericalEnd.radius === distance) return;
1102
- this._spherical.radius = distance;
1103
- this._sphericalEnd.radius = distance;
1104
- this._needsUpdate = true;
1105
- }
1106
- // horizontal angle
1107
- /**
1108
- * get/set the azimuth angle (horizontal) in radians.
1109
- * Every 360 degrees turn is added to `.azimuthAngle` value, which is accumulative.
1110
- * @category Properties
1111
- */
1112
- }, {
1113
- key: "azimuthAngle",
1114
- get: function get() {
1115
- return this._spherical.theta;
1116
- },
1117
- set: function set(azimuthAngle) {
1118
- if (this._spherical.theta === azimuthAngle && this._sphericalEnd.theta === azimuthAngle) return;
1119
- this._spherical.theta = azimuthAngle;
1120
- this._sphericalEnd.theta = azimuthAngle;
1121
- this._needsUpdate = true;
1122
- }
1123
- // vertical angle
1124
- /**
1125
- * get/set the polar angle (vertical) in radians.
1126
- * @category Properties
1127
- */
1128
- }, {
1129
- key: "polarAngle",
1130
- get: function get() {
1131
- return this._spherical.phi;
1132
- },
1133
- set: function set(polarAngle) {
1134
- if (this._spherical.phi === polarAngle && this._sphericalEnd.phi === polarAngle) return;
1135
- this._spherical.phi = polarAngle;
1136
- this._sphericalEnd.phi = polarAngle;
1137
- this._needsUpdate = true;
1138
- }
1139
- /**
1140
- * Whether camera position should be enclosed in the boundary or not.
1141
- * @category Properties
1142
- */
1143
- }, {
1144
- key: "boundaryEnclosesCamera",
1145
- get: function get() {
1146
- return this._boundaryEnclosesCamera;
1147
- },
1148
- set: function set(boundaryEnclosesCamera) {
1149
- this._boundaryEnclosesCamera = boundaryEnclosesCamera;
1150
- this._needsUpdate = true;
1151
- }
1152
- /**
1153
- * Set drag-start, touches and wheel enable area in the domElement.
1154
- * each values are between `0` and `1` inclusive, where `0` is left/top and `1` is right/bottom of the screen.
1155
- * e.g. `{ x: 0, y: 0, width: 1, height: 1 }` for entire area.
1156
- * @category Properties
1157
- */
1158
- }, {
1159
- key: "interactiveArea",
1160
- set: function set(interactiveArea) {
1161
- this._interactiveArea.width = clamp(interactiveArea.width, 0, 1);
1162
- this._interactiveArea.height = clamp(interactiveArea.height, 0, 1);
1163
- this._interactiveArea.x = clamp(interactiveArea.x, 0, 1 - this._interactiveArea.width);
1164
- this._interactiveArea.y = clamp(interactiveArea.y, 0, 1 - this._interactiveArea.height);
1165
- }
1166
- /**
1167
- * Adds the specified event listener.
1168
- * Applicable event types (which is `K`) are:
1169
- * | Event name | Timing |
1170
- * | ------------------- | ------ |
1171
- * | `'controlstart'` | When the user starts to control the camera via mouse / touches. ¹ |
1172
- * | `'control'` | When the user controls the camera (dragging). |
1173
- * | `'controlend'` | When the user ends to control the camera. ¹ |
1174
- * | `'transitionstart'` | When any kind of transition starts, either user control or using a method with `enableTransition = true` |
1175
- * | `'update'` | When the camera position is updated. |
1176
- * | `'wake'` | When the camera starts moving. |
1177
- * | `'rest'` | When the camera movement is below `.restThreshold` ². |
1178
- * | `'sleep'` | When the camera end moving. |
1179
- *
1180
- * 1. `mouseButtons.wheel` (Mouse wheel control) does not emit `'controlstart'` and `'controlend'`. `mouseButtons.wheel` uses scroll-event internally, and scroll-event happens intermittently. That means "start" and "end" cannot be detected.
1181
- * 2. Due to damping, `sleep` will usually fire a few seconds after the camera _appears_ to have stopped moving. If you want to do something (e.g. enable UI, perform another transition) at the point when the camera has stopped, you probably want the `rest` event. This can be fine tuned using the `.restThreshold` parameter. See the [Rest and Sleep Example](https://yomotsu.github.io/camera-controls/examples/rest-and-sleep.html).
1182
- *
1183
- * e.g.
1184
- * ```
1185
- * cameraControl.addEventListener( 'controlstart', myCallbackFunction );
1186
- * ```
1187
- * @param type event name
1188
- * @param listener handler function
1189
- * @category Methods
1190
- */
1191
- }, {
1192
- key: "addEventListener",
1193
- value: function addEventListener(type, listener) {
1194
- _superPropGet(CameraControls, "addEventListener", this, 3)([type, listener]);
1195
- }
1196
- /**
1197
- * Removes the specified event listener
1198
- * e.g.
1199
- * ```
1200
- * cameraControl.addEventListener( 'controlstart', myCallbackFunction );
1201
- * ```
1202
- * @param type event name
1203
- * @param listener handler function
1204
- * @category Methods
1205
- */
1206
- }, {
1207
- key: "removeEventListener",
1208
- value: function removeEventListener(type, listener) {
1209
- _superPropGet(CameraControls, "removeEventListener", this, 3)([type, listener]);
1210
- }
1211
- /**
1212
- * Rotate azimuthal angle(horizontal) and polar angle(vertical).
1213
- * Every value is added to the current value.
1214
- * @param azimuthAngle Azimuth rotate angle. In radian.
1215
- * @param polarAngle Polar rotate angle. In radian.
1216
- * @param enableTransition Whether to move smoothly or immediately
1217
- * @category Methods
1218
- */
1219
- }, {
1220
- key: "rotate",
1221
- value: function rotate(azimuthAngle, polarAngle) {
1222
- var enableTransition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1223
- return this.rotateTo(this._sphericalEnd.theta + azimuthAngle, this._sphericalEnd.phi + polarAngle, enableTransition);
1224
- }
1225
- /**
1226
- * Rotate azimuthal angle(horizontal) to the given angle and keep the same polar angle(vertical) target.
1227
- *
1228
- * e.g.
1229
- * ```
1230
- * cameraControls.rotateAzimuthTo( 30 * THREE.MathUtils.DEG2RAD, true );
1231
- * ```
1232
- * @param azimuthAngle Azimuth rotate angle. In radian.
1233
- * @param enableTransition Whether to move smoothly or immediately
1234
- * @category Methods
1235
- */
1236
- }, {
1237
- key: "rotateAzimuthTo",
1238
- value: function rotateAzimuthTo(azimuthAngle) {
1239
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1240
- return this.rotateTo(azimuthAngle, this._sphericalEnd.phi, enableTransition);
1241
- }
1242
- /**
1243
- * Rotate polar angle(vertical) to the given angle and keep the same azimuthal angle(horizontal) target.
1244
- *
1245
- * e.g.
1246
- * ```
1247
- * cameraControls.rotatePolarTo( 30 * THREE.MathUtils.DEG2RAD, true );
1248
- * ```
1249
- * @param polarAngle Polar rotate angle. In radian.
1250
- * @param enableTransition Whether to move smoothly or immediately
1251
- * @category Methods
1252
- */
1253
- }, {
1254
- key: "rotatePolarTo",
1255
- value: function rotatePolarTo(polarAngle) {
1256
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1257
- return this.rotateTo(this._sphericalEnd.theta, polarAngle, enableTransition);
1258
- }
1259
- /**
1260
- * Rotate azimuthal angle(horizontal) and polar angle(vertical) to the given angle.
1261
- * Camera view will rotate over the orbit pivot absolutely:
1262
- *
1263
- * azimuthAngle
1264
- * ```
1265
- * 0º
1266
- * \
1267
- * 90º -----+----- -90º
1268
- * \
1269
- * 180º
1270
- * ```
1271
- * | direction | angle |
1272
- * | --------- | ---------------------- |
1273
- * | front | 0º |
1274
- * | left | 90º (`Math.PI / 2`) |
1275
- * | right | -90º (`- Math.PI / 2`) |
1276
- * | back | 180º (`Math.PI`) |
1277
- *
1278
- * polarAngle
1279
- * ```
1280
- * 180º
1281
- * |
1282
- * 90º
1283
- * |
1284
- * 0º
1285
- * ```
1286
- * | direction | angle |
1287
- * | -------------------- | ---------------------- |
1288
- * | top/sky | 180º (`Math.PI`) |
1289
- * | horizontal from view | 90º (`Math.PI / 2`) |
1290
- * | bottom/floor | 0º |
1291
- *
1292
- * @param azimuthAngle Azimuth rotate angle to. In radian.
1293
- * @param polarAngle Polar rotate angle to. In radian.
1294
- * @param enableTransition Whether to move smoothly or immediately
1295
- * @category Methods
1296
- */
1297
- }, {
1298
- key: "rotateTo",
1299
- value: function rotateTo(azimuthAngle, polarAngle) {
1300
- var enableTransition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1301
- this._isUserControllingRotate = false;
1302
- var theta = clamp(azimuthAngle, this.minAzimuthAngle, this.maxAzimuthAngle);
1303
- var phi = clamp(polarAngle, this.minPolarAngle, this.maxPolarAngle);
1304
- this._sphericalEnd.theta = theta;
1305
- this._sphericalEnd.phi = phi;
1306
- this._sphericalEnd.makeSafe();
1307
- this._needsUpdate = true;
1308
- if (!enableTransition) {
1309
- this._spherical.theta = this._sphericalEnd.theta;
1310
- this._spherical.phi = this._sphericalEnd.phi;
1311
- }
1312
- var resolveImmediately = !enableTransition || approxEquals(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && approxEquals(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold);
1313
- return this._createOnRestPromise(resolveImmediately);
1314
- }
1315
- /**
1316
- * Dolly in/out camera position.
1317
- * @param distance Distance of dollyIn. Negative number for dollyOut.
1318
- * @param enableTransition Whether to move smoothly or immediately.
1319
- * @category Methods
1320
- */
1321
- }, {
1322
- key: "dolly",
1323
- value: function dolly(distance) {
1324
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1325
- return this.dollyTo(this._sphericalEnd.radius - distance, enableTransition);
1326
- }
1327
- /**
1328
- * Dolly in/out camera position to given distance.
1329
- * @param distance Distance of dolly.
1330
- * @param enableTransition Whether to move smoothly or immediately.
1331
- * @category Methods
1332
- */
1333
- }, {
1334
- key: "dollyTo",
1335
- value: function dollyTo(distance) {
1336
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1337
- this._isUserControllingDolly = false;
1338
- this._lastDollyDirection = DOLLY_DIRECTION.NONE;
1339
- this._changedDolly = 0;
1340
- return this._dollyToNoClamp(clamp(distance, this.minDistance, this.maxDistance), enableTransition);
1341
- }
1342
- }, {
1343
- key: "_dollyToNoClamp",
1344
- value: function _dollyToNoClamp(distance) {
1345
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1346
- var lastRadius = this._sphericalEnd.radius;
1347
- var hasCollider = this.colliderMeshes.length >= 1;
1348
- if (hasCollider) {
1349
- var maxDistanceByCollisionTest = this._collisionTest();
1350
- var isCollided = approxEquals(maxDistanceByCollisionTest, this._spherical.radius);
1351
- var isDollyIn = lastRadius > distance;
1352
- if (!isDollyIn && isCollided) return Promise.resolve();
1353
- this._sphericalEnd.radius = Math.min(distance, maxDistanceByCollisionTest);
1354
- } else {
1355
- this._sphericalEnd.radius = distance;
1356
- }
1357
- this._needsUpdate = true;
1358
- if (!enableTransition) {
1359
- this._spherical.radius = this._sphericalEnd.radius;
1360
- }
1361
- var resolveImmediately = !enableTransition || approxEquals(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
1362
- return this._createOnRestPromise(resolveImmediately);
1363
- }
1364
- /**
1365
- * Dolly in, but does not change the distance between the target and the camera, and moves the target position instead.
1366
- * Specify a negative value for dolly out.
1367
- * @param distance Distance of dolly.
1368
- * @param enableTransition Whether to move smoothly or immediately.
1369
- * @category Methods
1370
- */
1371
- }, {
1372
- key: "dollyInFixed",
1373
- value: function dollyInFixed(distance) {
1374
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1375
- this._targetEnd.add(this._getCameraDirection(_cameraDirection).multiplyScalar(distance));
1376
- if (!enableTransition) {
1377
- this._target.copy(this._targetEnd);
1378
- }
1379
- var resolveImmediately = !enableTransition || approxEquals(this._target.x, this._targetEnd.x, this.restThreshold) && approxEquals(this._target.y, this._targetEnd.y, this.restThreshold) && approxEquals(this._target.z, this._targetEnd.z, this.restThreshold);
1380
- return this._createOnRestPromise(resolveImmediately);
1381
- }
1382
- /**
1383
- * Zoom in/out camera. The value is added to camera zoom.
1384
- * Limits set with `.minZoom` and `.maxZoom`
1385
- * @param zoomStep zoom scale
1386
- * @param enableTransition Whether to move smoothly or immediately
1387
- * @category Methods
1388
- */
1389
- }, {
1390
- key: "zoom",
1391
- value: function zoom(zoomStep) {
1392
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1393
- return this.zoomTo(this._zoomEnd + zoomStep, enableTransition);
1394
- }
1395
- /**
1396
- * Zoom in/out camera to given scale. The value overwrites camera zoom.
1397
- * Limits set with .minZoom and .maxZoom
1398
- * @param zoom
1399
- * @param enableTransition
1400
- * @category Methods
1401
- */
1402
- }, {
1403
- key: "zoomTo",
1404
- value: function zoomTo(zoom) {
1405
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1406
- this._isUserControllingZoom = false;
1407
- this._zoomEnd = clamp(zoom, this.minZoom, this.maxZoom);
1408
- this._needsUpdate = true;
1409
- if (!enableTransition) {
1410
- this._zoom = this._zoomEnd;
1411
- }
1412
- var resolveImmediately = !enableTransition || approxEquals(this._zoom, this._zoomEnd, this.restThreshold);
1413
- this._changedZoom = 0;
1414
- return this._createOnRestPromise(resolveImmediately);
1415
- }
1416
- /**
1417
- * @deprecated `pan()` has been renamed to `truck()`
1418
- * @category Methods
1419
- */
1420
- }, {
1421
- key: "pan",
1422
- value: function pan(x, y) {
1423
- var enableTransition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1424
- console.warn('`pan` has been renamed to `truck`');
1425
- return this.truck(x, y, enableTransition);
1426
- }
1427
- /**
1428
- * Truck and pedestal camera using current azimuthal angle
1429
- * @param x Horizontal translate amount
1430
- * @param y Vertical translate amount
1431
- * @param enableTransition Whether to move smoothly or immediately
1432
- * @category Methods
1433
- */
1434
- }, {
1435
- key: "truck",
1436
- value: function truck(x, y) {
1437
- var enableTransition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1438
- this._camera.updateMatrix();
1439
- _xColumn.setFromMatrixColumn(this._camera.matrix, 0);
1440
- _yColumn.setFromMatrixColumn(this._camera.matrix, 1);
1441
- _xColumn.multiplyScalar(x);
1442
- _yColumn.multiplyScalar(-y);
1443
- var offset = _v3A.copy(_xColumn).add(_yColumn);
1444
- var to = _v3B.copy(this._targetEnd).add(offset);
1445
- return this.moveTo(to.x, to.y, to.z, enableTransition);
1446
- }
1447
- /**
1448
- * Move forward / backward.
1449
- * @param distance Amount to move forward / backward. Negative value to move backward
1450
- * @param enableTransition Whether to move smoothly or immediately
1451
- * @category Methods
1452
- */
1453
- }, {
1454
- key: "forward",
1455
- value: function forward(distance) {
1456
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1457
- _v3A.setFromMatrixColumn(this._camera.matrix, 0);
1458
- _v3A.crossVectors(this._camera.up, _v3A);
1459
- _v3A.multiplyScalar(distance);
1460
- var to = _v3B.copy(this._targetEnd).add(_v3A);
1461
- return this.moveTo(to.x, to.y, to.z, enableTransition);
1462
- }
1463
- /**
1464
- * Move up / down.
1465
- * @param height Amount to move up / down. Negative value to move down
1466
- * @param enableTransition Whether to move smoothly or immediately
1467
- * @category Methods
1468
- */
1469
- }, {
1470
- key: "elevate",
1471
- value: function elevate(height) {
1472
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1473
- _v3A.copy(this._camera.up).multiplyScalar(height);
1474
- return this.moveTo(this._targetEnd.x + _v3A.x, this._targetEnd.y + _v3A.y, this._targetEnd.z + _v3A.z, enableTransition);
1475
- }
1476
- /**
1477
- * Move target position to given point.
1478
- * @param x x coord to move center position
1479
- * @param y y coord to move center position
1480
- * @param z z coord to move center position
1481
- * @param enableTransition Whether to move smoothly or immediately
1482
- * @category Methods
1483
- */
1484
- }, {
1485
- key: "moveTo",
1486
- value: function moveTo(x, y, z) {
1487
- var enableTransition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1488
- this._isUserControllingTruck = false;
1489
- var offset = _v3A.set(x, y, z).sub(this._targetEnd);
1490
- this._encloseToBoundary(this._targetEnd, offset, this.boundaryFriction);
1491
- this._needsUpdate = true;
1492
- if (!enableTransition) {
1493
- this._target.copy(this._targetEnd);
1494
- }
1495
- var resolveImmediately = !enableTransition || approxEquals(this._target.x, this._targetEnd.x, this.restThreshold) && approxEquals(this._target.y, this._targetEnd.y, this.restThreshold) && approxEquals(this._target.z, this._targetEnd.z, this.restThreshold);
1496
- return this._createOnRestPromise(resolveImmediately);
1497
- }
1498
- /**
1499
- * Look in the given point direction.
1500
- * @param x point x.
1501
- * @param y point y.
1502
- * @param z point z.
1503
- * @param enableTransition Whether to move smoothly or immediately.
1504
- * @returns Transition end promise
1505
- * @category Methods
1506
- */
1507
- }, {
1508
- key: "lookInDirectionOf",
1509
- value: function lookInDirectionOf(x, y, z) {
1510
- var enableTransition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1511
- var point = _v3A.set(x, y, z);
1512
- var direction = point.sub(this._targetEnd).normalize();
1513
- var position = direction.multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);
1514
- return this.setPosition(position.x, position.y, position.z, enableTransition);
1515
- }
1516
- /**
1517
- * Fit the viewport to the box or the bounding box of the object, using the nearest axis. paddings are in unit.
1518
- * set `cover: true` to fill enter screen.
1519
- * e.g.
1520
- * ```
1521
- * cameraControls.fitToBox( myMesh );
1522
- * ```
1523
- * @param box3OrObject Axis aligned bounding box to fit the view.
1524
- * @param enableTransition Whether to move smoothly or immediately.
1525
- * @param options | `<object>` { cover: boolean, paddingTop: number, paddingLeft: number, paddingBottom: number, paddingRight: number }
1526
- * @returns Transition end promise
1527
- * @category Methods
1528
- */
1529
- }, {
1530
- key: "fitToBox",
1531
- value: function fitToBox(box3OrObject, enableTransition) {
1532
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
1533
- _ref$cover = _ref.cover,
1534
- cover = _ref$cover === void 0 ? false : _ref$cover,
1535
- _ref$paddingLeft = _ref.paddingLeft,
1536
- paddingLeft = _ref$paddingLeft === void 0 ? 0 : _ref$paddingLeft,
1537
- _ref$paddingRight = _ref.paddingRight,
1538
- paddingRight = _ref$paddingRight === void 0 ? 0 : _ref$paddingRight,
1539
- _ref$paddingBottom = _ref.paddingBottom,
1540
- paddingBottom = _ref$paddingBottom === void 0 ? 0 : _ref$paddingBottom,
1541
- _ref$paddingTop = _ref.paddingTop,
1542
- paddingTop = _ref$paddingTop === void 0 ? 0 : _ref$paddingTop;
1543
- var promises = [];
1544
- var aabb = box3OrObject.isBox3 ? _box3A.copy(box3OrObject) : _box3A.setFromObject(box3OrObject);
1545
- if (aabb.isEmpty()) {
1546
- console.warn('camera-controls: fitTo() cannot be used with an empty box. Aborting');
1547
- Promise.resolve();
1548
- }
1549
- // round to closest axis ( forward | backward | right | left | top | bottom )
1550
- var theta = roundToStep(this._sphericalEnd.theta, PI_HALF);
1551
- var phi = roundToStep(this._sphericalEnd.phi, PI_HALF);
1552
- promises.push(this.rotateTo(theta, phi, enableTransition));
1553
- var normal = _v3A.setFromSpherical(this._sphericalEnd).normalize();
1554
- var rotation = _quaternionA.setFromUnitVectors(normal, _AXIS_Z);
1555
- var viewFromPolar = approxEquals(Math.abs(normal.y), 1);
1556
- if (viewFromPolar) {
1557
- rotation.multiply(_quaternionB.setFromAxisAngle(_AXIS_Y, theta));
1558
- }
1559
- rotation.multiply(this._yAxisUpSpaceInverse);
1560
- // make oriented bounding box
1561
- var bb = _box3B.makeEmpty();
1562
- // left bottom back corner
1563
- _v3B.copy(aabb.min).applyQuaternion(rotation);
1564
- bb.expandByPoint(_v3B);
1565
- // right bottom back corner
1566
- _v3B.copy(aabb.min).setX(aabb.max.x).applyQuaternion(rotation);
1567
- bb.expandByPoint(_v3B);
1568
- // left top back corner
1569
- _v3B.copy(aabb.min).setY(aabb.max.y).applyQuaternion(rotation);
1570
- bb.expandByPoint(_v3B);
1571
- // right top back corner
1572
- _v3B.copy(aabb.max).setZ(aabb.min.z).applyQuaternion(rotation);
1573
- bb.expandByPoint(_v3B);
1574
- // left bottom front corner
1575
- _v3B.copy(aabb.min).setZ(aabb.max.z).applyQuaternion(rotation);
1576
- bb.expandByPoint(_v3B);
1577
- // right bottom front corner
1578
- _v3B.copy(aabb.max).setY(aabb.min.y).applyQuaternion(rotation);
1579
- bb.expandByPoint(_v3B);
1580
- // left top front corner
1581
- _v3B.copy(aabb.max).setX(aabb.min.x).applyQuaternion(rotation);
1582
- bb.expandByPoint(_v3B);
1583
- // right top front corner
1584
- _v3B.copy(aabb.max).applyQuaternion(rotation);
1585
- bb.expandByPoint(_v3B);
1586
- // add padding
1587
- bb.min.x -= paddingLeft;
1588
- bb.min.y -= paddingBottom;
1589
- bb.max.x += paddingRight;
1590
- bb.max.y += paddingTop;
1591
- rotation.setFromUnitVectors(_AXIS_Z, normal);
1592
- if (viewFromPolar) {
1593
- rotation.premultiply(_quaternionB.invert());
1594
- }
1595
- rotation.premultiply(this._yAxisUpSpace);
1596
- var bbSize = bb.getSize(_v3A);
1597
- var center = bb.getCenter(_v3B).applyQuaternion(rotation);
1598
- if (isPerspectiveCamera(this._camera)) {
1599
- var distance = this.getDistanceToFitBox(bbSize.x, bbSize.y, bbSize.z, cover);
1600
- promises.push(this.moveTo(center.x, center.y, center.z, enableTransition));
1601
- promises.push(this.dollyTo(distance, enableTransition));
1602
- promises.push(this.setFocalOffset(0, 0, 0, enableTransition));
1603
- } else if (isOrthographicCamera(this._camera)) {
1604
- var camera = this._camera;
1605
- var width = camera.right - camera.left;
1606
- var height = camera.top - camera.bottom;
1607
- var zoom = cover ? Math.max(width / bbSize.x, height / bbSize.y) : Math.min(width / bbSize.x, height / bbSize.y);
1608
- promises.push(this.moveTo(center.x, center.y, center.z, enableTransition));
1609
- promises.push(this.zoomTo(zoom, enableTransition));
1610
- promises.push(this.setFocalOffset(0, 0, 0, enableTransition));
1611
- }
1612
- return Promise.all(promises);
1613
- }
1614
- /**
1615
- * Fit the viewport to the sphere or the bounding sphere of the object.
1616
- * @param sphereOrMesh
1617
- * @param enableTransition
1618
- * @category Methods
1619
- */
1620
- }, {
1621
- key: "fitToSphere",
1622
- value: function fitToSphere(sphereOrMesh, enableTransition) {
1623
- var promises = [];
1624
- var isSphere = 'isSphere' in sphereOrMesh;
1625
- var boundingSphere = isSphere ? _sphere.copy(sphereOrMesh) : CameraControls.createBoundingSphere(sphereOrMesh, _sphere);
1626
- promises.push(this.moveTo(boundingSphere.center.x, boundingSphere.center.y, boundingSphere.center.z, enableTransition));
1627
- if (isPerspectiveCamera(this._camera)) {
1628
- var distanceToFit = this.getDistanceToFitSphere(boundingSphere.radius);
1629
- promises.push(this.dollyTo(distanceToFit, enableTransition));
1630
- } else if (isOrthographicCamera(this._camera)) {
1631
- var width = this._camera.right - this._camera.left;
1632
- var height = this._camera.top - this._camera.bottom;
1633
- var diameter = 2 * boundingSphere.radius;
1634
- var zoom = Math.min(width / diameter, height / diameter);
1635
- promises.push(this.zoomTo(zoom, enableTransition));
1636
- }
1637
- promises.push(this.setFocalOffset(0, 0, 0, enableTransition));
1638
- return Promise.all(promises);
1639
- }
1640
- /**
1641
- * Look at the `target` from the `position`.
1642
- * @param positionX
1643
- * @param positionY
1644
- * @param positionZ
1645
- * @param targetX
1646
- * @param targetY
1647
- * @param targetZ
1648
- * @param enableTransition
1649
- * @category Methods
1650
- */
1651
- }, {
1652
- key: "setLookAt",
1653
- value: function setLookAt(positionX, positionY, positionZ, targetX, targetY, targetZ) {
1654
- var enableTransition = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
1655
- this._isUserControllingRotate = false;
1656
- this._isUserControllingDolly = false;
1657
- this._isUserControllingTruck = false;
1658
- this._lastDollyDirection = DOLLY_DIRECTION.NONE;
1659
- this._changedDolly = 0;
1660
- var target = _v3B.set(targetX, targetY, targetZ);
1661
- var position = _v3A.set(positionX, positionY, positionZ);
1662
- this._targetEnd.copy(target);
1663
- this._sphericalEnd.setFromVector3(position.sub(target).applyQuaternion(this._yAxisUpSpace));
1664
- this.normalizeRotations();
1665
- this._needsUpdate = true;
1666
- if (!enableTransition) {
1667
- this._target.copy(this._targetEnd);
1668
- this._spherical.copy(this._sphericalEnd);
1669
- }
1670
- var resolveImmediately = !enableTransition || approxEquals(this._target.x, this._targetEnd.x, this.restThreshold) && approxEquals(this._target.y, this._targetEnd.y, this.restThreshold) && approxEquals(this._target.z, this._targetEnd.z, this.restThreshold) && approxEquals(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && approxEquals(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && approxEquals(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
1671
- return this._createOnRestPromise(resolveImmediately);
1672
- }
1673
- /**
1674
- * Similar to setLookAt, but it interpolates between two states.
1675
- * @param positionAX
1676
- * @param positionAY
1677
- * @param positionAZ
1678
- * @param targetAX
1679
- * @param targetAY
1680
- * @param targetAZ
1681
- * @param positionBX
1682
- * @param positionBY
1683
- * @param positionBZ
1684
- * @param targetBX
1685
- * @param targetBY
1686
- * @param targetBZ
1687
- * @param t
1688
- * @param enableTransition
1689
- * @category Methods
1690
- */
1691
- }, {
1692
- key: "lerpLookAt",
1693
- value: function lerpLookAt(positionAX, positionAY, positionAZ, targetAX, targetAY, targetAZ, positionBX, positionBY, positionBZ, targetBX, targetBY, targetBZ, t) {
1694
- var enableTransition = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
1695
- this._isUserControllingRotate = false;
1696
- this._isUserControllingDolly = false;
1697
- this._isUserControllingTruck = false;
1698
- this._lastDollyDirection = DOLLY_DIRECTION.NONE;
1699
- this._changedDolly = 0;
1700
- var targetA = _v3A.set(targetAX, targetAY, targetAZ);
1701
- var positionA = _v3B.set(positionAX, positionAY, positionAZ);
1702
- _sphericalA.setFromVector3(positionA.sub(targetA).applyQuaternion(this._yAxisUpSpace));
1703
- var targetB = _v3C.set(targetBX, targetBY, targetBZ);
1704
- var positionB = _v3B.set(positionBX, positionBY, positionBZ);
1705
- _sphericalB.setFromVector3(positionB.sub(targetB).applyQuaternion(this._yAxisUpSpace));
1706
- this._targetEnd.copy(targetA.lerp(targetB, t)); // tricky
1707
- var deltaTheta = _sphericalB.theta - _sphericalA.theta;
1708
- var deltaPhi = _sphericalB.phi - _sphericalA.phi;
1709
- var deltaRadius = _sphericalB.radius - _sphericalA.radius;
1710
- this._sphericalEnd.set(_sphericalA.radius + deltaRadius * t, _sphericalA.phi + deltaPhi * t, _sphericalA.theta + deltaTheta * t);
1711
- this.normalizeRotations();
1712
- this._needsUpdate = true;
1713
- if (!enableTransition) {
1714
- this._target.copy(this._targetEnd);
1715
- this._spherical.copy(this._sphericalEnd);
1716
- }
1717
- var resolveImmediately = !enableTransition || approxEquals(this._target.x, this._targetEnd.x, this.restThreshold) && approxEquals(this._target.y, this._targetEnd.y, this.restThreshold) && approxEquals(this._target.z, this._targetEnd.z, this.restThreshold) && approxEquals(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) && approxEquals(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) && approxEquals(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);
1718
- return this._createOnRestPromise(resolveImmediately);
1719
- }
1720
- /**
1721
- * Set angle and distance by given position.
1722
- * An alias of `setLookAt()`, without target change. Thus keep gazing at the current target
1723
- * @param positionX
1724
- * @param positionY
1725
- * @param positionZ
1726
- * @param enableTransition
1727
- * @category Methods
1728
- */
1729
- }, {
1730
- key: "setPosition",
1731
- value: function setPosition(positionX, positionY, positionZ) {
1732
- var enableTransition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1733
- return this.setLookAt(positionX, positionY, positionZ, this._targetEnd.x, this._targetEnd.y, this._targetEnd.z, enableTransition);
1734
- }
1735
- /**
1736
- * Set the target position where gaze at.
1737
- * An alias of `setLookAt()`, without position change. Thus keep the same position.
1738
- * @param targetX
1739
- * @param targetY
1740
- * @param targetZ
1741
- * @param enableTransition
1742
- * @category Methods
1743
- */
1744
- }, {
1745
- key: "setTarget",
1746
- value: function setTarget(targetX, targetY, targetZ) {
1747
- var enableTransition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1748
- var pos = this.getPosition(_v3A);
1749
- var promise = this.setLookAt(pos.x, pos.y, pos.z, targetX, targetY, targetZ, enableTransition);
1750
- // see https://github.com/yomotsu/camera-controls/issues/335
1751
- this._sphericalEnd.phi = clamp(this._sphericalEnd.phi, this.minPolarAngle, this.maxPolarAngle);
1752
- return promise;
1753
- }
1754
- /**
1755
- * Set focal offset using the screen parallel coordinates. z doesn't affect in Orthographic as with Dolly.
1756
- * @param x
1757
- * @param y
1758
- * @param z
1759
- * @param enableTransition
1760
- * @category Methods
1761
- */
1762
- }, {
1763
- key: "setFocalOffset",
1764
- value: function setFocalOffset(x, y, z) {
1765
- var enableTransition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1766
- this._isUserControllingOffset = false;
1767
- this._focalOffsetEnd.set(x, y, z);
1768
- this._needsUpdate = true;
1769
- if (!enableTransition) this._focalOffset.copy(this._focalOffsetEnd);
1770
- var resolveImmediately = !enableTransition || approxEquals(this._focalOffset.x, this._focalOffsetEnd.x, this.restThreshold) && approxEquals(this._focalOffset.y, this._focalOffsetEnd.y, this.restThreshold) && approxEquals(this._focalOffset.z, this._focalOffsetEnd.z, this.restThreshold);
1771
- return this._createOnRestPromise(resolveImmediately);
1772
- }
1773
- /**
1774
- * Set orbit point without moving the camera.
1775
- * SHOULD NOT RUN DURING ANIMATIONS. `setOrbitPoint()` will immediately fix the positions.
1776
- * @param targetX
1777
- * @param targetY
1778
- * @param targetZ
1779
- * @category Methods
1780
- */
1781
- }, {
1782
- key: "setOrbitPoint",
1783
- value: function setOrbitPoint(targetX, targetY, targetZ) {
1784
- this._camera.updateMatrixWorld();
1785
- _xColumn.setFromMatrixColumn(this._camera.matrixWorldInverse, 0);
1786
- _yColumn.setFromMatrixColumn(this._camera.matrixWorldInverse, 1);
1787
- _zColumn.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);
1788
- var position = _v3A.set(targetX, targetY, targetZ);
1789
- var distance = position.distanceTo(this._camera.position);
1790
- var cameraToPoint = position.sub(this._camera.position);
1791
- _xColumn.multiplyScalar(cameraToPoint.x);
1792
- _yColumn.multiplyScalar(cameraToPoint.y);
1793
- _zColumn.multiplyScalar(cameraToPoint.z);
1794
- _v3A.copy(_xColumn).add(_yColumn).add(_zColumn);
1795
- _v3A.z = _v3A.z + distance;
1796
- this.dollyTo(distance, false);
1797
- this.setFocalOffset(-_v3A.x, _v3A.y, -_v3A.z, false);
1798
- this.moveTo(targetX, targetY, targetZ, false);
1799
- }
1800
- /**
1801
- * Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3
1802
- * @param box3
1803
- * @category Methods
1804
- */
1805
- }, {
1806
- key: "setBoundary",
1807
- value: function setBoundary(box3) {
1808
- if (!box3) {
1809
- this._boundary.min.set(-Infinity, -Infinity, -Infinity);
1810
- this._boundary.max.set(Infinity, Infinity, Infinity);
1811
- this._needsUpdate = true;
1812
- return;
1813
- }
1814
- this._boundary.copy(box3);
1815
- this._boundary.clampPoint(this._targetEnd, this._targetEnd);
1816
- this._needsUpdate = true;
1817
- }
1818
- /**
1819
- * Set (or unset) the current viewport.
1820
- * Set this when you want to use renderer viewport and .dollyToCursor feature at the same time.
1821
- * @param viewportOrX
1822
- * @param y
1823
- * @param width
1824
- * @param height
1825
- * @category Methods
1826
- */
1827
- }, {
1828
- key: "setViewport",
1829
- value: function setViewport(viewportOrX, y, width, height) {
1830
- if (viewportOrX === null) {
1831
- // null
1832
- this._viewport = null;
1833
- return;
1834
- }
1835
- this._viewport = this._viewport || new THREE.Vector4();
1836
- if (typeof viewportOrX === 'number') {
1837
- // number
1838
- this._viewport.set(viewportOrX, y, width, height);
1839
- } else {
1840
- // Vector4
1841
- this._viewport.copy(viewportOrX);
1842
- }
1843
- }
1844
- /**
1845
- * Calculate the distance to fit the box.
1846
- * @param width box width
1847
- * @param height box height
1848
- * @param depth box depth
1849
- * @returns distance
1850
- * @category Methods
1851
- */
1852
- }, {
1853
- key: "getDistanceToFitBox",
1854
- value: function getDistanceToFitBox(width, height, depth) {
1855
- var cover = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1856
- if (notSupportedInOrthographicCamera(this._camera, 'getDistanceToFitBox')) return this._spherical.radius;
1857
- var boundingRectAspect = width / height;
1858
- var fov = this._camera.getEffectiveFOV() * DEG2RAD;
1859
- var aspect = this._camera.aspect;
1860
- var heightToFit = (cover ? boundingRectAspect > aspect : boundingRectAspect < aspect) ? height : width / aspect;
1861
- return heightToFit * 0.5 / Math.tan(fov * 0.5) + depth * 0.5;
1862
- }
1863
- /**
1864
- * Calculate the distance to fit the sphere.
1865
- * @param radius sphere radius
1866
- * @returns distance
1867
- * @category Methods
1868
- */
1869
- }, {
1870
- key: "getDistanceToFitSphere",
1871
- value: function getDistanceToFitSphere(radius) {
1872
- if (notSupportedInOrthographicCamera(this._camera, 'getDistanceToFitSphere')) return this._spherical.radius;
1873
- // https://stackoverflow.com/a/44849975
1874
- var vFOV = this._camera.getEffectiveFOV() * DEG2RAD;
1875
- var hFOV = Math.atan(Math.tan(vFOV * 0.5) * this._camera.aspect) * 2;
1876
- var fov = 1 < this._camera.aspect ? vFOV : hFOV;
1877
- return radius / Math.sin(fov * 0.5);
1878
- }
1879
- /**
1880
- * Returns the orbit center position, where the camera looking at.
1881
- * @param out The receiving Vector3 instance to copy the result
1882
- * @param receiveEndValue Whether receive the transition end coords or current. default is `true`
1883
- * @category Methods
1884
- */
1885
- }, {
1886
- key: "getTarget",
1887
- value: function getTarget(out) {
1888
- var receiveEndValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1889
- var _out = !!out && out.isVector3 ? out : new THREE.Vector3();
1890
- return _out.copy(receiveEndValue ? this._targetEnd : this._target);
1891
- }
1892
- /**
1893
- * Returns the camera position.
1894
- * @param out The receiving Vector3 instance to copy the result
1895
- * @param receiveEndValue Whether receive the transition end coords or current. default is `true`
1896
- * @category Methods
1897
- */
1898
- }, {
1899
- key: "getPosition",
1900
- value: function getPosition(out) {
1901
- var receiveEndValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1902
- var _out = !!out && out.isVector3 ? out : new THREE.Vector3();
1903
- return _out.setFromSpherical(receiveEndValue ? this._sphericalEnd : this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(receiveEndValue ? this._targetEnd : this._target);
1904
- }
1905
- /**
1906
- * Returns the spherical coordinates of the orbit.
1907
- * @param out The receiving Spherical instance to copy the result
1908
- * @param receiveEndValue Whether receive the transition end coords or current. default is `true`
1909
- * @category Methods
1910
- */
1911
- }, {
1912
- key: "getSpherical",
1913
- value: function getSpherical(out) {
1914
- var receiveEndValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1915
- var _out = out || new THREE.Spherical();
1916
- return _out.copy(receiveEndValue ? this._sphericalEnd : this._spherical);
1917
- }
1918
- /**
1919
- * Returns the focal offset, which is how much the camera appears to be translated in screen parallel coordinates.
1920
- * @param out The receiving Vector3 instance to copy the result
1921
- * @param receiveEndValue Whether receive the transition end coords or current. default is `true`
1922
- * @category Methods
1923
- */
1924
- }, {
1925
- key: "getFocalOffset",
1926
- value: function getFocalOffset(out) {
1927
- var receiveEndValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1928
- var _out = !!out && out.isVector3 ? out : new THREE.Vector3();
1929
- return _out.copy(receiveEndValue ? this._focalOffsetEnd : this._focalOffset);
1930
- }
1931
- /**
1932
- * Normalize camera azimuth angle rotation between 0 and 360 degrees.
1933
- * @category Methods
1934
- */
1935
- }, {
1936
- key: "normalizeRotations",
1937
- value: function normalizeRotations() {
1938
- this._sphericalEnd.theta = this._sphericalEnd.theta % PI_2;
1939
- if (this._sphericalEnd.theta < 0) this._sphericalEnd.theta += PI_2;
1940
- this._spherical.theta += PI_2 * Math.round((this._sphericalEnd.theta - this._spherical.theta) / PI_2);
1941
- }
1942
- /**
1943
- * Reset all rotation and position to defaults.
1944
- * @param enableTransition
1945
- * @category Methods
1946
- */
1947
- }, {
1948
- key: "reset",
1949
- value: function reset() {
1950
- var enableTransition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1951
- if (!approxEquals(this._camera.up.x, this._cameraUp0.x) || !approxEquals(this._camera.up.y, this._cameraUp0.y) || !approxEquals(this._camera.up.z, this._cameraUp0.z)) {
1952
- this._camera.up.copy(this._cameraUp0);
1953
- var position = this.getPosition(_v3A);
1954
- this.updateCameraUp();
1955
- this.setPosition(position.x, position.y, position.z);
1956
- }
1957
- var promises = [this.setLookAt(this._position0.x, this._position0.y, this._position0.z, this._target0.x, this._target0.y, this._target0.z, enableTransition), this.setFocalOffset(this._focalOffset0.x, this._focalOffset0.y, this._focalOffset0.z, enableTransition), this.zoomTo(this._zoom0, enableTransition)];
1958
- return Promise.all(promises);
1959
- }
1960
- /**
1961
- * Set current camera position as the default position.
1962
- * @category Methods
1963
- */
1964
- }, {
1965
- key: "saveState",
1966
- value: function saveState() {
1967
- this._cameraUp0.copy(this._camera.up);
1968
- this.getTarget(this._target0);
1969
- this.getPosition(this._position0);
1970
- this._zoom0 = this._zoom;
1971
- this._focalOffset0.copy(this._focalOffset);
1972
- }
1973
- /**
1974
- * Sync camera-up direction.
1975
- * When camera-up vector is changed, `.updateCameraUp()` must be called.
1976
- * @category Methods
1977
- */
1978
- }, {
1979
- key: "updateCameraUp",
1980
- value: function updateCameraUp() {
1981
- this._yAxisUpSpace.setFromUnitVectors(this._camera.up, _AXIS_Y);
1982
- this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert();
1983
- }
1984
- /**
1985
- * Apply current camera-up direction to the camera.
1986
- * The orbit system will be re-initialized with the current position.
1987
- * @category Methods
1988
- */
1989
- }, {
1990
- key: "applyCameraUp",
1991
- value: function applyCameraUp() {
1992
- var cameraDirection = _v3A.subVectors(this._target, this._camera.position).normalize();
1993
- // So first find the vector off to the side, orthogonal to both this.object.up and
1994
- // the "view" vector.
1995
- var side = _v3B.crossVectors(cameraDirection, this._camera.up);
1996
- // Then find the vector orthogonal to both this "side" vector and the "view" vector.
1997
- // This vector will be the new "up" vector.
1998
- this._camera.up.crossVectors(side, cameraDirection).normalize();
1999
- this._camera.updateMatrixWorld();
2000
- var position = this.getPosition(_v3A);
2001
- this.updateCameraUp();
2002
- this.setPosition(position.x, position.y, position.z);
2003
- }
2004
- /**
2005
- * Update camera position and directions.
2006
- * This should be called in your tick loop every time, and returns true if re-rendering is needed.
2007
- * @param delta
2008
- * @returns updated
2009
- * @category Methods
2010
- */
2011
- }, {
2012
- key: "update",
2013
- value: function update(delta) {
2014
- var deltaTheta = this._sphericalEnd.theta - this._spherical.theta;
2015
- var deltaPhi = this._sphericalEnd.phi - this._spherical.phi;
2016
- var deltaRadius = this._sphericalEnd.radius - this._spherical.radius;
2017
- var deltaTarget = _deltaTarget.subVectors(this._targetEnd, this._target);
2018
- var deltaOffset = _deltaOffset.subVectors(this._focalOffsetEnd, this._focalOffset);
2019
- var deltaZoom = this._zoomEnd - this._zoom;
2020
- // update theta
2021
- if (approxZero(deltaTheta)) {
2022
- this._thetaVelocity.value = 0;
2023
- this._spherical.theta = this._sphericalEnd.theta;
2024
- } else {
2025
- var smoothTime = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
2026
- this._spherical.theta = smoothDamp(this._spherical.theta, this._sphericalEnd.theta, this._thetaVelocity, smoothTime, Infinity, delta);
2027
- this._needsUpdate = true;
2028
- }
2029
- // update phi
2030
- if (approxZero(deltaPhi)) {
2031
- this._phiVelocity.value = 0;
2032
- this._spherical.phi = this._sphericalEnd.phi;
2033
- } else {
2034
- var _smoothTime = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;
2035
- this._spherical.phi = smoothDamp(this._spherical.phi, this._sphericalEnd.phi, this._phiVelocity, _smoothTime, Infinity, delta);
2036
- this._needsUpdate = true;
2037
- }
2038
- // update distance
2039
- if (approxZero(deltaRadius)) {
2040
- this._radiusVelocity.value = 0;
2041
- this._spherical.radius = this._sphericalEnd.radius;
2042
- } else {
2043
- var _smoothTime2 = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;
2044
- this._spherical.radius = smoothDamp(this._spherical.radius, this._sphericalEnd.radius, this._radiusVelocity, _smoothTime2, this.maxSpeed, delta);
2045
- this._needsUpdate = true;
2046
- }
2047
- // update target position
2048
- if (approxZero(deltaTarget.x) && approxZero(deltaTarget.y) && approxZero(deltaTarget.z)) {
2049
- this._targetVelocity.set(0, 0, 0);
2050
- this._target.copy(this._targetEnd);
2051
- } else {
2052
- var _smoothTime3 = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;
2053
- smoothDampVec3(this._target, this._targetEnd, this._targetVelocity, _smoothTime3, this.maxSpeed, delta, this._target);
2054
- this._needsUpdate = true;
2055
- }
2056
- // update focalOffset
2057
- if (approxZero(deltaOffset.x) && approxZero(deltaOffset.y) && approxZero(deltaOffset.z)) {
2058
- this._focalOffsetVelocity.set(0, 0, 0);
2059
- this._focalOffset.copy(this._focalOffsetEnd);
2060
- } else {
2061
- var _smoothTime4 = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;
2062
- smoothDampVec3(this._focalOffset, this._focalOffsetEnd, this._focalOffsetVelocity, _smoothTime4, this.maxSpeed, delta, this._focalOffset);
2063
- this._needsUpdate = true;
2064
- }
2065
- // update zoom
2066
- if (approxZero(deltaZoom)) {
2067
- this._zoomVelocity.value = 0;
2068
- this._zoom = this._zoomEnd;
2069
- } else {
2070
- var _smoothTime5 = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;
2071
- this._zoom = smoothDamp(this._zoom, this._zoomEnd, this._zoomVelocity, _smoothTime5, Infinity, delta);
2072
- }
2073
- if (this.dollyToCursor) {
2074
- if (isPerspectiveCamera(this._camera) && this._changedDolly !== 0) {
2075
- var dollyControlAmount = this._spherical.radius - this._lastDistance;
2076
- var camera = this._camera;
2077
- var cameraDirection = this._getCameraDirection(_cameraDirection);
2078
- var planeX = _v3A.copy(cameraDirection).cross(camera.up).normalize();
2079
- if (planeX.lengthSq() === 0) planeX.x = 1.0;
2080
- var planeY = _v3B.crossVectors(planeX, cameraDirection);
2081
- var worldToScreen = this._sphericalEnd.radius * Math.tan(camera.getEffectiveFOV() * DEG2RAD * 0.5);
2082
- var prevRadius = this._sphericalEnd.radius - dollyControlAmount;
2083
- var lerpRatio = (prevRadius - this._sphericalEnd.radius) / this._sphericalEnd.radius;
2084
- var cursor = _v3C.copy(this._targetEnd).add(planeX.multiplyScalar(this._dollyControlCoord.x * worldToScreen * camera.aspect)).add(planeY.multiplyScalar(this._dollyControlCoord.y * worldToScreen));
2085
- var newTargetEnd = _v3A.copy(this._targetEnd).lerp(cursor, lerpRatio);
2086
- var isMin = this._lastDollyDirection === DOLLY_DIRECTION.IN && this._spherical.radius <= this.minDistance;
2087
- var isMax = this._lastDollyDirection === DOLLY_DIRECTION.OUT && this.maxDistance <= this._spherical.radius;
2088
- if (this.infinityDolly && (isMin || isMax)) {
2089
- this._sphericalEnd.radius -= dollyControlAmount;
2090
- this._spherical.radius -= dollyControlAmount;
2091
- var dollyAmount = _v3B.copy(cameraDirection).multiplyScalar(-dollyControlAmount);
2092
- newTargetEnd.add(dollyAmount);
2093
- }
2094
- // target position may be moved beyond boundary.
2095
- this._boundary.clampPoint(newTargetEnd, newTargetEnd);
2096
- var targetEndDiff = _v3B.subVectors(newTargetEnd, this._targetEnd);
2097
- this._targetEnd.copy(newTargetEnd);
2098
- this._target.add(targetEndDiff);
2099
- this._changedDolly -= dollyControlAmount;
2100
- if (approxZero(this._changedDolly)) this._changedDolly = 0;
2101
- } else if (isOrthographicCamera(this._camera) && this._changedZoom !== 0) {
2102
- var _dollyControlAmount = this._zoom - this._lastZoom;
2103
- var _camera2 = this._camera;
2104
- var worldCursorPosition = _v3A.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (_camera2.near + _camera2.far) / (_camera2.near - _camera2.far)).unproject(_camera2);
2105
- var quaternion = _v3B.set(0, 0, -1).applyQuaternion(_camera2.quaternion);
2106
- var _cursor = _v3C.copy(worldCursorPosition).add(quaternion.multiplyScalar(-worldCursorPosition.dot(_camera2.up)));
2107
- var prevZoom = this._zoom - _dollyControlAmount;
2108
- var _lerpRatio = -(prevZoom - this._zoom) / this._zoom;
2109
- // find the "distance" (aka plane constant in three.js) of Plane
2110
- // from a given position (this._targetEnd) and normal vector (cameraDirection)
2111
- // https://www.maplesoft.com/support/help/maple/view.aspx?path=MathApps%2FEquationOfAPlaneNormal#bkmrk0
2112
- var _cameraDirection2 = this._getCameraDirection(_cameraDirection);
2113
- var prevPlaneConstant = this._targetEnd.dot(_cameraDirection2);
2114
- var _newTargetEnd = _v3A.copy(this._targetEnd).lerp(_cursor, _lerpRatio);
2115
- var newPlaneConstant = _newTargetEnd.dot(_cameraDirection2);
2116
- // Pull back the camera depth that has moved, to be the camera stationary as zoom
2117
- var pullBack = _cameraDirection2.multiplyScalar(newPlaneConstant - prevPlaneConstant);
2118
- _newTargetEnd.sub(pullBack);
2119
- // target position may be moved beyond boundary.
2120
- this._boundary.clampPoint(_newTargetEnd, _newTargetEnd);
2121
- var _targetEndDiff = _v3B.subVectors(_newTargetEnd, this._targetEnd);
2122
- this._targetEnd.copy(_newTargetEnd);
2123
- this._target.add(_targetEndDiff);
2124
- // this._target.copy( this._targetEnd );
2125
- this._changedZoom -= _dollyControlAmount;
2126
- if (approxZero(this._changedZoom)) this._changedZoom = 0;
2127
- }
2128
- }
2129
- if (this._camera.zoom !== this._zoom) {
2130
- this._camera.zoom = this._zoom;
2131
- this._camera.updateProjectionMatrix();
2132
- this._updateNearPlaneCorners();
2133
- this._needsUpdate = true;
2134
- }
2135
- this._dragNeedsUpdate = true;
2136
- // collision detection
2137
- var maxDistance = this._collisionTest();
2138
- this._spherical.radius = Math.min(this._spherical.radius, maxDistance);
2139
- // decompose spherical to the camera position
2140
- this._spherical.makeSafe();
2141
- this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target);
2142
- this._camera.lookAt(this._target);
2143
- // set offset after the orbit movement
2144
- var affectOffset = !approxZero(this._focalOffset.x) || !approxZero(this._focalOffset.y) || !approxZero(this._focalOffset.z);
2145
- if (affectOffset) {
2146
- this._camera.updateMatrixWorld();
2147
- _xColumn.setFromMatrixColumn(this._camera.matrix, 0);
2148
- _yColumn.setFromMatrixColumn(this._camera.matrix, 1);
2149
- _zColumn.setFromMatrixColumn(this._camera.matrix, 2);
2150
- _xColumn.multiplyScalar(this._focalOffset.x);
2151
- _yColumn.multiplyScalar(-this._focalOffset.y);
2152
- _zColumn.multiplyScalar(this._focalOffset.z); // notice: z-offset will not affect in Orthographic.
2153
- _v3A.copy(_xColumn).add(_yColumn).add(_zColumn);
2154
- this._camera.position.add(_v3A);
2155
- }
2156
- if (this._boundaryEnclosesCamera) {
2157
- this._encloseToBoundary(this._camera.position.copy(this._target), _v3A.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1.0);
2158
- }
2159
- var updated = this._needsUpdate;
2160
- if (updated && !this._updatedLastTime) {
2161
- this._hasRested = false;
2162
- this.dispatchEvent({
2163
- type: 'wake'
2164
- });
2165
- this.dispatchEvent({
2166
- type: 'update'
2167
- });
2168
- } else if (updated) {
2169
- this.dispatchEvent({
2170
- type: 'update'
2171
- });
2172
- if (approxZero(deltaTheta, this.restThreshold) && approxZero(deltaPhi, this.restThreshold) && approxZero(deltaRadius, this.restThreshold) && approxZero(deltaTarget.x, this.restThreshold) && approxZero(deltaTarget.y, this.restThreshold) && approxZero(deltaTarget.z, this.restThreshold) && approxZero(deltaOffset.x, this.restThreshold) && approxZero(deltaOffset.y, this.restThreshold) && approxZero(deltaOffset.z, this.restThreshold) && approxZero(deltaZoom, this.restThreshold) && !this._hasRested) {
2173
- this._hasRested = true;
2174
- this.dispatchEvent({
2175
- type: 'rest'
2176
- });
2177
- }
2178
- } else if (!updated && this._updatedLastTime) {
2179
- this.dispatchEvent({
2180
- type: 'sleep'
2181
- });
2182
- }
2183
- this._lastDistance = this._spherical.radius;
2184
- this._lastZoom = this._zoom;
2185
- this._updatedLastTime = updated;
2186
- this._needsUpdate = false;
2187
- return updated;
2188
- }
2189
- /**
2190
- * Get all state in JSON string
2191
- * @category Methods
2192
- */
2193
- }, {
2194
- key: "toJSON",
2195
- value: function toJSON() {
2196
- return JSON.stringify({
2197
- enabled: this._enabled,
2198
- minDistance: this.minDistance,
2199
- maxDistance: infinityToMaxNumber(this.maxDistance),
2200
- minZoom: this.minZoom,
2201
- maxZoom: infinityToMaxNumber(this.maxZoom),
2202
- minPolarAngle: this.minPolarAngle,
2203
- maxPolarAngle: infinityToMaxNumber(this.maxPolarAngle),
2204
- minAzimuthAngle: infinityToMaxNumber(this.minAzimuthAngle),
2205
- maxAzimuthAngle: infinityToMaxNumber(this.maxAzimuthAngle),
2206
- smoothTime: this.smoothTime,
2207
- draggingSmoothTime: this.draggingSmoothTime,
2208
- dollySpeed: this.dollySpeed,
2209
- truckSpeed: this.truckSpeed,
2210
- dollyToCursor: this.dollyToCursor,
2211
- verticalDragToForward: this.verticalDragToForward,
2212
- target: this._targetEnd.toArray(),
2213
- position: _v3A.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),
2214
- zoom: this._zoomEnd,
2215
- focalOffset: this._focalOffsetEnd.toArray(),
2216
- target0: this._target0.toArray(),
2217
- position0: this._position0.toArray(),
2218
- zoom0: this._zoom0,
2219
- focalOffset0: this._focalOffset0.toArray()
2220
- });
2221
- }
2222
- /**
2223
- * Reproduce the control state with JSON. enableTransition is where anim or not in a boolean.
2224
- * @param json
2225
- * @param enableTransition
2226
- * @category Methods
2227
- */
2228
- }, {
2229
- key: "fromJSON",
2230
- value: function fromJSON(json) {
2231
- var enableTransition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2232
- var obj = JSON.parse(json);
2233
- this.enabled = obj.enabled;
2234
- this.minDistance = obj.minDistance;
2235
- this.maxDistance = maxNumberToInfinity(obj.maxDistance);
2236
- this.minZoom = obj.minZoom;
2237
- this.maxZoom = maxNumberToInfinity(obj.maxZoom);
2238
- this.minPolarAngle = obj.minPolarAngle;
2239
- this.maxPolarAngle = maxNumberToInfinity(obj.maxPolarAngle);
2240
- this.minAzimuthAngle = maxNumberToInfinity(obj.minAzimuthAngle);
2241
- this.maxAzimuthAngle = maxNumberToInfinity(obj.maxAzimuthAngle);
2242
- this.smoothTime = obj.smoothTime;
2243
- this.draggingSmoothTime = obj.draggingSmoothTime;
2244
- this.dollySpeed = obj.dollySpeed;
2245
- this.truckSpeed = obj.truckSpeed;
2246
- this.dollyToCursor = obj.dollyToCursor;
2247
- this.verticalDragToForward = obj.verticalDragToForward;
2248
- this._target0.fromArray(obj.target0);
2249
- this._position0.fromArray(obj.position0);
2250
- this._zoom0 = obj.zoom0;
2251
- this._focalOffset0.fromArray(obj.focalOffset0);
2252
- this.moveTo(obj.target[0], obj.target[1], obj.target[2], enableTransition);
2253
- _sphericalA.setFromVector3(_v3A.fromArray(obj.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace));
2254
- this.rotateTo(_sphericalA.theta, _sphericalA.phi, enableTransition);
2255
- this.dollyTo(_sphericalA.radius, enableTransition);
2256
- this.zoomTo(obj.zoom, enableTransition);
2257
- this.setFocalOffset(obj.focalOffset[0], obj.focalOffset[1], obj.focalOffset[2], enableTransition);
2258
- this._needsUpdate = true;
2259
- }
2260
- /**
2261
- * Attach all internal event handlers to enable drag control.
2262
- * @category Methods
2263
- */
2264
- }, {
2265
- key: "connect",
2266
- value: function connect(domElement) {
2267
- if (this._domElement) {
2268
- console.warn('camera-controls is already connected.');
2269
- return;
2270
- }
2271
- domElement.setAttribute('data-camera-controls-version', VERSION);
2272
- this._addAllEventListeners(domElement);
2273
- this._getClientRect(this._elementRect);
2274
- }
2275
- /**
2276
- * Detach all internal event handlers to disable drag control.
2277
- */
2278
- }, {
2279
- key: "disconnect",
2280
- value: function disconnect() {
2281
- this.cancel();
2282
- this._removeAllEventListeners();
2283
- if (this._domElement) {
2284
- this._domElement.removeAttribute('data-camera-controls-version');
2285
- this._domElement = undefined;
2286
- }
2287
- }
2288
- /**
2289
- * Dispose the cameraControls instance itself, remove all eventListeners.
2290
- * @category Methods
2291
- */
2292
- }, {
2293
- key: "dispose",
2294
- value: function dispose() {
2295
- // remove all user event listeners
2296
- this.removeAllEventListeners();
2297
- // remove all internal event listeners
2298
- this.disconnect();
2299
- }
2300
- // it's okay to expose public though
2301
- }, {
2302
- key: "_getTargetDirection",
2303
- value: function _getTargetDirection(out) {
2304
- // divide by distance to normalize, lighter than `Vector3.prototype.normalize()`
2305
- return out.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse);
2306
- }
2307
- // it's okay to expose public though
2308
- }, {
2309
- key: "_getCameraDirection",
2310
- value: function _getCameraDirection(out) {
2311
- return this._getTargetDirection(out).negate();
2312
- }
2313
- }, {
2314
- key: "_findPointerById",
2315
- value: function _findPointerById(pointerId) {
2316
- return this._activePointers.find(function (activePointer) {
2317
- return activePointer.pointerId === pointerId;
2318
- });
2319
- }
2320
- }, {
2321
- key: "_findPointerByMouseButton",
2322
- value: function _findPointerByMouseButton(mouseButton) {
2323
- return this._activePointers.find(function (activePointer) {
2324
- return activePointer.mouseButton === mouseButton;
2325
- });
2326
- }
2327
- }, {
2328
- key: "_disposePointer",
2329
- value: function _disposePointer(pointer) {
2330
- this._activePointers.splice(this._activePointers.indexOf(pointer), 1);
2331
- }
2332
- }, {
2333
- key: "_encloseToBoundary",
2334
- value: function _encloseToBoundary(position, offset, friction) {
2335
- var offsetLength2 = offset.lengthSq();
2336
- if (offsetLength2 === 0.0) {
2337
- // sanity check
2338
- return position;
2339
- }
2340
- // See: https://twitter.com/FMS_Cat/status/1106508958640988161
2341
- var newTarget = _v3B.copy(offset).add(position); // target
2342
- var clampedTarget = this._boundary.clampPoint(newTarget, _v3C); // clamped target
2343
- var deltaClampedTarget = clampedTarget.sub(newTarget); // newTarget -> clampedTarget
2344
- var deltaClampedTargetLength2 = deltaClampedTarget.lengthSq(); // squared length of deltaClampedTarget
2345
- if (deltaClampedTargetLength2 === 0.0) {
2346
- // when the position doesn't have to be clamped
2347
- return position.add(offset);
2348
- } else if (deltaClampedTargetLength2 === offsetLength2) {
2349
- // when the position is completely stuck
2350
- return position;
2351
- } else if (friction === 0.0) {
2352
- return position.add(offset).add(deltaClampedTarget);
2353
- } else {
2354
- var offsetFactor = 1.0 + friction * deltaClampedTargetLength2 / offset.dot(deltaClampedTarget);
2355
- return position.add(_v3B.copy(offset).multiplyScalar(offsetFactor)).add(deltaClampedTarget.multiplyScalar(1.0 - friction));
2356
- }
2357
- }
2358
- }, {
2359
- key: "_updateNearPlaneCorners",
2360
- value: function _updateNearPlaneCorners() {
2361
- if (isPerspectiveCamera(this._camera)) {
2362
- var camera = this._camera;
2363
- var near = camera.near;
2364
- var fov = camera.getEffectiveFOV() * DEG2RAD;
2365
- var heightHalf = Math.tan(fov * 0.5) * near; // near plain half height
2366
- var widthHalf = heightHalf * camera.aspect; // near plain half width
2367
- this._nearPlaneCorners[0].set(-widthHalf, -heightHalf, 0);
2368
- this._nearPlaneCorners[1].set(widthHalf, -heightHalf, 0);
2369
- this._nearPlaneCorners[2].set(widthHalf, heightHalf, 0);
2370
- this._nearPlaneCorners[3].set(-widthHalf, heightHalf, 0);
2371
- } else if (isOrthographicCamera(this._camera)) {
2372
- var _camera3 = this._camera;
2373
- var zoomInv = 1 / _camera3.zoom;
2374
- var left = _camera3.left * zoomInv;
2375
- var right = _camera3.right * zoomInv;
2376
- var top = _camera3.top * zoomInv;
2377
- var bottom = _camera3.bottom * zoomInv;
2378
- this._nearPlaneCorners[0].set(left, top, 0);
2379
- this._nearPlaneCorners[1].set(right, top, 0);
2380
- this._nearPlaneCorners[2].set(right, bottom, 0);
2381
- this._nearPlaneCorners[3].set(left, bottom, 0);
2382
- }
2383
- }
2384
- // lateUpdate
2385
- }, {
2386
- key: "_collisionTest",
2387
- value: function _collisionTest() {
2388
- var distance = Infinity;
2389
- var hasCollider = this.colliderMeshes.length >= 1;
2390
- if (!hasCollider) return distance;
2391
- if (notSupportedInOrthographicCamera(this._camera, '_collisionTest')) return distance;
2392
- var rayDirection = this._getTargetDirection(_cameraDirection);
2393
- _rotationMatrix.lookAt(_ORIGIN, rayDirection, this._camera.up);
2394
- for (var i = 0; i < 4; i++) {
2395
- var nearPlaneCorner = _v3B.copy(this._nearPlaneCorners[i]);
2396
- nearPlaneCorner.applyMatrix4(_rotationMatrix);
2397
- var origin = _v3C.addVectors(this._target, nearPlaneCorner);
2398
- _raycaster.set(origin, rayDirection);
2399
- _raycaster.far = this._spherical.radius + 1;
2400
- var intersects = _raycaster.intersectObjects(this.colliderMeshes);
2401
- if (intersects.length !== 0 && intersects[0].distance < distance) {
2402
- distance = intersects[0].distance;
2403
- }
2404
- }
2405
- return distance;
2406
- }
2407
- /**
2408
- * Get its client rect and package into given `DOMRect` .
2409
- */
2410
- }, {
2411
- key: "_getClientRect",
2412
- value: function _getClientRect(target) {
2413
- if (!this._domElement) return;
2414
- var rect = this._domElement.getBoundingClientRect();
2415
- target.x = rect.left;
2416
- target.y = rect.top;
2417
- if (this._viewport) {
2418
- target.x += this._viewport.x;
2419
- target.y += rect.height - this._viewport.w - this._viewport.y;
2420
- target.width = this._viewport.z;
2421
- target.height = this._viewport.w;
2422
- } else {
2423
- target.width = rect.width;
2424
- target.height = rect.height;
2425
- }
2426
- return target;
2427
- }
2428
- }, {
2429
- key: "_createOnRestPromise",
2430
- value: function _createOnRestPromise(resolveImmediately) {
2431
- var _this2 = this;
2432
- if (resolveImmediately) return Promise.resolve();
2433
- this._hasRested = false;
2434
- this.dispatchEvent({
2435
- type: 'transitionstart'
2436
- });
2437
- return new Promise(function (resolve) {
2438
- var _onResolve = function onResolve() {
2439
- _this2.removeEventListener('rest', _onResolve);
2440
- resolve();
2441
- };
2442
- _this2.addEventListener('rest', _onResolve);
2443
- });
2444
- }
2445
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2446
- }, {
2447
- key: "_addAllEventListeners",
2448
- value: function _addAllEventListeners(_domElement) {}
2449
- }, {
2450
- key: "_removeAllEventListeners",
2451
- value: function _removeAllEventListeners() {}
2452
- /**
2453
- * backward compatible
2454
- * @deprecated use smoothTime (in seconds) instead
2455
- * @category Properties
2456
- */
2457
- }, {
2458
- key: "dampingFactor",
2459
- get: function get() {
2460
- console.warn('.dampingFactor has been deprecated. use smoothTime (in seconds) instead.');
2461
- return 0;
2462
- }
2463
- /**
2464
- * backward compatible
2465
- * @deprecated use smoothTime (in seconds) instead
2466
- * @category Properties
2467
- */,
2468
- set: function set(_) {
2469
- console.warn('.dampingFactor has been deprecated. use smoothTime (in seconds) instead.');
2470
- }
2471
- /**
2472
- * backward compatible
2473
- * @deprecated use draggingSmoothTime (in seconds) instead
2474
- * @category Properties
2475
- */
2476
- }, {
2477
- key: "draggingDampingFactor",
2478
- get: function get() {
2479
- console.warn('.draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.');
2480
- return 0;
2481
- }
2482
- /**
2483
- * backward compatible
2484
- * @deprecated use draggingSmoothTime (in seconds) instead
2485
- * @category Properties
2486
- */,
2487
- set: function set(_) {
2488
- console.warn('.draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.');
2489
- }
2490
- }], [{
2491
- key: "install",
2492
- value:
2493
- /**
2494
- * Injects THREE as the dependency. You can then proceed to use CameraControls.
2495
- *
2496
- * e.g
2497
- * ```javascript
2498
- * CameraControls.install( { THREE: THREE } );
2499
- * ```
2500
- *
2501
- * Note: If you do not wish to use enter three.js to reduce file size(tree-shaking for example), make a subset to install.
2502
- *
2503
- * ```js
2504
- * import {
2505
- * Vector2,
2506
- * Vector3,
2507
- * Vector4,
2508
- * Quaternion,
2509
- * Matrix4,
2510
- * Spherical,
2511
- * Box3,
2512
- * Sphere,
2513
- * Raycaster,
2514
- * MathUtils,
2515
- * } from 'three';
2516
- *
2517
- * const subsetOfTHREE = {
2518
- * Vector2 : Vector2,
2519
- * Vector3 : Vector3,
2520
- * Vector4 : Vector4,
2521
- * Quaternion: Quaternion,
2522
- * Matrix4 : Matrix4,
2523
- * Spherical : Spherical,
2524
- * Box3 : Box3,
2525
- * Sphere : Sphere,
2526
- * Raycaster : Raycaster,
2527
- * };
2528
- * CameraControls.install( { THREE: subsetOfTHREE } );
2529
- * ```
2530
- * @category Statics
2531
- */
2532
- function install(libs) {
2533
- THREE = libs.THREE;
2534
- _ORIGIN = Object.freeze(new THREE.Vector3(0, 0, 0));
2535
- _AXIS_Y = Object.freeze(new THREE.Vector3(0, 1, 0));
2536
- _AXIS_Z = Object.freeze(new THREE.Vector3(0, 0, 1));
2537
- _v2 = new THREE.Vector2();
2538
- _v3A = new THREE.Vector3();
2539
- _v3B = new THREE.Vector3();
2540
- _v3C = new THREE.Vector3();
2541
- _cameraDirection = new THREE.Vector3();
2542
- _xColumn = new THREE.Vector3();
2543
- _yColumn = new THREE.Vector3();
2544
- _zColumn = new THREE.Vector3();
2545
- _deltaTarget = new THREE.Vector3();
2546
- _deltaOffset = new THREE.Vector3();
2547
- _sphericalA = new THREE.Spherical();
2548
- _sphericalB = new THREE.Spherical();
2549
- _box3A = new THREE.Box3();
2550
- _box3B = new THREE.Box3();
2551
- _sphere = new THREE.Sphere();
2552
- _quaternionA = new THREE.Quaternion();
2553
- _quaternionB = new THREE.Quaternion();
2554
- _rotationMatrix = new THREE.Matrix4();
2555
- _raycaster = new THREE.Raycaster();
2556
- }
2557
- /**
2558
- * list all ACTIONs
2559
- * @category Statics
2560
- */
2561
- }, {
2562
- key: "ACTION",
2563
- get: function get() {
2564
- return ACTION;
2565
- }
2566
- }, {
2567
- key: "createBoundingSphere",
2568
- value: function createBoundingSphere(object3d) {
2569
- var out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new THREE.Sphere();
2570
- var boundingSphere = out;
2571
- var center = boundingSphere.center;
2572
- _box3A.makeEmpty();
2573
- // find the center
2574
- object3d.traverseVisible(function (object) {
2575
- if (!object.isMesh) return;
2576
- _box3A.expandByObject(object);
2577
- });
2578
- _box3A.getCenter(center);
2579
- // find the radius
2580
- var maxRadiusSq = 0;
2581
- object3d.traverseVisible(function (object) {
2582
- if (!object.isMesh) return;
2583
- var mesh = object;
2584
- var geometry = mesh.geometry.clone();
2585
- geometry.applyMatrix4(mesh.matrixWorld);
2586
- var bufferGeometry = geometry;
2587
- var position = bufferGeometry.attributes.position;
2588
- for (var i = 0, l = position.count; i < l; i++) {
2589
- _v3A.fromBufferAttribute(position, i);
2590
- maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_v3A));
2591
- }
2592
- });
2593
- boundingSphere.radius = Math.sqrt(maxRadiusSq);
2594
- return boundingSphere;
2595
- }
2596
- }]);
2597
- }(EventDispatcher);
2598
- //# sourceMappingURL=camera-controls.module.js.map