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

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