kitchen-simulator 2.0.0 → 2.0.1-test.1

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 (1165) hide show
  1. package/README.md +24 -1
  2. package/es/@history.js +2 -0
  3. package/es/AppContext.js +3 -0
  4. package/es/LiteKitchenConfigurator.js +480 -0
  5. package/es/LiteRenderer.js +503 -0
  6. package/es/actions/area-actions.js +14 -0
  7. package/es/actions/export.js +36 -0
  8. package/es/actions/groups-actions.js +89 -0
  9. package/es/actions/holes-actions.js +119 -0
  10. package/es/actions/items-actions.js +318 -0
  11. package/es/actions/lines-actions.js +81 -0
  12. package/es/actions/project-actions.js +286 -0
  13. package/es/actions/scene-actions.js +33 -0
  14. package/es/actions/vertices-actions.js +27 -0
  15. package/es/actions/viewer2d-actions.js +58 -0
  16. package/es/actions/viewer3d-actions.js +23 -0
  17. package/es/analytics/ga4.js +188 -0
  18. package/es/analytics/posthog.js +60 -0
  19. package/es/assets/Window.hdr +2100 -0
  20. package/es/assets/brown_photostudio_02_1k.hdr +0 -0
  21. package/es/assets/fonts/Rene Bieder Milliard Black Italic.woff +0 -0
  22. package/es/assets/fonts/Rene Bieder Milliard Black.woff +0 -0
  23. package/es/assets/fonts/Rene Bieder Milliard Bold Italic.woff +0 -0
  24. package/es/assets/fonts/Rene Bieder Milliard Bold.woff +0 -0
  25. package/es/assets/fonts/Rene Bieder Milliard Book Italic.woff +0 -0
  26. package/es/assets/fonts/Rene Bieder Milliard Book.woff +0 -0
  27. package/es/assets/fonts/Rene Bieder Milliard ExtraBold Italic.woff +0 -0
  28. package/es/assets/fonts/Rene Bieder Milliard ExtraBold.woff +0 -0
  29. package/es/assets/fonts/Rene Bieder Milliard ExtraLight Italic.woff +0 -0
  30. package/es/assets/fonts/Rene Bieder Milliard ExtraLight.woff +0 -0
  31. package/es/assets/fonts/Rene Bieder Milliard Hairline Italic.woff +0 -0
  32. package/es/assets/fonts/Rene Bieder Milliard Hairline.woff +0 -0
  33. package/es/assets/fonts/Rene Bieder Milliard Heavy Italic.woff +0 -0
  34. package/es/assets/fonts/Rene Bieder Milliard Heavy.woff +0 -0
  35. package/es/assets/fonts/Rene Bieder Milliard Light Italic.woff +0 -0
  36. package/es/assets/fonts/Rene Bieder Milliard Light.woff +0 -0
  37. package/es/assets/fonts/Rene Bieder Milliard Medium Italic.woff +0 -0
  38. package/es/assets/fonts/Rene Bieder Milliard Medium.woff +0 -0
  39. package/es/assets/fonts/Rene Bieder Milliard SemiBold Italic.woff +0 -0
  40. package/es/assets/fonts/Rene Bieder Milliard SemiBold.woff +0 -0
  41. package/es/assets/fonts/Rene Bieder Milliard Thin Italic.woff +0 -0
  42. package/es/assets/fonts/Rene Bieder Milliard Thin.woff +0 -0
  43. package/es/assets/fonts/style.css +177 -0
  44. package/es/assets/gltf/door_closet.bin +0 -0
  45. package/es/assets/gltf/door_closet.fbx +0 -0
  46. package/es/assets/gltf/door_closet.gltf +1 -0
  47. package/es/assets/gltf/door_exterior.bin +0 -0
  48. package/es/assets/gltf/door_exterior.fbx +0 -0
  49. package/es/assets/gltf/door_exterior.gltf +1 -0
  50. package/es/assets/gltf/door_interior.bin +0 -0
  51. package/es/assets/gltf/door_interior.fbx +0 -0
  52. package/es/assets/gltf/door_interior.gltf +1 -0
  53. package/es/assets/gltf/door_sliding.bin +0 -0
  54. package/es/assets/gltf/door_sliding.fbx +0 -0
  55. package/es/assets/gltf/door_sliding.gltf +1 -0
  56. package/es/assets/gltf/doorway_framed.bin +0 -0
  57. package/es/assets/gltf/doorway_framed.fbx +0 -0
  58. package/es/assets/gltf/doorway_framed.gltf +1 -0
  59. package/es/assets/gltf/window_clear.bin +0 -0
  60. package/es/assets/gltf/window_clear.fbx +0 -0
  61. package/es/assets/gltf/window_clear.gltf +1 -0
  62. package/es/assets/gltf/window_cross.bin +0 -0
  63. package/es/assets/gltf/window_cross.fbx +0 -0
  64. package/es/assets/gltf/window_cross.gltf +1 -0
  65. package/es/assets/gltf/window_double_hung.bin +0 -0
  66. package/es/assets/gltf/window_double_hung.fbx +0 -0
  67. package/es/assets/gltf/window_double_hung.gltf +1 -0
  68. package/es/assets/gltf/window_vertical.bin +0 -0
  69. package/es/assets/gltf/window_vertical.fbx +0 -0
  70. package/es/assets/gltf/window_vertical.gltf +1 -0
  71. package/es/assets/img/1.jpg +0 -0
  72. package/es/assets/img/TKC_thumbnail.png +0 -0
  73. package/es/assets/img/Toggle.png +0 -0
  74. package/es/assets/img/loading/loading.gif +0 -0
  75. package/es/assets/img/loading/loading_1.svg +11 -0
  76. package/es/assets/img/loading_large.gif +0 -0
  77. package/es/assets/img/png/door/closet.png +0 -0
  78. package/es/assets/img/png/door/doorwaysframed.png +0 -0
  79. package/es/assets/img/png/door/doorwaysframeles.png +0 -0
  80. package/es/assets/img/png/door/doorwaysframeless.png +0 -0
  81. package/es/assets/img/png/door/exterior.png +0 -0
  82. package/es/assets/img/png/door/interior.png +0 -0
  83. package/es/assets/img/png/door/sliding.png +0 -0
  84. package/es/assets/img/png/helper/outcome.png +0 -0
  85. package/es/assets/img/png/helper/video_preview_3d.png +0 -0
  86. package/es/assets/img/png/helper/video_preview_start.png +0 -0
  87. package/es/assets/img/project_img.png +0 -0
  88. package/es/assets/img/rta/rta_logo_box_blue.jpg +0 -0
  89. package/es/assets/img/rta/rta_logo_box_blue_ico.jpg +0 -0
  90. package/es/assets/img/rta/rta_logo_box_blue_ico.svg +55 -0
  91. package/es/assets/img/rta/rta_logo_box_darkGray.jpg +0 -0
  92. package/es/assets/img/rta/rta_logo_box_lightblue.png +0 -0
  93. package/es/assets/img/rta/rta_logo_box_lightmaroon.png +0 -0
  94. package/es/assets/img/rta/rta_logo_box_maroon.png +0 -0
  95. package/es/assets/img/rta/rta_logo_box_white.png +0 -0
  96. package/es/assets/img/rta_menu.png +0 -0
  97. package/es/assets/img/step2.jpg +0 -0
  98. package/es/assets/img/step3.jpg +0 -0
  99. package/es/assets/img/step4.jpg +0 -0
  100. package/es/assets/img/step5.jpg +0 -0
  101. package/es/assets/img/step6.jpg +0 -0
  102. package/es/assets/img/step7.jpg +0 -0
  103. package/es/assets/img/step8.jpg +0 -0
  104. package/es/assets/img/svg/2d_delete_object.svg +33 -0
  105. package/es/assets/img/svg/2d_delete_object1.svg +33 -0
  106. package/es/assets/img/svg/2d_lock_object.svg +33 -0
  107. package/es/assets/img/svg/3d_item_move.svg +106 -0
  108. package/es/assets/img/svg/3d_item_rotation.svg +76 -0
  109. package/es/assets/img/svg/3d_item_warning_edit.svg +77 -0
  110. package/es/assets/img/svg/3d_item_warning_info.svg +81 -0
  111. package/es/assets/img/svg/accessories.svg +4 -0
  112. package/es/assets/img/svg/angle_icon.svg +39 -0
  113. package/es/assets/img/svg/blank_div.svg +14 -0
  114. package/es/assets/img/svg/bottombar/2d3d_button.svg +3 -0
  115. package/es/assets/img/svg/bottombar/2d3d_button_active.svg +3 -0
  116. package/es/assets/img/svg/bottombar/2d3d_toggle.svg +4 -0
  117. package/es/assets/img/svg/bottombar/2d3d_toggle_active.svg +4 -0
  118. package/es/assets/img/svg/bottombar/arrow-down.svg +3 -0
  119. package/es/assets/img/svg/bottombar/arrow-left.svg +3 -0
  120. package/es/assets/img/svg/bottombar/arrow-minus.svg +3 -0
  121. package/es/assets/img/svg/bottombar/arrow-plus.svg +11 -0
  122. package/es/assets/img/svg/bottombar/arrow-right.svg +3 -0
  123. package/es/assets/img/svg/bottombar/arrow-up.svg +3 -0
  124. package/es/assets/img/svg/bottombar/collapse.svg +3 -0
  125. package/es/assets/img/svg/bottombar/elevation-back.svg +6 -0
  126. package/es/assets/img/svg/bottombar/elevation-front.svg +6 -0
  127. package/es/assets/img/svg/bottombar/elevation-left.svg +6 -0
  128. package/es/assets/img/svg/bottombar/elevation-right.svg +7 -0
  129. package/es/assets/img/svg/bottombar/elevation.svg +6 -0
  130. package/es/assets/img/svg/bottombar/expand.svg +3 -0
  131. package/es/assets/img/svg/bottombar/help.svg +72 -0
  132. package/es/assets/img/svg/bottombar/incm_toggle.svg +39 -0
  133. package/es/assets/img/svg/bottombar/pan_1.svg +57 -0
  134. package/es/assets/img/svg/bottombar/pan_2.svg +27 -0
  135. package/es/assets/img/svg/bottombar/pan_3.svg +27 -0
  136. package/es/assets/img/svg/bottombar/pan_4.svg +27 -0
  137. package/es/assets/img/svg/bottombar/pan_5.svg +27 -0
  138. package/es/assets/img/svg/bottombar/settings.svg +23 -0
  139. package/es/assets/img/svg/bottombar/spin-down.svg +76 -0
  140. package/es/assets/img/svg/bottombar/spin-left.svg +75 -0
  141. package/es/assets/img/svg/bottombar/spin-right.svg +75 -0
  142. package/es/assets/img/svg/bottombar/spin-up.svg +76 -0
  143. package/es/assets/img/svg/bottombar/spin_1.svg +48 -0
  144. package/es/assets/img/svg/bottombar/spin_2.svg +31 -0
  145. package/es/assets/img/svg/bottombar/spin_3.svg +31 -0
  146. package/es/assets/img/svg/bottombar/spin_4.svg +31 -0
  147. package/es/assets/img/svg/bottombar/spin_5.svg +31 -0
  148. package/es/assets/img/svg/bottombar/zoomin.svg +29 -0
  149. package/es/assets/img/svg/bottombar/zoomout.svg +26 -0
  150. package/es/assets/img/svg/check.svg +10 -0
  151. package/es/assets/img/svg/close.svg +11 -0
  152. package/es/assets/img/svg/color/Black.svg +3 -0
  153. package/es/assets/img/svg/color/Blue.svg +3 -0
  154. package/es/assets/img/svg/color/Brown.svg +9 -0
  155. package/es/assets/img/svg/color/Cream.svg +3 -0
  156. package/es/assets/img/svg/color/Dark.svg +9 -0
  157. package/es/assets/img/svg/color/Gray.svg +3 -0
  158. package/es/assets/img/svg/color/Green.svg +3 -0
  159. package/es/assets/img/svg/color/Light.svg +9 -0
  160. package/es/assets/img/svg/color/Medium.svg +9 -0
  161. package/es/assets/img/svg/color/Unfinished.svg +9 -0
  162. package/es/assets/img/svg/color/White.svg +3 -0
  163. package/es/assets/img/svg/color/White.svg.bak +3 -0
  164. package/es/assets/img/svg/color/stone2.jpg +0 -0
  165. package/es/assets/img/svg/color/wood2.jpg +0 -0
  166. package/es/assets/img/svg/copy.svg +11 -0
  167. package/es/assets/img/svg/delete.svg +3 -0
  168. package/es/assets/img/svg/detail.svg +77 -0
  169. package/es/assets/img/svg/disclaimer/background.svg +758 -0
  170. package/es/assets/img/svg/disclaimer/logo-dots.svg +11 -0
  171. package/es/assets/img/svg/door/Closet.svg +11 -0
  172. package/es/assets/img/svg/door/Exterior.svg +5 -0
  173. package/es/assets/img/svg/door/Framed_dorway.svg +5 -0
  174. package/es/assets/img/svg/door/Frameless_dorway.svg +5 -0
  175. package/es/assets/img/svg/door/Interior.svg +7 -0
  176. package/es/assets/img/svg/door/Sliding.svg +5 -0
  177. package/es/assets/img/svg/doors_closet.svg +47 -0
  178. package/es/assets/img/svg/doors_exterior.svg +25 -0
  179. package/es/assets/img/svg/doors_interior.svg +29 -0
  180. package/es/assets/img/svg/doors_patio.svg +26 -0
  181. package/es/assets/img/svg/duplicate.svg +11 -0
  182. package/es/assets/img/svg/duplicate_object_left.svg +32 -0
  183. package/es/assets/img/svg/duplicate_object_right.svg +32 -0
  184. package/es/assets/img/svg/filtersActive.svg +19 -0
  185. package/es/assets/img/svg/firstsetting/L.svg +3 -0
  186. package/es/assets/img/svg/firstsetting/L2.svg +3 -0
  187. package/es/assets/img/svg/firstsetting/Open.svg +3 -0
  188. package/es/assets/img/svg/firstsetting/Square.svg +3 -0
  189. package/es/assets/img/svg/firstsetting/bar-active.svg +9 -0
  190. package/es/assets/img/svg/firstsetting/bar-normal.svg +3 -0
  191. package/es/assets/img/svg/firstsetting/bullet-current.svg +3 -0
  192. package/es/assets/img/svg/firstsetting/bullet-done.svg +3 -0
  193. package/es/assets/img/svg/firstsetting/bullet-not-done.svg +3 -0
  194. package/es/assets/img/svg/firstsetting/check-active.svg +3 -0
  195. package/es/assets/img/svg/firstsetting/check-normal.svg +3 -0
  196. package/es/assets/img/svg/firstsetting/pencil.svg +11 -0
  197. package/es/assets/img/svg/green_checkmark.svg +27 -0
  198. package/es/assets/img/svg/headerbar/assist.svg +3 -0
  199. package/es/assets/img/svg/headerbar/cart.svg +3 -0
  200. package/es/assets/img/svg/headerbar/check.svg +10 -0
  201. package/es/assets/img/svg/headerbar/consult_designer.svg +45 -0
  202. package/es/assets/img/svg/headerbar/edit_name.svg +26 -0
  203. package/es/assets/img/svg/headerbar/file-dollar.svg +13 -0
  204. package/es/assets/img/svg/headerbar/hamburger_menu.svg +32 -0
  205. package/es/assets/img/svg/headerbar/plus.svg +11 -0
  206. package/es/assets/img/svg/headerbar/review_quote.svg +44 -0
  207. package/es/assets/img/svg/headerbar/ruler-measure.svg +11 -0
  208. package/es/assets/img/svg/headerbar/save.svg +3 -0
  209. package/es/assets/img/svg/headerbar/setting.svg +75 -0
  210. package/es/assets/img/svg/help/check.svg +10 -0
  211. package/es/assets/img/svg/help/search.svg +76 -0
  212. package/es/assets/img/svg/intro/1-start-with-floorplan-whole.svg +27 -0
  213. package/es/assets/img/svg/intro/1-start-with-floorplan.svg +26 -0
  214. package/es/assets/img/svg/intro/2-start-from-scratch-whole.svg +28 -0
  215. package/es/assets/img/svg/intro/2-start-from-scratch.svg +27 -0
  216. package/es/assets/img/svg/intro/3-retrieve-project-whole.svg +19 -0
  217. package/es/assets/img/svg/intro/3-retrieve-project.svg +18 -0
  218. package/es/assets/img/svg/invert.svg +127 -0
  219. package/es/assets/img/svg/lefttoolbar/appliance-active.svg +13 -0
  220. package/es/assets/img/svg/lefttoolbar/appliance.svg +13 -0
  221. package/es/assets/img/svg/lefttoolbar/cabinet-active.svg +10 -0
  222. package/es/assets/img/svg/lefttoolbar/cabinet-category.svg +3 -0
  223. package/es/assets/img/svg/lefttoolbar/cabinet-one.svg +3 -0
  224. package/es/assets/img/svg/lefttoolbar/cabinet.svg +10 -0
  225. package/es/assets/img/svg/lefttoolbar/disigner_assistance.svg +89 -0
  226. package/es/assets/img/svg/lefttoolbar/door-style-active.svg +20 -0
  227. package/es/assets/img/svg/lefttoolbar/door-style.svg +20 -0
  228. package/es/assets/img/svg/lefttoolbar/door.svg +12 -0
  229. package/es/assets/img/svg/lefttoolbar/error_icon.svg +81 -0
  230. package/es/assets/img/svg/lefttoolbar/finishing-active.svg +13 -0
  231. package/es/assets/img/svg/lefttoolbar/finishing.svg +13 -0
  232. package/es/assets/img/svg/lefttoolbar/reviewforquote-active.svg +86 -0
  233. package/es/assets/img/svg/lefttoolbar/reviewforquote.svg +12 -0
  234. package/es/assets/img/svg/lefttoolbar/room-shape-L.svg +3 -0
  235. package/es/assets/img/svg/lefttoolbar/room-shape-active.svg +18 -0
  236. package/es/assets/img/svg/lefttoolbar/room-shape-custom.svg +12 -0
  237. package/es/assets/img/svg/lefttoolbar/room-shape-irregular.svg +3 -0
  238. package/es/assets/img/svg/lefttoolbar/room-shape-open.svg +3 -0
  239. package/es/assets/img/svg/lefttoolbar/room-shape-square.svg +3 -0
  240. package/es/assets/img/svg/lefttoolbar/room-shape.svg +18 -0
  241. package/es/assets/img/svg/lefttoolbar/search.svg +76 -0
  242. package/es/assets/img/svg/lefttoolbar/view_more.svg +86 -0
  243. package/es/assets/img/svg/lefttoolbar/warning_icon.svg +81 -0
  244. package/es/assets/img/svg/lefttoolbar/window.svg +12 -0
  245. package/es/assets/img/svg/logo.svg +11 -0
  246. package/es/assets/img/svg/logo_with_text.svg +25 -0
  247. package/es/assets/img/svg/menubar/login.svg +84 -0
  248. package/es/assets/img/svg/menubar/my_projects.svg +85 -0
  249. package/es/assets/img/svg/menubar/new_project.svg +110 -0
  250. package/es/assets/img/svg/menubar/save_project.svg +84 -0
  251. package/es/assets/img/svg/options.svg +3 -0
  252. package/es/assets/img/svg/positioning.svg +3 -0
  253. package/es/assets/img/svg/rotate.png +0 -0
  254. package/es/assets/img/svg/rotate.svg +17 -0
  255. package/es/assets/img/svg/rotate_object_clockwise.svg +26 -0
  256. package/es/assets/img/svg/rotate_object_counterclockwise.svg +26 -0
  257. package/es/assets/img/svg/toggleFilters.svg +19 -0
  258. package/es/assets/img/svg/toolbar/add_appliances_active.svg +64 -0
  259. package/es/assets/img/svg/toolbar/add_appliances_inactive.svg +52 -0
  260. package/es/assets/img/svg/toolbar/add_button.svg +36 -0
  261. package/es/assets/img/svg/toolbar/add_cabinets_active.svg +59 -0
  262. package/es/assets/img/svg/toolbar/add_cabinets_inactive.svg +49 -0
  263. package/es/assets/img/svg/toolbar/add_items_doors.svg +25 -0
  264. package/es/assets/img/svg/toolbar/add_items_doorways.svg +24 -0
  265. package/es/assets/img/svg/toolbar/add_items_refrigerator.svg +32 -0
  266. package/es/assets/img/svg/toolbar/add_items_windows.svg +28 -0
  267. package/es/assets/img/svg/toolbar/apply_button.svg +38 -0
  268. package/es/assets/img/svg/toolbar/arrow-plus.svg +11 -0
  269. package/es/assets/img/svg/toolbar/backsplash.svg +8 -0
  270. package/es/assets/img/svg/toolbar/cancel_button.svg +37 -0
  271. package/es/assets/img/svg/toolbar/consult_a_designer_button.svg +47 -0
  272. package/es/assets/img/svg/toolbar/countertop.svg +7 -0
  273. package/es/assets/img/svg/toolbar/dcm.png +0 -0
  274. package/es/assets/img/svg/toolbar/dcm_off.svg +12 -0
  275. package/es/assets/img/svg/toolbar/dcm_on.svg +474 -0
  276. package/es/assets/img/svg/toolbar/delete_button.svg +37 -0
  277. package/es/assets/img/svg/toolbar/download.svg +77 -0
  278. package/es/assets/img/svg/toolbar/draw_custom_floor.svg +31 -0
  279. package/es/assets/img/svg/toolbar/edit_button.svg +75 -0
  280. package/es/assets/img/svg/toolbar/email_quote_button.svg +44 -0
  281. package/es/assets/img/svg/toolbar/fbm.png +0 -0
  282. package/es/assets/img/svg/toolbar/finishing_touches_active.svg +54 -0
  283. package/es/assets/img/svg/toolbar/finishing_touches_inactive.svg +42 -0
  284. package/es/assets/img/svg/toolbar/floorstyle.svg +9 -0
  285. package/es/assets/img/svg/toolbar/fmb.png +0 -0
  286. package/es/assets/img/svg/toolbar/fmb_off.svg +12 -0
  287. package/es/assets/img/svg/toolbar/fmb_on.svg +489 -0
  288. package/es/assets/img/svg/toolbar/furnishings_icon.svg +6 -0
  289. package/es/assets/img/svg/toolbar/get_started_button.svg +41 -0
  290. package/es/assets/img/svg/toolbar/handles.svg +5 -0
  291. package/es/assets/img/svg/toolbar/lighting.svg +7 -0
  292. package/es/assets/img/svg/toolbar/lrm.png +0 -0
  293. package/es/assets/img/svg/toolbar/lrm_off.svg +12 -0
  294. package/es/assets/img/svg/toolbar/lrm_on.svg +470 -0
  295. package/es/assets/img/svg/toolbar/make_floorplan_active.svg +66 -0
  296. package/es/assets/img/svg/toolbar/make_floorplan_inactive.svg +52 -0
  297. package/es/assets/img/svg/toolbar/predefined_room_l_shaped.svg +20 -0
  298. package/es/assets/img/svg/toolbar/predefined_room_layout.svg +20 -0
  299. package/es/assets/img/svg/toolbar/predefined_room_long_narrow.svg +20 -0
  300. package/es/assets/img/svg/toolbar/predefined_room_open_l_shape.svg +20 -0
  301. package/es/assets/img/svg/toolbar/predefined_room_open_pentagon.svg +20 -0
  302. package/es/assets/img/svg/toolbar/predefined_room_open_rectangle.svg +20 -0
  303. package/es/assets/img/svg/toolbar/predefined_room_open_rectangle_2.svg +20 -0
  304. package/es/assets/img/svg/toolbar/predefined_room_pentagon.svg +20 -0
  305. package/es/assets/img/svg/toolbar/predefined_room_rectangle.svg +20 -0
  306. package/es/assets/img/svg/toolbar/predefined_room_rectangle_with_alcove.svg +20 -0
  307. package/es/assets/img/svg/toolbar/redo_button.svg +75 -0
  308. package/es/assets/img/svg/toolbar/redo_button1.svg +75 -0
  309. package/es/assets/img/svg/toolbar/review_quote_active.svg +14 -0
  310. package/es/assets/img/svg/toolbar/review_quote_inactive.svg +44 -0
  311. package/es/assets/img/svg/toolbar/save_project_button.svg +44 -0
  312. package/es/assets/img/svg/toolbar/select_doorstyle_active.svg +67 -0
  313. package/es/assets/img/svg/toolbar/select_doorstyle_inactive.svg +57 -0
  314. package/es/assets/img/svg/toolbar/shopping-cart.svg +13 -0
  315. package/es/assets/img/svg/toolbar/style_change_button.svg +47 -0
  316. package/es/assets/img/svg/toolbar/take_picture.svg +75 -0
  317. package/es/assets/img/svg/toolbar/undo_button.svg +76 -0
  318. package/es/assets/img/svg/toolbar/undo_button1.svg +76 -0
  319. package/es/assets/img/svg/toolbar/use_button.svg +37 -0
  320. package/es/assets/img/svg/toolbar/wall_color_icon.svg +6 -0
  321. package/es/assets/img/svg/topbar/edit_active.svg +10 -0
  322. package/es/assets/img/svg/topbar/edit_inactive.svg +10 -0
  323. package/es/assets/img/svg/topbar/redo_active.svg +42 -0
  324. package/es/assets/img/svg/topbar/redo_inactive.svg +23 -0
  325. package/es/assets/img/svg/topbar/select_all_active.svg +50 -0
  326. package/es/assets/img/svg/topbar/select_all_inactive.svg +32 -0
  327. package/es/assets/img/svg/topbar/take_picture_active.svg +51 -0
  328. package/es/assets/img/svg/topbar/take_picture_inactive.svg +26 -0
  329. package/es/assets/img/svg/topbar/undo_active.svg +42 -0
  330. package/es/assets/img/svg/topbar/undo_inactive.svg +23 -0
  331. package/es/assets/img/svg/warning_info_2d.svg +81 -0
  332. package/es/assets/img/svg/window/Clear.svg +3 -0
  333. package/es/assets/img/svg/window/Cross.svg +5 -0
  334. package/es/assets/img/svg/window/Double_hung.svg +4 -0
  335. package/es/assets/img/svg/window/Vertical.svg +4 -0
  336. package/es/assets/img/svg/windows_clear.svg +23 -0
  337. package/es/assets/img/svg/windows_cross.svg +28 -0
  338. package/es/assets/img/svg/windows_double_hung.svg +24 -0
  339. package/es/assets/img/svg/windows_vertical.svg +24 -0
  340. package/es/assets/img/svg/wizardstep/Custom.svg +3 -0
  341. package/es/assets/img/svg/wizardstep/Dashed_line.svg +3 -0
  342. package/es/assets/img/svg/wizardstep/L.svg +3 -0
  343. package/es/assets/img/svg/wizardstep/L2.svg +3 -0
  344. package/es/assets/img/svg/wizardstep/Open.svg +3 -0
  345. package/es/assets/img/svg/wizardstep/Square.svg +3 -0
  346. package/es/assets/img/svg/wizardstep/bar-active.svg +9 -0
  347. package/es/assets/img/svg/wizardstep/bar-normal.svg +3 -0
  348. package/es/assets/img/svg/wizardstep/bullet-current.svg +3 -0
  349. package/es/assets/img/svg/wizardstep/bullet-done.svg +3 -0
  350. package/es/assets/img/svg/wizardstep/bullet-not-done.svg +3 -0
  351. package/es/assets/img/svg/wizardstep/check-active.svg +3 -0
  352. package/es/assets/img/svg/wizardstep/check-normal.svg +3 -0
  353. package/es/assets/img/svg/wizardstep/detail_view.svg +87 -0
  354. package/es/assets/img/svg/wizardstep/pencil.svg +11 -0
  355. package/es/assets/img/svg/wizardstep/tile_view.svg +95 -0
  356. package/es/assets/img/texture/glass.jpg +0 -0
  357. package/es/assets/img/texture/steel.jpg +0 -0
  358. package/es/assets/img/texture/white1px.jpg +0 -0
  359. package/es/assets/img/texture/wood.jpg +0 -0
  360. package/es/assets/model/DCM.bin +0 -0
  361. package/es/assets/model/DCM.fbx +0 -0
  362. package/es/assets/model/DCM.gltf +1 -0
  363. package/es/assets/model/FBM.bin +0 -0
  364. package/es/assets/model/FBM.fbx +0 -0
  365. package/es/assets/model/FBM.gltf +1 -0
  366. package/es/assets/model/LRM.bin +0 -0
  367. package/es/assets/model/LRM.fbx +0 -0
  368. package/es/assets/model/LRM.gltf +1 -0
  369. package/es/assets/rtastore_logo.png +0 -0
  370. package/es/catalog/areas/area/planner-element.js +45 -0
  371. package/es/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
  372. package/es/catalog/areas/area/textures/grass.jpg +0 -0
  373. package/es/catalog/areas/area/textures/parquet.jpg +0 -0
  374. package/es/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
  375. package/es/catalog/areas/area/textures/tile1.jpg +0 -0
  376. package/es/catalog/back.png +0 -0
  377. package/es/catalog/catalog.js +265 -0
  378. package/es/catalog/doors.png +0 -0
  379. package/es/catalog/doorways.png +0 -0
  380. package/es/catalog/envMap/nx.hdr +0 -0
  381. package/es/catalog/envMap/ny.hdr +0 -0
  382. package/es/catalog/envMap/nz.hdr +0 -0
  383. package/es/catalog/envMap/px.hdr +0 -0
  384. package/es/catalog/envMap/py.hdr +0 -0
  385. package/es/catalog/envMap/pz.hdr +0 -0
  386. package/es/catalog/export.js +0 -0
  387. package/es/catalog/factories/area-factory-3d.js +181 -0
  388. package/es/catalog/factories/area-factory.js +78 -0
  389. package/es/catalog/factories/export.js +7 -0
  390. package/es/catalog/factories/wall-factory-3d.js +202 -0
  391. package/es/catalog/factories/wall-factory.js +267 -0
  392. package/es/catalog/holes/door-closet/planner-element.js +222 -0
  393. package/es/catalog/holes/door-double/door_double.png +0 -0
  394. package/es/catalog/holes/door-double/planner-element.js +315 -0
  395. package/es/catalog/holes/door-exterior/planner-element.js +215 -0
  396. package/es/catalog/holes/door-interior/planner-element.js +227 -0
  397. package/es/catalog/holes/door-panic/panicDoor.png +0 -0
  398. package/es/catalog/holes/door-panic/planner-element.js +503 -0
  399. package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  400. package/es/catalog/holes/door-panic-double/planner-element.js +463 -0
  401. package/es/catalog/holes/door-sliding/planner-element.js +225 -0
  402. package/es/catalog/holes/doorway-framed/planner-element.js +145 -0
  403. package/es/catalog/holes/doorway-frameless/planner-element.js +104 -0
  404. package/es/catalog/holes/export.js +13 -0
  405. package/es/catalog/holes/gate/gate.jpg +0 -0
  406. package/es/catalog/holes/window-clear/planner-element.js +166 -0
  407. package/es/catalog/holes/window-clear/texture.png +0 -0
  408. package/es/catalog/holes/window-cross/planner-element.js +165 -0
  409. package/es/catalog/holes/window-cross/texture.png +0 -0
  410. package/es/catalog/holes/window-double-hung/planner-element.js +303 -0
  411. package/es/catalog/holes/window-double-hung/texture.png +0 -0
  412. package/es/catalog/holes/window-vertical/planner-element.js +276 -0
  413. package/es/catalog/holes/window-vertical/texture.png +0 -0
  414. package/es/catalog/lines/wall/planner-element.js +79 -0
  415. package/es/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
  416. package/es/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
  417. package/es/catalog/lines/wall/textures/bricks.jpg +0 -0
  418. package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
  419. package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
  420. package/es/catalog/lines/wall/textures/morden-normal.jpg +0 -0
  421. package/es/catalog/lines/wall/textures/morden.jpg +0 -0
  422. package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
  423. package/es/catalog/lines/wall/textures/painted.jpg +0 -0
  424. package/es/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
  425. package/es/catalog/lines/wall/textures/plaster.jpg +0 -0
  426. package/es/catalog/lines/wall/wall.png +0 -0
  427. package/es/catalog/molding/molding-dcm/planner-element.js +26 -0
  428. package/es/catalog/molding/molding-dcm/texture.png +0 -0
  429. package/es/catalog/molding/molding-fbm/planner-element.js +26 -0
  430. package/es/catalog/molding/molding-fbm/texture.png +0 -0
  431. package/es/catalog/molding/molding-lrm/planner-element.js +26 -0
  432. package/es/catalog/molding/molding-lrm/texture.png +0 -0
  433. package/es/catalog/properties/export.js +21 -0
  434. package/es/catalog/properties/property-checkbox.js +68 -0
  435. package/es/catalog/properties/property-color.js +39 -0
  436. package/es/catalog/properties/property-enum.js +50 -0
  437. package/es/catalog/properties/property-hidden.js +19 -0
  438. package/es/catalog/properties/property-lenght-measure.js +100 -0
  439. package/es/catalog/properties/property-length-measure.js +84 -0
  440. package/es/catalog/properties/property-length-measure_hole.js +100 -0
  441. package/es/catalog/properties/property-number.js +48 -0
  442. package/es/catalog/properties/property-read-only.js +26 -0
  443. package/es/catalog/properties/property-string.js +48 -0
  444. package/es/catalog/properties/property-toggle.js +39 -0
  445. package/es/catalog/properties/shared-property-style.js +14 -0
  446. package/es/catalog/utils/FuseUtils.js +79 -0
  447. package/es/catalog/utils/exporter.js +149 -0
  448. package/es/catalog/utils/geom-utils.js +189 -0
  449. package/es/catalog/utils/item-loader.js +1594 -0
  450. package/es/catalog/utils/load-obj.js +91 -0
  451. package/es/catalog/utils/mtl-loader.js +357 -0
  452. package/es/catalog/utils/obj-loader.js +476 -0
  453. package/es/catalog/windows.png +0 -0
  454. package/es/class/FuseUtils.js +79 -0
  455. package/es/class/area.js +141 -0
  456. package/es/class/export.js +24 -0
  457. package/es/class/group.js +431 -0
  458. package/es/class/guide.js +58 -0
  459. package/es/class/hole.js +926 -0
  460. package/es/class/item.js +1845 -0
  461. package/es/class/layer.js +663 -0
  462. package/es/class/line.js +1221 -0
  463. package/es/class/project.js +795 -0
  464. package/es/class/vertex.js +198 -0
  465. package/es/components/content.js +131 -0
  466. package/es/components/export.js +7 -0
  467. package/es/components/style/button.js +106 -0
  468. package/es/components/style/cancel-button.js +21 -0
  469. package/es/components/style/content-container.js +30 -0
  470. package/es/components/style/content-title.js +25 -0
  471. package/es/components/style/delete-button.js +24 -0
  472. package/es/components/style/export.js +31 -0
  473. package/es/components/style/form-block.js +20 -0
  474. package/es/components/style/form-color-input.js +26 -0
  475. package/es/components/style/form-label.js +22 -0
  476. package/es/components/style/form-number-input.js +183 -0
  477. package/es/components/style/form-number-input_2.js +200 -0
  478. package/es/components/style/form-select.js +19 -0
  479. package/es/components/style/form-slider.js +60 -0
  480. package/es/components/style/form-submit-button.js +25 -0
  481. package/es/components/style/form-text-input.js +69 -0
  482. package/es/components/viewer2d/area.js +81 -0
  483. package/es/components/viewer2d/export.js +31 -0
  484. package/es/components/viewer2d/grids/grid-horizontal-streak.js +36 -0
  485. package/es/components/viewer2d/grids/grid-streak.js +36 -0
  486. package/es/components/viewer2d/grids/grid-vertical-streak.js +36 -0
  487. package/es/components/viewer2d/grids/grids.js +30 -0
  488. package/es/components/viewer2d/group.js +53 -0
  489. package/es/components/viewer2d/item.js +447 -0
  490. package/es/components/viewer2d/layer.js +164 -0
  491. package/es/components/viewer2d/line.js +964 -0
  492. package/es/components/viewer2d/ruler.js +79 -0
  493. package/es/components/viewer2d/rulerDist.js +132 -0
  494. package/es/components/viewer2d/rulerX.js +145 -0
  495. package/es/components/viewer2d/rulerY.js +147 -0
  496. package/es/components/viewer2d/scene.js +128 -0
  497. package/es/components/viewer2d/snap.js +74 -0
  498. package/es/components/viewer2d/state.js +73 -0
  499. package/es/components/viewer2d/utils.js +187 -0
  500. package/es/components/viewer2d/vertex.js +65 -0
  501. package/es/components/viewer2d/viewer2d.js +1433 -0
  502. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +2585 -0
  503. package/es/components/viewer3d/dcm.js +401 -0
  504. package/es/components/viewer3d/fbm.js +414 -0
  505. package/es/components/viewer3d/front3D.js +61 -0
  506. package/es/components/viewer3d/grid-creator.js +25 -0
  507. package/es/components/viewer3d/grids/grid-horizontal-streak.js +36 -0
  508. package/es/components/viewer3d/grids/grid-streak.js +27 -0
  509. package/es/components/viewer3d/grids/grid-vertical-streak.js +36 -0
  510. package/es/components/viewer3d/libs/first-person-controls.js +67 -0
  511. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1281 -0
  512. package/es/components/viewer3d/libs/mtl-loader.js +357 -0
  513. package/es/components/viewer3d/libs/obj-loader.js +462 -0
  514. package/es/components/viewer3d/libs/orbit-controls.js +697 -0
  515. package/es/components/viewer3d/libs/pointer-lock-controls.js +44 -0
  516. package/es/components/viewer3d/lrm.js +305 -0
  517. package/es/components/viewer3d/model.js +708 -0
  518. package/es/components/viewer3d/pointer-lock-navigation.js +115 -0
  519. package/es/components/viewer3d/ruler-utils/itemRect.js +61 -0
  520. package/es/components/viewer3d/ruler-utils/layer3D.js +495 -0
  521. package/es/components/viewer3d/ruler-utils/ruler3D.js +224 -0
  522. package/es/components/viewer3d/ruler-utils/scene3D.js +59 -0
  523. package/es/components/viewer3d/ruler-utils/state3D.js +18 -0
  524. package/es/components/viewer3d/scene-creator.js +3617 -0
  525. package/es/components/viewer3d/three-memory-cleaner.js +51 -0
  526. package/es/components/viewer3d/viewer3d-first-person.js +309 -0
  527. package/es/components/viewer3d/viewer3d.js +2654 -0
  528. package/es/constants.js +688 -0
  529. package/es/devLiteRenderer.js +316 -0
  530. package/es/index.js +56 -0
  531. package/es/models.js +506 -0
  532. package/es/plugins/SVGLoader.js +1412 -0
  533. package/es/plugins/console-debugger.js +34 -0
  534. package/es/plugins/export.js +7 -0
  535. package/es/plugins/keyboard.js +101 -0
  536. package/es/reducers/areas-reducer.js +12 -0
  537. package/es/reducers/export.js +25 -0
  538. package/es/reducers/groups-reducer.js +38 -0
  539. package/es/reducers/holes-reducer.js +62 -0
  540. package/es/reducers/items-reducer.js +147 -0
  541. package/es/reducers/lines-reducer.js +45 -0
  542. package/es/reducers/project-reducer.js +131 -0
  543. package/es/reducers/reducer.js +19 -0
  544. package/es/reducers/scene-reducer.js +28 -0
  545. package/es/reducers/user-reducer.js +41 -0
  546. package/es/reducers/vertices-reducer.js +19 -0
  547. package/es/reducers/viewer2d-reducer.js +75 -0
  548. package/es/reducers/viewer3d-reducer.js +56 -0
  549. package/es/shared-style.js +66 -0
  550. package/es/styles/export.js +5 -0
  551. package/es/styles/tabs.css +40 -0
  552. package/es/translator/en.js +104 -0
  553. package/es/translator/it.js +79 -0
  554. package/es/translator/ru.js +79 -0
  555. package/es/translator/translator.js +80 -0
  556. package/es/utils/browser.js +33 -0
  557. package/es/utils/convert-units-lite.js +29 -0
  558. package/es/utils/email-validator.js +4 -0
  559. package/es/utils/export.js +25 -0
  560. package/es/utils/geometry.js +2446 -0
  561. package/es/utils/get-edges-of-subgraphs.js +26 -0
  562. package/es/utils/graph-cycles.js +238 -0
  563. package/es/utils/graph-inner-cycles.js +46 -0
  564. package/es/utils/graph.js +145 -0
  565. package/es/utils/helper.js +334 -0
  566. package/es/utils/history.js +29 -0
  567. package/es/utils/id-broker.js +15 -0
  568. package/es/utils/isolate-event-handler.js +683 -0
  569. package/es/utils/logger.js +8 -0
  570. package/es/utils/math.js +50 -0
  571. package/es/utils/molding.js +865 -0
  572. package/es/utils/name-generator.js +14 -0
  573. package/es/utils/objects-utils.js +50 -0
  574. package/es/utils/phone-validator.js +4 -0
  575. package/es/utils/process-black-list.js +15 -0
  576. package/es/utils/react-if.js +18 -0
  577. package/es/utils/snap-scene.js +94 -0
  578. package/es/utils/snap.js +231 -0
  579. package/es/utils/summarizeCart.js +24 -0
  580. package/es/utils/threeCSG.es6.js +494 -0
  581. package/es/version.js +1 -0
  582. package/lib/@history.js +11 -0
  583. package/lib/AppContext.js +11 -0
  584. package/lib/LiteKitchenConfigurator.js +490 -0
  585. package/lib/LiteRenderer.js +513 -0
  586. package/lib/actions/area-actions.js +21 -0
  587. package/lib/actions/export.js +36 -0
  588. package/lib/actions/groups-actions.js +107 -0
  589. package/lib/actions/holes-actions.js +140 -0
  590. package/lib/actions/items-actions.js +370 -0
  591. package/lib/actions/lines-actions.js +96 -0
  592. package/lib/actions/project-actions.js +338 -0
  593. package/lib/actions/scene-actions.js +43 -0
  594. package/lib/actions/vertices-actions.js +35 -0
  595. package/lib/actions/viewer2d-actions.js +73 -0
  596. package/lib/actions/viewer3d-actions.js +32 -0
  597. package/lib/analytics/ga4.js +194 -0
  598. package/lib/analytics/posthog.js +68 -0
  599. package/lib/assets/Window.hdr +2100 -0
  600. package/lib/assets/brown_photostudio_02_1k.hdr +0 -0
  601. package/lib/assets/fonts/Rene Bieder Milliard Black Italic.woff +0 -0
  602. package/lib/assets/fonts/Rene Bieder Milliard Black.woff +0 -0
  603. package/lib/assets/fonts/Rene Bieder Milliard Bold Italic.woff +0 -0
  604. package/lib/assets/fonts/Rene Bieder Milliard Bold.woff +0 -0
  605. package/lib/assets/fonts/Rene Bieder Milliard Book Italic.woff +0 -0
  606. package/lib/assets/fonts/Rene Bieder Milliard Book.woff +0 -0
  607. package/lib/assets/fonts/Rene Bieder Milliard ExtraBold Italic.woff +0 -0
  608. package/lib/assets/fonts/Rene Bieder Milliard ExtraBold.woff +0 -0
  609. package/lib/assets/fonts/Rene Bieder Milliard ExtraLight Italic.woff +0 -0
  610. package/lib/assets/fonts/Rene Bieder Milliard ExtraLight.woff +0 -0
  611. package/lib/assets/fonts/Rene Bieder Milliard Hairline Italic.woff +0 -0
  612. package/lib/assets/fonts/Rene Bieder Milliard Hairline.woff +0 -0
  613. package/lib/assets/fonts/Rene Bieder Milliard Heavy Italic.woff +0 -0
  614. package/lib/assets/fonts/Rene Bieder Milliard Heavy.woff +0 -0
  615. package/lib/assets/fonts/Rene Bieder Milliard Light Italic.woff +0 -0
  616. package/lib/assets/fonts/Rene Bieder Milliard Light.woff +0 -0
  617. package/lib/assets/fonts/Rene Bieder Milliard Medium Italic.woff +0 -0
  618. package/lib/assets/fonts/Rene Bieder Milliard Medium.woff +0 -0
  619. package/lib/assets/fonts/Rene Bieder Milliard SemiBold Italic.woff +0 -0
  620. package/lib/assets/fonts/Rene Bieder Milliard SemiBold.woff +0 -0
  621. package/lib/assets/fonts/Rene Bieder Milliard Thin Italic.woff +0 -0
  622. package/lib/assets/fonts/Rene Bieder Milliard Thin.woff +0 -0
  623. package/lib/assets/fonts/style.css +177 -0
  624. package/lib/assets/gltf/door_closet.bin +0 -0
  625. package/lib/assets/gltf/door_closet.fbx +0 -0
  626. package/lib/assets/gltf/door_closet.gltf +1 -0
  627. package/lib/assets/gltf/door_exterior.bin +0 -0
  628. package/lib/assets/gltf/door_exterior.fbx +0 -0
  629. package/lib/assets/gltf/door_exterior.gltf +1 -0
  630. package/lib/assets/gltf/door_interior.bin +0 -0
  631. package/lib/assets/gltf/door_interior.fbx +0 -0
  632. package/lib/assets/gltf/door_interior.gltf +1 -0
  633. package/lib/assets/gltf/door_sliding.bin +0 -0
  634. package/lib/assets/gltf/door_sliding.fbx +0 -0
  635. package/lib/assets/gltf/door_sliding.gltf +1 -0
  636. package/lib/assets/gltf/doorway_framed.bin +0 -0
  637. package/lib/assets/gltf/doorway_framed.fbx +0 -0
  638. package/lib/assets/gltf/doorway_framed.gltf +1 -0
  639. package/lib/assets/gltf/window_clear.bin +0 -0
  640. package/lib/assets/gltf/window_clear.fbx +0 -0
  641. package/lib/assets/gltf/window_clear.gltf +1 -0
  642. package/lib/assets/gltf/window_cross.bin +0 -0
  643. package/lib/assets/gltf/window_cross.fbx +0 -0
  644. package/lib/assets/gltf/window_cross.gltf +1 -0
  645. package/lib/assets/gltf/window_double_hung.bin +0 -0
  646. package/lib/assets/gltf/window_double_hung.fbx +0 -0
  647. package/lib/assets/gltf/window_double_hung.gltf +1 -0
  648. package/lib/assets/gltf/window_vertical.bin +0 -0
  649. package/lib/assets/gltf/window_vertical.fbx +0 -0
  650. package/lib/assets/gltf/window_vertical.gltf +1 -0
  651. package/lib/assets/img/1.jpg +0 -0
  652. package/lib/assets/img/TKC_thumbnail.png +0 -0
  653. package/lib/assets/img/Toggle.png +0 -0
  654. package/lib/assets/img/loading/loading.gif +0 -0
  655. package/lib/assets/img/loading/loading_1.svg +11 -0
  656. package/lib/assets/img/loading_large.gif +0 -0
  657. package/lib/assets/img/png/door/closet.png +0 -0
  658. package/lib/assets/img/png/door/doorwaysframed.png +0 -0
  659. package/lib/assets/img/png/door/doorwaysframeles.png +0 -0
  660. package/lib/assets/img/png/door/doorwaysframeless.png +0 -0
  661. package/lib/assets/img/png/door/exterior.png +0 -0
  662. package/lib/assets/img/png/door/interior.png +0 -0
  663. package/lib/assets/img/png/door/sliding.png +0 -0
  664. package/lib/assets/img/png/helper/outcome.png +0 -0
  665. package/lib/assets/img/png/helper/video_preview_3d.png +0 -0
  666. package/lib/assets/img/png/helper/video_preview_start.png +0 -0
  667. package/lib/assets/img/project_img.png +0 -0
  668. package/lib/assets/img/rta/rta_logo_box_blue.jpg +0 -0
  669. package/lib/assets/img/rta/rta_logo_box_blue_ico.jpg +0 -0
  670. package/lib/assets/img/rta/rta_logo_box_blue_ico.svg +55 -0
  671. package/lib/assets/img/rta/rta_logo_box_darkGray.jpg +0 -0
  672. package/lib/assets/img/rta/rta_logo_box_lightblue.png +0 -0
  673. package/lib/assets/img/rta/rta_logo_box_lightmaroon.png +0 -0
  674. package/lib/assets/img/rta/rta_logo_box_maroon.png +0 -0
  675. package/lib/assets/img/rta/rta_logo_box_white.png +0 -0
  676. package/lib/assets/img/rta_menu.png +0 -0
  677. package/lib/assets/img/step2.jpg +0 -0
  678. package/lib/assets/img/step3.jpg +0 -0
  679. package/lib/assets/img/step4.jpg +0 -0
  680. package/lib/assets/img/step5.jpg +0 -0
  681. package/lib/assets/img/step6.jpg +0 -0
  682. package/lib/assets/img/step7.jpg +0 -0
  683. package/lib/assets/img/step8.jpg +0 -0
  684. package/lib/assets/img/svg/2d_delete_object.svg +33 -0
  685. package/lib/assets/img/svg/2d_delete_object1.svg +33 -0
  686. package/lib/assets/img/svg/2d_lock_object.svg +33 -0
  687. package/lib/assets/img/svg/3d_item_move.svg +106 -0
  688. package/lib/assets/img/svg/3d_item_rotation.svg +76 -0
  689. package/lib/assets/img/svg/3d_item_warning_edit.svg +77 -0
  690. package/lib/assets/img/svg/3d_item_warning_info.svg +81 -0
  691. package/lib/assets/img/svg/accessories.svg +4 -0
  692. package/lib/assets/img/svg/angle_icon.svg +39 -0
  693. package/lib/assets/img/svg/blank_div.svg +14 -0
  694. package/lib/assets/img/svg/bottombar/2d3d_button.svg +3 -0
  695. package/lib/assets/img/svg/bottombar/2d3d_button_active.svg +3 -0
  696. package/lib/assets/img/svg/bottombar/2d3d_toggle.svg +4 -0
  697. package/lib/assets/img/svg/bottombar/2d3d_toggle_active.svg +4 -0
  698. package/lib/assets/img/svg/bottombar/arrow-down.svg +3 -0
  699. package/lib/assets/img/svg/bottombar/arrow-left.svg +3 -0
  700. package/lib/assets/img/svg/bottombar/arrow-minus.svg +3 -0
  701. package/lib/assets/img/svg/bottombar/arrow-plus.svg +11 -0
  702. package/lib/assets/img/svg/bottombar/arrow-right.svg +3 -0
  703. package/lib/assets/img/svg/bottombar/arrow-up.svg +3 -0
  704. package/lib/assets/img/svg/bottombar/collapse.svg +3 -0
  705. package/lib/assets/img/svg/bottombar/elevation-back.svg +6 -0
  706. package/lib/assets/img/svg/bottombar/elevation-front.svg +6 -0
  707. package/lib/assets/img/svg/bottombar/elevation-left.svg +6 -0
  708. package/lib/assets/img/svg/bottombar/elevation-right.svg +7 -0
  709. package/lib/assets/img/svg/bottombar/elevation.svg +6 -0
  710. package/lib/assets/img/svg/bottombar/expand.svg +3 -0
  711. package/lib/assets/img/svg/bottombar/help.svg +72 -0
  712. package/lib/assets/img/svg/bottombar/incm_toggle.svg +39 -0
  713. package/lib/assets/img/svg/bottombar/pan_1.svg +57 -0
  714. package/lib/assets/img/svg/bottombar/pan_2.svg +27 -0
  715. package/lib/assets/img/svg/bottombar/pan_3.svg +27 -0
  716. package/lib/assets/img/svg/bottombar/pan_4.svg +27 -0
  717. package/lib/assets/img/svg/bottombar/pan_5.svg +27 -0
  718. package/lib/assets/img/svg/bottombar/settings.svg +23 -0
  719. package/lib/assets/img/svg/bottombar/spin-down.svg +76 -0
  720. package/lib/assets/img/svg/bottombar/spin-left.svg +75 -0
  721. package/lib/assets/img/svg/bottombar/spin-right.svg +75 -0
  722. package/lib/assets/img/svg/bottombar/spin-up.svg +76 -0
  723. package/lib/assets/img/svg/bottombar/spin_1.svg +48 -0
  724. package/lib/assets/img/svg/bottombar/spin_2.svg +31 -0
  725. package/lib/assets/img/svg/bottombar/spin_3.svg +31 -0
  726. package/lib/assets/img/svg/bottombar/spin_4.svg +31 -0
  727. package/lib/assets/img/svg/bottombar/spin_5.svg +31 -0
  728. package/lib/assets/img/svg/bottombar/zoomin.svg +29 -0
  729. package/lib/assets/img/svg/bottombar/zoomout.svg +26 -0
  730. package/lib/assets/img/svg/check.svg +10 -0
  731. package/lib/assets/img/svg/close.svg +11 -0
  732. package/lib/assets/img/svg/color/Black.svg +3 -0
  733. package/lib/assets/img/svg/color/Blue.svg +3 -0
  734. package/lib/assets/img/svg/color/Brown.svg +9 -0
  735. package/lib/assets/img/svg/color/Cream.svg +3 -0
  736. package/lib/assets/img/svg/color/Dark.svg +9 -0
  737. package/lib/assets/img/svg/color/Gray.svg +3 -0
  738. package/lib/assets/img/svg/color/Green.svg +3 -0
  739. package/lib/assets/img/svg/color/Light.svg +9 -0
  740. package/lib/assets/img/svg/color/Medium.svg +9 -0
  741. package/lib/assets/img/svg/color/Unfinished.svg +9 -0
  742. package/lib/assets/img/svg/color/White.svg +3 -0
  743. package/lib/assets/img/svg/color/White.svg.bak +3 -0
  744. package/lib/assets/img/svg/color/stone2.jpg +0 -0
  745. package/lib/assets/img/svg/color/wood2.jpg +0 -0
  746. package/lib/assets/img/svg/copy.svg +11 -0
  747. package/lib/assets/img/svg/delete.svg +3 -0
  748. package/lib/assets/img/svg/detail.svg +77 -0
  749. package/lib/assets/img/svg/disclaimer/background.svg +758 -0
  750. package/lib/assets/img/svg/disclaimer/logo-dots.svg +11 -0
  751. package/lib/assets/img/svg/door/Closet.svg +11 -0
  752. package/lib/assets/img/svg/door/Exterior.svg +5 -0
  753. package/lib/assets/img/svg/door/Framed_dorway.svg +5 -0
  754. package/lib/assets/img/svg/door/Frameless_dorway.svg +5 -0
  755. package/lib/assets/img/svg/door/Interior.svg +7 -0
  756. package/lib/assets/img/svg/door/Sliding.svg +5 -0
  757. package/lib/assets/img/svg/doors_closet.svg +47 -0
  758. package/lib/assets/img/svg/doors_exterior.svg +25 -0
  759. package/lib/assets/img/svg/doors_interior.svg +29 -0
  760. package/lib/assets/img/svg/doors_patio.svg +26 -0
  761. package/lib/assets/img/svg/duplicate.svg +11 -0
  762. package/lib/assets/img/svg/duplicate_object_left.svg +32 -0
  763. package/lib/assets/img/svg/duplicate_object_right.svg +32 -0
  764. package/lib/assets/img/svg/filtersActive.svg +19 -0
  765. package/lib/assets/img/svg/firstsetting/L.svg +3 -0
  766. package/lib/assets/img/svg/firstsetting/L2.svg +3 -0
  767. package/lib/assets/img/svg/firstsetting/Open.svg +3 -0
  768. package/lib/assets/img/svg/firstsetting/Square.svg +3 -0
  769. package/lib/assets/img/svg/firstsetting/bar-active.svg +9 -0
  770. package/lib/assets/img/svg/firstsetting/bar-normal.svg +3 -0
  771. package/lib/assets/img/svg/firstsetting/bullet-current.svg +3 -0
  772. package/lib/assets/img/svg/firstsetting/bullet-done.svg +3 -0
  773. package/lib/assets/img/svg/firstsetting/bullet-not-done.svg +3 -0
  774. package/lib/assets/img/svg/firstsetting/check-active.svg +3 -0
  775. package/lib/assets/img/svg/firstsetting/check-normal.svg +3 -0
  776. package/lib/assets/img/svg/firstsetting/pencil.svg +11 -0
  777. package/lib/assets/img/svg/green_checkmark.svg +27 -0
  778. package/lib/assets/img/svg/headerbar/assist.svg +3 -0
  779. package/lib/assets/img/svg/headerbar/cart.svg +3 -0
  780. package/lib/assets/img/svg/headerbar/check.svg +10 -0
  781. package/lib/assets/img/svg/headerbar/consult_designer.svg +45 -0
  782. package/lib/assets/img/svg/headerbar/edit_name.svg +26 -0
  783. package/lib/assets/img/svg/headerbar/file-dollar.svg +13 -0
  784. package/lib/assets/img/svg/headerbar/hamburger_menu.svg +32 -0
  785. package/lib/assets/img/svg/headerbar/plus.svg +11 -0
  786. package/lib/assets/img/svg/headerbar/review_quote.svg +44 -0
  787. package/lib/assets/img/svg/headerbar/ruler-measure.svg +11 -0
  788. package/lib/assets/img/svg/headerbar/save.svg +3 -0
  789. package/lib/assets/img/svg/headerbar/setting.svg +75 -0
  790. package/lib/assets/img/svg/help/check.svg +10 -0
  791. package/lib/assets/img/svg/help/search.svg +76 -0
  792. package/lib/assets/img/svg/intro/1-start-with-floorplan-whole.svg +27 -0
  793. package/lib/assets/img/svg/intro/1-start-with-floorplan.svg +26 -0
  794. package/lib/assets/img/svg/intro/2-start-from-scratch-whole.svg +28 -0
  795. package/lib/assets/img/svg/intro/2-start-from-scratch.svg +27 -0
  796. package/lib/assets/img/svg/intro/3-retrieve-project-whole.svg +19 -0
  797. package/lib/assets/img/svg/intro/3-retrieve-project.svg +18 -0
  798. package/lib/assets/img/svg/invert.svg +127 -0
  799. package/lib/assets/img/svg/lefttoolbar/appliance-active.svg +13 -0
  800. package/lib/assets/img/svg/lefttoolbar/appliance.svg +13 -0
  801. package/lib/assets/img/svg/lefttoolbar/cabinet-active.svg +10 -0
  802. package/lib/assets/img/svg/lefttoolbar/cabinet-category.svg +3 -0
  803. package/lib/assets/img/svg/lefttoolbar/cabinet-one.svg +3 -0
  804. package/lib/assets/img/svg/lefttoolbar/cabinet.svg +10 -0
  805. package/lib/assets/img/svg/lefttoolbar/disigner_assistance.svg +89 -0
  806. package/lib/assets/img/svg/lefttoolbar/door-style-active.svg +20 -0
  807. package/lib/assets/img/svg/lefttoolbar/door-style.svg +20 -0
  808. package/lib/assets/img/svg/lefttoolbar/door.svg +12 -0
  809. package/lib/assets/img/svg/lefttoolbar/error_icon.svg +81 -0
  810. package/lib/assets/img/svg/lefttoolbar/finishing-active.svg +13 -0
  811. package/lib/assets/img/svg/lefttoolbar/finishing.svg +13 -0
  812. package/lib/assets/img/svg/lefttoolbar/reviewforquote-active.svg +86 -0
  813. package/lib/assets/img/svg/lefttoolbar/reviewforquote.svg +12 -0
  814. package/lib/assets/img/svg/lefttoolbar/room-shape-L.svg +3 -0
  815. package/lib/assets/img/svg/lefttoolbar/room-shape-active.svg +18 -0
  816. package/lib/assets/img/svg/lefttoolbar/room-shape-custom.svg +12 -0
  817. package/lib/assets/img/svg/lefttoolbar/room-shape-irregular.svg +3 -0
  818. package/lib/assets/img/svg/lefttoolbar/room-shape-open.svg +3 -0
  819. package/lib/assets/img/svg/lefttoolbar/room-shape-square.svg +3 -0
  820. package/lib/assets/img/svg/lefttoolbar/room-shape.svg +18 -0
  821. package/lib/assets/img/svg/lefttoolbar/search.svg +76 -0
  822. package/lib/assets/img/svg/lefttoolbar/view_more.svg +86 -0
  823. package/lib/assets/img/svg/lefttoolbar/warning_icon.svg +81 -0
  824. package/lib/assets/img/svg/lefttoolbar/window.svg +12 -0
  825. package/lib/assets/img/svg/logo.svg +11 -0
  826. package/lib/assets/img/svg/logo_with_text.svg +25 -0
  827. package/lib/assets/img/svg/menubar/login.svg +84 -0
  828. package/lib/assets/img/svg/menubar/my_projects.svg +85 -0
  829. package/lib/assets/img/svg/menubar/new_project.svg +110 -0
  830. package/lib/assets/img/svg/menubar/save_project.svg +84 -0
  831. package/lib/assets/img/svg/options.svg +3 -0
  832. package/lib/assets/img/svg/positioning.svg +3 -0
  833. package/lib/assets/img/svg/rotate.png +0 -0
  834. package/lib/assets/img/svg/rotate.svg +17 -0
  835. package/lib/assets/img/svg/rotate_object_clockwise.svg +26 -0
  836. package/lib/assets/img/svg/rotate_object_counterclockwise.svg +26 -0
  837. package/lib/assets/img/svg/toggleFilters.svg +19 -0
  838. package/lib/assets/img/svg/toolbar/add_appliances_active.svg +64 -0
  839. package/lib/assets/img/svg/toolbar/add_appliances_inactive.svg +52 -0
  840. package/lib/assets/img/svg/toolbar/add_button.svg +36 -0
  841. package/lib/assets/img/svg/toolbar/add_cabinets_active.svg +59 -0
  842. package/lib/assets/img/svg/toolbar/add_cabinets_inactive.svg +49 -0
  843. package/lib/assets/img/svg/toolbar/add_items_doors.svg +25 -0
  844. package/lib/assets/img/svg/toolbar/add_items_doorways.svg +24 -0
  845. package/lib/assets/img/svg/toolbar/add_items_refrigerator.svg +32 -0
  846. package/lib/assets/img/svg/toolbar/add_items_windows.svg +28 -0
  847. package/lib/assets/img/svg/toolbar/apply_button.svg +38 -0
  848. package/lib/assets/img/svg/toolbar/arrow-plus.svg +11 -0
  849. package/lib/assets/img/svg/toolbar/backsplash.svg +8 -0
  850. package/lib/assets/img/svg/toolbar/cancel_button.svg +37 -0
  851. package/lib/assets/img/svg/toolbar/consult_a_designer_button.svg +47 -0
  852. package/lib/assets/img/svg/toolbar/countertop.svg +7 -0
  853. package/lib/assets/img/svg/toolbar/dcm.png +0 -0
  854. package/lib/assets/img/svg/toolbar/dcm_off.svg +12 -0
  855. package/lib/assets/img/svg/toolbar/dcm_on.svg +474 -0
  856. package/lib/assets/img/svg/toolbar/delete_button.svg +37 -0
  857. package/lib/assets/img/svg/toolbar/download.svg +77 -0
  858. package/lib/assets/img/svg/toolbar/draw_custom_floor.svg +31 -0
  859. package/lib/assets/img/svg/toolbar/edit_button.svg +75 -0
  860. package/lib/assets/img/svg/toolbar/email_quote_button.svg +44 -0
  861. package/lib/assets/img/svg/toolbar/fbm.png +0 -0
  862. package/lib/assets/img/svg/toolbar/finishing_touches_active.svg +54 -0
  863. package/lib/assets/img/svg/toolbar/finishing_touches_inactive.svg +42 -0
  864. package/lib/assets/img/svg/toolbar/floorstyle.svg +9 -0
  865. package/lib/assets/img/svg/toolbar/fmb.png +0 -0
  866. package/lib/assets/img/svg/toolbar/fmb_off.svg +12 -0
  867. package/lib/assets/img/svg/toolbar/fmb_on.svg +489 -0
  868. package/lib/assets/img/svg/toolbar/furnishings_icon.svg +6 -0
  869. package/lib/assets/img/svg/toolbar/get_started_button.svg +41 -0
  870. package/lib/assets/img/svg/toolbar/handles.svg +5 -0
  871. package/lib/assets/img/svg/toolbar/lighting.svg +7 -0
  872. package/lib/assets/img/svg/toolbar/lrm.png +0 -0
  873. package/lib/assets/img/svg/toolbar/lrm_off.svg +12 -0
  874. package/lib/assets/img/svg/toolbar/lrm_on.svg +470 -0
  875. package/lib/assets/img/svg/toolbar/make_floorplan_active.svg +66 -0
  876. package/lib/assets/img/svg/toolbar/make_floorplan_inactive.svg +52 -0
  877. package/lib/assets/img/svg/toolbar/predefined_room_l_shaped.svg +20 -0
  878. package/lib/assets/img/svg/toolbar/predefined_room_layout.svg +20 -0
  879. package/lib/assets/img/svg/toolbar/predefined_room_long_narrow.svg +20 -0
  880. package/lib/assets/img/svg/toolbar/predefined_room_open_l_shape.svg +20 -0
  881. package/lib/assets/img/svg/toolbar/predefined_room_open_pentagon.svg +20 -0
  882. package/lib/assets/img/svg/toolbar/predefined_room_open_rectangle.svg +20 -0
  883. package/lib/assets/img/svg/toolbar/predefined_room_open_rectangle_2.svg +20 -0
  884. package/lib/assets/img/svg/toolbar/predefined_room_pentagon.svg +20 -0
  885. package/lib/assets/img/svg/toolbar/predefined_room_rectangle.svg +20 -0
  886. package/lib/assets/img/svg/toolbar/predefined_room_rectangle_with_alcove.svg +20 -0
  887. package/lib/assets/img/svg/toolbar/redo_button.svg +75 -0
  888. package/lib/assets/img/svg/toolbar/redo_button1.svg +75 -0
  889. package/lib/assets/img/svg/toolbar/review_quote_active.svg +14 -0
  890. package/lib/assets/img/svg/toolbar/review_quote_inactive.svg +44 -0
  891. package/lib/assets/img/svg/toolbar/save_project_button.svg +44 -0
  892. package/lib/assets/img/svg/toolbar/select_doorstyle_active.svg +67 -0
  893. package/lib/assets/img/svg/toolbar/select_doorstyle_inactive.svg +57 -0
  894. package/lib/assets/img/svg/toolbar/shopping-cart.svg +13 -0
  895. package/lib/assets/img/svg/toolbar/style_change_button.svg +47 -0
  896. package/lib/assets/img/svg/toolbar/take_picture.svg +75 -0
  897. package/lib/assets/img/svg/toolbar/undo_button.svg +76 -0
  898. package/lib/assets/img/svg/toolbar/undo_button1.svg +76 -0
  899. package/lib/assets/img/svg/toolbar/use_button.svg +37 -0
  900. package/lib/assets/img/svg/toolbar/wall_color_icon.svg +6 -0
  901. package/lib/assets/img/svg/topbar/edit_active.svg +10 -0
  902. package/lib/assets/img/svg/topbar/edit_inactive.svg +10 -0
  903. package/lib/assets/img/svg/topbar/redo_active.svg +42 -0
  904. package/lib/assets/img/svg/topbar/redo_inactive.svg +23 -0
  905. package/lib/assets/img/svg/topbar/select_all_active.svg +50 -0
  906. package/lib/assets/img/svg/topbar/select_all_inactive.svg +32 -0
  907. package/lib/assets/img/svg/topbar/take_picture_active.svg +51 -0
  908. package/lib/assets/img/svg/topbar/take_picture_inactive.svg +26 -0
  909. package/lib/assets/img/svg/topbar/undo_active.svg +42 -0
  910. package/lib/assets/img/svg/topbar/undo_inactive.svg +23 -0
  911. package/lib/assets/img/svg/warning_info_2d.svg +81 -0
  912. package/lib/assets/img/svg/window/Clear.svg +3 -0
  913. package/lib/assets/img/svg/window/Cross.svg +5 -0
  914. package/lib/assets/img/svg/window/Double_hung.svg +4 -0
  915. package/lib/assets/img/svg/window/Vertical.svg +4 -0
  916. package/lib/assets/img/svg/windows_clear.svg +23 -0
  917. package/lib/assets/img/svg/windows_cross.svg +28 -0
  918. package/lib/assets/img/svg/windows_double_hung.svg +24 -0
  919. package/lib/assets/img/svg/windows_vertical.svg +24 -0
  920. package/lib/assets/img/svg/wizardstep/Custom.svg +3 -0
  921. package/lib/assets/img/svg/wizardstep/Dashed_line.svg +3 -0
  922. package/lib/assets/img/svg/wizardstep/L.svg +3 -0
  923. package/lib/assets/img/svg/wizardstep/L2.svg +3 -0
  924. package/lib/assets/img/svg/wizardstep/Open.svg +3 -0
  925. package/lib/assets/img/svg/wizardstep/Square.svg +3 -0
  926. package/lib/assets/img/svg/wizardstep/bar-active.svg +9 -0
  927. package/lib/assets/img/svg/wizardstep/bar-normal.svg +3 -0
  928. package/lib/assets/img/svg/wizardstep/bullet-current.svg +3 -0
  929. package/lib/assets/img/svg/wizardstep/bullet-done.svg +3 -0
  930. package/lib/assets/img/svg/wizardstep/bullet-not-done.svg +3 -0
  931. package/lib/assets/img/svg/wizardstep/check-active.svg +3 -0
  932. package/lib/assets/img/svg/wizardstep/check-normal.svg +3 -0
  933. package/lib/assets/img/svg/wizardstep/detail_view.svg +87 -0
  934. package/lib/assets/img/svg/wizardstep/pencil.svg +11 -0
  935. package/lib/assets/img/svg/wizardstep/tile_view.svg +95 -0
  936. package/lib/assets/img/texture/glass.jpg +0 -0
  937. package/lib/assets/img/texture/steel.jpg +0 -0
  938. package/lib/assets/img/texture/white1px.jpg +0 -0
  939. package/lib/assets/img/texture/wood.jpg +0 -0
  940. package/lib/assets/model/DCM.bin +0 -0
  941. package/lib/assets/model/DCM.fbx +0 -0
  942. package/lib/assets/model/DCM.gltf +1 -0
  943. package/lib/assets/model/FBM.bin +0 -0
  944. package/lib/assets/model/FBM.fbx +0 -0
  945. package/lib/assets/model/FBM.gltf +1 -0
  946. package/lib/assets/model/LRM.bin +0 -0
  947. package/lib/assets/model/LRM.fbx +0 -0
  948. package/lib/assets/model/LRM.gltf +1 -0
  949. package/lib/assets/rtastore_logo.png +0 -0
  950. package/lib/catalog/areas/area/planner-element.js +53 -0
  951. package/lib/catalog/areas/area/textures/ceramic-tile.jpg +0 -0
  952. package/lib/catalog/areas/area/textures/grass.jpg +0 -0
  953. package/lib/catalog/areas/area/textures/parquet.jpg +0 -0
  954. package/lib/catalog/areas/area/textures/strand-porcelain.jpg +0 -0
  955. package/lib/catalog/areas/area/textures/tile1.jpg +0 -0
  956. package/lib/catalog/back.png +0 -0
  957. package/lib/catalog/catalog.js +272 -0
  958. package/lib/catalog/doors.png +0 -0
  959. package/lib/catalog/doorways.png +0 -0
  960. package/lib/catalog/envMap/nx.hdr +0 -0
  961. package/lib/catalog/envMap/ny.hdr +0 -0
  962. package/lib/catalog/envMap/nz.hdr +0 -0
  963. package/lib/catalog/envMap/px.hdr +0 -0
  964. package/lib/catalog/envMap/py.hdr +0 -0
  965. package/lib/catalog/envMap/pz.hdr +0 -0
  966. package/lib/catalog/export.js +1 -0
  967. package/lib/catalog/factories/area-factory-3d.js +190 -0
  968. package/lib/catalog/factories/area-factory.js +88 -0
  969. package/lib/catalog/factories/export.js +25 -0
  970. package/lib/catalog/factories/wall-factory-3d.js +212 -0
  971. package/lib/catalog/factories/wall-factory.js +279 -0
  972. package/lib/catalog/holes/door-closet/planner-element.js +232 -0
  973. package/lib/catalog/holes/door-double/door_double.png +0 -0
  974. package/lib/catalog/holes/door-double/planner-element.js +325 -0
  975. package/lib/catalog/holes/door-exterior/planner-element.js +225 -0
  976. package/lib/catalog/holes/door-interior/planner-element.js +237 -0
  977. package/lib/catalog/holes/door-panic/panicDoor.png +0 -0
  978. package/lib/catalog/holes/door-panic/planner-element.js +513 -0
  979. package/lib/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  980. package/lib/catalog/holes/door-panic-double/planner-element.js +473 -0
  981. package/lib/catalog/holes/door-sliding/planner-element.js +235 -0
  982. package/lib/catalog/holes/doorway-framed/planner-element.js +155 -0
  983. package/lib/catalog/holes/doorway-frameless/planner-element.js +114 -0
  984. package/lib/catalog/holes/export.js +97 -0
  985. package/lib/catalog/holes/gate/gate.jpg +0 -0
  986. package/lib/catalog/holes/window-clear/planner-element.js +176 -0
  987. package/lib/catalog/holes/window-clear/texture.png +0 -0
  988. package/lib/catalog/holes/window-cross/planner-element.js +175 -0
  989. package/lib/catalog/holes/window-cross/texture.png +0 -0
  990. package/lib/catalog/holes/window-double-hung/planner-element.js +313 -0
  991. package/lib/catalog/holes/window-double-hung/texture.png +0 -0
  992. package/lib/catalog/holes/window-vertical/planner-element.js +286 -0
  993. package/lib/catalog/holes/window-vertical/texture.png +0 -0
  994. package/lib/catalog/lines/wall/planner-element.js +87 -0
  995. package/lib/catalog/lines/wall/textures/bricks-normal.jpg +0 -0
  996. package/lib/catalog/lines/wall/textures/bricks-normal2.jpg +0 -0
  997. package/lib/catalog/lines/wall/textures/bricks.jpg +0 -0
  998. package/lib/catalog/lines/wall/textures/bricks2.jpg +0 -0
  999. package/lib/catalog/lines/wall/textures/bricks3.jpg +0 -0
  1000. package/lib/catalog/lines/wall/textures/morden-normal.jpg +0 -0
  1001. package/lib/catalog/lines/wall/textures/morden.jpg +0 -0
  1002. package/lib/catalog/lines/wall/textures/painted-normal.jpg +0 -0
  1003. package/lib/catalog/lines/wall/textures/painted.jpg +0 -0
  1004. package/lib/catalog/lines/wall/textures/plaster-normal.jpg +0 -0
  1005. package/lib/catalog/lines/wall/textures/plaster.jpg +0 -0
  1006. package/lib/catalog/lines/wall/wall.png +0 -0
  1007. package/lib/catalog/molding/molding-dcm/planner-element.js +33 -0
  1008. package/lib/catalog/molding/molding-dcm/texture.png +0 -0
  1009. package/lib/catalog/molding/molding-fbm/planner-element.js +33 -0
  1010. package/lib/catalog/molding/molding-fbm/texture.png +0 -0
  1011. package/lib/catalog/molding/molding-lrm/planner-element.js +33 -0
  1012. package/lib/catalog/molding/molding-lrm/texture.png +0 -0
  1013. package/lib/catalog/properties/export.js +81 -0
  1014. package/lib/catalog/properties/property-checkbox.js +76 -0
  1015. package/lib/catalog/properties/property-color.js +47 -0
  1016. package/lib/catalog/properties/property-enum.js +58 -0
  1017. package/lib/catalog/properties/property-hidden.js +27 -0
  1018. package/lib/catalog/properties/property-lenght-measure.js +108 -0
  1019. package/lib/catalog/properties/property-length-measure.js +92 -0
  1020. package/lib/catalog/properties/property-length-measure_hole.js +108 -0
  1021. package/lib/catalog/properties/property-number.js +56 -0
  1022. package/lib/catalog/properties/property-read-only.js +34 -0
  1023. package/lib/catalog/properties/property-string.js +56 -0
  1024. package/lib/catalog/properties/property-toggle.js +47 -0
  1025. package/lib/catalog/properties/shared-property-style.js +21 -0
  1026. package/lib/catalog/utils/FuseUtils.js +87 -0
  1027. package/lib/catalog/utils/exporter.js +157 -0
  1028. package/lib/catalog/utils/geom-utils.js +205 -0
  1029. package/lib/catalog/utils/item-loader.js +1608 -0
  1030. package/lib/catalog/utils/load-obj.js +99 -0
  1031. package/lib/catalog/utils/mtl-loader.js +366 -0
  1032. package/lib/catalog/utils/obj-loader.js +486 -0
  1033. package/lib/catalog/windows.png +0 -0
  1034. package/lib/class/FuseUtils.js +87 -0
  1035. package/lib/class/area.js +148 -0
  1036. package/lib/class/export.js +96 -0
  1037. package/lib/class/group.js +438 -0
  1038. package/lib/class/guide.js +64 -0
  1039. package/lib/class/hole.js +932 -0
  1040. package/lib/class/item.js +1852 -0
  1041. package/lib/class/layer.js +670 -0
  1042. package/lib/class/line.js +1230 -0
  1043. package/lib/class/project.js +804 -0
  1044. package/lib/class/vertex.js +205 -0
  1045. package/lib/components/content.js +142 -0
  1046. package/lib/components/export.js +7 -0
  1047. package/lib/components/style/button.js +115 -0
  1048. package/lib/components/style/cancel-button.js +29 -0
  1049. package/lib/components/style/content-container.js +38 -0
  1050. package/lib/components/style/content-title.js +35 -0
  1051. package/lib/components/style/delete-button.js +34 -0
  1052. package/lib/components/style/export.js +121 -0
  1053. package/lib/components/style/form-block.js +28 -0
  1054. package/lib/components/style/form-color-input.js +34 -0
  1055. package/lib/components/style/form-label.js +30 -0
  1056. package/lib/components/style/form-number-input.js +192 -0
  1057. package/lib/components/style/form-number-input_2.js +209 -0
  1058. package/lib/components/style/form-select.js +29 -0
  1059. package/lib/components/style/form-slider.js +68 -0
  1060. package/lib/components/style/form-submit-button.js +35 -0
  1061. package/lib/components/style/form-text-input.js +78 -0
  1062. package/lib/components/viewer2d/area.js +89 -0
  1063. package/lib/components/viewer2d/export.js +121 -0
  1064. package/lib/components/viewer2d/grids/grid-horizontal-streak.js +44 -0
  1065. package/lib/components/viewer2d/grids/grid-streak.js +44 -0
  1066. package/lib/components/viewer2d/grids/grid-vertical-streak.js +44 -0
  1067. package/lib/components/viewer2d/grids/grids.js +40 -0
  1068. package/lib/components/viewer2d/group.js +63 -0
  1069. package/lib/components/viewer2d/item.js +457 -0
  1070. package/lib/components/viewer2d/layer.js +172 -0
  1071. package/lib/components/viewer2d/line.js +975 -0
  1072. package/lib/components/viewer2d/ruler.js +87 -0
  1073. package/lib/components/viewer2d/rulerDist.js +140 -0
  1074. package/lib/components/viewer2d/rulerX.js +154 -0
  1075. package/lib/components/viewer2d/rulerY.js +156 -0
  1076. package/lib/components/viewer2d/scene.js +137 -0
  1077. package/lib/components/viewer2d/snap.js +84 -0
  1078. package/lib/components/viewer2d/state.js +83 -0
  1079. package/lib/components/viewer2d/utils.js +200 -0
  1080. package/lib/components/viewer2d/vertex.js +75 -0
  1081. package/lib/components/viewer2d/viewer2d.js +1444 -0
  1082. package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +2591 -0
  1083. package/lib/components/viewer3d/dcm.js +408 -0
  1084. package/lib/components/viewer3d/fbm.js +421 -0
  1085. package/lib/components/viewer3d/front3D.js +71 -0
  1086. package/lib/components/viewer3d/grid-creator.js +35 -0
  1087. package/lib/components/viewer3d/grids/grid-horizontal-streak.js +45 -0
  1088. package/lib/components/viewer3d/grids/grid-streak.js +36 -0
  1089. package/lib/components/viewer3d/grids/grid-vertical-streak.js +45 -0
  1090. package/lib/components/viewer3d/libs/first-person-controls.js +74 -0
  1091. package/lib/components/viewer3d/libs/helvetiker_regular.typeface.js +1287 -0
  1092. package/lib/components/viewer3d/libs/mtl-loader.js +366 -0
  1093. package/lib/components/viewer3d/libs/obj-loader.js +471 -0
  1094. package/lib/components/viewer3d/libs/orbit-controls.js +706 -0
  1095. package/lib/components/viewer3d/libs/pointer-lock-controls.js +53 -0
  1096. package/lib/components/viewer3d/lrm.js +312 -0
  1097. package/lib/components/viewer3d/model.js +714 -0
  1098. package/lib/components/viewer3d/pointer-lock-navigation.js +122 -0
  1099. package/lib/components/viewer3d/ruler-utils/itemRect.js +69 -0
  1100. package/lib/components/viewer3d/ruler-utils/layer3D.js +503 -0
  1101. package/lib/components/viewer3d/ruler-utils/ruler3D.js +232 -0
  1102. package/lib/components/viewer3d/ruler-utils/scene3D.js +67 -0
  1103. package/lib/components/viewer3d/ruler-utils/state3D.js +26 -0
  1104. package/lib/components/viewer3d/scene-creator.js +3652 -0
  1105. package/lib/components/viewer3d/three-memory-cleaner.js +60 -0
  1106. package/lib/components/viewer3d/viewer3d-first-person.js +316 -0
  1107. package/lib/components/viewer3d/viewer3d.js +2661 -0
  1108. package/lib/constants.js +697 -0
  1109. package/lib/devLiteRenderer.js +320 -0
  1110. package/lib/index.js +64 -0
  1111. package/lib/models.js +513 -0
  1112. package/lib/plugins/SVGLoader.js +1417 -0
  1113. package/lib/plugins/console-debugger.js +42 -0
  1114. package/lib/plugins/export.js +25 -0
  1115. package/lib/plugins/keyboard.js +108 -0
  1116. package/lib/reducers/areas-reducer.js +19 -0
  1117. package/lib/reducers/export.js +97 -0
  1118. package/lib/reducers/groups-reducer.js +45 -0
  1119. package/lib/reducers/holes-reducer.js +69 -0
  1120. package/lib/reducers/items-reducer.js +151 -0
  1121. package/lib/reducers/lines-reducer.js +52 -0
  1122. package/lib/reducers/project-reducer.js +138 -0
  1123. package/lib/reducers/reducer.js +26 -0
  1124. package/lib/reducers/scene-reducer.js +35 -0
  1125. package/lib/reducers/user-reducer.js +48 -0
  1126. package/lib/reducers/vertices-reducer.js +26 -0
  1127. package/lib/reducers/viewer2d-reducer.js +82 -0
  1128. package/lib/reducers/viewer3d-reducer.js +63 -0
  1129. package/lib/shared-style.js +72 -0
  1130. package/lib/styles/export.js +13 -0
  1131. package/lib/styles/tabs.css +40 -0
  1132. package/lib/translator/en.js +111 -0
  1133. package/lib/translator/it.js +86 -0
  1134. package/lib/translator/ru.js +86 -0
  1135. package/lib/translator/translator.js +87 -0
  1136. package/lib/utils/browser.js +40 -0
  1137. package/lib/utils/convert-units-lite.js +35 -0
  1138. package/lib/utils/email-validator.js +10 -0
  1139. package/lib/utils/export.js +56 -0
  1140. package/lib/utils/geometry.js +2545 -0
  1141. package/lib/utils/get-edges-of-subgraphs.js +33 -0
  1142. package/lib/utils/graph-cycles.js +239 -0
  1143. package/lib/utils/graph-inner-cycles.js +54 -0
  1144. package/lib/utils/graph.js +153 -0
  1145. package/lib/utils/helper.js +358 -0
  1146. package/lib/utils/history.js +36 -0
  1147. package/lib/utils/id-broker.js +22 -0
  1148. package/lib/utils/isolate-event-handler.js +691 -0
  1149. package/lib/utils/logger.js +14 -0
  1150. package/lib/utils/math.js +57 -0
  1151. package/lib/utils/molding.js +890 -0
  1152. package/lib/utils/name-generator.js +21 -0
  1153. package/lib/utils/objects-utils.js +62 -0
  1154. package/lib/utils/phone-validator.js +10 -0
  1155. package/lib/utils/process-black-list.js +22 -0
  1156. package/lib/utils/react-if.js +25 -0
  1157. package/lib/utils/snap-scene.js +101 -0
  1158. package/lib/utils/snap.js +245 -0
  1159. package/lib/utils/summarizeCart.js +30 -0
  1160. package/lib/utils/threeCSG.es6.js +504 -0
  1161. package/lib/version.js +7 -0
  1162. package/package.json +93 -86
  1163. package/dist/index.js +0 -3
  1164. package/dist/index.js.LICENSE.txt +0 -55
  1165. package/dist/index.js.map +0 -1
@@ -0,0 +1,2545 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ContainsPoint = ContainsPoint;
9
+ exports._twoLineSegmentsIntersection = _twoLineSegmentsIntersection;
10
+ exports.absAngleBetweenTwoPoints = absAngleBetweenTwoPoints;
11
+ exports.almostEqual = void 0;
12
+ exports.angleBetweenTwoLines = angleBetweenTwoLines;
13
+ exports.angleBetweenTwoPoints = angleBetweenTwoPoints;
14
+ exports.angleBetweenTwoPointsAndOrigin = angleBetweenTwoPointsAndOrigin;
15
+ exports.buildRectFromLines = buildRectFromLines;
16
+ exports.calcCreateSnap = calcCreateSnap;
17
+ exports.calcSnap = calcSnap;
18
+ exports.calcSnap1 = calcSnap1;
19
+ exports.calcSnap2 = calcSnap2;
20
+ exports.calcSnap3 = calcSnap3;
21
+ exports.clone_point = clone_point;
22
+ exports.closestPointFromLine = closestPointFromLine;
23
+ exports.closestPointFromLineSegment = closestPointFromLineSegment;
24
+ exports.compareVertices = compareVertices;
25
+ exports.containLine = containLine;
26
+ exports.containPointInRect = containPointInRect;
27
+ exports.cosWithThreshold = cosWithThreshold;
28
+ exports.crossprod = crossprod;
29
+ exports.diff = diff;
30
+ exports.distancePointFromLine = distancePointFromLine;
31
+ exports.distancePointFromLineSegment = distancePointFromLineSegment;
32
+ exports.dotprod = dotprod;
33
+ exports.downcrossLine = downcrossLine;
34
+ exports.extendLine = extendLine;
35
+ exports.findCatalogElement = findCatalogElement;
36
+ exports.getAllArea = getAllArea;
37
+ exports.getAllAreaLines = getAllAreaLines;
38
+ exports.getAllCurSnap = getAllCurSnap;
39
+ exports.getAllHoleRect = getAllHoleRect;
40
+ exports.getAllItemSnap = getAllItemSnap;
41
+ exports.getAllItemSpecified = getAllItemSpecified;
42
+ exports.getAllItems = getAllItems;
43
+ exports.getAllLineSnap = getAllLineSnap;
44
+ exports.getAllLines = getAllLines;
45
+ exports.getCalcRectFromItem = getCalcRectFromItem;
46
+ exports.getCalcRectFromItem3D = getCalcRectFromItem3D;
47
+ exports.getCalcRectFromLine = getCalcRectFromLine;
48
+ exports.getCentroidOfPolygon = getCentroidOfPolygon;
49
+ exports.getHoleItems = getHoleItems;
50
+ exports.getInterSect = getInterSect;
51
+ exports.getLineInterSect = getLineInterSect;
52
+ exports.getNormaline = getNormaline;
53
+ exports.getPoylgonPoints = getPoylgonPoints;
54
+ exports.getRelatedLines = void 0;
55
+ exports.getRelatedVertices = getRelatedVertices;
56
+ exports.horizontalLine = horizontalLine;
57
+ exports.intersectRect = intersectRect;
58
+ exports.isBackWall = isBackWall;
59
+ exports.isFrontWall = isFrontWall;
60
+ exports.isLeftWall = isLeftWall;
61
+ exports.isPointInArea = isPointInArea;
62
+ exports.isPointInRect = isPointInRect;
63
+ exports.isPointOnLineSegment = isPointOnLineSegment;
64
+ exports.isRightWall = isRightWall;
65
+ exports.isSnappedLine = isSnappedLine;
66
+ exports.isSnappedSideLine = isSnappedSideLine;
67
+ exports.itemInfo = itemInfo;
68
+ exports.linePassingThroughTwoPoints = linePassingThroughTwoPoints;
69
+ exports.mapRange = mapRange;
70
+ exports.maxVertex = maxVertex;
71
+ exports.midPoint = midPoint;
72
+ exports.minVertex = minVertex;
73
+ exports.needSnap = needSnap;
74
+ exports.orderVertices = orderVertices;
75
+ exports.pointPositionOnLineSegment = pointPositionOnLineSegment;
76
+ exports.pointsDistance = pointsDistance;
77
+ exports.relationshipOfTwoOverlappedLines = relationshipOfTwoOverlappedLines;
78
+ exports.relationshipOfTwoOverlappedLines1 = relationshipOfTwoOverlappedLines1;
79
+ exports.relationshipOfTwoOverlappedLines2 = relationshipOfTwoOverlappedLines2;
80
+ exports.rotatePointAroundPoint = rotatePointAroundPoint;
81
+ exports.roundVertex = roundVertex;
82
+ exports.sameDistances = sameDistances;
83
+ exports.sameMDistances = sameMDistances;
84
+ exports.sameMPoints = sameMPoints;
85
+ exports.samePoints = samePoints;
86
+ exports.shrinkRect = shrinkRect;
87
+ exports.sinWithThreshold = sinWithThreshold;
88
+ exports.snapAngleByUnit = snapAngleByUnit;
89
+ exports.twoLineSegmentsIntersection = twoLineSegmentsIntersection;
90
+ exports.twoLinesIntersection = twoLinesIntersection;
91
+ exports.upcrossLine = upcrossLine;
92
+ exports.validInterSect = validInterSect;
93
+ exports.validRect = validRect;
94
+ exports.validSnap = validSnap;
95
+ exports.validateLineSnaps = validateLineSnaps;
96
+ exports.validateSnaps = validateSnaps;
97
+ exports.verticalLine = verticalLine;
98
+ exports.verticesDistance = verticesDistance;
99
+ exports.verticesMidPoint = verticesMidPoint;
100
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
101
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
102
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
103
+ var _math = require("./math.js");
104
+ var _constants = require("../constants");
105
+ var _convertUnitsLite = require("./convert-units-lite");
106
+ var Three = _interopRequireWildcard(require("three"));
107
+ var _utils = require("../components/viewer2d/utils.js");
108
+ var _helper = require("./helper.js");
109
+ var _export = require("./export.js");
110
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
111
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
112
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
113
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
114
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
115
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /** @description Determines the distance between two points
116
+ * @param {number} x0 Vertex 0 x
117
+ * @param {number} y0 Vertex 0 y
118
+ * @param {number} x1 Vertex 1 x
119
+ * @param {number} y1 Vertex 1 y
120
+ * @return {number}
121
+ */
122
+ function compareVertices(v0, v1) {
123
+ return v0.x === v1.x ? v0.y - v1.y : v0.x - v1.x;
124
+ }
125
+ function minVertex(v0, v1) {
126
+ return compareVertices(v0, v1) > 0 ? v1 : v0;
127
+ }
128
+ function maxVertex(v0, v1) {
129
+ return compareVertices(v0, v1) > 0 ? v0 : v1;
130
+ }
131
+ function orderVertices(vertices) {
132
+ return vertices.sort(compareVertices);
133
+ }
134
+ function pointsDistance(x0, y0, x1, y1) {
135
+ var diff_x = x0 - x1;
136
+ var diff_y = y0 - y1;
137
+ return Math.sqrt(diff_x * diff_x + diff_y * diff_y);
138
+ }
139
+ function verticesDistance(v1, v2) {
140
+ var x0 = v1.x,
141
+ y0 = v1.y;
142
+ var x1 = v2.x,
143
+ y1 = v2.y;
144
+ return pointsDistance(x0, y0, x1, y1);
145
+ }
146
+ function horizontalLine(y) {
147
+ return {
148
+ a: 0,
149
+ b: 1,
150
+ c: -y
151
+ };
152
+ }
153
+ var almostEqual = exports.almostEqual = function almostEqual(x, y) {
154
+ return Math.abs(x - y) < _constants.EPSILON;
155
+ };
156
+ function verticalLine(x) {
157
+ return {
158
+ a: 1,
159
+ b: 0,
160
+ c: -x
161
+ };
162
+ }
163
+ function upcrossLine(x, y) {
164
+ return {
165
+ a: 1,
166
+ b: 1,
167
+ c: -x - y
168
+ };
169
+ }
170
+ function downcrossLine(x, y) {
171
+ return {
172
+ a: 1,
173
+ b: -1,
174
+ c: -x + y
175
+ };
176
+ }
177
+ function linePassingThroughTwoPoints(x1, y1, x2, y2) {
178
+ if (x1 === x2 && y1 == y2) throw new Error('Geometry error');
179
+ //if (x1 === x2) return verticalLine(x1);
180
+ //if (y1 === y2) return horizontalLine(y1);
181
+
182
+ return {
183
+ a: y1 - y2,
184
+ b: x2 - x1,
185
+ c: y2 * x1 - x2 * y1
186
+ };
187
+ }
188
+ function getNormaline(x1, y1, x2, y2) {
189
+ var lineFunction = linePassingThroughTwoPoints(x1, y1, x2, y2);
190
+ return {
191
+ x: lineFunction.a / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b),
192
+ y: lineFunction.b / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b)
193
+ };
194
+ }
195
+ function distancePointFromLine(a, b, c, x, y) {
196
+ //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
197
+ return (0, _math.fAbs)(a * x + b * y + c) / Math.sqrt(a * a + b * b);
198
+ }
199
+ function closestPointFromLine(a, b, c, x, y) {
200
+ //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
201
+ var denom = a * a + b * b;
202
+ return {
203
+ x: (b * (b * x - a * y) - a * c) / denom,
204
+ y: (a * -b * x + a * y - b * c) / denom
205
+ };
206
+ }
207
+
208
+ /** @description Get point of intersection between two lines using ax+by+c line's equation
209
+ * @param {number} a x coefficent of first line
210
+ * @param {number} b y coefficent of first line
211
+ * @param {number} c costant of first line
212
+ * @param {number} j x coefficent of second line
213
+ * @param {number} k y coefficent of second line
214
+ * @param {number} l costant of second line
215
+ * @return {object} {x,y} point's coordinates
216
+ */
217
+ function twoLinesIntersection(a, b, c, j, k, l) {
218
+ var angularCoefficientsDiff = b * j - a * k;
219
+ if (angularCoefficientsDiff === 0) return undefined; //no intersection
220
+
221
+ var y = (a * l - c * j) / angularCoefficientsDiff;
222
+ var x = (c * k - b * l) / angularCoefficientsDiff;
223
+ return {
224
+ x: x,
225
+ y: y
226
+ };
227
+ }
228
+ function twoLineSegmentsIntersection(p1, p2, p3, p4) {
229
+ return _twoLineSegmentsIntersection(p1, p2, p3.toJS(), p4.toJS());
230
+ }
231
+ function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
232
+ //https://github.com/psalaets/line-intersect/blob/master/lib/check-intersection.js
233
+
234
+ var x1 = p1.x,
235
+ y1 = p1.y;
236
+ var x2 = p2.x,
237
+ y2 = p2.y;
238
+ var x3 = p3.x,
239
+ y3 = p3.y;
240
+ var x4 = p4.x,
241
+ y4 = p4.y;
242
+ var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
243
+ var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
244
+ var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
245
+ if ((0, _math.fAbs)(denom) <= _constants.EPSILON) {
246
+ if ((0, _math.fAbs)(numA) <= _constants.EPSILON && (0, _math.fAbs)(numB) <= _constants.EPSILON) {
247
+ var comparator = function comparator(pa, pb) {
248
+ return pa.x === pb.x ? pa.y - pb.y : pa.x - pb.x;
249
+ };
250
+ var line0 = [p1, p2].sort(comparator);
251
+ var line1 = [p3, p4].sort(comparator);
252
+ var _sort = [line0, line1].sort(function (lineA, lineB) {
253
+ return comparator(lineA[0], lineB[0]);
254
+ }),
255
+ _sort2 = (0, _slicedToArray2["default"])(_sort, 2),
256
+ lineSX = _sort2[0],
257
+ lineDX = _sort2[1];
258
+ comparator(lineSX[1], lineDX[0]) < 0 ? 'colinear' : 'none';
259
+ if (lineSX[1].x === lineDX[0].x) {
260
+ return {
261
+ type: lineDX[0].y <= lineSX[1].y ? 'colinear' : 'none'
262
+ };
263
+ } else {
264
+ return {
265
+ type: lineDX[0].x <= lineSX[1].x ? 'colinear' : 'none'
266
+ };
267
+ }
268
+ }
269
+ return {
270
+ type: 'parallel'
271
+ };
272
+ }
273
+ var uA = numA / denom;
274
+ var uB = numB / denom;
275
+ if (uA >= 0 - _constants.EPSILON && uA <= 1 + _constants.EPSILON && uB >= 0 - _constants.EPSILON && uB <= 1 + _constants.EPSILON) {
276
+ var _point = {
277
+ x: x1 + uA * (x2 - x1),
278
+ y: y1 + uA * (y2 - y1)
279
+ };
280
+ return {
281
+ type: 'intersecting',
282
+ point: _point
283
+ };
284
+ }
285
+ return {
286
+ type: 'none'
287
+ };
288
+ }
289
+ function distancePointFromLineSegment(v1, v2, xp, yp) {
290
+ //http://stackoverflow.com/a/6853926/1398836
291
+ var x1 = v1.x,
292
+ y1 = v1.y;
293
+ var x2 = v2.x,
294
+ y2 = v2.y;
295
+ var A = xp - x1;
296
+ var B = yp - y1;
297
+ var C = x2 - x1;
298
+ var D = y2 - y1;
299
+ var dot = A * C + B * D;
300
+ var len_sq = C * C + D * D;
301
+ var param = -1;
302
+ if (len_sq != 0)
303
+ //in case of 0 length line
304
+ param = dot / len_sq;
305
+ var xx, yy;
306
+ if (param < 0) {
307
+ xx = x1;
308
+ yy = y1;
309
+ } else if (param > 1) {
310
+ xx = x2;
311
+ yy = y2;
312
+ } else {
313
+ xx = x1 + param * C;
314
+ yy = y1 + param * D;
315
+ }
316
+ var dx = xp - xx;
317
+ var dy = yp - yy;
318
+ return Math.sqrt(dx * dx + dy * dy);
319
+ }
320
+
321
+ /**
322
+ *
323
+ * @param x1 {number} x for first vertex of the segment
324
+ * @param y1 {number} y for first vertex of the segment
325
+ * @param x2 {number} x for second vertex of the segment
326
+ * @param y2 {number} y for second vertex of the segment
327
+ * @param xp {number} x for point we want to verify
328
+ * @param yp {number} y for point we want to verify
329
+ * @param maxDistance {number} the epsilon value used for comparisons
330
+ * @returns {boolean} true if the point lies on the line segment false otherwise
331
+ */
332
+ function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
333
+ var maxDistance = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : _constants.EPSILON;
334
+ return distancePointFromLineSegment({
335
+ x: x1,
336
+ y: y1
337
+ }, {
338
+ x: x2,
339
+ y: y2
340
+ }, xp, yp) <= maxDistance;
341
+ }
342
+ function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
343
+ if (x1 === x2) return {
344
+ x: x1,
345
+ y: yp
346
+ };
347
+ if (y1 === y2) return {
348
+ x: xp,
349
+ y: y1
350
+ };
351
+ var m = (y2 - y1) / (x2 - x1);
352
+ var q = y1 - m * x1;
353
+ var mi = -1 / m;
354
+ var qi = yp - mi * xp;
355
+ var x = (qi - q) / (m - mi);
356
+ var y = m * x + q;
357
+ return {
358
+ x: x,
359
+ y: y
360
+ };
361
+ }
362
+ function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
363
+ var length = pointsDistance(x1, y1, x2, y2);
364
+ var distance = pointsDistance(x1, y1, xp, yp);
365
+ var offset = distance / length;
366
+ /*
367
+ if (x1 > x2) offset = 1 - offset;
368
+ if (y1 > y2) offset = 1 - offset;
369
+ */
370
+ return offset;
371
+ }
372
+ function mapRange(value, low1, high1, low2, high2) {
373
+ return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
374
+ }
375
+ function angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2) {
376
+ return -Math.atan2(y1 - y2, x2 - x1) * 180 / Math.PI;
377
+ }
378
+ function angleBetweenTwoPoints(x1, y1, x2, y2) {
379
+ return Math.atan2(y2 - y1, x2 - x1);
380
+ }
381
+ function angleBetweenTwoLines(line, drawingLine, vertices) {
382
+ var points = [];
383
+
384
+ // safety guards
385
+ var lv = Array.isArray(line === null || line === void 0 ? void 0 : line.vertices) ? line.vertices : [];
386
+ var dv = Array.isArray(drawingLine === null || drawingLine === void 0 ? void 0 : drawingLine.vertices) ? drawingLine.vertices : [];
387
+
388
+ // 1) push common vertices (in order of line.vertices)
389
+ var _iterator = _createForOfIteratorHelper(lv),
390
+ _step;
391
+ try {
392
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
393
+ var vt = _step.value;
394
+ if (dv.includes(vt) && !points.includes(vt)) points.push(vt);
395
+ }
396
+
397
+ // 2) push remaining vertices from line.vertices
398
+ } catch (err) {
399
+ _iterator.e(err);
400
+ } finally {
401
+ _iterator.f();
402
+ }
403
+ var _iterator2 = _createForOfIteratorHelper(lv),
404
+ _step2;
405
+ try {
406
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
407
+ var _vt = _step2.value;
408
+ if (!points.includes(_vt)) points.push(_vt);
409
+ }
410
+
411
+ // 3) push remaining vertices from drawingLine.vertices
412
+ } catch (err) {
413
+ _iterator2.e(err);
414
+ } finally {
415
+ _iterator2.f();
416
+ }
417
+ var _iterator3 = _createForOfIteratorHelper(dv),
418
+ _step3;
419
+ try {
420
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
421
+ var _vt2 = _step3.value;
422
+ if (!points.includes(_vt2)) points.push(_vt2);
423
+ }
424
+
425
+ // If no points at all, nothing to compute — return 0 (safe fallback)
426
+ } catch (err) {
427
+ _iterator3.e(err);
428
+ } finally {
429
+ _iterator3.f();
430
+ }
431
+ if (points.length === 0) return 0;
432
+
433
+ // Ensure we have at least 3 entries (same behaviour as original)
434
+ while (points.length < 3) points.push(points[points.length - 1]);
435
+ var _points$slice$map = points.slice(0, 3).map(function (idx) {
436
+ var v = vertices === null || vertices === void 0 ? void 0 : vertices[idx];
437
+ return v ? new Three.Vector2(v.x, v.y) : new Three.Vector2(0, 0);
438
+ }),
439
+ _points$slice$map2 = (0, _slicedToArray2["default"])(_points$slice$map, 3),
440
+ c = _points$slice$map2[0],
441
+ p1 = _points$slice$map2[1],
442
+ p2 = _points$slice$map2[2];
443
+ var vec1 = p1.clone().sub(c).normalize();
444
+ var vec2 = p2.clone().sub(c).normalize();
445
+ return Math.floor(vec1.angle() * 180 / Math.PI - vec2.angle() * 180 / Math.PI + 0.5);
446
+ }
447
+ var getRelatedLines = exports.getRelatedLines = function getRelatedLines(tlines, drawingLine, vertices, lines) {
448
+ var exceptLineId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
449
+ if (!(drawingLine !== null && drawingLine !== void 0 && drawingLine.vertices) || !Array.isArray(drawingLine.vertices)) return;
450
+ var seen = new Set();
451
+ var _iterator4 = _createForOfIteratorHelper(drawingLine.vertices),
452
+ _step4;
453
+ try {
454
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
455
+ var vIdx = _step4.value;
456
+ var vertex = vertices === null || vertices === void 0 ? void 0 : vertices[vIdx];
457
+ if (!(vertex !== null && vertex !== void 0 && vertex.lines)) continue;
458
+ var _iterator5 = _createForOfIteratorHelper(vertex.lines),
459
+ _step5;
460
+ try {
461
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
462
+ var lineId = _step5.value;
463
+ if (lineId !== drawingLine.id && lineId !== exceptLineId && !(0, _helper.isEmpty)(lines === null || lines === void 0 ? void 0 : lines[lineId]) && !seen.has(lineId)) {
464
+ seen.add(lineId);
465
+ tlines.push(lines[lineId]);
466
+ }
467
+ }
468
+ } catch (err) {
469
+ _iterator5.e(err);
470
+ } finally {
471
+ _iterator5.f();
472
+ }
473
+ }
474
+ } catch (err) {
475
+ _iterator4.e(err);
476
+ } finally {
477
+ _iterator4.f();
478
+ }
479
+ };
480
+ function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVertexId) {
481
+ var tx, ty;
482
+ var absAngle = Math.abs(lineAngle);
483
+ // angle snapping as a value of UNIT_ANGLE
484
+ var rest = absAngle % _constants.UNIT_ANGLE;
485
+ var missAngle = _constants.UNIT_ANGLE - rest;
486
+ var isSingleLine = !drawingLine.vertices.some(function (vetID) {
487
+ return vertices[vetID].lines.some(function (lineID) {
488
+ return lineID !== drawingLine.id;
489
+ });
490
+ });
491
+ // the origin point of rotation(snapping)
492
+ var originVerIndex = drawingLine.vertices.findIndex(function (vertice) {
493
+ return vertice !== dragVertexId;
494
+ });
495
+ var originVerId = originVerIndex < 0 ? drawingLine.vertices[0] : drawingLine.vertices[originVerIndex];
496
+ var ox = vertices[originVerId].x;
497
+ var oy = vertices[originVerId].y;
498
+ // check whether the line is snapped to before point.
499
+ if (rest <= _constants.UNIT_ANGLE / 2) {
500
+ // determine the direction of rotation.
501
+ rest = lineAngle > 0 ? rest : -rest;
502
+ rest = isSingleLine ? -rest : rest;
503
+ // rotate the current point to last point around the first point of drawing line.
504
+ tx = rotatePointAroundPoint(x, y, ox, oy, rest).x;
505
+ ty = rotatePointAroundPoint(x, y, ox, oy, rest).y;
506
+ }
507
+ // check whether the line is snapped to next new point.
508
+ else if (rest > _constants.UNIT_ANGLE / 2) {
509
+ // determine the direction of rotation.
510
+ missAngle = lineAngle > 0 ? -missAngle : missAngle;
511
+ missAngle = isSingleLine ? -missAngle : missAngle;
512
+ // rotate the current point to last point around the first point of drawing line.
513
+ tx = rotatePointAroundPoint(x, y, ox, oy, missAngle).x;
514
+ ty = rotatePointAroundPoint(x, y, ox, oy, missAngle).y;
515
+ }
516
+ var resPoint = {
517
+ x: tx,
518
+ y: ty
519
+ };
520
+ return resPoint;
521
+ }
522
+ function absAngleBetweenTwoPoints(x1, y1, x2, y2) {
523
+ return Math.atan2(y2 - y1, Math.abs(x2 - x1));
524
+ }
525
+ function samePoints(_ref, _ref2) {
526
+ var x1 = _ref.x,
527
+ y1 = _ref.y;
528
+ var x2 = _ref2.x,
529
+ y2 = _ref2.y;
530
+ return (0, _math.fAbs)(x1 - x2) <= _constants.EPSILON && (0, _math.fAbs)(y1 - y2) <= _constants.EPSILON;
531
+ }
532
+ function sameDistances(dis1, dis2) {
533
+ return (0, _math.fAbs)(dis1 - dis2) <= _constants.EPSILON;
534
+ }
535
+ function sameMPoints(_ref3, _ref4) {
536
+ var x1 = _ref3.x,
537
+ y1 = _ref3.y;
538
+ var x2 = _ref4.x,
539
+ y2 = _ref4.y;
540
+ return (0, _math.fAbs)(x1 - x2) <= _constants.MEPSILON && (0, _math.fAbs)(y1 - y2) <= _constants.MEPSILON;
541
+ }
542
+ function sameMDistances(dis1, dis2) {
543
+ return (0, _math.fAbs)(dis1 - dis2) <= _constants.MEPSILON;
544
+ }
545
+ function isPointInRect(rect, point) {
546
+ var result = true;
547
+ for (var i = 0; i < rect.length; i++) {
548
+ var pos1 = rect[i];
549
+ var pos2 = rect[(i + 1) % rect.length];
550
+ if (isPointOnLineSegment(pos1.x, pos1.y, pos2.x, pos2.y, point.x, point.y)) {
551
+ result = false;
552
+ }
553
+ }
554
+ return result;
555
+ }
556
+
557
+ /** @description Extend line based on coordinates and new line length
558
+ * @param {number} x1 Vertex 1 x
559
+ * @param {number} y1 Vertex 1 y
560
+ * @param {number} x2 Vertex 2 x
561
+ * @param {number} y2 Vertex 2 y
562
+ * @param {number} newDistance New line length
563
+ * @return {object}
564
+ */
565
+ function extendLine(x1, y1, x2, y2, newDistance) {
566
+ var precision = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 6;
567
+ var rad = angleBetweenTwoPoints(x1, y1, x2, y2);
568
+ return {
569
+ x: (0, _math.toFixedFloat)(x1 + Math.cos(rad) * newDistance, precision),
570
+ y: (0, _math.toFixedFloat)(y1 + Math.sin(rad) * newDistance, precision)
571
+ };
572
+ }
573
+ function roundVertex(vertex) {
574
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
575
+ vertex.set('x', (0, _math.toFixedFloat)(vertex.get('x'), precision));
576
+ vertex.set('y', (0, _math.toFixedFloat)(vertex.get('y'), precision));
577
+ return vertex;
578
+ }
579
+
580
+ //https://github.com/MartyWallace/PolyK
581
+ function ContainsPoint(polygon, pointX, pointY) {
582
+ var n = polygon.length >> 1;
583
+ var ax, lup;
584
+ var ay = polygon[2 * n - 3] - pointY;
585
+ var bx = polygon[2 * n - 2] - pointX;
586
+ var by = polygon[2 * n - 1] - pointY;
587
+ if (bx === 0 && by === 0) return false; // point on edge
588
+
589
+ // let lup = by > ay;
590
+ for (var ii = 0; ii < n; ii++) {
591
+ ax = bx;
592
+ ay = by;
593
+ bx = polygon[2 * ii] - pointX;
594
+ by = polygon[2 * ii + 1] - pointY;
595
+ if (bx === 0 && by === 0) return false; // point on edge
596
+ if (ay === by) continue;
597
+ lup = by > ay;
598
+ }
599
+ var depth = 0;
600
+ for (var i = 0; i < n; i++) {
601
+ ax = bx;
602
+ ay = by;
603
+ bx = polygon[2 * i] - pointX;
604
+ by = polygon[2 * i + 1] - pointY;
605
+ if (ay < 0 && by < 0) continue; // both 'up' or both 'down'
606
+ if (ay > 0 && by > 0) continue; // both 'up' or both 'down'
607
+ if (ax < 0 && bx < 0) continue; // both points on the left
608
+
609
+ if (ay === by && Math.min(ax, bx) < 0) return true;
610
+ if (ay === by) continue;
611
+ var lx = ax + (bx - ax) * -ay / (by - ay);
612
+ if (lx === 0) return false; // point on edge
613
+ if (lx > 0) depth++;
614
+ if (ay === 0 && lup && by > ay) depth--; // hit vertex, both up
615
+ if (ay === 0 && !lup && by < ay) depth--; // hit vertex, both down
616
+ lup = by > ay;
617
+ }
618
+ return (depth & 1) === 1;
619
+ }
620
+ function cosWithThreshold(alpha, threshold) {
621
+ var cos = Math.cos(alpha);
622
+ return cos < threshold ? 0 : cos;
623
+ }
624
+ function sinWithThreshold(alpha, threshold) {
625
+ var sin = Math.sin(alpha);
626
+ return sin < threshold ? 0 : sin;
627
+ }
628
+ function midPoint(x1, y1, x2, y2) {
629
+ return {
630
+ x: (x1 + x2) / 2,
631
+ y: (y1 + y2) / 2
632
+ };
633
+ }
634
+ function verticesMidPoint(verticesArray) {
635
+ var res = verticesArray.reduce(function (incr, vertex) {
636
+ return {
637
+ x: incr.x + vertex.x,
638
+ y: incr.y + vertex.y
639
+ };
640
+ }, {
641
+ x: 0,
642
+ y: 0
643
+ });
644
+ return {
645
+ x: res.x / verticesArray.length,
646
+ y: res.y / verticesArray.length
647
+ };
648
+ }
649
+ function rotatePointAroundPoint(px, py, ox, oy, theta) {
650
+ var thetaRad = theta * Math.PI / 180;
651
+ var cos = Math.cos(thetaRad);
652
+ var sin = Math.sin(thetaRad);
653
+ var deltaX = px - ox;
654
+ var deltaY = py - oy;
655
+ return {
656
+ x: cos * deltaX - sin * deltaY + ox,
657
+ y: sin * deltaX + cos * deltaY + oy
658
+ };
659
+ }
660
+
661
+ // point: x,y
662
+ // itemrectInfo: pos(x,y),rotRad,size,layoutpos,is_corner
663
+ // calcRect: rect(point[4]),pos(x,y),rotRad,size,layoutpos,is_corner
664
+
665
+ function point(x, y) {
666
+ return {
667
+ x: x,
668
+ y: y
669
+ };
670
+ }
671
+ function itemrectInfo(x, y, rotRad, size, layoutpos, is_corner) {
672
+ return {
673
+ pos: {
674
+ x: x,
675
+ y: y
676
+ },
677
+ rotRad: rotRad,
678
+ size: size,
679
+ layoutpos: layoutpos,
680
+ is_corner: is_corner
681
+ };
682
+ }
683
+ function getCalcRectFromItem(item) {
684
+ var itemInfo;
685
+ if (item === undefined) itemInfo = [];else itemInfo = item.item;
686
+ var x = item.pos.x;
687
+ var y = item.pos.y;
688
+ var rotRad = item.rotRad;
689
+ var w = item.size && item.size.width / 2;
690
+ var h = item.size && item.size.height / 2;
691
+ var mx = x - w * Math.cos(rotRad);
692
+ var my = y - w * Math.sin(rotRad);
693
+ var x0 = mx + h * Math.sin(rotRad);
694
+ var y0 = my - h * Math.cos(rotRad);
695
+ var x3 = mx * 2 - x0;
696
+ var y3 = my * 2 - y0;
697
+ var x1 = x * 2 - x3;
698
+ var y1 = y * 2 - y3;
699
+ var x2 = x * 2 - x0;
700
+ var y2 = y * 2 - y0;
701
+ return {
702
+ rect: [point(x0, y0), point(x1, y1), point(x2, y2), point(x3, y3)],
703
+ pos: point(x, y),
704
+ rotRad: rotRad,
705
+ size: item.size,
706
+ layoutpos: item.layoutpos,
707
+ is_corner: item.is_corner,
708
+ itemInfo: itemInfo
709
+ };
710
+ }
711
+ function getCalcRectFromItem3D(item) {
712
+ var itemInfo;
713
+ if (item === undefined) itemInfo = [];else itemInfo = item.item;
714
+ var x = item.pos.x;
715
+ var y = item.pos.y;
716
+ var rotRad = item.rotRad;
717
+ var w = item.size.width / 2;
718
+ var h = item.size.depth / 2;
719
+ var mx = x - w * Math.cos(rotRad);
720
+ var my = y - w * Math.sin(rotRad);
721
+ var x0 = mx + h * Math.sin(rotRad);
722
+ var y0 = my - h * Math.cos(rotRad);
723
+ var x3 = mx * 2 - x0;
724
+ var y3 = my * 2 - y0;
725
+ var x1 = x * 2 - x3;
726
+ var y1 = y * 2 - y3;
727
+ var x2 = x * 2 - x0;
728
+ var y2 = y * 2 - y0;
729
+ return {
730
+ rect: [point(x0, y0), point(x1, y1), point(x2, y2), point(x3, y3)],
731
+ pos: point(x, y),
732
+ rotRad: rotRad,
733
+ size: item.size,
734
+ layoutpos: item.layoutpos,
735
+ is_corner: item.is_corner,
736
+ itemInfo: itemInfo
737
+ };
738
+ }
739
+ function getAllItems(scene, catalog, allLineRects) {
740
+ var layerID = scene.selectedLayer;
741
+ var layer = scene.layers.get(layerID);
742
+ var curiteminfo;
743
+ var iteminfo = [];
744
+ var otherItems = [];
745
+ var selectedItem;
746
+ var currentItem;
747
+ if (layer.selected.items.size > 0) {
748
+ selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
749
+ var catid = selectedItem.type;
750
+ var cat = catalog.elements[catid];
751
+ if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
752
+ currentItem = {
753
+ selectedItem: selectedItem,
754
+ cat: cat
755
+ };
756
+ }
757
+ layer.items.forEach(function (item) {
758
+ var val = {
759
+ pos: {
760
+ x: item.x,
761
+ y: item.y
762
+ },
763
+ rotRad: item.rotation / 180 * Math.PI
764
+ };
765
+ var catid = item.type;
766
+ var cat = catalog.elements[catid];
767
+ if (!cat) {
768
+ cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
769
+ }
770
+ var sizeinfo = [];
771
+ var width, height, depth;
772
+ sizeinfo = {
773
+ width: item.properties.get('width').get('_length'),
774
+ height: item.properties.get('height').get('_length'),
775
+ depth: item.properties.get('depth').get('_length'),
776
+ widthUnit: item.properties.get('width').get('_unit'),
777
+ heightUnit: item.properties.get('height').get('_unit'),
778
+ depthUnit: item.properties.get('depth').get('_unit')
779
+ };
780
+ sizeinfo = _objectSpread(_objectSpread({}, sizeinfo), {}, {
781
+ layoutpos: cat && cat.info.layoutpos,
782
+ is_corner: cat && cat.info.is_corner
783
+ });
784
+ width = (0, _convertUnitsLite.convert)(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
785
+ height = (0, _convertUnitsLite.convert)(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
786
+ depth = (0, _convertUnitsLite.convert)(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
787
+ val.size = {
788
+ width: width,
789
+ height: height,
790
+ depth: depth
791
+ };
792
+ val.layoutpos = sizeinfo.layoutpos;
793
+ val.is_corner = sizeinfo.is_corner;
794
+ val.doorStyle = item.doorStyle;
795
+ val.item = item;
796
+ var otherItem = {
797
+ item: item,
798
+ cat: cat
799
+ };
800
+ if (!needSnap(currentItem, otherItem)) {
801
+ return;
802
+ }
803
+ if (item.selected) {
804
+ curiteminfo = getCalcRectFromItem(val);
805
+ } else {
806
+ var calcrect = getCalcRectFromItem(val);
807
+ calcrect.isSnappedLine = isSnappedLine(calcrect, allLineRects);
808
+ iteminfo.push(calcrect);
809
+ otherItems.push(otherItem);
810
+ }
811
+ });
812
+ return {
813
+ cur: curiteminfo,
814
+ others: iteminfo,
815
+ currentItem: currentItem,
816
+ otherItems: otherItems
817
+ };
818
+ }
819
+ function getAllItemSpecified(scene, catalog, filter) {
820
+ var _scene$layers, _scene$layers$get;
821
+ var layerID = scene === null || scene === void 0 ? void 0 : scene.selectedLayer;
822
+ var layer = scene === null || scene === void 0 || (_scene$layers = scene.layers) === null || _scene$layers === void 0 || (_scene$layers$get = _scene$layers.get) === null || _scene$layers$get === void 0 ? void 0 : _scene$layers$get.call(_scene$layers, layerID);
823
+ if (!layer || !layer.items) return {
824
+ cur: null,
825
+ others: []
826
+ };
827
+ var curiteminfo;
828
+ var iteminfo = [];
829
+ layer.items.forEach(function (item) {
830
+ var _cat$obj;
831
+ if (!item) return;
832
+ var val = {
833
+ pos: {
834
+ x: item.x,
835
+ y: item.y
836
+ },
837
+ rotRad: item.rotation / 180 * Math.PI
838
+ };
839
+ var cat = item.type ? findCatalogElement(catalog, item.type) : null;
840
+ var info = cat === null || cat === void 0 ? void 0 : cat.info;
841
+ var props = item.properties;
842
+ var getSize = function getSize(key) {
843
+ var _props$getIn;
844
+ var length = props === null || props === void 0 || (_props$getIn = props.getIn) === null || _props$getIn === void 0 ? void 0 : _props$getIn.call(props, [key, '_length']);
845
+ return length != null ? (0, _convertUnitsLite.convert)(length).from('in').to(scene.unit) : 0;
846
+ };
847
+ val.size = {
848
+ width: getSize('width'),
849
+ height: getSize('height'),
850
+ depth: getSize('depth')
851
+ };
852
+ val.item = item;
853
+ if (info) {
854
+ val.layoutpos = info.layoutpos;
855
+ val.is_corner = info.is_corner;
856
+ }
857
+
858
+ // Filter check
859
+ if (Array.isArray(filter)) {
860
+ if (info && !filter.includes(info.layoutpos)) return;
861
+ } else if (info && (info.layoutpos !== filter || (cat === null || cat === void 0 ? void 0 : cat.type) === 'appliance' && ['Cook Top', 'Microwave'].includes(cat === null || cat === void 0 || (_cat$obj = cat.obj) === null || _cat$obj === void 0 ? void 0 : _cat$obj.category))) {
862
+ return;
863
+ }
864
+
865
+ // Current vs others
866
+ var rect = getCalcRectFromItem3D(val);
867
+ if (item.selected) {
868
+ curiteminfo = rect;
869
+ } else {
870
+ iteminfo.push(rect);
871
+ }
872
+ });
873
+ return {
874
+ cur: curiteminfo,
875
+ others: iteminfo
876
+ };
877
+ }
878
+ function findCatalogElement(catalog, elementName) {
879
+ if (!elementName || !catalog) return null;
880
+ var variants = [elementName, elementName.toLowerCase()];
881
+ var deepVariants = variants.map(function (v) {
882
+ return (0, _utils.returnReplaceableDeepSearchType)(v);
883
+ }).filter(Boolean);
884
+ var allCandidates = [].concat(variants, (0, _toConsumableArray2["default"])(deepVariants));
885
+ var getElement = function getElement(catid) {
886
+ if (!catid) return null;
887
+
888
+ // Immutable.js Map
889
+ if (typeof catalog.getIn === 'function') {
890
+ return catalog.getIn(['elements', catid]);
891
+ }
892
+
893
+ // Plain JS object
894
+ if (catalog.elements && catalog.elements[catid]) {
895
+ return catalog.elements[catid];
896
+ }
897
+ return null;
898
+ };
899
+ var _iterator6 = _createForOfIteratorHelper(allCandidates),
900
+ _step6;
901
+ try {
902
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
903
+ var name = _step6.value;
904
+ var cat = getElement(name);
905
+ if (cat) return cat;
906
+ }
907
+ } catch (err) {
908
+ _iterator6.e(err);
909
+ } finally {
910
+ _iterator6.f();
911
+ }
912
+ return null;
913
+ }
914
+ function isSnappedLine(calcrect, allLineRects) {
915
+ if (allLineRects === undefined) return false;
916
+ var r2 = calcrect.rect[2];
917
+ var r3 = calcrect.rect[3];
918
+ var result = allLineRects.some(function (linerect) {
919
+ var l2 = linerect.rect[2];
920
+ var l3 = linerect.rect[3];
921
+ var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
922
+ if (delta < _constants.EPSILON) {
923
+ return true;
924
+ } else {
925
+ l2 = linerect.rect[3];
926
+ l3 = linerect.rect[2];
927
+ delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
928
+ return delta < _constants.EPSILON;
929
+ }
930
+ });
931
+ return result;
932
+ }
933
+ function isSnappedSideLine(calcrect, allLineRects) {
934
+ if (allLineRects === undefined) return 0;
935
+ var r2 = calcrect.rect[1];
936
+ var r3 = calcrect.rect[2];
937
+ var result = allLineRects.some(function (linerect) {
938
+ var l2 = linerect.rect[2];
939
+ var l3 = linerect.rect[3];
940
+ var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
941
+ return delta < _constants.EPSILON;
942
+ });
943
+ return result;
944
+ }
945
+
946
+ /** Calculate candidate positions */
947
+ function getAllItemSnap(allItemRects) {
948
+ var allItemSnap = [];
949
+ var cur = allItemRects.cur;
950
+
951
+ // For development
952
+ var otherItems = allItemRects.otherItems,
953
+ currentItem = allItemRects.currentItem;
954
+ allItemRects.others.forEach(function (rect, index) {
955
+ var cw = cur && cur.size.width / 2;
956
+ var ch = cur && cur.size.height / 2;
957
+ var cos = Math.cos(rect.rotRad);
958
+ var sin = Math.sin(rect.rotRad);
959
+ var ox0 = cw * cos - ch * sin; // (cw, ch) rot
960
+ var oy0 = cw * sin + ch * cos;
961
+ var ox1 = -cw * cos - ch * sin; // (-cw, ch) rot
962
+ var oy1 = -cw * sin + ch * cos;
963
+ var ox2 = ch * sin - cw * cos;
964
+ var oy2 = -ch * cos - cw * sin;
965
+ var ox3 = ch * sin + cw * cos;
966
+ var oy3 = -ch * cos + cw * sin;
967
+ var nrot = rect.rotRad + Math.PI;
968
+ if (nrot >= Math.PI) nrot -= Math.PI * 2;
969
+ var snap1 = itemrectInfo(rect.rect[2].x + ox3, rect.rect[2].y + oy3, rect.rotRad, cur && cur.size, rect.layoutpos, rect.is_corner);
970
+ var snap2 = itemrectInfo(rect.rect[3].x + ox2, rect.rect[3].y + oy2, rect.rotRad, cur && cur.size, rect.layoutpos, rect.is_corner);
971
+ var snap3 = itemrectInfo(rect.rect[2].x + ox1, rect.rect[2].y + oy1, nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
972
+ var snap4 = itemrectInfo(rect.rect[3].x + ox0, rect.rect[3].y + oy0, nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
973
+ var sizeinfo = otherItems[index].cat && otherItems[index].cat.info.sizeinfo;
974
+ if (sizeinfo) {
975
+ var leftBlindLength = sizeinfo.leftBlindLength,
976
+ rightBlindLength = sizeinfo.rightBlindLength;
977
+ if (leftBlindLength > 0) {
978
+ var vx = leftBlindLength - ch;
979
+ var vy = cw;
980
+ var dx = vx * cos + vy * sin;
981
+ var dy = vx * sin - vy * cos;
982
+ var snap6 = itemrectInfo(rect.rect[0].x + dx, rect.rect[0].y + dy, rect.rotRad + Math.PI / 2, cur && cur.size, rect.layoutpos, rect.is_corner);
983
+ allItemSnap.push(snap6);
984
+ }
985
+ if (rightBlindLength > 0) {
986
+ var _vx = ch - rightBlindLength;
987
+ var _vy = cw;
988
+ var _dx = _vx * cos + _vy * sin;
989
+ var _dy = _vx * sin - _vy * cos;
990
+ var snap7 = itemrectInfo(rect.rect[1].x + _dx, rect.rect[1].y + _dy, rect.rotRad - Math.PI / 2, cur && cur.size, rect.layoutpos, rect.is_corner);
991
+ allItemSnap.push(snap7);
992
+ }
993
+ }
994
+ if (rect.isSnappedLine) {
995
+ snap1.isSnappedLine = true;
996
+ snap2.isSnappedLine = true;
997
+ }
998
+ if (rect.is_corner) {
999
+ var _nrot = rect.rotRad + Math.PI * 3 / 2;
1000
+ if (_nrot >= Math.PI) _nrot -= Math.PI * 2;
1001
+ var snap5 = itemrectInfo(rect.rect[1].x - oy1, rect.rect[1].y + ox1, _nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
1002
+ allItemSnap.push(snap2);
1003
+ allItemSnap.push(snap5);
1004
+ } else {
1005
+ allItemSnap.push(snap1);
1006
+ allItemSnap.push(snap2);
1007
+ allItemSnap.push(snap3);
1008
+ allItemSnap.push(snap4);
1009
+ }
1010
+ });
1011
+ return allItemSnap;
1012
+ }
1013
+ function getAllArea(layer) {
1014
+ var allAreaLines = [];
1015
+ var allLines = [];
1016
+ var verticesArray = [];
1017
+ var vertexID_to_verticesArrayIndex = {};
1018
+ layer.vertices.forEach(function (vertex) {
1019
+ var verticesCount = verticesArray.push([vertex.x, vertex.y]);
1020
+ var latestVertexIndex = verticesCount - 1;
1021
+ vertexID_to_verticesArrayIndex[vertex.id] = latestVertexIndex;
1022
+ });
1023
+ layer.areas.forEach(function (area) {
1024
+ allAreaLines.push(area.vertices);
1025
+ });
1026
+ allAreaLines.forEach(function (area) {
1027
+ var pt = [];
1028
+ area.forEach(function (element) {
1029
+ pt.push({
1030
+ x: verticesArray[vertexID_to_verticesArrayIndex[element]][0],
1031
+ y: verticesArray[vertexID_to_verticesArrayIndex[element]][1]
1032
+ });
1033
+ });
1034
+ allLines.push(pt);
1035
+ });
1036
+ return allLines;
1037
+ }
1038
+
1039
+ /** Get all lines of the scene */
1040
+ function getAllLines(layer) {
1041
+ var allArea = getAllArea(layer);
1042
+ var allAreaLines = [];
1043
+ var allVertices = layer.get('vertices').toJS();
1044
+ layer.lines.forEach(function (tline) {
1045
+ var line = tline.toJS();
1046
+ if (isPointInArea(allArea, allVertices[line.vertices[0]]) || isPointInArea(allArea, allVertices[line.vertices[1]])) {
1047
+ allAreaLines.push(line.vertices.reverse());
1048
+ }
1049
+ });
1050
+ var allLines = [];
1051
+ //let allNonAreaLines = [];
1052
+ var thick = _constants.LINE_THICKNESS / 2;
1053
+ layer.lines.forEach(function (line) {
1054
+ var i = containLine(allAreaLines, line);
1055
+ // let thick = line.properties.getIn(['thickness', 'length']);
1056
+ if (i < 0) {
1057
+ var vertices = line.vertices.toJS();
1058
+ var tmp_vertices = {
1059
+ x1: layer.vertices.get(vertices[0]).x,
1060
+ y1: layer.vertices.get(vertices[0]).y,
1061
+ x2: layer.vertices.get(vertices[1]).x,
1062
+ y2: layer.vertices.get(vertices[1]).y
1063
+ };
1064
+ if (tmp_vertices.x1 == tmp_vertices.x2 && tmp_vertices.y1 == tmp_vertices.y2) return;
1065
+ var addIdx = allLines.length;
1066
+ var flag = 0;
1067
+ allLines.forEach(function (element, idx) {
1068
+ if (flag == 0) {
1069
+ var el = element[0];
1070
+ var tmp_el = {
1071
+ x1: layer.vertices.get(el[0]).x,
1072
+ y1: layer.vertices.get(el[0]).y,
1073
+ x2: layer.vertices.get(el[1]).x,
1074
+ y2: layer.vertices.get(el[1]).y
1075
+ };
1076
+ if (tmp_el.x1 == tmp_vertices.x1 && tmp_el.y1 == tmp_vertices.y1) {
1077
+ var tmp = vertices[0];
1078
+ vertices[0] = vertices[1];
1079
+ vertices[1] = tmp;
1080
+ addIdx = idx == 0 ? 0 : idx - 1;
1081
+ flag = 1;
1082
+ } else if (tmp_el.x2 == tmp_vertices.x1 && tmp_el.y2 == tmp_vertices.y1) {
1083
+ addIdx = idx;
1084
+ flag = 1;
1085
+ } else if (tmp_el.x1 == tmp_vertices.x2 && tmp_el.y1 == tmp_vertices.y2) {
1086
+ addIdx = idx == 0 ? 0 : idx - 1;
1087
+ flag = 1;
1088
+ } else if (tmp_el.x2 == tmp_vertices.x2 && tmp_el.y2 == tmp_vertices.y2) {
1089
+ var _tmp = vertices[0];
1090
+ vertices[0] = vertices[1];
1091
+ vertices[1] = _tmp;
1092
+ addIdx = idx;
1093
+ flag = 1;
1094
+ }
1095
+ }
1096
+ });
1097
+ allLines.splice(addIdx, 0, [vertices, thick]);
1098
+ } else {
1099
+ allLines.push([allAreaLines[i], thick]);
1100
+ }
1101
+ });
1102
+ return allLines;
1103
+ }
1104
+
1105
+ /** Get lines that wraps the area */
1106
+ function getAllAreaLines(layer) {
1107
+ var areainfo = [];
1108
+ layer.areas.forEach(function (area) {
1109
+ var sz = area.vertices.size;
1110
+ for (var i = 0; i < sz; i++) {
1111
+ areainfo.push([area.vertices.get(i), area.vertices.get((i + 1) % sz)]);
1112
+ }
1113
+ });
1114
+ return areainfo;
1115
+ }
1116
+ function containLine(lines, line) {
1117
+ // lines: [array]
1118
+ var sz = lines.length;
1119
+ for (var i = 0; i < sz; i++) {
1120
+ var l = lines[i];
1121
+ if (line.vertices.get(0) == l[0] && line.vertices.get(1) == l[1] || line.vertices.get(1) == l[0] && line.vertices.get(0) == l[1]) {
1122
+ return i;
1123
+ }
1124
+ }
1125
+ return -1;
1126
+ }
1127
+ function buildRectFromLines(layer, lines) {
1128
+ var rect = [];
1129
+ lines.forEach(function (line) {
1130
+ var vxys = []; // 0: x0, 1: y0, 2: x1, 3: y1
1131
+ line[0].forEach(function (vertex) {
1132
+ var vert = layer.vertices.get(vertex);
1133
+ vxys.push(vert.x);
1134
+ vxys.push(vert.y);
1135
+ });
1136
+ var thick = line[1];
1137
+ var x0 = vxys[0];
1138
+ var y0 = vxys[1];
1139
+ var x1 = vxys[2];
1140
+ var y1 = vxys[3];
1141
+ rect.push(getCalcRectFromLine(x0, y0, x1, y1, thick, layer));
1142
+ });
1143
+ return rect;
1144
+ }
1145
+ function getRelatedVertices(x0, y0, x1, y1, layer) {
1146
+ var verticesArray = [];
1147
+ var mapVertIDtoIndex = {};
1148
+ layer.vertices.forEach(function (vertex) {
1149
+ var verticesCount = verticesArray.push([vertex.x, vertex.y]);
1150
+ var latestVertexIndex = verticesCount - 1;
1151
+ mapVertIDtoIndex[vertex.id] = latestVertexIndex;
1152
+ });
1153
+ var relVerts = [];
1154
+ layer.lines.some(function (line) {
1155
+ var vertID0 = line.vertices.get(0);
1156
+ var vertID1 = line.vertices.get(1);
1157
+ var pt0 = {
1158
+ x: verticesArray[mapVertIDtoIndex[vertID0]][0],
1159
+ y: verticesArray[mapVertIDtoIndex[vertID0]][1]
1160
+ };
1161
+ var pt1 = {
1162
+ x: verticesArray[mapVertIDtoIndex[vertID1]][0],
1163
+ y: verticesArray[mapVertIDtoIndex[vertID1]][1]
1164
+ };
1165
+ if (Math.abs(pt0.x - x0) < _constants.EPSILON && Math.abs(pt0.y - y0) < _constants.EPSILON && Math.abs(pt1.x - x1) < _constants.EPSILON && Math.abs(pt1.y - y1) < _constants.EPSILON || Math.abs(pt0.x - x1) < _constants.EPSILON && Math.abs(pt0.y - y1) < _constants.EPSILON && Math.abs(pt1.x - x0) < _constants.EPSILON && Math.abs(pt1.y - y0) < _constants.EPSILON) {
1166
+ if (line.relatedVertices.size == 2) {
1167
+ var relPt0 = point(x0, y0);
1168
+ var relPt1 = point(x1, y1);
1169
+ line.relatedVertices.forEach(function (relatedVertice, index) {
1170
+ if (relatedVertice.index == undefined) relatedVertice = relatedVertice.toJSON();
1171
+ if (relatedVertice.index == 0) relPt0 = point(relatedVertice.point.x, relatedVertice.point.y);else relPt1 = point(relatedVertice.point.x, relatedVertice.point.y);
1172
+ });
1173
+ relVerts.push(relPt0);
1174
+ relVerts.push(relPt1);
1175
+ }
1176
+ return true;
1177
+ }
1178
+ });
1179
+ return relVerts;
1180
+ }
1181
+ function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1182
+ // get line from vertex coordinate
1183
+ var relVerts = getRelatedVertices(x0, y0, x1, y1, layer);
1184
+ var dx = x1 - x0;
1185
+ var dy = y1 - y0;
1186
+ var dl = Math.sqrt(dx * dx + dy * dy);
1187
+ var ox = -dy / dl * thick;
1188
+ var oy = dx / dl * thick;
1189
+ var rot = Math.atan2(dy, dx);
1190
+ if (relVerts.length == 2) {
1191
+ var vN = point(ox, oy);
1192
+ var vR = point(relVerts[0].x - x0, relVerts[0].y - y0);
1193
+ if (dotprod(vN, vR) < 0) {
1194
+ ox = -ox;
1195
+ oy = -oy;
1196
+ } else {
1197
+ rot += Math.PI;
1198
+ }
1199
+ } else {
1200
+ ox = -ox;
1201
+ oy = -oy;
1202
+ }
1203
+ return {
1204
+ rectEnd: [point(x0 + ox / 2, y0 + oy / 2), point(x1 + ox / 2, y1 + oy / 2)],
1205
+ rect: [point(x0 + ox, y0 + oy), point(x1 + ox, y1 + oy), point(x1, y1), point(x0, y0)],
1206
+ pos: point((x0 + x1 + ox) / 2, (y0 + y1 + ox) / 2),
1207
+ rotRad: rot,
1208
+ size: {
1209
+ width: dl,
1210
+ height: thick / 2
1211
+ }
1212
+ };
1213
+ }
1214
+ function getAllLineSnap(allLineRects, curItemRect) {
1215
+ var allLineSnap = [];
1216
+ var cur = curItemRect;
1217
+ if (cur === undefined || cur === null) return;else allLineRects.forEach(function (rect) {
1218
+ var cw = cur.size.width / 2;
1219
+ var ch = cur.size.height / 2;
1220
+ var cos = Math.cos(rect.rotRad);
1221
+ var sin = Math.sin(rect.rotRad);
1222
+ var ox0 = cw * cos - ch * sin; // (cw, ch) rot
1223
+ var oy0 = cw * sin + ch * cos;
1224
+ var ox1 = -cw * cos - ch * sin; // (-cw, ch) rot
1225
+ var oy1 = -cw * sin + ch * cos;
1226
+ var nrot = rect.rotRad + Math.PI;
1227
+ if (nrot >= Math.PI) nrot -= Math.PI * 2;
1228
+ var thick = rect.size.height;
1229
+ var snap3 = itemInfo(rect.rect[2].x + ox1, rect.rect[2].y + oy1, nrot, cur.size);
1230
+ var snap4 = itemInfo(rect.rect[3].x + ox0, rect.rect[3].y + oy0, nrot, cur.size);
1231
+ if (!cur.is_corner) {
1232
+ allLineSnap.push(snap3);
1233
+ }
1234
+ allLineSnap.push(snap4);
1235
+ });
1236
+ return allLineSnap;
1237
+ }
1238
+ function validateSnaps(allSnaps, allRects) {
1239
+ var validSnaps = [];
1240
+ if (allSnaps !== undefined && allSnaps !== null && allSnaps.length > 0) allSnaps.forEach(function (snap) {
1241
+ if (validSnap(snap, allRects)) {
1242
+ validSnaps.push(snap);
1243
+ }
1244
+ });
1245
+ return validSnaps;
1246
+ }
1247
+ function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRects, allLineRects, allRects) {
1248
+ var validSnaps = [];
1249
+ var addFlag = true;
1250
+ allSnaps.forEach(function (snap) {
1251
+ if (validSnap(snap, allRects)) {
1252
+ validSnaps.push(snap);
1253
+ } else if (addFlag) {
1254
+ allItemSnap.forEach(function (snap) {
1255
+ validSnaps.push(snap);
1256
+ });
1257
+ allLineSnap.forEach(function (snap) {
1258
+ validSnaps.push(snap);
1259
+ });
1260
+ addFlag = false;
1261
+ }
1262
+ });
1263
+ return validSnaps;
1264
+ }
1265
+ function validSnap(snap, rects) {
1266
+ var snaprect = getCalcRectFromItem(snap);
1267
+ return rects.every(function (rect) {
1268
+ return !intersectRect(rect.rect, snaprect.rect);
1269
+ });
1270
+ }
1271
+ function itemInfo(x, y, rotRad, size) {
1272
+ return {
1273
+ pos: {
1274
+ x: x,
1275
+ y: y
1276
+ },
1277
+ rotRad: rotRad,
1278
+ size: size
1279
+ };
1280
+ }
1281
+ function intersectRect(rect1, rect2) {
1282
+ var ret = false;
1283
+ rect1 = shrinkRect(rect1);
1284
+ rect2 = shrinkRect(rect2);
1285
+ ret = ret || getInterSect(rect1, rect2);
1286
+ ret = ret || rect1.some(function (pt) {
1287
+ return containPointInRect(pt, rect2);
1288
+ });
1289
+ ret = ret || rect2.some(function (pt) {
1290
+ return containPointInRect(pt, rect1);
1291
+ });
1292
+ return ret;
1293
+ }
1294
+ function containPointInRect(point, rect) {
1295
+ // true: contain, false: not contain
1296
+ for (var i = 0; i < rect.length; i++) {
1297
+ var ni = (i + 1) % rect.length;
1298
+ if (crossprod(diff(point, rect[i]), diff(rect[i], rect[ni])) < 0) {
1299
+ return false;
1300
+ }
1301
+ }
1302
+ return true;
1303
+ }
1304
+ function diff(v0, v1) {
1305
+ return {
1306
+ x: v0.x - v1.x,
1307
+ y: v0.y - v1.y
1308
+ };
1309
+ }
1310
+ function crossprod(v0, v1) {
1311
+ return v0.x * v1.y - v0.y * v1.x;
1312
+ }
1313
+ function shrinkRect(rect) {
1314
+ var v02x = rect[2].x - rect[0].x;
1315
+ var v02y = rect[2].y - rect[0].y;
1316
+ var d02 = Math.sqrt(v02x * v02x + v02y * v02y);
1317
+ var o02x = v02x / d02 * 0.1;
1318
+ var o02y = v02y / d02 * 0.1;
1319
+ var v13x = rect[3].x - rect[1].x;
1320
+ var v13y = rect[3].y - rect[1].y;
1321
+ var d13 = Math.sqrt(v02x * v02x + v02y * v02y);
1322
+ var o13x = v13x / d13 * 0.1;
1323
+ var o13y = v13y / d13 * 0.1;
1324
+ return [point(rect[0].x + o02x, rect[0].y + o02y), point(rect[1].x + o13x, rect[1].y + o13y), point(rect[2].x - o02x, rect[2].y - o02y), point(rect[3].x - o13x, rect[3].y - o13y)];
1325
+ }
1326
+ function getInterSect(shape1, shape2) {
1327
+ // return result of intersect of two shape
1328
+ var count = 0;
1329
+ for (var i = 0; i < shape1.length; i++) {
1330
+ var sl1 = {
1331
+ x: shape1[i].x,
1332
+ y: shape1[i].y
1333
+ };
1334
+ var sl2 = {
1335
+ x: shape1[(i + 1) % shape1.length].x,
1336
+ y: shape1[(i + 1) % shape1.length].y
1337
+ };
1338
+ for (var j = 0; j < shape2.length; j++) {
1339
+ var el1 = {
1340
+ x: shape2[j].x,
1341
+ y: shape2[j].y
1342
+ };
1343
+ var el2 = {
1344
+ x: shape2[(j + 1) % shape2.length].x,
1345
+ y: shape2[(j + 1) % shape2.length].y
1346
+ };
1347
+ var flag = getLineInterSect(sl1.x, sl1.y, sl2.x, sl2.y, el1.x, el1.y, el2.x, el2.y);
1348
+ if (flag) {
1349
+ count++;
1350
+ if (count > 1) return true;
1351
+ }
1352
+ }
1353
+ }
1354
+ return false;
1355
+ }
1356
+ function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1357
+ var ax = s1x;
1358
+ var ay = s1y;
1359
+ var bx = e1x - s1x;
1360
+ var by = e1y - s1y;
1361
+ var cx = s2x;
1362
+ var cy = s2y;
1363
+ var dx = e2x - s2x;
1364
+ var dy = e2y - s2y;
1365
+ if (Math.abs(bx * dy - by * dx) < 0.00000001) {
1366
+ if (Math.abs((cx - ax) * by - (cy - ay) * bx) < 0.00000001) {
1367
+ var maxX = ax;
1368
+ var minX = ax;
1369
+ var maxY = ay;
1370
+ var minY = ay;
1371
+ if (maxX < e1x) maxX = e1x;
1372
+ if (maxX < cx) maxX = cx;
1373
+ if (maxX < e2x) maxX = e2x;
1374
+ if (minX > e1x) minX = e1x;
1375
+ if (minX > cx) minX = cx;
1376
+ if (minX > e2x) minX = e2x;
1377
+ if (maxY < e1y) maxY = e1y;
1378
+ if (maxY < cy) maxY = cy;
1379
+ if (maxY < e2y) maxY = e2y;
1380
+ if (minY > e1y) minY = e1y;
1381
+ if (minY > cy) minY = cy;
1382
+ if (minY > e2y) minX = e2y;
1383
+ var len = Math.sqrt((maxX - minX) * (maxX - minX) + (maxY - minY) * (maxY - minY));
1384
+ var len1 = Math.sqrt(bx * bx + by * by);
1385
+ var len2 = Math.sqrt(dx * dx + dy * dy);
1386
+ if (len < len1 + len2) {
1387
+ return true;
1388
+ } else {
1389
+ return false;
1390
+ }
1391
+ } else {
1392
+ return false;
1393
+ }
1394
+ } else {
1395
+ var t = (dx * (ay - cy) + dy * (cx - ax)) / (bx * dy - by * dx);
1396
+ var u = (bx * (cy - ay) + by * (ax - cx)) / (dx * by - dy * bx);
1397
+ var ret = u < 1 && u > 0 && t > 0 && t < 1;
1398
+ return ret;
1399
+ }
1400
+ }
1401
+ function isPointInArea(allArea, pt) {
1402
+ var x = pt.x;
1403
+ var y = pt.y;
1404
+ var result = false;
1405
+ result = allArea.some(function (area) {
1406
+ var sum = 0,
1407
+ alpha = 0;
1408
+ for (var i = 0; i < area.length; i++) {
1409
+ var x0 = area[i].x;
1410
+ var y0 = area[i].y;
1411
+ var x1 = area[(i + 1) % area.length].x;
1412
+ var y1 = area[(i + 1) % area.length].y;
1413
+ var v0 = {
1414
+ x: x0 - x,
1415
+ y: y0 - y
1416
+ };
1417
+ var v1 = {
1418
+ x: x1 - x,
1419
+ y: y1 - y
1420
+ };
1421
+ if (Math.abs(v0.x) < _constants.EPSILON && Math.abs(v0.y) < _constants.EPSILON)
1422
+ // check if pt is area point
1423
+ return true;
1424
+
1425
+ // check if pt is in area line
1426
+ var lineLen = Math.sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
1427
+ var v0Len = Math.sqrt(v0.x * v0.x + v0.y * v0.y);
1428
+ var vPt = {
1429
+ x: -v0.x / v0Len,
1430
+ y: -v0.y / v0Len
1431
+ };
1432
+ var xE = x0 + vPt.x * lineLen;
1433
+ var yE = y0 + vPt.y * lineLen;
1434
+ if (v0Len <= lineLen && Math.abs(xE - x1) < _constants.EPSILON && Math.abs(yE - y1) < _constants.EPSILON) return true;
1435
+ alpha = Math.atan2(v0.x * v1.y - v1.x * v0.y, v0.x * v1.x + v0.y * v1.y);
1436
+ sum += alpha;
1437
+ }
1438
+ if (Math.abs(Math.abs(sum) - Math.PI * 2) < _constants.EPSILON) return true;
1439
+ });
1440
+ return result;
1441
+ }
1442
+ function calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines) {
1443
+ return calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines);
1444
+ }
1445
+ function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, polygonPoint) {
1446
+ // Validate required input and guard against missing `.cur`
1447
+ if (!allItemRect || !allItemRect.cur) return;
1448
+ var cur = allItemRect.cur; // safe alias
1449
+ var cx = x;
1450
+ var cy = y;
1451
+ var ndist = 5000;
1452
+ var rotRad = cur.rotRad;
1453
+
1454
+ // Get candidate snaps and validate them as before
1455
+ var allCurSnap = getAllCurSnap(allLineRects, x, y, cur);
1456
+ allCurSnap = validateLineSnaps(allCurSnap, allItemSnap, allLineSnap, allItemRect, allLineRects, allRect);
1457
+ var getSnap = false;
1458
+ var snapdist = [];
1459
+
1460
+ // Build distances for snaps that lie inside polygonPoint (if any)
1461
+ if (Array.isArray(allCurSnap)) {
1462
+ allCurSnap.forEach(function (snap) {
1463
+ if (!snap || !snap.pos) return;
1464
+ var inside = ContainsPoint(polygonPoint, snap.pos.x, snap.pos.y);
1465
+ if (inside) {
1466
+ var dx = snap.pos.x - x;
1467
+ var dy = snap.pos.y - y;
1468
+ snapdist.push(dx * dx + dy * dy);
1469
+ }
1470
+ });
1471
+ }
1472
+
1473
+ // Find minimum distance (Infinity if none)
1474
+ var edist = snapdist.length ? Math.min.apply(Math, snapdist) : Infinity;
1475
+
1476
+ // Choose the snap with distance === edist
1477
+ if (Array.isArray(allCurSnap)) {
1478
+ allCurSnap.forEach(function (snap) {
1479
+ if (!snap || !snap.pos) return;
1480
+ var dx = snap.pos.x - x;
1481
+ var dy = snap.pos.y - y;
1482
+ var dist = dx * dx + dy * dy;
1483
+ if (dist === edist) {
1484
+ var _snap$rotRad;
1485
+ ndist = dist;
1486
+ cx = snap.pos.x;
1487
+ cy = snap.pos.y;
1488
+ rotRad = (_snap$rotRad = snap.rotRad) !== null && _snap$rotRad !== void 0 ? _snap$rotRad : rotRad; // nullish coalescing
1489
+ getSnap = true;
1490
+ }
1491
+ });
1492
+ }
1493
+ var crot = rotRad / Math.PI * 180;
1494
+ return {
1495
+ cx: cx,
1496
+ cy: cy,
1497
+ crot: crot,
1498
+ rotRad: rotRad
1499
+ };
1500
+ }
1501
+
1502
+ ////////////
1503
+ function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1504
+ var cx = allItemRect.cur.pos.x;
1505
+ var cy = allItemRect.cur.pos.y;
1506
+ var nx = x;
1507
+ var ny = y;
1508
+ var cursize = allItemRect.cur.size;
1509
+ var ndist = cursize.width * cursize.width + cursize.height * cursize.height;
1510
+ ndist = ndist / 4;
1511
+ var rotRad = allItemRect.cur.rotRad;
1512
+ var allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1513
+ allCurSnap = validateSnaps(allCurSnap, allRect);
1514
+ var getSnap = false;
1515
+ allCurSnap.forEach(function (snap) {
1516
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1517
+ if (dist < ndist) {
1518
+ ndist = dist;
1519
+ nx = snap.pos.x;
1520
+ ny = snap.pos.y;
1521
+ rotRad = snap.rotRad;
1522
+ getSnap = true;
1523
+ }
1524
+ });
1525
+ if (!getSnap) {
1526
+ allLineSnap.concat(allItemSnap).forEach(function (snap) {
1527
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1528
+ if (dist < ndist) {
1529
+ ndist = dist;
1530
+ nx = snap.pos.x;
1531
+ ny = snap.pos.y;
1532
+ rotRad = snap.rotRad;
1533
+ }
1534
+ });
1535
+ }
1536
+ var rot = rotRad / Math.PI * 180;
1537
+ var ret = {
1538
+ nx: nx,
1539
+ ny: ny,
1540
+ rot: rot,
1541
+ rotRad: rotRad
1542
+ };
1543
+ return ret;
1544
+ }
1545
+
1546
+ ////////////
1547
+ function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea) {
1548
+ var nx = x;
1549
+ var ny = y;
1550
+ var ndist = 20;
1551
+ var rotRad = allItemRect.cur && allItemRect.cur.rotRad;
1552
+ var val = {
1553
+ pos: {
1554
+ x: x,
1555
+ y: y
1556
+ },
1557
+ rotRad: rotRad
1558
+ };
1559
+ val.size = allItemRect.cur && allItemRect.cur.size;
1560
+ val.layoutpos = allItemRect.cur && allItemRect.cur.layoutpos;
1561
+ val.is_corner = allItemRect.cur && allItemRect.cur.is_corner;
1562
+ var curitem = getCalcRectFromItem(val);
1563
+ var allCurSnap = [];
1564
+ allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1565
+ allCurSnap = validateSnaps(allCurSnap, allRect);
1566
+ var getSnap = false;
1567
+ var snapdist = [];
1568
+ //console.log("allItemSnap", allItemSnap.filter(e => e.isSnappedLine))
1569
+ //console.log("~~~~start~~~~");
1570
+ allItemSnap.filter(function (e) {
1571
+ return e.isSnappedLine;
1572
+ }).forEach(function (snap) {
1573
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1574
+ snapdist.push(dist);
1575
+ //console.log("dist", snap)
1576
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < 100) {
1577
+ ndist = dist;
1578
+ nx = snap.pos.x;
1579
+ ny = snap.pos.y;
1580
+ rotRad = snap.rotRad;
1581
+ getSnap = true;
1582
+
1583
+ //console.log("SUCCESS!!!!");
1584
+ }
1585
+ });
1586
+ //console.log("====end====");
1587
+ if (getSnap == false) {
1588
+ allCurSnap.forEach(function (snap) {
1589
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1590
+ snapdist.push(dist);
1591
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < ndist) {
1592
+ ndist = dist;
1593
+ nx = snap.pos.x;
1594
+ ny = snap.pos.y;
1595
+ rotRad = snap.rotRad;
1596
+ getSnap = true;
1597
+ //console.log("SUCCE!!!!");
1598
+ }
1599
+ });
1600
+ if (!getSnap && allLineRects.some(function (others) {
1601
+ return intersectRect(others.rect, curitem.rect);
1602
+ })) {
1603
+ var edist = Math.min.apply(null, snapdist);
1604
+ allCurSnap.forEach(function (snap) {
1605
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1606
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist === edist) {
1607
+ ndist = dist;
1608
+ nx = snap.pos.x;
1609
+ ny = snap.pos.y;
1610
+ rotRad = snap.rotRad;
1611
+ getSnap = true;
1612
+ }
1613
+ });
1614
+ }
1615
+ if (getSnap === false) {
1616
+ var nearRect = null;
1617
+ var minDist = Infinity;
1618
+ allLineRects.forEach(function (rect) {
1619
+ var e = rect.rectEnd[0];
1620
+ e = clone_point(e);
1621
+ e.x -= curitem.pos.x;
1622
+ e.y -= curitem.pos.y;
1623
+ var nRot = rect.rotRad + Math.PI / 2;
1624
+ var dist = Math.abs(e.x * Math.cos(nRot) + e.y * Math.sin(nRot));
1625
+ if (minDist > dist) {
1626
+ minDist = dist;
1627
+ nearRect = rect;
1628
+ }
1629
+ });
1630
+ var containrect = nearRect && intersectRect(nearRect.rect, curitem.rect);
1631
+ if (containrect) {
1632
+ var filter_func = function filter_func(snap) {
1633
+ var diff = Math.abs(snap.rotRad - nearRect.rotRad - Math.PI);
1634
+ return diff == 0 || diff == 2 * Math.PI;
1635
+ };
1636
+ var tempSnap = allLineSnap.filter(filter_func);
1637
+ tempSnap = tempSnap.concat(allLineSnap.filter(function (snap) {
1638
+ return !filter_func(snap);
1639
+ }));
1640
+ tempSnap.some(function (snap) {
1641
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1642
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < 5000) {
1643
+ nx = snap.pos.x;
1644
+ ny = snap.pos.y;
1645
+ rotRad = snap.rotRad;
1646
+ getSnap = true;
1647
+ return true;
1648
+ }
1649
+ return false;
1650
+ });
1651
+ }
1652
+ }
1653
+ if (allItemRect.others.some(function (others) {
1654
+ return intersectRect(others.rect, curitem.rect);
1655
+ })) {
1656
+ getSnap = false;
1657
+ }
1658
+ if (!getSnap) {
1659
+ var _snapdist = [];
1660
+ allItemSnap.forEach(function (snap) {
1661
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1662
+ _snapdist.push(dist);
1663
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist < ndist) {
1664
+ ndist = dist;
1665
+ nx = snap.pos.x;
1666
+ ny = snap.pos.y;
1667
+ rotRad = snap.rotRad;
1668
+ getSnap = true;
1669
+ }
1670
+ });
1671
+ if (!getSnap && allItemRect.others.some(function (others) {
1672
+ return intersectRect(others.rect, curitem.rect);
1673
+ })) {
1674
+ var _edist = Math.min.apply(null, _snapdist);
1675
+ allItemSnap.forEach(function (snap) {
1676
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1677
+ if (isPointInArea(allArea, snap.pos) || !allArea.length) if (dist === _edist) {
1678
+ ndist = dist;
1679
+ nx = snap.pos.x;
1680
+ ny = snap.pos.y;
1681
+ rotRad = snap.rotRad;
1682
+ }
1683
+ });
1684
+ if (allItemRect.cur.itemInfo.name.includes('Cook Top')) {
1685
+ var intersects = allItemRect.others.filter(function (others) {
1686
+ return intersectRect(others.rect, curitem.rect);
1687
+ });
1688
+ intersects.forEach(function (rect) {
1689
+ if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.layoutpos.includes(_constants.BASE_CABINET_LAYOUTPOS)) {
1690
+ nx = rect.itemInfo.x;
1691
+ ny = rect.itemInfo.y;
1692
+ rotRad = rect.itemInfo.rotation * Math.PI / 180;
1693
+ }
1694
+ });
1695
+ }
1696
+ if (allItemRect.cur.itemInfo.name.includes('Hood') || allItemRect.cur.itemInfo.name.includes('Range') || allItemRect.cur.itemInfo.name.includes('Cook Top')) {
1697
+ var _intersects = allItemRect.others.filter(function (others) {
1698
+ return intersectRect(others.rect, curitem.rect);
1699
+ });
1700
+ _intersects.forEach(function (rect) {
1701
+ if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.name.includes('Hood') || rect.itemInfo.name.includes('Range') || rect.itemInfo.name.includes('Cook Top')) {
1702
+ nx = rect.itemInfo.x;
1703
+ ny = rect.itemInfo.y;
1704
+ rotRad = rect.itemInfo.rotation * Math.PI / 180;
1705
+ }
1706
+ });
1707
+ }
1708
+ }
1709
+ }
1710
+ }
1711
+ var rot = rotRad / Math.PI * 180;
1712
+
1713
+ //Check case.
1714
+ //If item is 'blind base cabinet', it must be pulled from other 3".
1715
+ if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.startsWith('BBC')) {
1716
+ var offset3inch = (0, _convertUnitsLite.convert)(3).from('in').to('cm');
1717
+ var tx = nx,
1718
+ ty = ny;
1719
+ if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-L')) {
1720
+ if (rot == 0 || rot == -180) {
1721
+ tx -= offset3inch * Math.cos(rotRad);
1722
+ }
1723
+ if (rot == 90 || rot == -90) {
1724
+ ty -= offset3inch * Math.sin(rotRad);
1725
+ }
1726
+ }
1727
+ if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-R')) {
1728
+ if (rot == 0 || rot == -180) {
1729
+ tx += offset3inch * Math.cos(rotRad);
1730
+ }
1731
+ if (rot == 90 || rot == -90) {
1732
+ ty += offset3inch * Math.sin(rotRad);
1733
+ }
1734
+ }
1735
+ var t_val = {
1736
+ pos: {
1737
+ x: tx,
1738
+ y: ty
1739
+ },
1740
+ rotRad: rotRad,
1741
+ size: allItemRect.cur.size,
1742
+ layoutpos: allItemRect.cur.layoutpos,
1743
+ is_corner: allItemRect.cur.is_corner
1744
+ };
1745
+ var isItemRectSect = validInterSect(allItemRect.others, t_val);
1746
+ var isWallRectSect = validInterSect(allLineRects, t_val);
1747
+ if (isItemRectSect && isWallRectSect) {
1748
+ nx = tx;
1749
+ ny = ty;
1750
+ }
1751
+ }
1752
+ return {
1753
+ nx: nx,
1754
+ ny: ny,
1755
+ rot: rot,
1756
+ rotRad: rotRad
1757
+ };
1758
+ }
1759
+
1760
+ ////////////
1761
+ function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1762
+ // let layer = scene.layers.get(layerID);
1763
+ // let cx = allItemRect.cur.pos.x;
1764
+ // let cy = allItemRect.cur.pos.y;
1765
+ var nx = x;
1766
+ var ny = y;
1767
+ var ndist = 20;
1768
+ var rotRad = allItemRect.cur.rotRad;
1769
+ var val = {
1770
+ pos: {
1771
+ x: x,
1772
+ y: y
1773
+ },
1774
+ rotRad: rotRad
1775
+ };
1776
+ val.size = allItemRect.cur.size;
1777
+ val.layoutpos = allItemRect.cur.layoutpos;
1778
+ val.is_corner = allItemRect.cur.is_corner;
1779
+ var curitem = getCalcRectFromItem3D(val);
1780
+ var allCurSnap = getAllCurSnap(allLineRects, x, y, allItemRect.cur);
1781
+ allCurSnap = validateSnaps(allCurSnap, allRect);
1782
+ var getSnap = false;
1783
+ var snapdist = [];
1784
+ allCurSnap.forEach(function (snap) {
1785
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1786
+ snapdist.push(dist);
1787
+ if (dist < ndist) {
1788
+ ndist = dist;
1789
+ nx = snap.pos.x;
1790
+ ny = snap.pos.y;
1791
+ rotRad = snap.rotRad;
1792
+ getSnap = true;
1793
+ } else {
1794
+ var i = 0;
1795
+ allLineRects.forEach(function (others) {
1796
+ var containrect = intersectRect(others.rect, curitem.rect);
1797
+ if (containrect) {
1798
+ var edist = Math.min.apply(null, snapdist);
1799
+ allCurSnap.forEach(function (snap) {
1800
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1801
+ if (dist === edist) {
1802
+ ndist = dist;
1803
+ nx = snap.pos.x;
1804
+ ny = snap.pos.y;
1805
+ rotRad = snap.rotRad;
1806
+ getSnap = true;
1807
+ }
1808
+ });
1809
+ }
1810
+ });
1811
+ }
1812
+ });
1813
+ if (getSnap === false) {
1814
+ allLineRects.forEach(function (others) {
1815
+ var containrect = intersectRect(others.rect, curitem.rect);
1816
+ if (containrect) {
1817
+ allLineSnap.forEach(function (snap) {
1818
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1819
+ if (dist < 5000) {
1820
+ nx = snap.pos.x;
1821
+ ny = snap.pos.y;
1822
+ rotRad = snap.rotRad;
1823
+ getSnap = true;
1824
+ }
1825
+ });
1826
+ }
1827
+ });
1828
+ }
1829
+ allItemRect.others.forEach(function (others) {
1830
+ if (!(others.layoutpos === 'base' && allItemRect.cur.layoutpos === 'wall') || !(others.layoutpos === 'wall' && allItemRect.cur.layoutpos === 'base')) {
1831
+ var containrect = intersectRect(others.rect, curitem.rect);
1832
+ if (containrect) {
1833
+ getSnap = false;
1834
+ }
1835
+ }
1836
+ });
1837
+ if (!getSnap) {
1838
+ var _snapdist2 = [];
1839
+ allItemSnap.forEach(function (snap) {
1840
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1841
+ _snapdist2.push(dist);
1842
+ if (dist < ndist) {
1843
+ ndist = dist;
1844
+ nx = snap.pos.x;
1845
+ ny = snap.pos.y;
1846
+ rotRad = snap.rotRad;
1847
+ } else {
1848
+ allItemRect.others.forEach(function (others) {
1849
+ if (!(others.layoutpos === 'base' && allItemRect.cur.layoutpos === 'wall') || !(others.layoutpos === 'wall' && allItemRect.cur.layoutpos === 'base')) {
1850
+ var containrect = intersectRect(others.rect, curitem.rect);
1851
+ if (containrect) {
1852
+ var edist = Math.min.apply(null, _snapdist2);
1853
+ allItemSnap.forEach(function (snap) {
1854
+ var dist = (snap.pos.x - x) * (snap.pos.x - x) + (snap.pos.y - y) * (snap.pos.y - y);
1855
+ if (dist === edist) {
1856
+ ndist = dist;
1857
+ nx = snap.pos.x;
1858
+ ny = snap.pos.y;
1859
+ rotRad = snap.rotRad;
1860
+ }
1861
+ });
1862
+ }
1863
+ }
1864
+ });
1865
+ }
1866
+ });
1867
+ }
1868
+ var rot = rotRad / Math.PI * 180;
1869
+ return {
1870
+ nx: nx,
1871
+ ny: ny,
1872
+ rot: rot,
1873
+ rotRad: rotRad
1874
+ };
1875
+ }
1876
+ function getAllCurSnap(allLineRects, x, y, curItemRect) {
1877
+ if (!curItemRect) return;
1878
+ var allCurSnap = [];
1879
+ var thick = _constants.LINE_THICKNESS / 2;
1880
+ allLineRects.forEach(function (linerect) {
1881
+ //allLineRects:left, right, top, bottom line
1882
+ var p0 = clone_point(linerect.rect[2]); //point 2(x, y) inside of line
1883
+ var p1 = clone_point(linerect.rect[3]); //point 3(x, y) inside of line
1884
+ var q = point(x, y); // point of item
1885
+ var cos = Math.cos(linerect.rotRad);
1886
+ var sin = Math.sin(linerect.rotRad);
1887
+ p0.x -= cos * curItemRect.size.width / 2;
1888
+ p0.y -= sin * curItemRect.size.width / 2;
1889
+ p1.x += cos * curItemRect.size.width / 2;
1890
+ p1.y += sin * curItemRect.size.width / 2;
1891
+ var n = point(-sin, cos);
1892
+ var v3to0 = {
1893
+ x: linerect.rect[0].x - p1.x,
1894
+ y: linerect.rect[0].y - p1.y
1895
+ };
1896
+ var fDot = dotprod(n, v3to0);
1897
+ if (fDot > 0) {
1898
+ // normal vector is crossing the wall
1899
+ n.x = -n.x;
1900
+ n.y = -n.y;
1901
+ }
1902
+ var dist = dotprod(diff(p1, q), n);
1903
+ var h = point(q.x + dist * n.x, q.y + dist * n.y);
1904
+ var nrot = linerect.rotRad + Math.PI;
1905
+ if (nrot >= Math.PI) nrot -= Math.PI * 2;
1906
+ var o = itemrectInfo(h.x + n.x * (curItemRect && curItemRect.size.height / 2), h.y + n.y * (curItemRect && curItemRect.size.height / 2), nrot, curItemRect && curItemRect.size, curItemRect && curItemRect.layoutpos, curItemRect && curItemRect.is_corner);
1907
+ allCurSnap.push(o);
1908
+ nrot = nrot + Math.PI;
1909
+ o = itemrectInfo(h.x - n.x * (curItemRect && curItemRect.size.height / 2 + thick), h.y - n.y * (curItemRect && curItemRect.size.height / 2 + thick), nrot, curItemRect && curItemRect.size, curItemRect && curItemRect.layoutpos, curItemRect && curItemRect.is_corner);
1910
+ allCurSnap.push(o);
1911
+ });
1912
+ return allCurSnap;
1913
+ }
1914
+ function clone_point(pt) {
1915
+ return point(pt.x, pt.y);
1916
+ }
1917
+ function dotprod(v0, v1) {
1918
+ return v0.x * v1.x + v0.y * v1.y;
1919
+ }
1920
+
1921
+ //////////
1922
+ function validInterSect(rect, val) {
1923
+ var curitem = getCalcRectFromItem(val);
1924
+ var datas = [];
1925
+ rect.forEach(function (line) {
1926
+ datas.push(line);
1927
+ });
1928
+ for (var i = 0; i < datas.length; i++) {
1929
+ var data = datas[i];
1930
+ var containrect = intersectRect(data.rect, curitem.rect);
1931
+ if (containrect) {
1932
+ return false;
1933
+ }
1934
+ }
1935
+ return true;
1936
+ }
1937
+ var lineRect = function lineRect(layer) {
1938
+ var areainfo = [];
1939
+ layer.areas.forEach(function (area) {
1940
+ var sz = area.vertices.size;
1941
+ for (var i = 0; i < sz; i++) {
1942
+ areainfo.push(area.vertices.get(i));
1943
+ }
1944
+ });
1945
+ var rect = [];
1946
+ areainfo.forEach(function (area) {
1947
+ var vert = layer.vertices.get(area);
1948
+ rect.push(vert.x, vert.y);
1949
+ });
1950
+ return rect;
1951
+ };
1952
+ function getAllHoleRect(scene, val) {
1953
+ var layerID = scene.selectedLayer;
1954
+ var layer = scene.layers.get(layerID);
1955
+ var selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
1956
+ if (selectedItem !== undefined) {
1957
+ if (selectedItem.category != 'cabinet') {
1958
+ // If selected Item type is not `cabinet` then do not snap at windows
1959
+ return {
1960
+ isSect: true,
1961
+ snap: null
1962
+ };
1963
+ }
1964
+ } else {
1965
+ return {
1966
+ isSect: false,
1967
+ snap: null
1968
+ };
1969
+ }
1970
+ var holes = [];
1971
+ var itemRect = getCalcRectFromItem(val);
1972
+ layer.lines.forEach(function (line) {
1973
+ line.holes.forEach(function (holeID) {
1974
+ var hole = layer.holes.get(holeID);
1975
+ holes.push(hole);
1976
+ });
1977
+ });
1978
+ var i = 0;
1979
+ for (; i < holes.length; i++) {
1980
+ var twidth = holes[i].properties.getIn(['width', 'length']);
1981
+ var theight = holes[i].properties.getIn(['thickness', 'length']) + 1;
1982
+ var tdepth = holes[i].properties.getIn(['altitude', 'length']);
1983
+ //let trot = holes[i].rotation;
1984
+ var verticeIDs = scene.getIn(['layers', layerID, 'lines', holes[i].line, 'vertices'])._tail.array;
1985
+ var vertice0 = scene.getIn(['layers', layerID, 'vertices', verticeIDs[0]]);
1986
+ var vertice1 = scene.getIn(['layers', layerID, 'vertices', verticeIDs[1]]);
1987
+ var point0 = {
1988
+ x: vertice0.x,
1989
+ y: vertice0.y
1990
+ };
1991
+ var point1 = {
1992
+ x: vertice1.x,
1993
+ y: vertice1.y
1994
+ };
1995
+ var rotation = Math.atan2(point1.y - point0.y, point1.x - point0.x);
1996
+ var rectInfo = getCalcRectFromLine(point1.x, point1.y, point0.x, point0.y, _constants.LINE_THICKNESS, layer);
1997
+ var vN = point(rectInfo.rect[0].x - rectInfo.rect[3].x, rectInfo.rect[0].y - rectInfo.rect[3].y);
1998
+ var lenN = Math.sqrt(vN.x * vN.x + vN.y * vN.y);
1999
+ vN.x /= lenN;
2000
+ vN.y /= lenN;
2001
+ var hx = holes[i].x;
2002
+ var hy = holes[i].y;
2003
+ hx += theight / 2 * vN.x;
2004
+ hy += theight / 2 * vN.y;
2005
+ var tval = {
2006
+ pos: {
2007
+ x: hx,
2008
+ y: hy
2009
+ },
2010
+ rotRad: rotation
2011
+ };
2012
+ tval.size = {
2013
+ width: twidth,
2014
+ height: theight
2015
+ };
2016
+ var hole_rect = getCalcRectFromItem(tval);
2017
+ if (intersectRect(itemRect.rect, hole_rect.rect)) {
2018
+ if (tdepth > itemRect.size.depth && itemRect.layoutpos !== _constants.WALL_CABINET_LAYOUTPOS) {
2019
+ var dist = itemRect.size.height / 2 + theight / 2;
2020
+ var snap = [];
2021
+ var p0 = {
2022
+ x: hx + dist * Math.cos(rotation + Math.PI / 2),
2023
+ y: hy + dist * Math.sin(rotation + Math.PI / 2)
2024
+ };
2025
+ var p1 = {
2026
+ x: hx - dist * Math.cos(rotation + Math.PI / 2),
2027
+ y: hy - dist * Math.sin(rotation + Math.PI / 2)
2028
+ };
2029
+ var allArea = getAllArea(layer);
2030
+ if (isPointInArea(allArea, p0)) {
2031
+ snap.push(p0);
2032
+ }
2033
+ if (isPointInArea(allArea, p1)) {
2034
+ snap.push(p1);
2035
+ }
2036
+ return {
2037
+ isSect: true,
2038
+ snap: snap
2039
+ };
2040
+ } else return {
2041
+ isSect: false,
2042
+ snap: null
2043
+ };
2044
+ }
2045
+ }
2046
+ return {
2047
+ isSect: true,
2048
+ snap: null
2049
+ };
2050
+ }
2051
+ function getHoleItems(layer) {
2052
+ var holeItems = [];
2053
+ layer.holes.map(function (hole) {
2054
+ var width = hole.properties.getIn(['width', 'length']);
2055
+ var altitude = hole.properties.getIn(['altitude', 'length']);
2056
+ holeItems.push({
2057
+ x: hole.x,
2058
+ y: hole.y,
2059
+ width: width,
2060
+ altitude: altitude
2061
+ });
2062
+ });
2063
+ return holeItems;
2064
+ }
2065
+ function needSnap(curItem, othItem) {
2066
+ var blSnap = false;
2067
+ if (curItem == undefined || curItem == null) return false;
2068
+ var altitude = curItem.selectedItem.properties.get('altitude');
2069
+ var heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2070
+ var height = curItem.cat.info.sizeinfo.height;
2071
+ var currentItem = {
2072
+ heightFromFloor: heightFromFloor,
2073
+ height: height
2074
+ };
2075
+ altitude = othItem.item.properties.get('altitude');
2076
+ heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2077
+ height = othItem.cat && othItem.cat.info.sizeinfo.height;
2078
+ var otherItem = {
2079
+ heightFromFloor: heightFromFloor,
2080
+ height: height
2081
+ };
2082
+ var curFloor = currentItem.heightFromFloor;
2083
+ var otherFloor = otherItem.heightFromFloor;
2084
+ var delta;
2085
+ curFloor > otherFloor ? delta = otherItem.height : delta = currentItem.height;
2086
+ if (Math.abs(curFloor - otherFloor) < delta) blSnap = true;
2087
+ if (curItem.cat.hasOwnProperty('long_name') || othItem.cat && othItem.cat.hasOwnProperty('long_name')) {
2088
+ if (curItem.cat.long_name.includes('Hood') || othItem.cat && othItem.cat.long_name.includes('Hood')) blSnap = true;
2089
+ if (curItem.cat.long_name.includes('Hood') && othItem.cat && othItem.cat.long_name.includes('Base Cabinet') || curItem.cat.long_name.includes('Base Cabinet') && othItem.cat && othItem.cat.long_name.includes('Hood')) blSnap = false;
2090
+ if (curItem.cat.long_name.includes('Cook Top') && othItem.cat && othItem.cat.long_name.includes('Cabinet') || curItem.cat.long_name.includes('Cabinet') && othItem.cat && othItem.cat.long_name.includes('Cook Top')) blSnap = true;
2091
+ }
2092
+ return blSnap;
2093
+ }
2094
+ function isFrontWall(v0, v1) {
2095
+ var x1 = v0.x,
2096
+ y1 = v0.y;
2097
+ var x2 = v1.x,
2098
+ y2 = v1.y;
2099
+ var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2100
+ return almostEqual(y1, y2) && x1 < x2 || -Math.PI / 2 < alpha && alpha < Math.PI / 2;
2101
+ }
2102
+ function isBackWall(v0, v1) {
2103
+ var x1 = v0.x,
2104
+ y1 = v0.y;
2105
+ var x2 = v1.x,
2106
+ y2 = v1.y;
2107
+ var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2108
+ return almostEqual(y1, y2) && x1 > x2 || -Math.PI / 2 > alpha || alpha > Math.PI / 2;
2109
+ }
2110
+ function isLeftWall(v0, v1) {
2111
+ var x1 = v0.x,
2112
+ y1 = v0.y;
2113
+ var x2 = v1.x,
2114
+ y2 = v1.y;
2115
+ var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2116
+ return almostEqual(x1, x2) && y1 < y2 || Math.PI > alpha && alpha > 0;
2117
+ }
2118
+ function isRightWall(v0, v1) {
2119
+ var x1 = v0.x,
2120
+ y1 = v0.y;
2121
+ var x2 = v1.x,
2122
+ y2 = v1.y;
2123
+ var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2124
+ return almostEqual(x1, x2) && y1 > y2 || -Math.PI < alpha && alpha < 0;
2125
+ }
2126
+
2127
+ /**
2128
+ * Calculate the overlapping relationship of two lines
2129
+ * @param {*} srcLine // source line
2130
+ * @param {*} destLine // destination line
2131
+ * @returns overlapping status (OVERLAP_NONE | OVERLAP_SAME | OVERLAP_LINK | OVERLAP_INCLUDED | OVERLAP_SOME) and line segments of srcLine which broken with destLine
2132
+ * OVERLAP_NONE: two lines are not overlapped
2133
+ * OVERLAP_SAME: the start point and endpoint of two lines are same
2134
+ * OVERLAP_LINK: two lines are linked at the common point, so they can be merged to one line
2135
+ * OVERLAP_INCLUDED: destLine includes srcLine
2136
+ * OVERLAP_SOME: two lines are overlapped with some common range, then returns the trimmed segments of srcLine
2137
+ *
2138
+ * //////// test - start /////////////
2139
+ const p1 = { x1: 1413.1313131313132, y1: 1044.949494949495 };
2140
+ const p2 = { x1: 1476.2626262626263, y1: 1108.0808080808079 };
2141
+ const p3 = { x1: 1596.969696969697, y1: 1228.7878787878785 };
2142
+ const p4 = { x1: 1664.1414141414139, y1: 1295.9595959595958 };
2143
+ const tempRet = GeometryUtils.relationshipOfTwoOverlappedLines(
2144
+ { x1: p3.x1, y1: p3.y1, x2: p1.x1, y2: p1.y1 },
2145
+ { x1: p1.x1, y1: p1.y1, x2: p3.x1, y2: p3.y1 }
2146
+ );
2147
+ console.log(tempRet);
2148
+ //////// test - end /////////////
2149
+
2150
+ */
2151
+ function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2152
+ // let res1 = relationshipOfTwoOverlappedLines1(srcLine, destLine);
2153
+ var res2 = relationshipOfTwoOverlappedLines2(srcLine, destLine);
2154
+ // if (res1.result !== 0 || res2.result !== 0) {
2155
+ // console.group(res1.result);
2156
+ // console.log(res1);
2157
+ // console.log(res2);
2158
+ // console.log(srcLine, destLine);
2159
+ // console.groupEnd();
2160
+ // }
2161
+ return res2;
2162
+ }
2163
+ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2164
+ var p1 = {
2165
+ x: srcLine.x1,
2166
+ y: srcLine.y1
2167
+ };
2168
+ var p2 = {
2169
+ x: srcLine.x2,
2170
+ y: srcLine.y2
2171
+ };
2172
+ var p3 = {
2173
+ x: destLine.x1,
2174
+ y: destLine.y1
2175
+ };
2176
+ var p4 = {
2177
+ x: destLine.x2,
2178
+ y: destLine.y2
2179
+ };
2180
+ var x1 = p1.x,
2181
+ y1 = p1.y;
2182
+ var x2 = p2.x,
2183
+ y2 = p2.y;
2184
+ var x3 = p3.x,
2185
+ y3 = p3.y;
2186
+ var x4 = p4.x,
2187
+ y4 = p4.y;
2188
+ var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
2189
+ var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
2190
+ var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
2191
+ if ((0, _math.fAbs)(denom) <= _constants.EPSILON) {
2192
+ if ((0, _math.fAbs)(numA) <= _constants.EPSILON && (0, _math.fAbs)(numB) <= _constants.EPSILON) {
2193
+ var comparator = function comparator(pa, pb) {
2194
+ return (0, _math.fAbs)(pa.x - pb.x) <= _constants.EPSILON ? pa.y - pb.y : pa.x - pb.x;
2195
+ };
2196
+ var line0 = [p1, p2].sort(comparator);
2197
+ var line1 = [p3, p4].sort(comparator);
2198
+ var isReversedSrcLineDirection = false;
2199
+ if (line0[0].x === srcLine.x2 && line0[0].y === srcLine.y2) isReversedSrcLineDirection = true;
2200
+ var _sort3 = [line0, line1].sort(function (lineA, lineB) {
2201
+ return comparator(lineA[0], lineB[0]);
2202
+ }),
2203
+ _sort4 = (0, _slicedToArray2["default"])(_sort3, 2),
2204
+ lineSX = _sort4[0],
2205
+ lineDX = _sort4[1];
2206
+ var isReversedSrcLineIdx = false;
2207
+ if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true;
2208
+ var compare0 = comparator(lineSX[0], lineDX[0]);
2209
+ var compare1 = comparator(lineSX[1], lineDX[0]);
2210
+ var compare2 = comparator(lineSX[1], lineDX[1]);
2211
+ if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && _export.MathUtils.fAbs(compare2) < _constants.EPSILON) {
2212
+ return {
2213
+ result: _constants.OVERLAP_SAME
2214
+ };
2215
+ } else if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && compare2 < 0) {
2216
+ // lineDX includes lineSX
2217
+ if (!isReversedSrcLineIdx) {
2218
+ // dest === lineDX : dest includes src
2219
+ // return OVERLAP_INCLUDED; // lineSX[1] - lineDX[1]
2220
+ return {
2221
+ result: _constants.OVERLAP_INCLUDED
2222
+ };
2223
+ }
2224
+ // else {
2225
+ // // src includes dest
2226
+ // // return OVERLAP_SOME; // lineSX[1] - lineDX[1]
2227
+ // return {
2228
+ // result: OVERLAP_SOME,
2229
+ // trimmedSegs: {
2230
+ // x1: lineSX[1].x,
2231
+ // y1: lineSX[1].y,
2232
+ // x2: lineDX[1].x,
2233
+ // y2: lineDX[1].y
2234
+ // }
2235
+ // };
2236
+ // }
2237
+ }
2238
+ if (_export.MathUtils.fAbs(compare1) < _constants.EPSILON) {
2239
+ // return OVERLAP_LINK; // lineSX[1]
2240
+ return {
2241
+ result: _constants.OVERLAP_LINK,
2242
+ linkedLine: {
2243
+ x1: isReversedSrcLineDirection ? lineDX[1].x : lineSX[0].x,
2244
+ y1: isReversedSrcLineDirection ? lineDX[1].y : lineSX[0].y,
2245
+ x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[1].x,
2246
+ y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[1].y
2247
+ }
2248
+ };
2249
+ } else if (compare1 < 0) {
2250
+ return {
2251
+ result: _constants.OVERLAP_NONE
2252
+ };
2253
+ } else {
2254
+ if (_export.MathUtils.fAbs(compare2) < _constants.EPSILON || compare2 > 0) {
2255
+ // lineSX includes lineDX
2256
+ if (isReversedSrcLineIdx) {
2257
+ // dest === lineSX : dest includes src
2258
+ // return OVERLAP_INCLUDED; // lineDX[0] - lineDX[1]
2259
+ return {
2260
+ result: _constants.OVERLAP_INCLUDED
2261
+ };
2262
+ } else {
2263
+ // dest === lineDX : src includes dest
2264
+ var trimmedSegs = [];
2265
+ // return OVERLAP_SOME; // lineSX[0] - lineDX[0], lineDX[1] - lineSX[1]
2266
+ if (compare0 < 0) trimmedSegs.push({
2267
+ x1: isReversedSrcLineDirection ? lineDX[0].x : lineSX[0].x,
2268
+ y1: isReversedSrcLineDirection ? lineDX[0].y : lineSX[0].y,
2269
+ x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[0].x,
2270
+ y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[0].y
2271
+ });
2272
+ if (compare2 > 0) trimmedSegs.push({
2273
+ x1: isReversedSrcLineDirection ? lineSX[1].x : lineDX[1].x,
2274
+ y1: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y,
2275
+ x2: isReversedSrcLineDirection ? lineDX[1].x : lineSX[1].x,
2276
+ y2: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y
2277
+ });
2278
+ return {
2279
+ result: _constants.OVERLAP_SOME,
2280
+ trimmedSegs: trimmedSegs
2281
+ };
2282
+ }
2283
+ }
2284
+ if (compare2 < 0) {
2285
+ // return OVERLAP_SOME; // lineSX[0] - lineDX[0], lineSX[1] - lineDX[1]
2286
+ var _trimmedSegs = [];
2287
+ if (compare0 < 0 && !isReversedSrcLineIdx) _trimmedSegs.push({
2288
+ x1: isReversedSrcLineDirection ? lineDX[0].x : lineSX[0].x,
2289
+ y1: isReversedSrcLineDirection ? lineDX[0].y : lineSX[0].y,
2290
+ x2: isReversedSrcLineDirection ? lineSX[0].x : lineDX[0].x,
2291
+ y2: isReversedSrcLineDirection ? lineSX[0].y : lineDX[0].y
2292
+ });
2293
+ if (compare2 < 0 && isReversedSrcLineIdx) _trimmedSegs.push({
2294
+ x1: isReversedSrcLineDirection ? lineDX[1].x : lineSX[1].x,
2295
+ y1: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y,
2296
+ x2: isReversedSrcLineDirection ? lineSX[1].x : lineDX[1].x,
2297
+ y2: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y
2298
+ });
2299
+ return {
2300
+ result: _constants.OVERLAP_SOME,
2301
+ trimmedSegs: _trimmedSegs
2302
+ };
2303
+ }
2304
+ }
2305
+ }
2306
+ }
2307
+ return {
2308
+ result: _constants.OVERLAP_NONE
2309
+ };
2310
+ }
2311
+ function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2312
+ var INFINITY = 1000000;
2313
+ var ZERO_DELTA = 0.01;
2314
+ // geometric equation of srcLine
2315
+ var dx1 = srcLine.x2 - srcLine.x1;
2316
+ dx1 = _export.MathUtils.fAbs(dx1) < ZERO_DELTA ? 0 : dx1;
2317
+ var dy1 = srcLine.y2 - srcLine.y1;
2318
+ dy1 = _export.MathUtils.fAbs(dy1) < ZERO_DELTA ? 0 : dy1;
2319
+ var a1 = dx1 === 0 ? INFINITY : dy1 / dx1;
2320
+ var b1 = a1 === INFINITY ? srcLine.x1 : srcLine.y1 - a1 * srcLine.x1;
2321
+ // geometric equation of destLine
2322
+ var dx2 = destLine.x2 - destLine.x1;
2323
+ dx2 = _export.MathUtils.fAbs(dx2) < ZERO_DELTA ? 0 : dx2;
2324
+ var dy2 = destLine.y2 - destLine.y1;
2325
+ dy2 = _export.MathUtils.fAbs(dy2) < ZERO_DELTA ? 0 : dy2;
2326
+ var a2 = dx2 === 0 ? INFINITY : dy2 / dx2;
2327
+ var b2 = a2 === INFINITY ? destLine.x1 : destLine.y1 - a2 * destLine.x1;
2328
+ if (_export.MathUtils.fAbs(_export.MathUtils.fAbs(a1) - _export.MathUtils.fAbs(a2)) > ZERO_DELTA)
2329
+ // two lines are not parallel
2330
+ return {
2331
+ result: _constants.OVERLAP_NONE
2332
+ };
2333
+ if (_export.MathUtils.fAbs(_export.MathUtils.fAbs(b1) - _export.MathUtils.fAbs(b2)) > ZERO_DELTA)
2334
+ // two lines are parallel but not overlap
2335
+ return {
2336
+ result: _constants.OVERLAP_NONE
2337
+ };
2338
+
2339
+ // parametric equation of destLine
2340
+ var sk1 = dx1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.x1 - srcLine.x1) / dx1, 3);
2341
+ var sk2 = dy1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.y1 - srcLine.y1) / dy1, 3);
2342
+ var ek1 = dx1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.x2 - srcLine.x1) / dx1, 3);
2343
+ var ek2 = dy1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.y2 - srcLine.y1) / dy1, 3);
2344
+ if (sk1 !== INFINITY && sk2 !== INFINITY && ek1 !== INFINITY && ek2 !== INFINITY && (sk1 !== sk2 || ek1 !== ek2))
2345
+ // destLine does not overlap with srcLine
2346
+ return {
2347
+ result: _constants.OVERLAP_NONE
2348
+ };
2349
+
2350
+ // parameter of destLine on the start and end points
2351
+ var sk = Math.min(sk1, sk2);
2352
+ if (Math.abs(sk) < 0.05) sk = 0;else if (Math.abs(Math.abs(sk) - 1) < 0.05) sk = 1;
2353
+ var ek = Math.abs(Math.min(ek1, ek2)) > 0.05 ? Math.min(ek1, ek2) : 0;
2354
+ if (Math.abs(ek) < 0.05) ek = 0;else if (Math.abs(Math.abs(ek) - 1) < 0.05) ek = 1;
2355
+ // let ek = Math.min(ek1, ek2);
2356
+
2357
+ // check the relationship between srcLine and destLine
2358
+ if (sk < 0 && ek < 0 || sk > 1 && ek > 1)
2359
+ // not overlap
2360
+ return {
2361
+ result: _constants.OVERLAP_NONE
2362
+ };
2363
+ if (sk === 0 && ek === 1 || sk === 1 && ek === 0)
2364
+ // same lines
2365
+ return {
2366
+ result: _constants.OVERLAP_SAME
2367
+ };
2368
+ if (sk <= 0 && ek >= 1 || sk >= 1 && ek <= 0)
2369
+ // destLine includes srcLine
2370
+ return {
2371
+ result: _constants.OVERLAP_INCLUDED
2372
+ };
2373
+ if (sk === 0 && ek < 0 || sk === 1 && ek > 1 || ek === 0 && sk < 0 || ek === 1 && sk > 1) {
2374
+ // linked with one common point
2375
+ var linkedLine;
2376
+ if (sk === 0 && ek < 0) {
2377
+ // destE destS srcS srcE
2378
+ // |----------|------------|
2379
+ linkedLine = {
2380
+ x1: destLine.x2,
2381
+ y1: destLine.y2,
2382
+ x2: srcLine.x2,
2383
+ y2: srcLine.y2
2384
+ };
2385
+ } else if (sk === 1 && ek > 1) {
2386
+ // srcS srcE destS destE
2387
+ // |----------|------------|
2388
+ linkedLine = {
2389
+ x1: srcLine.x1,
2390
+ y1: srcLine.y1,
2391
+ x2: destLine.x2,
2392
+ y2: destLine.y2
2393
+ };
2394
+ } else if (ek === 0 && sk < 0) {
2395
+ // destS destE srcS srcE
2396
+ // |----------|------------|
2397
+ linkedLine = {
2398
+ x1: destLine.x1,
2399
+ y1: destLine.y1,
2400
+ x2: srcLine.x2,
2401
+ y2: srcLine.y2
2402
+ };
2403
+ } else if (ek === 1 && sk > 1) {
2404
+ // srcS srcE destE destS
2405
+ // |----------|------------|
2406
+ linkedLine = {
2407
+ x1: srcLine.x1,
2408
+ y1: srcLine.y1,
2409
+ x2: destLine.x1,
2410
+ y2: destLine.y1
2411
+ };
2412
+ }
2413
+ return {
2414
+ result: _constants.OVERLAP_LINK,
2415
+ linkedLine: linkedLine
2416
+ };
2417
+ }
2418
+ var trimmedSegment1 = null;
2419
+ var trimmedSegment2 = null;
2420
+ var ret = {
2421
+ result: _constants.OVERLAP_SOME,
2422
+ trimmedSegs: []
2423
+ };
2424
+ if (0 <= sk && sk <= 1 && 0 <= ek && ek <= 1) {
2425
+ // srcLine includes destLine
2426
+ if (sk < ek) {
2427
+ // srcS destS destE srcE
2428
+ // |------|---------|-------|
2429
+ if (sk > 0) trimmedSegment1 = {
2430
+ x1: srcLine.x1,
2431
+ y1: srcLine.y1,
2432
+ x2: destLine.x1,
2433
+ y2: destLine.y1
2434
+ };
2435
+ if (ek < 1) trimmedSegment2 = {
2436
+ x1: destLine.x2,
2437
+ y1: destLine.y2,
2438
+ x2: srcLine.x2,
2439
+ y2: srcLine.y2
2440
+ };
2441
+ } else {
2442
+ // srcS destE destS srcE
2443
+ // |------|---------|-------|
2444
+ if (ek > 0) trimmedSegment1 = {
2445
+ x1: srcLine.x1,
2446
+ y1: srcLine.y1,
2447
+ x2: destLine.x2,
2448
+ y2: destLine.y2
2449
+ };
2450
+ if (sk < 1) trimmedSegment2 = {
2451
+ x1: destLine.x1,
2452
+ y1: destLine.y1,
2453
+ x2: srcLine.x2,
2454
+ y2: srcLine.y2
2455
+ };
2456
+ }
2457
+ } else {
2458
+ // srcLine and destLine are overlapped with some range
2459
+ if (sk < 0) {
2460
+ // destS srcS destE srcE
2461
+ // |------|---------|-------|
2462
+ trimmedSegment1 = {
2463
+ x1: destLine.x2,
2464
+ y1: destLine.y2,
2465
+ x2: srcLine.x2,
2466
+ y2: srcLine.y2
2467
+ };
2468
+ } else if (ek < 0) {
2469
+ // destE srcS destS srcE
2470
+ // |------|---------|-------|
2471
+ trimmedSegment1 = {
2472
+ x1: destLine.x1,
2473
+ y1: destLine.y1,
2474
+ x2: srcLine.x2,
2475
+ y2: srcLine.y2
2476
+ };
2477
+ } else if (sk > 1) {
2478
+ // srcS destE srcE destS
2479
+ // |------|---------|-------|
2480
+ trimmedSegment1 = {
2481
+ x1: srcLine.x1,
2482
+ y1: srcLine.y1,
2483
+ x2: destLine.x2,
2484
+ y2: destLine.y2
2485
+ };
2486
+ } else if (ek > 1) {
2487
+ // srcS destS srcE destE
2488
+ // |------|---------|-------|
2489
+ trimmedSegment1 = {
2490
+ x1: srcLine.x1,
2491
+ y1: srcLine.y1,
2492
+ x2: destLine.x1,
2493
+ y2: destLine.y1
2494
+ };
2495
+ }
2496
+ }
2497
+ if (trimmedSegment1 !== null) ret.trimmedSegs.push(trimmedSegment1);
2498
+ if (trimmedSegment2 !== null) ret.trimmedSegs.push(trimmedSegment2);
2499
+ return ret;
2500
+ }
2501
+
2502
+ /**
2503
+ *
2504
+ * @param {Array} points points of polygon [[x0, y0], [x1, y1], ...]
2505
+ * @returns {Array} { x, y } position of centroid
2506
+ */
2507
+ function getCentroidOfPolygon(points) {
2508
+ var centroid = points.reduce(function (x, y) {
2509
+ return [x[0] + y[0] / points.length, x[1] + y[1] / points.length];
2510
+ }, [0, 0]);
2511
+ return {
2512
+ x: centroid[0],
2513
+ y: centroid[1]
2514
+ };
2515
+ }
2516
+
2517
+ /**
2518
+ * Return the polygon points of room
2519
+ * @param {Object} layer
2520
+ * @returns {Array} polygon points [x0, y0, x1, y1, ... ]
2521
+ */
2522
+ function getPoylgonPoints(layer) {
2523
+ var _layer$areas;
2524
+ var areainfo = [];
2525
+ (_layer$areas = layer.areas) === null || _layer$areas === void 0 || _layer$areas.forEach(function (area) {
2526
+ var _area$vertices;
2527
+ var sz = (_area$vertices = area.vertices) === null || _area$vertices === void 0 ? void 0 : _area$vertices.size;
2528
+ for (var i = 0; i < sz; i++) {
2529
+ areainfo.push(area.vertices.get(i));
2530
+ }
2531
+ });
2532
+ var rect = [];
2533
+ areainfo.forEach(function (area) {
2534
+ var _layer$vertices;
2535
+ var vert = (_layer$vertices = layer.vertices) === null || _layer$vertices === void 0 ? void 0 : _layer$vertices.get(area);
2536
+ rect.push(vert === null || vert === void 0 ? void 0 : vert.x, vert === null || vert === void 0 ? void 0 : vert.y);
2537
+ });
2538
+ return rect;
2539
+ }
2540
+ function validRect(itemRect, rects) {
2541
+ var updatedItemRect = getCalcRectFromItem(itemRect);
2542
+ return rects.every(function (rect) {
2543
+ return !intersectRect(rect.rect, updatedItemRect.rect);
2544
+ });
2545
+ }