kitchen-simulator 5.10.2-react.18 → 5.10.4-react.18

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 (579) hide show
  1. package/es/@history.js +2 -0
  2. package/es/AppContext.js +6 -0
  3. package/es/LiteKitchenConfigurator.js +474 -0
  4. package/es/LiteRenderer.js +363 -0
  5. package/es/WorkSpace.js +851 -0
  6. package/es/actions/area-actions.js +14 -0
  7. package/es/actions/export.js +23 -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 +316 -0
  11. package/es/actions/lines-actions.js +83 -0
  12. package/es/actions/project-actions.js +298 -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/assets/brown_photostudio_02_1k.hdr +0 -0
  18. package/es/assets/fonts/Rene Bieder Milliard Black Italic.woff +0 -0
  19. package/es/assets/fonts/Rene Bieder Milliard Black.woff +0 -0
  20. package/es/assets/fonts/Rene Bieder Milliard Bold Italic.woff +0 -0
  21. package/es/assets/fonts/Rene Bieder Milliard Bold.woff +0 -0
  22. package/es/assets/fonts/Rene Bieder Milliard Book Italic.woff +0 -0
  23. package/es/assets/fonts/Rene Bieder Milliard Book.woff +0 -0
  24. package/es/assets/fonts/Rene Bieder Milliard ExtraBold Italic.woff +0 -0
  25. package/es/assets/fonts/Rene Bieder Milliard ExtraBold.woff +0 -0
  26. package/es/assets/fonts/Rene Bieder Milliard ExtraLight Italic.woff +0 -0
  27. package/es/assets/fonts/Rene Bieder Milliard ExtraLight.woff +0 -0
  28. package/es/assets/fonts/Rene Bieder Milliard Hairline Italic.woff +0 -0
  29. package/es/assets/fonts/Rene Bieder Milliard Hairline.woff +0 -0
  30. package/es/assets/fonts/Rene Bieder Milliard Heavy Italic.woff +0 -0
  31. package/es/assets/fonts/Rene Bieder Milliard Heavy.woff +0 -0
  32. package/es/assets/fonts/Rene Bieder Milliard Light Italic.woff +0 -0
  33. package/es/assets/fonts/Rene Bieder Milliard Light.woff +0 -0
  34. package/es/assets/fonts/Rene Bieder Milliard Medium Italic.woff +0 -0
  35. package/es/assets/fonts/Rene Bieder Milliard Medium.woff +0 -0
  36. package/es/assets/fonts/Rene Bieder Milliard SemiBold Italic.woff +0 -0
  37. package/es/assets/fonts/Rene Bieder Milliard SemiBold.woff +0 -0
  38. package/es/assets/fonts/Rene Bieder Milliard Thin Italic.woff +0 -0
  39. package/es/assets/fonts/Rene Bieder Milliard Thin.woff +0 -0
  40. package/es/assets/fonts/style.css +177 -0
  41. package/es/assets/gltf/door_closet.bin +0 -0
  42. package/es/assets/gltf/door_closet.fbx +0 -0
  43. package/es/assets/gltf/door_closet.gltf +1 -0
  44. package/es/assets/gltf/door_exterior.bin +0 -0
  45. package/es/assets/gltf/door_exterior.fbx +0 -0
  46. package/es/assets/gltf/door_exterior.gltf +1 -0
  47. package/es/assets/gltf/door_interior.bin +0 -0
  48. package/es/assets/gltf/door_interior.fbx +0 -0
  49. package/es/assets/gltf/door_interior.gltf +1 -0
  50. package/es/assets/gltf/door_sliding.bin +0 -0
  51. package/es/assets/gltf/door_sliding.fbx +0 -0
  52. package/es/assets/gltf/door_sliding.gltf +1 -0
  53. package/es/assets/gltf/doorway_framed.bin +0 -0
  54. package/es/assets/gltf/doorway_framed.fbx +0 -0
  55. package/es/assets/gltf/doorway_framed.gltf +1 -0
  56. package/es/assets/gltf/window_clear.bin +0 -0
  57. package/es/assets/gltf/window_clear.fbx +0 -0
  58. package/es/assets/gltf/window_clear.gltf +1 -0
  59. package/es/assets/gltf/window_cross.bin +0 -0
  60. package/es/assets/gltf/window_cross.fbx +0 -0
  61. package/es/assets/gltf/window_cross.gltf +1 -0
  62. package/es/assets/gltf/window_double_hung.bin +0 -0
  63. package/es/assets/gltf/window_double_hung.fbx +0 -0
  64. package/es/assets/gltf/window_double_hung.gltf +1 -0
  65. package/es/assets/gltf/window_vertical.bin +0 -0
  66. package/es/assets/gltf/window_vertical.fbx +0 -0
  67. package/es/assets/gltf/window_vertical.gltf +1 -0
  68. package/es/assets/img/TKC_thumbnail.png +0 -0
  69. package/es/assets/img/Toggle.png +0 -0
  70. package/es/assets/img/loading/loading.gif +0 -0
  71. package/es/assets/img/loading/loading_1.svg +11 -0
  72. package/es/assets/img/loading_large.gif +0 -0
  73. package/es/assets/img/png/door/closet.png +0 -0
  74. package/es/assets/img/png/door/doorwaysframed.png +0 -0
  75. package/es/assets/img/png/door/doorwaysframeles.png +0 -0
  76. package/es/assets/img/png/door/doorwaysframeless.png +0 -0
  77. package/es/assets/img/png/door/exterior.png +0 -0
  78. package/es/assets/img/png/door/interior.png +0 -0
  79. package/es/assets/img/png/door/sliding.png +0 -0
  80. package/es/assets/img/png/helper/outcome.png +0 -0
  81. package/es/assets/img/png/helper/video_preview_3d.png +0 -0
  82. package/es/assets/img/png/helper/video_preview_start.png +0 -0
  83. package/es/assets/img/project_img.png +0 -0
  84. package/es/assets/img/rta/rta_logo_box_blue.jpg +0 -0
  85. package/es/assets/img/rta/rta_logo_box_blue_ico.jpg +0 -0
  86. package/es/assets/img/rta/rta_logo_box_blue_ico.svg +55 -0
  87. package/es/assets/img/rta/rta_logo_box_darkGray.jpg +0 -0
  88. package/es/assets/img/rta/rta_logo_box_lightblue.png +0 -0
  89. package/es/assets/img/rta/rta_logo_box_lightmaroon.png +0 -0
  90. package/es/assets/img/rta/rta_logo_box_maroon.png +0 -0
  91. package/es/assets/img/rta/rta_logo_box_white.png +0 -0
  92. package/es/assets/img/rta_menu.png +0 -0
  93. package/es/assets/img/step2.jpg +0 -0
  94. package/es/assets/img/step3.jpg +0 -0
  95. package/es/assets/img/step4.jpg +0 -0
  96. package/es/assets/img/step5.jpg +0 -0
  97. package/es/assets/img/step6.jpg +0 -0
  98. package/es/assets/img/step7.jpg +0 -0
  99. package/es/assets/img/step8.jpg +0 -0
  100. package/es/assets/img/svg/2d_delete_object.svg +33 -0
  101. package/es/assets/img/svg/2d_delete_object1.svg +33 -0
  102. package/es/assets/img/svg/2d_lock_object.svg +33 -0
  103. package/es/assets/img/svg/3d_item_move.svg +106 -0
  104. package/es/assets/img/svg/3d_item_rotation.svg +76 -0
  105. package/es/assets/img/svg/3d_item_warning_edit.svg +77 -0
  106. package/es/assets/img/svg/3d_item_warning_info.svg +81 -0
  107. package/es/assets/img/svg/accessories.svg +4 -0
  108. package/es/assets/img/svg/angle_icon.svg +39 -0
  109. package/es/assets/img/svg/blank_div.svg +14 -0
  110. package/es/assets/img/svg/bottombar/2d3d_button.svg +3 -0
  111. package/es/assets/img/svg/bottombar/2d3d_button_active.svg +3 -0
  112. package/es/assets/img/svg/bottombar/2d3d_toggle.svg +4 -0
  113. package/es/assets/img/svg/bottombar/2d3d_toggle_active.svg +4 -0
  114. package/es/assets/img/svg/bottombar/arrow-down.svg +3 -0
  115. package/es/assets/img/svg/bottombar/arrow-left.svg +3 -0
  116. package/es/assets/img/svg/bottombar/arrow-minus.svg +3 -0
  117. package/es/assets/img/svg/bottombar/arrow-plus.svg +11 -0
  118. package/es/assets/img/svg/bottombar/arrow-right.svg +3 -0
  119. package/es/assets/img/svg/bottombar/arrow-up.svg +3 -0
  120. package/es/assets/img/svg/bottombar/collapse.svg +3 -0
  121. package/es/assets/img/svg/bottombar/elevation-back.svg +6 -0
  122. package/es/assets/img/svg/bottombar/elevation-front.svg +6 -0
  123. package/es/assets/img/svg/bottombar/elevation-left.svg +6 -0
  124. package/es/assets/img/svg/bottombar/elevation-right.svg +7 -0
  125. package/es/assets/img/svg/bottombar/elevation.svg +13 -0
  126. package/es/assets/img/svg/bottombar/expand.svg +3 -0
  127. package/es/assets/img/svg/bottombar/help.svg +72 -0
  128. package/es/assets/img/svg/bottombar/incm_toggle.svg +39 -0
  129. package/es/assets/img/svg/bottombar/pan_1.svg +57 -0
  130. package/es/assets/img/svg/bottombar/pan_2.svg +27 -0
  131. package/es/assets/img/svg/bottombar/pan_3.svg +27 -0
  132. package/es/assets/img/svg/bottombar/pan_4.svg +27 -0
  133. package/es/assets/img/svg/bottombar/pan_5.svg +27 -0
  134. package/es/assets/img/svg/bottombar/settings.svg +23 -0
  135. package/es/assets/img/svg/bottombar/spin-down.svg +76 -0
  136. package/es/assets/img/svg/bottombar/spin-left.svg +75 -0
  137. package/es/assets/img/svg/bottombar/spin-right.svg +75 -0
  138. package/es/assets/img/svg/bottombar/spin-up.svg +76 -0
  139. package/es/assets/img/svg/bottombar/spin_1.svg +48 -0
  140. package/es/assets/img/svg/bottombar/spin_2.svg +31 -0
  141. package/es/assets/img/svg/bottombar/spin_3.svg +31 -0
  142. package/es/assets/img/svg/bottombar/spin_4.svg +31 -0
  143. package/es/assets/img/svg/bottombar/spin_5.svg +31 -0
  144. package/es/assets/img/svg/bottombar/zoomin.svg +29 -0
  145. package/es/assets/img/svg/bottombar/zoomout.svg +26 -0
  146. package/es/assets/img/svg/check.svg +10 -0
  147. package/es/assets/img/svg/close.svg +11 -0
  148. package/es/assets/img/svg/color/Black.svg +3 -0
  149. package/es/assets/img/svg/color/Blue.svg +3 -0
  150. package/es/assets/img/svg/color/Brown.svg +9 -0
  151. package/es/assets/img/svg/color/Cream.svg +3 -0
  152. package/es/assets/img/svg/color/Dark.svg +9 -0
  153. package/es/assets/img/svg/color/Gray.svg +3 -0
  154. package/es/assets/img/svg/color/Green.svg +3 -0
  155. package/es/assets/img/svg/color/Light.svg +9 -0
  156. package/es/assets/img/svg/color/Medium.svg +9 -0
  157. package/es/assets/img/svg/color/Unfinished.svg +9 -0
  158. package/es/assets/img/svg/color/White.svg +3 -0
  159. package/es/assets/img/svg/color/White.svg.bak +3 -0
  160. package/es/assets/img/svg/color/stone2.jpg +0 -0
  161. package/es/assets/img/svg/color/wood2.jpg +0 -0
  162. package/es/assets/img/svg/copy.svg +11 -0
  163. package/es/assets/img/svg/delete.svg +3 -0
  164. package/es/assets/img/svg/detail.svg +77 -0
  165. package/es/assets/img/svg/disclaimer/background.svg +758 -0
  166. package/es/assets/img/svg/disclaimer/logo-dots.svg +11 -0
  167. package/es/assets/img/svg/door/Closet.svg +11 -0
  168. package/es/assets/img/svg/door/Exterior.svg +5 -0
  169. package/es/assets/img/svg/door/Framed_dorway.svg +5 -0
  170. package/es/assets/img/svg/door/Frameless_dorway.svg +5 -0
  171. package/es/assets/img/svg/door/Interior.svg +7 -0
  172. package/es/assets/img/svg/door/Sliding.svg +5 -0
  173. package/es/assets/img/svg/doors_closet.svg +47 -0
  174. package/es/assets/img/svg/doors_exterior.svg +25 -0
  175. package/es/assets/img/svg/doors_interior.svg +29 -0
  176. package/es/assets/img/svg/doors_patio.svg +26 -0
  177. package/es/assets/img/svg/duplicate.svg +11 -0
  178. package/es/assets/img/svg/duplicate_object_left.svg +32 -0
  179. package/es/assets/img/svg/duplicate_object_right.svg +32 -0
  180. package/es/assets/img/svg/filtersActive.svg +19 -0
  181. package/es/assets/img/svg/firstsetting/L.svg +3 -0
  182. package/es/assets/img/svg/firstsetting/L2.svg +3 -0
  183. package/es/assets/img/svg/firstsetting/Open.svg +3 -0
  184. package/es/assets/img/svg/firstsetting/Square.svg +3 -0
  185. package/es/assets/img/svg/firstsetting/bar-active.svg +9 -0
  186. package/es/assets/img/svg/firstsetting/bar-normal.svg +3 -0
  187. package/es/assets/img/svg/firstsetting/bullet-current.svg +3 -0
  188. package/es/assets/img/svg/firstsetting/bullet-done.svg +3 -0
  189. package/es/assets/img/svg/firstsetting/bullet-not-done.svg +3 -0
  190. package/es/assets/img/svg/firstsetting/check-active.svg +3 -0
  191. package/es/assets/img/svg/firstsetting/check-normal.svg +3 -0
  192. package/es/assets/img/svg/firstsetting/pencil.svg +11 -0
  193. package/es/assets/img/svg/green_checkmark.svg +27 -0
  194. package/es/assets/img/svg/headerbar/assist.svg +3 -0
  195. package/es/assets/img/svg/headerbar/cart.svg +3 -0
  196. package/es/assets/img/svg/headerbar/check.svg +10 -0
  197. package/es/assets/img/svg/headerbar/consult_designer.svg +45 -0
  198. package/es/assets/img/svg/headerbar/edit_name.svg +26 -0
  199. package/es/assets/img/svg/headerbar/file-dollar.svg +13 -0
  200. package/es/assets/img/svg/headerbar/hamburger_menu.svg +32 -0
  201. package/es/assets/img/svg/headerbar/plus.svg +11 -0
  202. package/es/assets/img/svg/headerbar/review_quote.svg +44 -0
  203. package/es/assets/img/svg/headerbar/ruler-measure.svg +11 -0
  204. package/es/assets/img/svg/headerbar/save.svg +3 -0
  205. package/es/assets/img/svg/headerbar/setting.svg +75 -0
  206. package/es/assets/img/svg/help/check.svg +10 -0
  207. package/es/assets/img/svg/help/search.svg +76 -0
  208. package/es/assets/img/svg/intro/1-start-with-floorplan-whole.svg +27 -0
  209. package/es/assets/img/svg/intro/1-start-with-floorplan.svg +26 -0
  210. package/es/assets/img/svg/intro/2-start-from-scratch-whole.svg +28 -0
  211. package/es/assets/img/svg/intro/2-start-from-scratch.svg +27 -0
  212. package/es/assets/img/svg/intro/3-retrieve-project-whole.svg +19 -0
  213. package/es/assets/img/svg/intro/3-retrieve-project.svg +18 -0
  214. package/es/assets/img/svg/invert.svg +127 -0
  215. package/es/assets/img/svg/lefttoolbar/appliance-active.svg +13 -0
  216. package/es/assets/img/svg/lefttoolbar/appliance.svg +13 -0
  217. package/es/assets/img/svg/lefttoolbar/cabinet-active.svg +10 -0
  218. package/es/assets/img/svg/lefttoolbar/cabinet-category.svg +3 -0
  219. package/es/assets/img/svg/lefttoolbar/cabinet-one.svg +3 -0
  220. package/es/assets/img/svg/lefttoolbar/cabinet.svg +10 -0
  221. package/es/assets/img/svg/lefttoolbar/disigner_assistance.svg +89 -0
  222. package/es/assets/img/svg/lefttoolbar/door-style-active.svg +20 -0
  223. package/es/assets/img/svg/lefttoolbar/door-style.svg +20 -0
  224. package/es/assets/img/svg/lefttoolbar/door.svg +12 -0
  225. package/es/assets/img/svg/lefttoolbar/error_icon.svg +81 -0
  226. package/es/assets/img/svg/lefttoolbar/finishing-active.svg +13 -0
  227. package/es/assets/img/svg/lefttoolbar/finishing.svg +13 -0
  228. package/es/assets/img/svg/lefttoolbar/reviewforquote-active.svg +86 -0
  229. package/es/assets/img/svg/lefttoolbar/reviewforquote.svg +12 -0
  230. package/es/assets/img/svg/lefttoolbar/room-shape-L.svg +3 -0
  231. package/es/assets/img/svg/lefttoolbar/room-shape-active.svg +18 -0
  232. package/es/assets/img/svg/lefttoolbar/room-shape-custom.svg +12 -0
  233. package/es/assets/img/svg/lefttoolbar/room-shape-irregular.svg +3 -0
  234. package/es/assets/img/svg/lefttoolbar/room-shape-open.svg +3 -0
  235. package/es/assets/img/svg/lefttoolbar/room-shape-square.svg +3 -0
  236. package/es/assets/img/svg/lefttoolbar/room-shape.svg +18 -0
  237. package/es/assets/img/svg/lefttoolbar/search.svg +76 -0
  238. package/es/assets/img/svg/lefttoolbar/view_more.svg +86 -0
  239. package/es/assets/img/svg/lefttoolbar/warning_icon.svg +81 -0
  240. package/es/assets/img/svg/lefttoolbar/window.svg +12 -0
  241. package/es/assets/img/svg/logo.svg +11 -0
  242. package/es/assets/img/svg/logo_with_text.svg +25 -0
  243. package/es/assets/img/svg/menubar/login.svg +84 -0
  244. package/es/assets/img/svg/menubar/my_projects.svg +85 -0
  245. package/es/assets/img/svg/menubar/new_project.svg +110 -0
  246. package/es/assets/img/svg/menubar/save_project.svg +84 -0
  247. package/es/assets/img/svg/options.svg +3 -0
  248. package/es/assets/img/svg/positioning.svg +3 -0
  249. package/es/assets/img/svg/rotate.png +0 -0
  250. package/es/assets/img/svg/rotate.svg +17 -0
  251. package/es/assets/img/svg/rotate_object_clockwise.svg +26 -0
  252. package/es/assets/img/svg/rotate_object_counterclockwise.svg +26 -0
  253. package/es/assets/img/svg/toggleFilters.svg +19 -0
  254. package/es/assets/img/svg/toolbar/add_appliances_active.svg +64 -0
  255. package/es/assets/img/svg/toolbar/add_appliances_inactive.svg +52 -0
  256. package/es/assets/img/svg/toolbar/add_button.svg +36 -0
  257. package/es/assets/img/svg/toolbar/add_cabinets_active.svg +59 -0
  258. package/es/assets/img/svg/toolbar/add_cabinets_inactive.svg +49 -0
  259. package/es/assets/img/svg/toolbar/add_items_doors.svg +25 -0
  260. package/es/assets/img/svg/toolbar/add_items_doorways.svg +24 -0
  261. package/es/assets/img/svg/toolbar/add_items_refrigerator.svg +32 -0
  262. package/es/assets/img/svg/toolbar/add_items_windows.svg +28 -0
  263. package/es/assets/img/svg/toolbar/apply_button.svg +38 -0
  264. package/es/assets/img/svg/toolbar/arrow-plus.svg +11 -0
  265. package/es/assets/img/svg/toolbar/backsplash.svg +8 -0
  266. package/es/assets/img/svg/toolbar/cancel_button.svg +37 -0
  267. package/es/assets/img/svg/toolbar/consult_a_designer_button.svg +47 -0
  268. package/es/assets/img/svg/toolbar/countertop.svg +7 -0
  269. package/es/assets/img/svg/toolbar/dcm.png +0 -0
  270. package/es/assets/img/svg/toolbar/dcm_off.svg +12 -0
  271. package/es/assets/img/svg/toolbar/dcm_on.svg +474 -0
  272. package/es/assets/img/svg/toolbar/delete_button.svg +37 -0
  273. package/es/assets/img/svg/toolbar/download.svg +77 -0
  274. package/es/assets/img/svg/toolbar/draw_custom_floor.svg +31 -0
  275. package/es/assets/img/svg/toolbar/edit_button.svg +75 -0
  276. package/es/assets/img/svg/toolbar/email_quote_button.svg +44 -0
  277. package/es/assets/img/svg/toolbar/fbm.png +0 -0
  278. package/es/assets/img/svg/toolbar/finishing_touches_active.svg +54 -0
  279. package/es/assets/img/svg/toolbar/finishing_touches_inactive.svg +42 -0
  280. package/es/assets/img/svg/toolbar/floorstyle.svg +9 -0
  281. package/es/assets/img/svg/toolbar/fmb.png +0 -0
  282. package/es/assets/img/svg/toolbar/fmb_off.svg +12 -0
  283. package/es/assets/img/svg/toolbar/fmb_on.svg +489 -0
  284. package/es/assets/img/svg/toolbar/furnishings_icon.svg +6 -0
  285. package/es/assets/img/svg/toolbar/get_started_button.svg +41 -0
  286. package/es/assets/img/svg/toolbar/handles.svg +5 -0
  287. package/es/assets/img/svg/toolbar/lighting.svg +7 -0
  288. package/es/assets/img/svg/toolbar/lrm.png +0 -0
  289. package/es/assets/img/svg/toolbar/lrm_off.svg +12 -0
  290. package/es/assets/img/svg/toolbar/lrm_on.svg +470 -0
  291. package/es/assets/img/svg/toolbar/make_floorplan_active.svg +66 -0
  292. package/es/assets/img/svg/toolbar/make_floorplan_inactive.svg +52 -0
  293. package/es/assets/img/svg/toolbar/predefined_room_l_shaped.svg +20 -0
  294. package/es/assets/img/svg/toolbar/predefined_room_layout.svg +20 -0
  295. package/es/assets/img/svg/toolbar/predefined_room_long_narrow.svg +20 -0
  296. package/es/assets/img/svg/toolbar/predefined_room_open_l_shape.svg +20 -0
  297. package/es/assets/img/svg/toolbar/predefined_room_open_pentagon.svg +20 -0
  298. package/es/assets/img/svg/toolbar/predefined_room_open_rectangle.svg +20 -0
  299. package/es/assets/img/svg/toolbar/predefined_room_open_rectangle_2.svg +20 -0
  300. package/es/assets/img/svg/toolbar/predefined_room_pentagon.svg +20 -0
  301. package/es/assets/img/svg/toolbar/predefined_room_rectangle.svg +20 -0
  302. package/es/assets/img/svg/toolbar/predefined_room_rectangle_with_alcove.svg +20 -0
  303. package/es/assets/img/svg/toolbar/redo_button.svg +75 -0
  304. package/es/assets/img/svg/toolbar/redo_button1.svg +75 -0
  305. package/es/assets/img/svg/toolbar/review_quote_active.svg +14 -0
  306. package/es/assets/img/svg/toolbar/review_quote_inactive.svg +44 -0
  307. package/es/assets/img/svg/toolbar/save_project_button.svg +44 -0
  308. package/es/assets/img/svg/toolbar/select_doorstyle_active.svg +67 -0
  309. package/es/assets/img/svg/toolbar/select_doorstyle_inactive.svg +57 -0
  310. package/es/assets/img/svg/toolbar/shopping-cart.svg +13 -0
  311. package/es/assets/img/svg/toolbar/style_change_button.svg +47 -0
  312. package/es/assets/img/svg/toolbar/take_picture.svg +75 -0
  313. package/es/assets/img/svg/toolbar/undo_button.svg +76 -0
  314. package/es/assets/img/svg/toolbar/undo_button1.svg +76 -0
  315. package/es/assets/img/svg/toolbar/use_button.svg +37 -0
  316. package/es/assets/img/svg/toolbar/wall_color_icon.svg +6 -0
  317. package/es/assets/img/svg/topbar/edit_active.svg +10 -0
  318. package/es/assets/img/svg/topbar/edit_inactive.svg +10 -0
  319. package/es/assets/img/svg/topbar/redo_active.svg +42 -0
  320. package/es/assets/img/svg/topbar/redo_inactive.svg +23 -0
  321. package/es/assets/img/svg/topbar/select_all_active.svg +50 -0
  322. package/es/assets/img/svg/topbar/select_all_inactive.svg +32 -0
  323. package/es/assets/img/svg/topbar/take_picture_active.svg +51 -0
  324. package/es/assets/img/svg/topbar/take_picture_inactive.svg +26 -0
  325. package/es/assets/img/svg/topbar/undo_active.svg +42 -0
  326. package/es/assets/img/svg/topbar/undo_inactive.svg +23 -0
  327. package/es/assets/img/svg/warning_info_2d.svg +81 -0
  328. package/es/assets/img/svg/window/Clear.svg +3 -0
  329. package/es/assets/img/svg/window/Cross.svg +5 -0
  330. package/es/assets/img/svg/window/Double_hung.svg +4 -0
  331. package/es/assets/img/svg/window/Vertical.svg +4 -0
  332. package/es/assets/img/svg/windows_clear.svg +23 -0
  333. package/es/assets/img/svg/windows_cross.svg +28 -0
  334. package/es/assets/img/svg/windows_double_hung.svg +24 -0
  335. package/es/assets/img/svg/windows_vertical.svg +24 -0
  336. package/es/assets/img/svg/wizardstep/Custom.svg +3 -0
  337. package/es/assets/img/svg/wizardstep/Dashed_line.svg +3 -0
  338. package/es/assets/img/svg/wizardstep/L.svg +3 -0
  339. package/es/assets/img/svg/wizardstep/L2.svg +3 -0
  340. package/es/assets/img/svg/wizardstep/Open.svg +3 -0
  341. package/es/assets/img/svg/wizardstep/Square.svg +3 -0
  342. package/es/assets/img/svg/wizardstep/bar-active.svg +9 -0
  343. package/es/assets/img/svg/wizardstep/bar-normal.svg +3 -0
  344. package/es/assets/img/svg/wizardstep/bullet-current.svg +3 -0
  345. package/es/assets/img/svg/wizardstep/bullet-done.svg +3 -0
  346. package/es/assets/img/svg/wizardstep/bullet-not-done.svg +3 -0
  347. package/es/assets/img/svg/wizardstep/check-active.svg +3 -0
  348. package/es/assets/img/svg/wizardstep/check-normal.svg +3 -0
  349. package/es/assets/img/svg/wizardstep/detail_view.svg +87 -0
  350. package/es/assets/img/svg/wizardstep/pencil.svg +11 -0
  351. package/es/assets/img/svg/wizardstep/tile_view.svg +95 -0
  352. package/es/assets/img/texture/glass.jpg +0 -0
  353. package/es/assets/img/texture/steel.jpg +0 -0
  354. package/es/assets/img/texture/white1px.jpg +0 -0
  355. package/es/assets/img/texture/wood.jpg +0 -0
  356. package/es/assets/model/DCM.bin +0 -0
  357. package/es/assets/model/DCM.fbx +0 -0
  358. package/es/assets/model/DCM.gltf +1 -0
  359. package/es/assets/model/FBM.bin +0 -0
  360. package/es/assets/model/FBM.fbx +0 -0
  361. package/es/assets/model/FBM.gltf +1 -0
  362. package/es/assets/model/LRM.bin +0 -0
  363. package/es/assets/model/LRM.fbx +0 -0
  364. package/es/assets/model/LRM.gltf +1 -0
  365. package/es/assets/rtastore_logo.png +0 -0
  366. package/es/catalog/areas/area/planner-element.js +45 -0
  367. package/es/catalog/back.png +0 -0
  368. package/es/catalog/catalog.js +265 -0
  369. package/es/catalog/doors.png +0 -0
  370. package/es/catalog/doorways.png +0 -0
  371. package/es/catalog/envMap/nx.hdr +0 -0
  372. package/es/catalog/envMap/ny.hdr +0 -0
  373. package/es/catalog/envMap/nz.hdr +0 -0
  374. package/es/catalog/envMap/px.hdr +0 -0
  375. package/es/catalog/envMap/py.hdr +0 -0
  376. package/es/catalog/envMap/pz.hdr +0 -0
  377. package/es/catalog/export.js +0 -0
  378. package/es/catalog/factories/area-factory-3d.js +182 -0
  379. package/es/catalog/factories/area-factory.js +78 -0
  380. package/es/catalog/factories/export.js +7 -0
  381. package/es/catalog/factories/wall-factory-3d.js +202 -0
  382. package/es/catalog/factories/wall-factory.js +267 -0
  383. package/es/catalog/holes/door-closet/planner-element.js +222 -0
  384. package/es/catalog/holes/door-double/door_double.png +0 -0
  385. package/es/catalog/holes/door-double/planner-element.js +315 -0
  386. package/es/catalog/holes/door-exterior/planner-element.js +215 -0
  387. package/es/catalog/holes/door-interior/planner-element.js +227 -0
  388. package/es/catalog/holes/door-panic/panicDoor.png +0 -0
  389. package/es/catalog/holes/door-panic/planner-element.js +503 -0
  390. package/es/catalog/holes/door-panic-double/panicDoorDouble.png +0 -0
  391. package/es/catalog/holes/door-panic-double/planner-element.js +463 -0
  392. package/es/catalog/holes/door-sliding/planner-element.js +225 -0
  393. package/es/catalog/holes/doorway-framed/planner-element.js +145 -0
  394. package/es/catalog/holes/doorway-frameless/planner-element.js +104 -0
  395. package/es/catalog/holes/export.js +13 -0
  396. package/es/catalog/holes/gate/gate.jpg +0 -0
  397. package/es/catalog/holes/window-clear/planner-element.js +166 -0
  398. package/es/catalog/holes/window-clear/texture.png +0 -0
  399. package/es/catalog/holes/window-cross/planner-element.js +165 -0
  400. package/es/catalog/holes/window-cross/texture.png +0 -0
  401. package/es/catalog/holes/window-double-hung/planner-element.js +303 -0
  402. package/es/catalog/holes/window-double-hung/texture.png +0 -0
  403. package/es/catalog/holes/window-vertical/planner-element.js +276 -0
  404. package/es/catalog/holes/window-vertical/texture.png +0 -0
  405. package/es/catalog/lines/wall/planner-element.js +79 -0
  406. package/es/catalog/lines/wall/textures/bricks2.jpg +0 -0
  407. package/es/catalog/lines/wall/textures/bricks3.jpg +0 -0
  408. package/es/catalog/lines/wall/textures/painted-normal.jpg +0 -0
  409. package/es/catalog/molding/molding-dcm/planner-element.js +26 -0
  410. package/es/catalog/molding/molding-dcm/texture.png +0 -0
  411. package/es/catalog/molding/molding-fbm/planner-element.js +26 -0
  412. package/es/catalog/molding/molding-fbm/texture.png +0 -0
  413. package/es/catalog/molding/molding-lrm/planner-element.js +26 -0
  414. package/es/catalog/molding/molding-lrm/texture.png +0 -0
  415. package/es/catalog/properties/export.js +21 -0
  416. package/es/catalog/properties/property-checkbox.js +68 -0
  417. package/es/catalog/properties/property-color.js +39 -0
  418. package/es/catalog/properties/property-enum.js +50 -0
  419. package/es/catalog/properties/property-hidden.js +19 -0
  420. package/es/catalog/properties/property-lenght-measure.js +96 -0
  421. package/es/catalog/properties/property-length-measure.js +80 -0
  422. package/es/catalog/properties/property-length-measure_hole.js +96 -0
  423. package/es/catalog/properties/property-number.js +48 -0
  424. package/es/catalog/properties/property-read-only.js +26 -0
  425. package/es/catalog/properties/property-string.js +48 -0
  426. package/es/catalog/properties/property-toggle.js +39 -0
  427. package/es/catalog/properties/shared-property-style.js +14 -0
  428. package/es/catalog/utils/FuseUtils.js +79 -0
  429. package/es/catalog/utils/exporter.js +161 -0
  430. package/es/catalog/utils/geom-utils.js +189 -0
  431. package/es/catalog/utils/item-loader.js +1602 -0
  432. package/es/catalog/utils/load-obj.js +91 -0
  433. package/es/catalog/utils/mtl-loader.js +357 -0
  434. package/es/catalog/utils/obj-loader.js +476 -0
  435. package/es/catalog/windows.png +0 -0
  436. package/es/class/FuseUtils.js +79 -0
  437. package/es/class/area.js +141 -0
  438. package/es/class/export.js +24 -0
  439. package/es/class/group.js +431 -0
  440. package/es/class/guide.js +58 -0
  441. package/es/class/hole.js +924 -0
  442. package/es/class/item.js +1884 -0
  443. package/es/class/layer.js +663 -0
  444. package/es/class/line.js +1229 -0
  445. package/es/class/project.js +937 -0
  446. package/es/class/vertex.js +198 -0
  447. package/es/components/content.js +135 -0
  448. package/es/components/export.js +9 -0
  449. package/es/components/style/button.js +106 -0
  450. package/es/components/style/cancel-button.js +21 -0
  451. package/es/components/style/content-container.js +30 -0
  452. package/es/components/style/content-title.js +25 -0
  453. package/es/components/style/delete-button.js +24 -0
  454. package/es/components/style/export.js +31 -0
  455. package/es/components/style/form-block.js +20 -0
  456. package/es/components/style/form-color-input.js +26 -0
  457. package/es/components/style/form-label.js +22 -0
  458. package/es/components/style/form-number-input.js +192 -0
  459. package/es/components/style/form-number-input_2.js +238 -0
  460. package/es/components/style/form-select.js +19 -0
  461. package/es/components/style/form-slider.js +60 -0
  462. package/es/components/style/form-submit-button.js +25 -0
  463. package/es/components/style/form-text-input.js +69 -0
  464. package/es/components/viewer2d/area.js +81 -0
  465. package/es/components/viewer2d/export.js +31 -0
  466. package/es/components/viewer2d/grids/grid-horizontal-streak.js +36 -0
  467. package/es/components/viewer2d/grids/grid-streak.js +36 -0
  468. package/es/components/viewer2d/grids/grid-vertical-streak.js +36 -0
  469. package/es/components/viewer2d/grids/grids.js +30 -0
  470. package/es/components/viewer2d/group.js +48 -0
  471. package/es/components/viewer2d/item.js +243 -0
  472. package/es/components/viewer2d/layer.js +164 -0
  473. package/es/components/viewer2d/line.js +997 -0
  474. package/es/components/viewer2d/ruler.js +84 -0
  475. package/es/components/viewer2d/rulerDist.js +102 -0
  476. package/es/components/viewer2d/rulerX.js +142 -0
  477. package/es/components/viewer2d/rulerY.js +144 -0
  478. package/es/components/viewer2d/scene.js +108 -0
  479. package/es/components/viewer2d/snap.js +74 -0
  480. package/es/components/viewer2d/state.js +73 -0
  481. package/es/components/viewer2d/utils.js +193 -0
  482. package/es/components/viewer2d/vertex.js +66 -0
  483. package/es/components/viewer2d/viewer2d.js +1405 -0
  484. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +2585 -0
  485. package/es/components/viewer3d/dcm.js +401 -0
  486. package/es/components/viewer3d/fbm.js +414 -0
  487. package/es/components/viewer3d/front3D.js +62 -0
  488. package/es/components/viewer3d/grid-creator.js +25 -0
  489. package/es/components/viewer3d/grids/grid-horizontal-streak.js +36 -0
  490. package/es/components/viewer3d/grids/grid-streak.js +27 -0
  491. package/es/components/viewer3d/grids/grid-vertical-streak.js +36 -0
  492. package/es/components/viewer3d/libs/first-person-controls.js +67 -0
  493. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1281 -0
  494. package/es/components/viewer3d/libs/mtl-loader.js +357 -0
  495. package/es/components/viewer3d/libs/obj-loader.js +462 -0
  496. package/es/components/viewer3d/libs/orbit-controls.js +697 -0
  497. package/es/components/viewer3d/libs/pointer-lock-controls.js +44 -0
  498. package/es/components/viewer3d/lrm.js +305 -0
  499. package/es/components/viewer3d/model.js +708 -0
  500. package/es/components/viewer3d/pointer-lock-navigation.js +115 -0
  501. package/es/components/viewer3d/ruler-utils/itemRect.js +61 -0
  502. package/es/components/viewer3d/ruler-utils/layer3D.js +495 -0
  503. package/es/components/viewer3d/ruler-utils/ruler3D.js +224 -0
  504. package/es/components/viewer3d/ruler-utils/scene3D.js +59 -0
  505. package/es/components/viewer3d/ruler-utils/state3D.js +18 -0
  506. package/es/components/viewer3d/scene-creator.js +3818 -0
  507. package/es/components/viewer3d/three-memory-cleaner.js +51 -0
  508. package/es/components/viewer3d/viewer3d-first-person.js +311 -0
  509. package/es/components/viewer3d/viewer3d.js +2654 -0
  510. package/es/constants.js +769 -0
  511. package/es/index.html.ejs +264 -0
  512. package/es/index.js +627 -3
  513. package/es/models.js +512 -0
  514. package/es/plugins/SVGLoader.js +1414 -0
  515. package/es/plugins/console-debugger.js +34 -0
  516. package/es/plugins/export.js +7 -0
  517. package/es/plugins/keyboard.js +110 -0
  518. package/es/reducers/areas-reducer.js +12 -0
  519. package/es/reducers/export.js +25 -0
  520. package/es/reducers/groups-reducer.js +38 -0
  521. package/es/reducers/holes-reducer.js +62 -0
  522. package/es/reducers/items-reducer.js +143 -0
  523. package/es/reducers/lines-reducer.js +45 -0
  524. package/es/reducers/project-reducer.js +136 -0
  525. package/es/reducers/reducer.js +19 -0
  526. package/es/reducers/scene-reducer.js +28 -0
  527. package/es/reducers/user-reducer.js +41 -0
  528. package/es/reducers/vertices-reducer.js +19 -0
  529. package/es/reducers/viewer2d-reducer.js +77 -0
  530. package/es/reducers/viewer3d-reducer.js +58 -0
  531. package/es/shared-style.js +66 -0
  532. package/es/translator/en.js +104 -0
  533. package/es/translator/it.js +79 -0
  534. package/es/translator/ru.js +79 -0
  535. package/es/translator/translator.js +80 -0
  536. package/es/utils/browser.js +33 -0
  537. package/es/utils/convert-units-lite.js +29 -0
  538. package/es/utils/email-validator.js +4 -0
  539. package/es/utils/export.js +25 -0
  540. package/es/utils/geometry.js +2609 -0
  541. package/es/utils/get-edges-of-subgraphs.js +26 -0
  542. package/es/utils/graph-cycles.js +238 -0
  543. package/es/utils/graph-inner-cycles.js +46 -0
  544. package/es/utils/graph.js +145 -0
  545. package/es/utils/helper.js +436 -0
  546. package/es/utils/history.js +29 -0
  547. package/es/utils/id-broker.js +15 -0
  548. package/es/utils/isolate-event-handler.js +1622 -0
  549. package/es/utils/logger.js +8 -0
  550. package/es/utils/math.js +50 -0
  551. package/es/utils/molding.js +1347 -0
  552. package/es/utils/name-generator.js +17 -0
  553. package/es/utils/objects-utils.js +50 -0
  554. package/es/utils/phone-validator.js +4 -0
  555. package/es/utils/process-black-list.js +15 -0
  556. package/es/utils/react-if.js +18 -0
  557. package/es/utils/ruler.js +58 -0
  558. package/es/utils/snap-scene.js +94 -0
  559. package/es/utils/snap.js +231 -0
  560. package/es/utils/summarizeCart.js +24 -0
  561. package/es/utils/threeCSG.es6.js +494 -0
  562. package/es/version.js +1 -0
  563. package/package.json +3 -4
  564. package/es/index.js.LICENSE.txt +0 -45
  565. package/es/index.js.map +0 -1
  566. /package/es/{e8e5de0892f5375460bd.jpg → catalog/areas/area/textures/ceramic-tile.jpg} +0 -0
  567. /package/es/{e470a2ce76062955fa98.jpg → catalog/areas/area/textures/grass.jpg} +0 -0
  568. /package/es/{e5ae13166775e7d071e4.jpg → catalog/areas/area/textures/parquet.jpg} +0 -0
  569. /package/es/{c232d250fd899392b1b7.jpg → catalog/areas/area/textures/strand-porcelain.jpg} +0 -0
  570. /package/es/{c7ae6f4de09134ebe588.jpg → catalog/areas/area/textures/tile1.jpg} +0 -0
  571. /package/es/{81e7a7e6edf162e88b44.jpg → catalog/lines/wall/textures/bricks-normal.jpg} +0 -0
  572. /package/es/{340a84d3930143a53545.jpg → catalog/lines/wall/textures/bricks-normal2.jpg} +0 -0
  573. /package/es/{a07d30a04bda8ee03491.jpg → catalog/lines/wall/textures/bricks.jpg} +0 -0
  574. /package/es/{5c8d36b3e7223934f447.jpg → catalog/lines/wall/textures/morden-normal.jpg} +0 -0
  575. /package/es/{8fe0f1210d8ba435a790.jpg → catalog/lines/wall/textures/morden.jpg} +0 -0
  576. /package/es/{bee3f62687a97bcc3d9f.jpg → catalog/lines/wall/textures/painted.jpg} +0 -0
  577. /package/es/{1fc74a85baa030dbc913.jpg → catalog/lines/wall/textures/plaster-normal.jpg} +0 -0
  578. /package/es/{dad5ee758630256ee702.jpg → catalog/lines/wall/textures/plaster.jpg} +0 -0
  579. /package/es/{30a49a74d9bd10068b65.png → catalog/lines/wall/wall.png} +0 -0
@@ -0,0 +1,1347 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ 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; }
4
+ 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) { _defineProperty(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; }
5
+ 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; } } }; }
6
+ 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; } }
7
+ 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; }
8
+ import { BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, EPSILON, ITEM_TYPE, MIDDLE_MOLDING_LOCATION, MOLDING_LOCATIONS, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_SAME, OVERLAP_SOME, TALL_CABINET_LAYOUTPOS, TOE_KICK_MOLDING, TOP_MOLDING_LOCATION, WALL_CABINET_LAYOUTPOS } from "../constants";
9
+ import * as Three from 'three';
10
+ import { convert } from "./convert-units-lite";
11
+ import IDBroker from "./id-broker";
12
+ import { getToeKickSKU, isEqualInstallationType, returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
13
+ import { GeometryUtils } from "./export";
14
+ import { isEmpty } from "./helper";
15
+ export function getItemRect(item) {
16
+ var x = item.x;
17
+ var y = item.y;
18
+ var rotRad = item.rotation / 180 * Math.PI;
19
+ var itemWidth = item.properties.get('width').get('_length');
20
+ var itemWidthUnit = item.properties.get('width').get('_unit') || 'cm';
21
+ itemWidth = convert(itemWidth / 2).from(itemWidthUnit).to('cm');
22
+ var itemDepth = item.properties.get('depth').get('_length');
23
+ var itemDepthUnit = item.properties.get('depth').get('_unit') || 'cm';
24
+ itemDepth = convert(itemDepth / 2).from(itemDepthUnit).to('cm');
25
+ var mx = x - itemWidth * Math.cos(rotRad);
26
+ var my = y - itemWidth * Math.sin(rotRad);
27
+ var x0 = mx + itemDepth * Math.sin(rotRad);
28
+ var y0 = my - itemDepth * Math.cos(rotRad);
29
+ var x3 = mx * 2 - x0;
30
+ var y3 = my * 2 - y0;
31
+ var x1 = x * 2 - x3;
32
+ var y1 = y * 2 - y3;
33
+ var x2 = x * 2 - x0;
34
+ var y2 = y * 2 - y0;
35
+ return {
36
+ rect: [{
37
+ x: x0,
38
+ y: y0
39
+ }, {
40
+ x: x1,
41
+ y: y1
42
+ }, {
43
+ x: x2,
44
+ y: y2
45
+ }, {
46
+ x: x3,
47
+ y: y3
48
+ }]
49
+ };
50
+ }
51
+ export function hasMoldingLayout(molding, layoutpos) {
52
+ var types = molding === null || molding === void 0 ? void 0 : molding.molding_type;
53
+ return (Array.isArray(types) || typeof types === 'string') && types.includes(layoutpos);
54
+ }
55
+ export function isEnableItemForMolding(layer, selItem) {
56
+ var molding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
57
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
58
+ var result = !isEmpty(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === BASE_CABINET_LAYOUTPOS && !GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === WALL_CABINET_LAYOUTPOS || selItem.layoutpos === TALL_CABINET_LAYOUTPOS) && GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
59
+
60
+ // check this item is enable for any molding
61
+ if (isEmpty(molding)) return result;
62
+ // check this item is enable for specified molding
63
+ else return result && hasMoldingLayout(molding, selItem.layoutpos);
64
+ }
65
+ export function isAttachedWall(layer, selItem) {
66
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
67
+ return GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects);
68
+ }
69
+
70
+ /**
71
+ * Check two line segments are overlap. The direction of the two line segments must be opposite.
72
+ * s1 c2 s2 c1
73
+ * |--------|------|-----------|
74
+ * Decision Formular: L(s1,c1) + L(s2, c2) = L(s1, s2) + L(c1, c2)
75
+ * @param {*} selRectPos1
76
+ * @param {*} selRectPos2
77
+ * @param {*} curRectPos1
78
+ * @param {*} curRectPos2
79
+ * @returns L(s1,c1) + L(s2, c2) - L(s1, s2) - L(c1, c2)
80
+ */
81
+ function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
82
+ return (
83
+ // GeometryUtils.verticesDistance(curRectPos1, selRectPos2) +
84
+ // GeometryUtils.verticesDistance(selRectPos1, curRectPos2) -
85
+ // Math.abs(
86
+ // GeometryUtils.verticesDistance(curRectPos2, curRectPos1) -
87
+ // GeometryUtils.verticesDistance(selRectPos1, selRectPos2)
88
+ // )
89
+ Math.abs(GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
90
+ );
91
+ }
92
+ export function isItemSnappedItem(selItem, curItem) {
93
+ var selRect = getItemRect(selItem).rect;
94
+ var curRect = getItemRect(curItem).rect;
95
+ var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < EPSILON;
96
+ var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < EPSILON;
97
+ var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < EPSILON;
98
+ var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < EPSILON;
99
+ var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < EPSILON;
100
+ return flag30 || flag21 || flag23 || flag01 || flag03;
101
+ }
102
+ export function isItemSnappedGroup(selItem, itemGroup) {
103
+ return itemGroup.some(function (curItem) {
104
+ return isItemSnappedItem(selItem, curItem);
105
+ });
106
+ }
107
+ export function sortItemsByDistance(items, selItem) {
108
+ items.sort(function (a, b) {
109
+ return GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
110
+ });
111
+ return items;
112
+ }
113
+ export function isSameMoldingLayoutpos(curItem, item) {
114
+ return curItem.layoutpos === BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
115
+ }
116
+ export function isItemSameItemByLocation(item1, item2, location) {
117
+ var item1Altitude = item1.properties.get('altitude').get('_length');
118
+ var item1AltitudeUnit = item1.properties.get('altitude').get('_unit');
119
+ item1Altitude = convert(item1Altitude).from(item1AltitudeUnit).to('cm');
120
+ var item1Height = item1.properties.get('height').get('_length');
121
+ var item1HeightUnit = item1.properties.get('height').get('_unit');
122
+ item1Height = convert(item1Height).from(item1HeightUnit).to('cm');
123
+ var item2Altitude = item2.properties.get('altitude').get('_length');
124
+ var item2AltitudeUnit = item2.properties.get('altitude').get('_unit');
125
+ item2Altitude = convert(item2Altitude).from(item2AltitudeUnit).to('cm');
126
+ var item2Height = item2.properties.get('height').get('_length');
127
+ var item2HeightUnit = item2.properties.get('height').get('_unit');
128
+ item2Height = convert(item2Height).from(item2HeightUnit).to('cm');
129
+ var flag = false;
130
+ switch (location) {
131
+ case TOP_MOLDING_LOCATION:
132
+ if (GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
133
+ break;
134
+ case MIDDLE_MOLDING_LOCATION:
135
+ if (GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
136
+ break;
137
+ case BOTTOM_MOLDING_LOCATION:
138
+ if (GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
139
+ break;
140
+ }
141
+ return flag;
142
+ }
143
+ export function tryMergeMDItem(layer, selItem, curItem, itemGroup, molding) {
144
+ return isSameMoldingLayoutpos(selItem, curItem) && isEnableItemForMolding(layer, curItem, molding) && isItemSnappedGroup(curItem, itemGroup) && !itemGroup.some(function (item) {
145
+ return item.id === curItem.id;
146
+ }) && isItemSameItemByLocation(selItem, curItem, molding.location_type);
147
+ }
148
+ export function getItemGroupFromMolding(layer, curItem, molding) {
149
+ var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
150
+ var itemGroup = [curItem];
151
+ var temp_layer_items = layer.items.toArray().filter(function (item) {
152
+ return item.category === 'cabinet' && item.id !== curItem.id && item.id !== (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id);
153
+ });
154
+ temp_layer_items = sortItemsByDistance(temp_layer_items, curItem);
155
+ for (var idx = 0; idx < temp_layer_items.length; idx++) {
156
+ if (tryMergeMDItem(layer, curItem, temp_layer_items[idx], itemGroup, molding)) {
157
+ itemGroup.push(temp_layer_items[idx]);
158
+ idx = -1;
159
+ }
160
+ }
161
+ return itemGroup;
162
+ }
163
+ function tryMergeItemWithLocation(curItem, itemGroup, location) {
164
+ return itemGroup.some(function (item) {
165
+ return isItemSnappedItem(curItem, item) && isItemSameItemByLocation(curItem, item, location);
166
+ });
167
+ }
168
+
169
+ /**
170
+ * Make the molding group array with [items].
171
+ * @param {*} layer
172
+ * @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
173
+ * @returns MG array
174
+ */
175
+ export function getAllMoldingGroups(layer) {
176
+ var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
177
+ if (items === null) items = layer.items.toArray();
178
+ var MGArray = [];
179
+ items.forEach(function (curItem) {
180
+ // let allLineRects = GeometryUtils.buildRectFromLines(
181
+ // layer,
182
+ // GeometryUtils.getAllLines(layer)
183
+ // );
184
+ // if (
185
+ // (curItem.category === 'cabinet' &&
186
+ // curItem.layoutpos === BASE_CABINET_LAYOUTPOS &&
187
+ // !GeometryUtils.isSnappedLine(getItemRect(curItem), allLineRects)) ||
188
+ // ((curItem.layoutpos === WALL_CABINET_LAYOUTPOS ||
189
+ // curItem.layoutpos === TALL_CABINET_LAYOUTPOS) &&
190
+ // GeometryUtils.isSnappedLine(getItemRect(curItem), allLineRects))
191
+ // ) {
192
+ if (curItem.category === 'cabinet') {
193
+ var temp_items = items.filter(function (it) {
194
+ return it.category === 'cabinet' && isSameMoldingLayoutpos(curItem, it) && it.id !== curItem.id;
195
+ });
196
+ temp_items = sortItemsByDistance(temp_items, curItem);
197
+ MOLDING_LOCATIONS.forEach(function (location) {
198
+ if (!MGArray.some(function (mg) {
199
+ return mg.items.some(function (it) {
200
+ return it.id === curItem.id;
201
+ }) && mg.location_type === location;
202
+ })) {
203
+ var itemGroup = [curItem];
204
+ var isChangedItemGroup = false;
205
+ do {
206
+ isChangedItemGroup = false;
207
+ var _loop = function _loop(idx) {
208
+ if (!itemGroup.some(function (it) {
209
+ return it.id === temp_items[idx].id;
210
+ }) && tryMergeItemWithLocation(temp_items[idx], itemGroup, location)) {
211
+ itemGroup.push(temp_items[idx]);
212
+ isChangedItemGroup = true;
213
+ }
214
+ };
215
+ for (var idx = 0; idx < temp_items.length; idx++) {
216
+ _loop(idx);
217
+ }
218
+ } while (isChangedItemGroup);
219
+ MGArray.push({
220
+ id: IDBroker.acquireID(),
221
+ items: itemGroup,
222
+ location_type: location,
223
+ molding: null,
224
+ lines: null,
225
+ pointGroups: null,
226
+ meshes: [],
227
+ rot: 0,
228
+ pos: 0
229
+ });
230
+ }
231
+ });
232
+ }
233
+ // }
234
+ });
235
+ return MGArray;
236
+ }
237
+ export function getLinesOfItem(item, allLineRects, catalog) {
238
+ var lines = [];
239
+ var outline = null;
240
+ var element = catalog.elements[item.get('type')];
241
+ if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
242
+ // get edge lines
243
+ var newWidth = item.properties.get('width').get('_length');
244
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
245
+ newWidth = convert(newWidth).from(wUnit).to('cm');
246
+ var newDepth = item.properties.get('depth').get('_length');
247
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
248
+ newDepth = convert(newDepth).from(hUnit).to('cm');
249
+ if (item) {
250
+ // Get Outline Data of Selected Item
251
+ outline = element.info.outline;
252
+ if (outline) {
253
+ // Extract Points from `outline`
254
+ var outlinePaths = outline.paths;
255
+ var outlineWidth = outline.svgWidth;
256
+ var outlineHeight = outline.svgHeight;
257
+ var outlinePoints = []; // Hold Points Of SVG
258
+ var _iterator = _createForOfIteratorHelper(outlinePaths),
259
+ _step;
260
+ try {
261
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
262
+ var path = _step.value;
263
+ var _iterator2 = _createForOfIteratorHelper(path.subPaths),
264
+ _step2;
265
+ try {
266
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
267
+ var subPath = _step2.value;
268
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
269
+ }
270
+ } catch (err) {
271
+ _iterator2.e(err);
272
+ } finally {
273
+ _iterator2.f();
274
+ }
275
+ }
276
+ } catch (err) {
277
+ _iterator.e(err);
278
+ } finally {
279
+ _iterator.f();
280
+ }
281
+ outline.reverse && outlinePoints.reverse();
282
+ for (var i = 0; i < outlinePoints.length - 1; i++) {
283
+ lines.push([GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), IDBroker.acquireID()]);
284
+ }
285
+ } else {
286
+ var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
287
+ for (var _i = 0; _i < 4; _i++) {
288
+ lines.push([GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), IDBroker.acquireID()]);
289
+ }
290
+ }
291
+ }
292
+ if (item.layoutpos !== BASE_CABINET_LAYOUTPOS) {
293
+ lines = lines.filter(function (line) {
294
+ return !GeometryUtils.isSnappedLine({
295
+ rect: [{
296
+ x: 0,
297
+ y: 0
298
+ }, {
299
+ x: 0,
300
+ y: 0
301
+ }, line[0], line[1]]
302
+ }, allLineRects);
303
+ });
304
+ }
305
+ return lines;
306
+ }
307
+ export function getLinesOfItem2(item, allLineRects, catalog) {
308
+ var _lines;
309
+ var lines = [];
310
+ var outline = null;
311
+ var element = catalog.elements[item.get('type')];
312
+ if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
313
+ // get edge lines
314
+ var newWidth = item.properties.get('width').get('_length');
315
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
316
+ newWidth = convert(newWidth).from(wUnit).to('cm');
317
+ var newDepth = item.properties.get('depth').get('_length');
318
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
319
+ newDepth = convert(newDepth).from(hUnit).to('cm');
320
+ if (item) {
321
+ var _element;
322
+ // Get Outline Data of Selected Item
323
+ outline = (_element = element) === null || _element === void 0 ? void 0 : _element.info.outline;
324
+ if (outline) {
325
+ // Extract Points from `outline`
326
+ var outlinePaths = outline.paths;
327
+ var outlineWidth = outline.svgWidth;
328
+ var outlineHeight = outline.svgHeight;
329
+ var outlinePoints = []; // Hold Points Of SVG
330
+ var _iterator3 = _createForOfIteratorHelper(outlinePaths),
331
+ _step3;
332
+ try {
333
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
334
+ var path = _step3.value;
335
+ var _iterator4 = _createForOfIteratorHelper(path.subPaths),
336
+ _step4;
337
+ try {
338
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
339
+ var subPath = _step4.value;
340
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
341
+ }
342
+ } catch (err) {
343
+ _iterator4.e(err);
344
+ } finally {
345
+ _iterator4.f();
346
+ }
347
+ }
348
+ } catch (err) {
349
+ _iterator3.e(err);
350
+ } finally {
351
+ _iterator3.f();
352
+ }
353
+ outline.reverse && outlinePoints.reverse();
354
+ for (var i = 0; i < outlinePoints.length - 1; i++) {
355
+ lines.push([GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), IDBroker.acquireID()]);
356
+ }
357
+ } else {
358
+ var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
359
+ for (var _i2 = 0; _i2 < 4; _i2++) {
360
+ lines.push([GeometryUtils.rotatePointAroundPoint(pos[_i2][0] * newWidth / 2 + item.x, pos[_i2][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), GeometryUtils.rotatePointAroundPoint(pos[(_i2 + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i2 + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), IDBroker.acquireID()]);
361
+ }
362
+ }
363
+ }
364
+ lines = (_lines = lines) === null || _lines === void 0 ? void 0 : _lines.filter(function (line) {
365
+ return !GeometryUtils.isSnappedLine({
366
+ rect: [{
367
+ x: 0,
368
+ y: 0
369
+ }, {
370
+ x: 0,
371
+ y: 0
372
+ }, line[0], line[1]]
373
+ }, allLineRects);
374
+ });
375
+ return lines;
376
+ }
377
+ function isParallelLines(line1, line2) {
378
+ var isParallel = false;
379
+ if (Math.abs(line1[0].y - line1[1].y) <= EPSILON && Math.abs(line2[0].y - line2[1].y) <= EPSILON) isParallel = true;
380
+ if (Math.abs(line1[0].x - line1[1].x) <= EPSILON && Math.abs(line2[0].x - line2[1].x) <= EPSILON) isParallel = true;
381
+ if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= EPSILON) isParallel = true;
382
+ if (isParallel) {
383
+ return true;
384
+ }
385
+ return false;
386
+ }
387
+ export function isLinesOverlapped(line1, line2) {
388
+ return isParallelLines(line1, line2) && line1.some(function (l1) {
389
+ return line2.some(function (l2) {
390
+ return GeometryUtils.samePoints(l1, l2);
391
+ });
392
+ });
393
+ }
394
+ export function mergeOverlappedLines(line1, line2) {
395
+ var line1_idx = 0,
396
+ line2_idx = 0;
397
+ line1.forEach(function (l1, idx1) {
398
+ if (idx1 !== line1.length - 1) {
399
+ line2.forEach(function (l2, idx2) {
400
+ if (idx2 !== line2.length - 1) {
401
+ if (GeometryUtils.samePoints(l1, l2)) {
402
+ line1_idx = idx1;
403
+ line2_idx = idx2;
404
+ }
405
+ }
406
+ });
407
+ }
408
+ });
409
+ //If line1 's end point and line2 's start point is same, two lines merge into a line with
410
+ //the line1's start point as the start point and line2's end point as the end point.
411
+ if (line1_idx === 1) {
412
+ return [line1[1 - line1_idx], line2[1 - line2_idx], IDBroker.acquireID()];
413
+ } else {
414
+ return [line2[1 - line2_idx], line1[1 - line1_idx], IDBroker.acquireID()];
415
+ }
416
+ }
417
+
418
+ /**
419
+ * Get the contour line array of moldingGroup items
420
+ * @param {*} moldingGroup
421
+ * @param {*} layer
422
+ * @param {*} catalog
423
+ * @returns contour line array of moldingGroup items
424
+ */
425
+ export function getLinesFromItems2(moldingGroup, layer, catalog) {
426
+ // wall lines
427
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
428
+ var MGlines = [];
429
+ var MGlinesOtherSnapped = [];
430
+ var items = _toConsumableArray(moldingGroup.items);
431
+ // The other item's lines (these items are snapped to the moldingGroup items)
432
+ var itemsOtherSnapped = layer.items.toArray().filter(function (item) {
433
+ if (items.some(function (it) {
434
+ return item.id === it.id;
435
+ })) return false;
436
+ if (isItemSnappedGroup(item, items)) {
437
+ var itemLines = getLinesOfItem(item, allLineRects, catalog);
438
+ var itemAltitude = item.properties.get('altitude').get('_length');
439
+ var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
440
+ itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
441
+ var itemHeight = item.properties.get('height').get('_length');
442
+ var itemHeightUnit = item.properties.get('height').get('_unit');
443
+ itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
444
+ itemLines.forEach(function (line) {
445
+ line.push({
446
+ altitude: itemAltitude,
447
+ height: itemHeight
448
+ });
449
+ });
450
+ MGlinesOtherSnapped = [].concat(_toConsumableArray(MGlinesOtherSnapped), _toConsumableArray(itemLines));
451
+ return true;
452
+ } else return false;
453
+ });
454
+
455
+ // get all lines of moldingGroup items
456
+ items.forEach(function (item) {
457
+ var itemAltitude = item.properties.get('altitude').get('_length');
458
+ var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
459
+ itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
460
+ var itemHeight = item.properties.get('height').get('_length');
461
+ var itemHeightUnit = item.properties.get('height').get('_unit');
462
+ itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
463
+ var itemLines = getLinesOfItem(item, allLineRects, catalog);
464
+
465
+ // remove the edge that overlapped with other snapped items
466
+ itemLines = itemLines.filter(function (itLine) {
467
+ var ret = true;
468
+ var srcLine = {
469
+ x1: itLine[0].x,
470
+ y1: itLine[0].y,
471
+ x2: itLine[1].x,
472
+ y2: itLine[1].y
473
+ };
474
+ for (var j = 0; j < MGlinesOtherSnapped.length; j++) {
475
+ var bCheck = false;
476
+ switch (moldingGroup.location_type) {
477
+ case TOP_MOLDING_LOCATION:
478
+ bCheck = MGlinesOtherSnapped[j][3].altitude + MGlinesOtherSnapped[j][3].height > itemAltitude + itemHeight;
479
+ break;
480
+ case MIDDLE_MOLDING_LOCATION:
481
+ bCheck = true;
482
+ break;
483
+ case BOTTOM_MOLDING_LOCATION:
484
+ bCheck = MGlinesOtherSnapped[j][3].altitude < itemAltitude;
485
+ break;
486
+ }
487
+ if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
488
+ if (bCheck) {
489
+ var destLine = {
490
+ x1: MGlinesOtherSnapped[j][0].x,
491
+ y1: MGlinesOtherSnapped[j][0].y,
492
+ x2: MGlinesOtherSnapped[j][1].x,
493
+ y2: MGlinesOtherSnapped[j][1].y
494
+ };
495
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
496
+ if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
497
+ ret = false;
498
+ break;
499
+ }
500
+ }
501
+ }
502
+ return ret;
503
+ });
504
+ MGlines = [].concat(_toConsumableArray(MGlines), _toConsumableArray(itemLines));
505
+ });
506
+
507
+ // Filtering overlapped edges and get contour edges
508
+ var removeLineIds = []; // remove the edge that fully overlapped to other edge
509
+ var newLines = []; // new countour edge segment that except the overlapped part
510
+ var _loop2 = function _loop2(i) {
511
+ var srcLine = {
512
+ x1: MGlines[i][0].x,
513
+ y1: MGlines[i][0].y,
514
+ x2: MGlines[i][1].x,
515
+ y2: MGlines[i][1].y
516
+ };
517
+ var _loop4 = function _loop4(j) {
518
+ if (i === j) return 0; // continue
519
+ var destLine = {
520
+ x1: MGlines[j][0].x,
521
+ y1: MGlines[j][0].y,
522
+ x2: MGlines[j][1].x,
523
+ y2: MGlines[j][1].y
524
+ };
525
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
526
+ if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
527
+ removeLineIds.push(i);
528
+ return 1; // break
529
+ } else if (rst.result === OVERLAP_SOME) {
530
+ removeLineIds.push(i);
531
+ var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, MGlines.filter(function (v, idx) {
532
+ return idx !== i && idx !== j;
533
+ }), 0);
534
+ if (lineSegs.length > 0) newLines = [].concat(_toConsumableArray(newLines), _toConsumableArray(lineSegs));
535
+ return 1; // break
536
+ }
537
+ },
538
+ _ret2;
539
+ for (var j = 0; j < MGlines.length; j++) {
540
+ _ret2 = _loop4(j);
541
+ if (_ret2 === 0) continue;
542
+ if (_ret2 === 1) break;
543
+ }
544
+ };
545
+ for (var i = 0; i < MGlines.length; i++) {
546
+ _loop2(i);
547
+ }
548
+ MGlines = MGlines.filter(function (line, idx) {
549
+ return !removeLineIds.some(function (id) {
550
+ return idx === id;
551
+ });
552
+ });
553
+ if (newLines.length > 0) MGlines = [].concat(_toConsumableArray(MGlines), _toConsumableArray(newLines));
554
+
555
+ // merge the collinear linked lines to one line
556
+ var newMGlines = [];
557
+ var filteredMGlines = MGlines;
558
+ var _loop3 = function _loop3(_i3) {
559
+ if (filteredMGlines.length < 1) return 0; // break
560
+ if (!filteredMGlines.some(function (v) {
561
+ return v[2] === MGlines[_i3][2];
562
+ })) return 1; // continue
563
+ var mergedResult = getMergedLine(MGlines[_i3], filteredMGlines, 0);
564
+ if (mergedResult) {
565
+ newMGlines.push(mergedResult.mergedLine);
566
+ filteredMGlines = mergedResult.filteredMGlines;
567
+ }
568
+ },
569
+ _ret;
570
+ for (var _i3 = 0; _i3 < MGlines.length; _i3++) {
571
+ _ret = _loop3(_i3);
572
+ if (_ret === 0) break;
573
+ if (_ret === 1) continue;
574
+ }
575
+ return newMGlines;
576
+ }
577
+
578
+ /**
579
+ * Get the line that colinear linked with [line], and merge them to a new line
580
+ * @param {*} line
581
+ * @param {*} MGlines
582
+ * @returns
583
+ * - returns merged new line
584
+ * - returns filtered new line group (remove linked line from [MGlines])
585
+ */
586
+ function getMergedLine(line, MGlines, cnt) {
587
+ try {
588
+ cnt++;
589
+ if (cnt > 5000) {
590
+ console.log('getMergedLine has limited!');
591
+ return null;
592
+ }
593
+ var newMGlines = MGlines.filter(function (v) {
594
+ return line[2] !== v[2];
595
+ });
596
+ var mergeResult = {
597
+ mergedLine: line,
598
+ filteredMGlines: newMGlines
599
+ };
600
+ var srcLine = {
601
+ x1: line[0].x,
602
+ y1: line[0].y,
603
+ x2: line[1].x,
604
+ y2: line[1].y
605
+ };
606
+ var _loop5 = function _loop5(i) {
607
+ var destLine = {
608
+ x1: newMGlines[i][0].x,
609
+ y1: newMGlines[i][0].y,
610
+ x2: newMGlines[i][1].x,
611
+ y2: newMGlines[i][1].y
612
+ };
613
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
614
+ if (rst.result === OVERLAP_LINK) {
615
+ var mergedLine = [{
616
+ x: rst.linkedLine.x1,
617
+ y: rst.linkedLine.y1
618
+ }, {
619
+ x: rst.linkedLine.x2,
620
+ y: rst.linkedLine.y2
621
+ }, IDBroker.acquireID()];
622
+ mergeResult = getMergedLine(mergedLine, newMGlines.filter(function (v, idx) {
623
+ return idx !== i;
624
+ }), cnt);
625
+ }
626
+ };
627
+ for (var i = 0; i < newMGlines.length; i++) {
628
+ _loop5(i);
629
+ }
630
+ return mergeResult;
631
+ } catch (e) {
632
+ console.log('getMergedLine catched :', e);
633
+ return null;
634
+ }
635
+ }
636
+
637
+ /**
638
+ * Get the contour line segments from [lineSegs]
639
+ * @param {*} lineSegs
640
+ * @param {*} otherLines
641
+ * @returns
642
+ */
643
+ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
644
+ try {
645
+ cnt++;
646
+ if (cnt > 5000) {
647
+ console.log('getTrimmedContourLineSegs has limited!');
648
+ return [];
649
+ }
650
+ var returnSegs = [];
651
+ for (var i = 0; i < lineSegs.length; i++) {
652
+ var srcLine = {
653
+ x1: lineSegs[i].x1,
654
+ y1: lineSegs[i].y1,
655
+ x2: lineSegs[i].x2,
656
+ y2: lineSegs[i].y2
657
+ };
658
+ var bContourSeg = true;
659
+ var _loop6 = function _loop6(j) {
660
+ var _otherLines$j$0$x, _otherLines$j$, _otherLines$j$line$, _otherLines$j$0$y, _otherLines$j$2, _otherLines$j$line$2, _otherLines$j$1$x, _otherLines$j$3, _otherLines$j$line$3, _otherLines$j$1$y, _otherLines$j$4, _otherLines$j$line$4;
661
+ var destLine = {
662
+ x1: (_otherLines$j$0$x = (_otherLines$j$ = otherLines[j][0]) === null || _otherLines$j$ === void 0 ? void 0 : _otherLines$j$.x) !== null && _otherLines$j$0$x !== void 0 ? _otherLines$j$0$x : (_otherLines$j$line$ = otherLines[j].line[0]) === null || _otherLines$j$line$ === void 0 ? void 0 : _otherLines$j$line$.x,
663
+ y1: (_otherLines$j$0$y = (_otherLines$j$2 = otherLines[j][0]) === null || _otherLines$j$2 === void 0 ? void 0 : _otherLines$j$2.y) !== null && _otherLines$j$0$y !== void 0 ? _otherLines$j$0$y : (_otherLines$j$line$2 = otherLines[j].line[0]) === null || _otherLines$j$line$2 === void 0 ? void 0 : _otherLines$j$line$2.y,
664
+ x2: (_otherLines$j$1$x = (_otherLines$j$3 = otherLines[j][1]) === null || _otherLines$j$3 === void 0 ? void 0 : _otherLines$j$3.x) !== null && _otherLines$j$1$x !== void 0 ? _otherLines$j$1$x : (_otherLines$j$line$3 = otherLines[j].line[1]) === null || _otherLines$j$line$3 === void 0 ? void 0 : _otherLines$j$line$3.x,
665
+ y2: (_otherLines$j$1$y = (_otherLines$j$4 = otherLines[j][1]) === null || _otherLines$j$4 === void 0 ? void 0 : _otherLines$j$4.y) !== null && _otherLines$j$1$y !== void 0 ? _otherLines$j$1$y : (_otherLines$j$line$4 = otherLines[j].line[1]) === null || _otherLines$j$line$4 === void 0 ? void 0 : _otherLines$j$line$4.y
666
+ };
667
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
668
+ if (rst.result == OVERLAP_SAME || rst.result == OVERLAP_INCLUDED) {
669
+ bContourSeg = false;
670
+ return 0; // break
671
+ } else if (rst.result == OVERLAP_SOME) {
672
+ var tLineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, otherLines.filter(function (v, idx) {
673
+ return idx !== j;
674
+ }), cnt);
675
+ if (tLineSegs.length > 0) returnSegs = [].concat(_toConsumableArray(returnSegs), _toConsumableArray(tLineSegs));
676
+ bContourSeg = false;
677
+ return 0; // break
678
+ }
679
+ },
680
+ _ret3;
681
+ for (var j = 0; j < otherLines.length; j++) {
682
+ _ret3 = _loop6(j);
683
+ if (_ret3 === 0) break;
684
+ }
685
+ if (bContourSeg) returnSegs.push([{
686
+ x: lineSegs[i].x1,
687
+ y: lineSegs[i].y1
688
+ }, {
689
+ x: lineSegs[i].x2,
690
+ y: lineSegs[i].y2
691
+ }, IDBroker.acquireID()]);
692
+ }
693
+ return returnSegs;
694
+ } catch (e) {
695
+ console.log('getTrimmedContourLineSegs catched :', e);
696
+ return [];
697
+ }
698
+ }
699
+ export function getLinesFromItems(moldingGroup, layer, catalog) {
700
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
701
+ var items = _toConsumableArray(moldingGroup.items);
702
+ var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
703
+ items = sortItemsByDistance(items, items[0]);
704
+ var _loop7 = function _loop7() {
705
+ var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
706
+ var temp_MGLines = [];
707
+ MGlines.forEach(function (line) {
708
+ var idx = itemLines.findIndex(function (itemLine) {
709
+ return isLinesOverlapped(line, itemLine);
710
+ });
711
+ var curItemLine = itemLines[idx];
712
+ if (idx > -1) {
713
+ if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
714
+ var MGLine = mergeOverlappedLines(line, curItemLine);
715
+ temp_MGLines.push(MGLine);
716
+ }
717
+ itemLines.splice(idx, 1);
718
+ } else {
719
+ temp_MGLines.push(line);
720
+ }
721
+ });
722
+ itemLines.forEach(function (itemLine) {
723
+ return temp_MGLines.push(itemLine);
724
+ });
725
+ MGlines = [].concat(temp_MGLines);
726
+ };
727
+ for (var i = 1; i < items.length; i++) {
728
+ _loop7();
729
+ }
730
+ // return MGlines;
731
+ var snapped_other_items = layer.items.toArray().filter(function (item) {
732
+ if (items.some(function (it) {
733
+ return item.id === it.id;
734
+ })) return false;
735
+ return isItemSnappedGroup(item, items);
736
+ });
737
+ snapped_other_items.forEach(function (item) {
738
+ var itemAltitude = item.properties.get('altitude').get('_length');
739
+ var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
740
+ itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
741
+ var itemHeight = item.properties.get('height').get('_length');
742
+ var itemHeightUnit = item.properties.get('height').get('_unit');
743
+ itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
744
+ var mgroupAltitude = items[0].properties.get('altitude').get('_length');
745
+ var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
746
+ mgroupAltitude = convert(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
747
+ var mgroupHeight = items[0].properties.get('height').get('_length');
748
+ var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
749
+ mgroupHeight = convert(mgroupHeight).from(mgroupHeightUnit).to('cm');
750
+ var flag = false;
751
+ switch (moldingGroup.location_type) {
752
+ case TOP_MOLDING_LOCATION:
753
+ flag = itemAltitude + itemHeight > mgroupAltitude + mgroupHeight;
754
+ break;
755
+ case MIDDLE_MOLDING_LOCATION:
756
+ flag = true;
757
+ break;
758
+ case BOTTOM_MOLDING_LOCATION:
759
+ flag = itemAltitude < mgroupAltitude;
760
+ break;
761
+ }
762
+ if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
763
+ if (flag) {
764
+ var itemLines = getLinesOfItem(item, allLineRects, catalog);
765
+ var temp_MGLines = [];
766
+ MGlines.forEach(function (mgl) {
767
+ var idx = itemLines.findIndex(function (itl) {
768
+ return isLinesOverlapped(mgl, itl);
769
+ });
770
+ var curITL = itemLines[idx];
771
+ if (idx > -1) {
772
+ if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < EPSILON) {
773
+ if (GeometryUtils.verticesDistance(mgl[0], mgl[1]) > GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
774
+ var MGLine = mergeOverlappedLines(mgl, curITL);
775
+ temp_MGLines.push(MGLine);
776
+ }
777
+ itemLines.splice(idx, 1);
778
+ } else {
779
+ temp_MGLines.push(mgl);
780
+ }
781
+ } else {
782
+ temp_MGLines.push(mgl);
783
+ }
784
+ });
785
+ MGlines = [].concat(temp_MGLines);
786
+ }
787
+ });
788
+ return MGlines;
789
+ }
790
+ function getMDPoints(newMD) {
791
+ if (newMD.lines.length < 1) return _objectSpread(_objectSpread({}, newMD), {}, {
792
+ pointGroups: []
793
+ });
794
+ // let maxX = newMD.lines[0][0].x,
795
+ var maxX = newMD.lines[0][0].x,
796
+ minX = newMD.lines[0][0].x;
797
+ var maxY = newMD.lines[0][0].y,
798
+ minY = newMD.lines[0][0].y;
799
+ newMD.lines.forEach(function (line) {
800
+ if (line[0].x > maxX) {
801
+ maxX = line[0].x;
802
+ }
803
+ if (line[0].x < minX) {
804
+ minX = line[0].x;
805
+ }
806
+ if (line[1].x > maxX) {
807
+ maxX = line[1].x;
808
+ }
809
+ if (line[1].x < minX) {
810
+ minX = line[1].x;
811
+ }
812
+ if (line[0].y > maxY) {
813
+ maxY = line[0].y;
814
+ }
815
+ if (line[0].y < minY) {
816
+ minY = line[0].y;
817
+ }
818
+ if (line[1].y > maxY) {
819
+ maxY = line[1].y;
820
+ }
821
+ if (line[1].y < minY) {
822
+ minY = line[1].y;
823
+ }
824
+ });
825
+ var cPos = {
826
+ x: (maxX + minX) / 2,
827
+ y: (maxY + minY) / 2
828
+ };
829
+ var newSize = _objectSpread(_objectSpread({}, newMD.size), {}, {
830
+ width: maxX - minX,
831
+ depth: maxY - minY
832
+ });
833
+
834
+ // get vertex points
835
+ var MDlines = _toConsumableArray(newMD.lines);
836
+ var pointGroups = [[]];
837
+ var flag = 1;
838
+ var i = 0;
839
+ var _loop8 = function _loop8() {
840
+ if (pointGroups[i].length === 0) {
841
+ pointGroups[i].push(new Three.Vector2(MDlines[0][0].x - cPos.x, MDlines[0][0].y - cPos.y), new Three.Vector2(MDlines[0][1].x - cPos.x, MDlines[0][1].y - cPos.y));
842
+ MDlines.splice(0, 1);
843
+ } else {
844
+ if (flag) {
845
+ var lastPoint = pointGroups[i][pointGroups[i].length - 1];
846
+ var res = MDlines.findIndex(function (a) {
847
+ return GeometryUtils.samePoints({
848
+ x: a[0].x - cPos.x,
849
+ y: a[0].y - cPos.y
850
+ }, lastPoint) || GeometryUtils.samePoints({
851
+ x: a[1].x - cPos.x,
852
+ y: a[1].y - cPos.y
853
+ }, lastPoint);
854
+ });
855
+ if (res > -1) {
856
+ var newPos = {
857
+ x: MDlines[res][0].x - cPos.x,
858
+ y: MDlines[res][0].y - cPos.y
859
+ };
860
+ if (GeometryUtils.samePoints(newPos, lastPoint)) {
861
+ newPos = {
862
+ x: MDlines[res][1].x - cPos.x,
863
+ y: MDlines[res][1].y - cPos.y
864
+ };
865
+ }
866
+ pointGroups[i].push(new Three.Vector2(newPos.x, newPos.y));
867
+ MDlines.splice(res, 1);
868
+ } else {
869
+ flag = 0;
870
+ }
871
+ } else {
872
+ var firstPoint = pointGroups[i][0];
873
+ var _res = MDlines.findIndex(function (a) {
874
+ return GeometryUtils.samePoints({
875
+ x: a[0].x - cPos.x,
876
+ y: a[0].y - cPos.y
877
+ }, firstPoint) || GeometryUtils.samePoints({
878
+ x: a[1].x - cPos.x,
879
+ y: a[1].y - cPos.y
880
+ }, firstPoint);
881
+ });
882
+ if (_res > -1) {
883
+ var _newPos = {
884
+ x: MDlines[_res][0].x - cPos.x,
885
+ y: MDlines[_res][0].y - cPos.y
886
+ };
887
+ if (GeometryUtils.samePoints(_newPos, firstPoint)) {
888
+ _newPos = {
889
+ x: MDlines[_res][1].x - cPos.x,
890
+ y: MDlines[_res][1].y - cPos.y
891
+ };
892
+ }
893
+ pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat(_toConsumableArray(pointGroups[i]));
894
+ MDlines.splice(_res, 1);
895
+ } else {
896
+ flag = 1;
897
+ i++;
898
+ if (MDlines.length !== 0) pointGroups.push([]);
899
+ }
900
+ }
901
+ }
902
+ };
903
+ while (MDlines.length !== 0) {
904
+ _loop8();
905
+ }
906
+ var z = newMD.items[0].properties.get('altitude').get('_length');
907
+ var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
908
+ z = convert(z).from(zUnit).to('cm');
909
+ var height = newMD.items[0].properties.get('height').get('_length');
910
+ var heightUnit = newMD.items[0].properties.get('height').get('_unit') || 'cm';
911
+ height = convert(height).from(heightUnit).to('cm');
912
+ switch (newMD.location_type) {
913
+ case TOP_MOLDING_LOCATION:
914
+ z += height;
915
+ break;
916
+ case MIDDLE_MOLDING_LOCATION:
917
+ z += height / 2;
918
+ break;
919
+ case BOTTOM_MOLDING_LOCATION:
920
+ z += 0;
921
+ break;
922
+ default:
923
+ break;
924
+ }
925
+ return _objectSpread(_objectSpread({}, newMD), {}, {
926
+ pointGroups: pointGroups,
927
+ pos: _objectSpread(_objectSpread({}, cPos), {}, {
928
+ z: z
929
+ }),
930
+ size: newSize
931
+ });
932
+ }
933
+ export function createMonldingGroup(oldMG, layer, molding, catalog) {
934
+ var newMG = _objectSpread({}, oldMG);
935
+ newMG.molding = molding;
936
+ newMG.lines = getLinesFromItems2(oldMG, layer, catalog);
937
+ newMG.lines.reverse();
938
+ newMG = getMDPoints(newMG);
939
+ return newMG;
940
+ }
941
+ export function getMoldingDataOfScene2(layer, catalog, doorStyle) {
942
+ var _layer$items;
943
+ var moldingData = [];
944
+ var items = layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 ? void 0 : _layer$items.toArray();
945
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
946
+
947
+ // get all molding line segments
948
+ var moldingLines = [];
949
+ items === null || items === void 0 || items.forEach(function (item) {
950
+ if (item.category === ITEM_TYPE.CABINET) {
951
+ var _item$properties$get$, _item$properties$get$2, _item$properties$get$3, _item$molding;
952
+ var MGlines = getLinesOfItem2(item, allLineRects, catalog); // exclude overlayed to wall
953
+ // id & width
954
+ var parentId = item.id;
955
+ var inchWidth = convert(item.properties.get('width').get('_length')).from((_item$properties$get$ = item.properties.get('width').get('_unit')) !== null && _item$properties$get$ !== void 0 ? _item$properties$get$ : 'in').to('in');
956
+ // z position of molding line
957
+ var z = item.properties.get('altitude').get('_length');
958
+ var zUnit = (_item$properties$get$2 = item.properties.get('altitude').get('_unit')) !== null && _item$properties$get$2 !== void 0 ? _item$properties$get$2 : 'in';
959
+ z = convert(z).from(zUnit).to('cm');
960
+ var h = item.properties.get('height').get('_length');
961
+ var hUnit = (_item$properties$get$3 = item.properties.get('height').get('_unit')) !== null && _item$properties$get$3 !== void 0 ? _item$properties$get$3 : 'in';
962
+ h = convert(h).from(hUnit).to('cm');
963
+ if (!isEmpty(item.molding) && isEnableItemForMolding(layer, item)) {
964
+ // calc normal molding line
965
+ item === null || item === void 0 || item.molding.forEach(function (molding) {
966
+ var lineZ = z;
967
+ switch (molding.location_type) {
968
+ case TOP_MOLDING_LOCATION:
969
+ lineZ = z + h;
970
+ break;
971
+ case MIDDLE_MOLDING_LOCATION:
972
+ lineZ = z + h / 2;
973
+ break;
974
+ }
975
+ MGlines === null || MGlines === void 0 || MGlines.forEach(function (line) {
976
+ return moldingLines.push({
977
+ molding: _objectSpread({}, molding),
978
+ doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : !isEmpty(item.doorStyle) && item.doorStyle.toJS(),
979
+ line: line,
980
+ z: lineZ,
981
+ parentId: parentId,
982
+ inchWidth: inchWidth
983
+ });
984
+ });
985
+ });
986
+ } else if (
987
+ // calc toe kick molding line
988
+ item.layoutpos === BASE_CABINET_LAYOUTPOS && (isEmpty(item.molding) || ((_item$molding = item.molding) === null || _item$molding === void 0 ? void 0 : _item$molding.length) < 1 || !isEnableItemForMolding(layer, item))) {
989
+ var skuName = getToeKickSKU(item.doorStyle, catalog);
990
+ var thumbnail = skuName ? skuName : '';
991
+ MGlines === null || MGlines === void 0 || MGlines.forEach(function (line) {
992
+ return moldingLines.push({
993
+ molding: {
994
+ name: TOE_KICK_MOLDING,
995
+ sku: getToeKickSKU(item.doorStyle, catalog),
996
+ thumbnail: thumbnail,
997
+ category: 'molding',
998
+ type: 'cabinet'
999
+ },
1000
+ doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : !isEmpty(item.doorStyle) && item.doorStyle.toJS(),
1001
+ line: line,
1002
+ z: z,
1003
+ parentId: parentId,
1004
+ inchWidth: inchWidth
1005
+ });
1006
+ });
1007
+ }
1008
+ }
1009
+ });
1010
+
1011
+ // filter the real molding line segments
1012
+ var removeLineIds = []; // remove the line that fully overlapped to other line
1013
+ var newLines = []; // new countour line segment that except the overlapped part
1014
+ var _loop9 = function _loop9(i) {
1015
+ var srcLine = {
1016
+ x1: moldingLines[i].line[0].x,
1017
+ y1: moldingLines[i].line[0].y,
1018
+ x2: moldingLines[i].line[1].x,
1019
+ y2: moldingLines[i].line[1].y
1020
+ };
1021
+ var _loop1 = function _loop1(_j) {
1022
+ if (i === _j) return 0; // continue
1023
+ if (Math.abs(moldingLines[i].z - moldingLines[_j].z) > EPSILON) return 0; // continue
1024
+ var destLine = {
1025
+ x1: moldingLines[_j].line[0].x,
1026
+ y1: moldingLines[_j].line[0].y,
1027
+ x2: moldingLines[_j].line[1].x,
1028
+ y2: moldingLines[_j].line[1].y
1029
+ };
1030
+ var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
1031
+ if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
1032
+ removeLineIds.push(i);
1033
+ return 1; // break
1034
+ } else if (rst.result === OVERLAP_SOME) {
1035
+ removeLineIds.push(i);
1036
+ var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, moldingLines.filter(function (v, idx) {
1037
+ return idx !== i && idx !== _j && Math.abs(v.z - moldingLines[i].z) < EPSILON;
1038
+ }), 0);
1039
+ if (lineSegs.length > 0) {
1040
+ lineSegs.forEach(function (ls) {
1041
+ return newLines.push({
1042
+ molding: _objectSpread({}, moldingLines[i].molding),
1043
+ doorStyle: moldingLines[i].doorStyle,
1044
+ line: _toConsumableArray(ls),
1045
+ z: moldingLines[i].z,
1046
+ parentId: moldingLines[i].parentId,
1047
+ inchWidth: moldingLines[i].inchWidth
1048
+ });
1049
+ });
1050
+ }
1051
+ return 1; // break
1052
+ }
1053
+ },
1054
+ _ret4;
1055
+ for (var _j = 0; _j < moldingLines.length; _j++) {
1056
+ _ret4 = _loop1(_j);
1057
+ if (_ret4 === 0) continue;
1058
+ if (_ret4 === 1) break;
1059
+ }
1060
+ };
1061
+ for (var i = 0; i < moldingLines.length; i++) {
1062
+ _loop9(i);
1063
+ }
1064
+ moldingLines = moldingLines.filter(function (line, idx) {
1065
+ return !removeLineIds.some(function (id) {
1066
+ return idx === id;
1067
+ });
1068
+ });
1069
+ if (newLines.length > 0) moldingLines = [].concat(_toConsumableArray(moldingLines), newLines);
1070
+
1071
+ // filter again for toe kick molding lines
1072
+ // only remain one line per toe kick molding item
1073
+ var duplicatedLineIdxs = [];
1074
+ for (var _i4 = 0; _i4 < moldingLines.length; _i4++) {
1075
+ var _iml$molding;
1076
+ if (duplicatedLineIdxs.includes(_i4)) continue;
1077
+ var iml = moldingLines[_i4];
1078
+ if (((_iml$molding = iml.molding) === null || _iml$molding === void 0 ? void 0 : _iml$molding.name) !== TOE_KICK_MOLDING) continue;
1079
+ for (var j = 0; j < moldingLines.length; j++) {
1080
+ if (_i4 === j) continue;
1081
+ var jml = moldingLines[j];
1082
+ if (jml.parentId === iml.parentId) duplicatedLineIdxs.push(j);
1083
+ }
1084
+ }
1085
+ moldingLines = moldingLines.filter(function (line, idx) {
1086
+ return !duplicatedLineIdxs.some(function (id) {
1087
+ return idx === id;
1088
+ });
1089
+ });
1090
+ // console.log('moldingLines: ', moldingLines);
1091
+
1092
+ // make molding data with sorting molding & doorStyle
1093
+ var _loop0 = function _loop0() {
1094
+ var ml = moldingLines[k];
1095
+ var mlLength = ml.molding.name === TOE_KICK_MOLDING ? ml.inchWidth : convert(GeometryUtils.verticesDistance(ml.line[0], ml.line[1])).from('cm').to('in');
1096
+ var idx = moldingData.findIndex(function (v) {
1097
+ var _ml$molding, _v$doorStyle, _ml$doorStyle;
1098
+ return (v === null || v === void 0 ? void 0 : v.name) === ((_ml$molding = ml.molding) === null || _ml$molding === void 0 ? void 0 : _ml$molding.name) && ((_v$doorStyle = v.doorStyle) === null || _v$doorStyle === void 0 ? void 0 : _v$doorStyle.id) === ((_ml$doorStyle = ml.doorStyle) === null || _ml$doorStyle === void 0 ? void 0 : _ml$doorStyle.id);
1099
+ });
1100
+ if (idx < 0) moldingData.push(_objectSpread(_objectSpread({}, ml.molding), {}, {
1101
+ doorStyle: ml.doorStyle,
1102
+ totalLength: mlLength,
1103
+ count: Math.ceil(mlLength * 1.1 / 96)
1104
+ }));else {
1105
+ moldingData[idx].totalLength += mlLength;
1106
+ moldingData[idx].count = Math.ceil(moldingData[idx].totalLength * 1.1 / 96);
1107
+ }
1108
+ };
1109
+ for (var k = 0; k < moldingLines.length; k++) {
1110
+ _loop0();
1111
+ }
1112
+ // console.log('moldingData: ', moldingData);
1113
+
1114
+ return moldingData;
1115
+ }
1116
+ export function getMoldingDataOfScene(layer, catalog, doorStyle) {
1117
+ var moldingData = [];
1118
+ var items = layer.items.toArray();
1119
+ var moldings = [];
1120
+ // get all moldings info
1121
+ items.forEach(function (itemCat) {
1122
+ var _itemCat$molding;
1123
+ itemCat === null || itemCat === void 0 || (_itemCat$molding = itemCat.molding) === null || _itemCat$molding === void 0 || _itemCat$molding.forEach(function (molding) {
1124
+ if (!moldings.some(function (m) {
1125
+ return m.name === molding.name;
1126
+ })) moldings.push(molding);
1127
+ });
1128
+ });
1129
+
1130
+ // calc normal molding
1131
+ moldings.forEach(function (molding) {
1132
+ var itemGroups = [];
1133
+ var temp_items = [];
1134
+ items.forEach(function (item) {
1135
+ if (item.molding.some(function (mol) {
1136
+ return mol.itemID === molding.itemID;
1137
+ }) && isEnableItemForMolding(layer, item)) {
1138
+ temp_items.push(item);
1139
+ }
1140
+ });
1141
+ if (temp_items.length) {
1142
+ while (temp_items.length > 0) {
1143
+ var itemGroup = [temp_items[0]];
1144
+ var _loop10 = function _loop10(_idx) {
1145
+ if (!itemGroup.some(function (it) {
1146
+ return it.id === temp_items[_idx].id;
1147
+ }) && isItemSnappedGroup(temp_items[_idx], itemGroup)) {
1148
+ itemGroup.push(temp_items[_idx]);
1149
+ _idx = 0;
1150
+ }
1151
+ idx = _idx;
1152
+ };
1153
+ for (var idx = 0; idx < temp_items.length; idx++) {
1154
+ _loop10(idx);
1155
+ }
1156
+ itemGroup.forEach(function (item) {
1157
+ var index = temp_items.findIndex(function (it) {
1158
+ return it.id === item.id;
1159
+ });
1160
+ if (index > -1) {
1161
+ temp_items.splice(index, 1);
1162
+ }
1163
+ });
1164
+ itemGroups.push(itemGroup);
1165
+ }
1166
+ var molding_totalLength = 0;
1167
+ itemGroups.forEach(function (itemgroup) {
1168
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
1169
+ var items = _toConsumableArray(itemgroup);
1170
+ var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
1171
+ items = sortItemsByDistance(items, items[0]);
1172
+ var _loop11 = function _loop11() {
1173
+ var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
1174
+ var temp_MGLines = [];
1175
+ MGlines.forEach(function (line) {
1176
+ var idx = itemLines.findIndex(function (itemLine) {
1177
+ return isLinesOverlapped(line, itemLine);
1178
+ });
1179
+ var curItemLine = itemLines[idx];
1180
+ if (idx > -1) {
1181
+ if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
1182
+ var MGLine = mergeOverlappedLines(line, curItemLine);
1183
+ temp_MGLines.push(MGLine);
1184
+ }
1185
+ itemLines.splice(idx, 1);
1186
+ } else {
1187
+ temp_MGLines.push(line);
1188
+ }
1189
+ });
1190
+ itemLines.forEach(function (itemLine) {
1191
+ return temp_MGLines.push(itemLine);
1192
+ });
1193
+ MGlines = [].concat(temp_MGLines);
1194
+ };
1195
+ for (var i = 1; i < items.length; i++) {
1196
+ _loop11();
1197
+ }
1198
+ MGlines.forEach(function (line) {
1199
+ molding_totalLength += GeometryUtils.verticesDistance(line[0], line[1]);
1200
+ });
1201
+ });
1202
+ molding_totalLength = convert(molding_totalLength).from('cm').to('in');
1203
+ moldingData.push(_objectSpread(_objectSpread({}, molding), {}, {
1204
+ doorStyle: doorStyle,
1205
+ count: Math.ceil(molding_totalLength * 1.1 / 96)
1206
+ }));
1207
+ }
1208
+ });
1209
+
1210
+ // calc toe kick molding
1211
+ var tmp = [];
1212
+ items.forEach(function (item) {
1213
+ if (item.category === 'cabinet' && !item.cabinet_category.toLowerCase().includes('microwave')) {
1214
+ tmp.push(item);
1215
+ }
1216
+ });
1217
+ var tmpMoldingData = [];
1218
+ var toedoorStyles = [];
1219
+ tmp.map(function (item) {
1220
+ var _item$molding2;
1221
+ if (item.layoutpos === BASE_CABINET_LAYOUTPOS && (isEmpty(item.molding) || ((_item$molding2 = item.molding) === null || _item$molding2 === void 0 ? void 0 : _item$molding2.length) < 1 || !isEnableItemForMolding(layer, item))) {
1222
+ var w = item.properties.get('width').get('_length');
1223
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
1224
+ w = convert(w / 2).from(wUnit).to('cm');
1225
+ var h = item.properties.get('depth').get('_length');
1226
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
1227
+ h = convert(h / 2).from(hUnit).to('cm');
1228
+ var outline = null;
1229
+ var element = catalog.elements[item.get('type')];
1230
+ if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
1231
+ outline = element.info.outline;
1232
+ var len = 0;
1233
+ if (outline) {
1234
+ // Extract Points from `outline`
1235
+ var outlinePaths = outline.paths;
1236
+ var outlineWidth = outline.svgWidth;
1237
+ var outlineHeight = outline.svgHeight;
1238
+ var outlinePoints = []; // Hold Points Of SVG
1239
+ var _iterator5 = _createForOfIteratorHelper(outlinePaths),
1240
+ _step5;
1241
+ try {
1242
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1243
+ var path = _step5.value;
1244
+ var _iterator6 = _createForOfIteratorHelper(path.subPaths),
1245
+ _step6;
1246
+ try {
1247
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1248
+ var subPath = _step6.value;
1249
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
1250
+ }
1251
+ } catch (err) {
1252
+ _iterator6.e(err);
1253
+ } finally {
1254
+ _iterator6.f();
1255
+ }
1256
+ }
1257
+ } catch (err) {
1258
+ _iterator5.e(err);
1259
+ } finally {
1260
+ _iterator5.f();
1261
+ }
1262
+ var maxX = outlinePoints[0].x,
1263
+ minX = outlinePoints[0].x;
1264
+ var maxY = outlinePoints[0].y,
1265
+ minY = outlinePoints[0].y;
1266
+ outlinePoints.forEach(function (point) {
1267
+ if (point.x > maxX) {
1268
+ maxX = point.x;
1269
+ }
1270
+ if (point.x < minX) {
1271
+ minX = point.x;
1272
+ }
1273
+ if (point.y > maxY) {
1274
+ maxY = point.y;
1275
+ }
1276
+ if (point.y < minY) {
1277
+ minY = point.y;
1278
+ }
1279
+ });
1280
+ outlinePoints.forEach(function (point) {
1281
+ if (GeometryUtils.isPointInRect([{
1282
+ x: minX,
1283
+ y: minY
1284
+ }, {
1285
+ x: minX,
1286
+ y: maxY
1287
+ }, {
1288
+ x: maxX,
1289
+ y: maxY
1290
+ }, {
1291
+ x: maxX,
1292
+ y: minY
1293
+ }], point)) {
1294
+ if (point.x > 10) len += (point.x / outlineWidth - 0.5) * w * 2 + h * 2 - (point.y / outlineHeight - 0.5) * h * 2;
1295
+ }
1296
+ });
1297
+ len = convert(len).from('cm').to('in');
1298
+ } else {
1299
+ w = convert(w * 2).from('cm').to('in');
1300
+ len += w;
1301
+ }
1302
+ var doorIndex = toedoorStyles.findIndex(function (a) {
1303
+ var iDS = item === null || item === void 0 ? void 0 : item.doorStyle;
1304
+ if (!iDS) return false;
1305
+ if (!iDS.hasOwnProperty('id')) {
1306
+ iDS = iDS.toJS();
1307
+ }
1308
+ return a.doorStyle.id === iDS.id && isEqualInstallationType(a.doorStyle, iDS);
1309
+ });
1310
+ if (doorIndex > -1) {
1311
+ toedoorStyles[doorIndex].totalLength += len;
1312
+ } else {
1313
+ toedoorStyles.push({
1314
+ doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : item.doorStyle && item.doorStyle.toJS(),
1315
+ totalLength: len
1316
+ });
1317
+ }
1318
+ }
1319
+ });
1320
+ toedoorStyles.forEach(function (doorStyle) {
1321
+ var skuName = getToeKickSKU(doorStyle.doorStyle, catalog);
1322
+ var thumbnail = skuName ? skuName : '';
1323
+ // moldings.forEach(molding => {
1324
+ // if (
1325
+ // molding.name ===
1326
+ // getToeKickSKU(
1327
+ // doorStyle.doorStyle,
1328
+ // catalog,
1329
+ // true
1330
+ // )
1331
+ // )
1332
+ // thumbnail = molding.thumbnail;
1333
+ // });
1334
+
1335
+ doorStyle.totalLength && tmpMoldingData.push({
1336
+ name: TOE_KICK_MOLDING,
1337
+ sku: getToeKickSKU(doorStyle.doorStyle, catalog),
1338
+ thumbnail: thumbnail,
1339
+ category: 'molding',
1340
+ type: 'cabinet',
1341
+ doorStyle: doorStyle.doorStyle,
1342
+ count: Math.ceil(doorStyle.totalLength * 1.1 / 96)
1343
+ });
1344
+ });
1345
+ if (tmpMoldingData.length > 0) moldingData = [].concat(_toConsumableArray(moldingData), tmpMoldingData);
1346
+ return moldingData;
1347
+ }