kitchen-simulator 4.0.8-react-18 → 4.0.8

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 (196) hide show
  1. package/README.md +3 -0
  2. package/es/AppContext.js +1 -1
  3. package/es/LiteKitchenConfigurator.js +162 -107
  4. package/es/LiteRenderer.js +162 -137
  5. package/es/actions/export.js +25 -12
  6. package/es/assets/gltf/door_sliding.bin +0 -0
  7. package/es/assets/img/png/helper/video_preview_start.png +0 -0
  8. package/es/assets/img/svg/bottombar/elevation.svg +12 -5
  9. package/es/catalog/catalog.js +21 -5
  10. package/es/catalog/holes/window-clear/planner-element.js +2 -2
  11. package/es/catalog/properties/export.js +21 -0
  12. package/es/catalog/properties/property-checkbox.js +68 -0
  13. package/es/catalog/properties/property-color.js +39 -0
  14. package/es/catalog/properties/property-enum.js +50 -0
  15. package/es/catalog/properties/property-hidden.js +19 -0
  16. package/es/catalog/properties/property-lenght-measure.js +100 -0
  17. package/es/catalog/properties/property-length-measure.js +84 -0
  18. package/es/catalog/properties/property-length-measure_hole.js +100 -0
  19. package/es/catalog/properties/property-number.js +48 -0
  20. package/es/catalog/properties/property-read-only.js +26 -0
  21. package/es/catalog/properties/property-string.js +48 -0
  22. package/es/catalog/properties/property-toggle.js +39 -0
  23. package/es/catalog/properties/shared-property-style.js +14 -0
  24. package/es/catalog/utils/exporter.js +24 -11
  25. package/es/catalog/utils/item-loader.js +35 -26
  26. package/es/class/hole.js +0 -2
  27. package/es/class/item.js +96 -70
  28. package/es/class/line.js +4 -8
  29. package/es/class/project.js +95 -80
  30. package/es/components/content.js +5 -93
  31. package/es/components/export.js +4 -6
  32. package/es/components/style/button.js +106 -0
  33. package/es/components/style/cancel-button.js +21 -0
  34. package/es/components/style/content-container.js +30 -0
  35. package/es/components/style/content-title.js +25 -0
  36. package/es/components/style/delete-button.js +24 -0
  37. package/es/components/style/export.js +28 -2
  38. package/es/components/style/form-block.js +20 -0
  39. package/es/components/style/form-color-input.js +26 -0
  40. package/es/components/style/form-label.js +22 -0
  41. package/es/components/style/form-number-input.js +29 -27
  42. package/es/components/style/form-number-input_2.js +200 -0
  43. package/es/components/style/form-select.js +19 -0
  44. package/es/components/style/form-slider.js +60 -0
  45. package/es/components/style/form-submit-button.js +25 -0
  46. package/es/components/style/form-text-input.js +69 -0
  47. package/es/components/viewer2d/grids/grid-streak.js +1 -1
  48. package/es/components/viewer2d/group.js +5 -4
  49. package/es/components/viewer2d/item.js +155 -359
  50. package/es/components/viewer2d/layer.js +1 -1
  51. package/es/components/viewer2d/line.js +17 -47
  52. package/es/components/viewer2d/ruler.js +5 -3
  53. package/es/components/viewer2d/rulerDist.js +8 -7
  54. package/es/components/viewer2d/rulerX.js +4 -2
  55. package/es/components/viewer2d/rulerY.js +3 -0
  56. package/es/components/viewer2d/scene.js +17 -12
  57. package/es/components/viewer2d/state.js +1 -1
  58. package/es/components/viewer2d/utils.js +2 -2
  59. package/es/components/viewer2d/vertex.js +3 -2
  60. package/es/components/viewer2d/viewer2d.js +52 -87
  61. package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
  62. package/es/components/viewer3d/scene-creator.js +77 -39
  63. package/es/components/viewer3d/viewer3d-first-person.js +24 -26
  64. package/es/components/viewer3d/viewer3d.js +104 -114
  65. package/es/constants.js +7 -2
  66. package/es/devLiteRenderer.js +491 -150
  67. package/es/index.js +590 -21
  68. package/es/models.js +13 -8
  69. package/es/plugins/SVGLoader.js +1414 -0
  70. package/es/plugins/console-debugger.js +34 -0
  71. package/es/plugins/export.js +7 -0
  72. package/es/plugins/keyboard.js +110 -0
  73. package/es/reducers/project-reducer.js +3 -0
  74. package/es/reducers/viewer2d-reducer.js +3 -1
  75. package/es/reducers/viewer3d-reducer.js +3 -1
  76. package/es/styles/export.js +5 -0
  77. package/es/styles/tabs.css +40 -0
  78. package/es/utils/geometry.js +77 -119
  79. package/es/utils/helper.js +38 -1
  80. package/es/utils/isolate-event-handler.js +826 -606
  81. package/es/utils/molding.js +457 -11
  82. package/lib/AppContext.js +1 -1
  83. package/lib/LiteKitchenConfigurator.js +161 -107
  84. package/lib/LiteRenderer.js +161 -137
  85. package/lib/actions/export.js +35 -39
  86. package/lib/assets/gltf/door_sliding.bin +0 -0
  87. package/lib/assets/img/png/helper/video_preview_start.png +0 -0
  88. package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
  89. package/lib/catalog/catalog.js +20 -4
  90. package/lib/catalog/holes/window-clear/planner-element.js +2 -2
  91. package/lib/catalog/properties/export.js +81 -0
  92. package/lib/catalog/properties/property-checkbox.js +76 -0
  93. package/lib/catalog/properties/property-color.js +47 -0
  94. package/lib/catalog/properties/property-enum.js +58 -0
  95. package/lib/catalog/properties/property-hidden.js +27 -0
  96. package/lib/catalog/properties/property-lenght-measure.js +108 -0
  97. package/lib/catalog/properties/property-length-measure.js +92 -0
  98. package/lib/catalog/properties/property-length-measure_hole.js +108 -0
  99. package/lib/catalog/properties/property-number.js +56 -0
  100. package/lib/catalog/properties/property-read-only.js +34 -0
  101. package/lib/catalog/properties/property-string.js +56 -0
  102. package/lib/catalog/properties/property-toggle.js +47 -0
  103. package/lib/catalog/properties/shared-property-style.js +21 -0
  104. package/lib/catalog/utils/exporter.js +24 -11
  105. package/lib/catalog/utils/item-loader.js +35 -26
  106. package/lib/class/hole.js +0 -2
  107. package/lib/class/item.js +94 -68
  108. package/lib/class/line.js +3 -7
  109. package/lib/class/project.js +95 -80
  110. package/lib/components/content.js +5 -93
  111. package/lib/components/export.js +6 -26
  112. package/lib/components/style/button.js +115 -0
  113. package/lib/components/style/cancel-button.js +29 -0
  114. package/lib/components/style/content-container.js +38 -0
  115. package/lib/components/style/content-title.js +35 -0
  116. package/lib/components/style/delete-button.js +34 -0
  117. package/lib/components/style/export.js +105 -1
  118. package/lib/components/style/form-block.js +28 -0
  119. package/lib/components/style/form-color-input.js +34 -0
  120. package/lib/components/style/form-label.js +30 -0
  121. package/lib/components/style/form-number-input.js +29 -27
  122. package/lib/components/style/form-number-input_2.js +209 -0
  123. package/lib/components/style/form-select.js +29 -0
  124. package/lib/components/style/form-slider.js +68 -0
  125. package/lib/components/style/form-submit-button.js +35 -0
  126. package/lib/components/style/form-text-input.js +78 -0
  127. package/lib/components/viewer2d/grids/grid-streak.js +1 -1
  128. package/lib/components/viewer2d/group.js +5 -4
  129. package/lib/components/viewer2d/item.js +152 -356
  130. package/lib/components/viewer2d/layer.js +1 -1
  131. package/lib/components/viewer2d/line.js +17 -47
  132. package/lib/components/viewer2d/ruler.js +4 -2
  133. package/lib/components/viewer2d/rulerDist.js +8 -7
  134. package/lib/components/viewer2d/rulerX.js +4 -2
  135. package/lib/components/viewer2d/rulerY.js +3 -0
  136. package/lib/components/viewer2d/scene.js +17 -12
  137. package/lib/components/viewer2d/state.js +1 -1
  138. package/lib/components/viewer2d/utils.js +2 -2
  139. package/lib/components/viewer2d/vertex.js +3 -2
  140. package/lib/components/viewer2d/viewer2d.js +50 -84
  141. package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
  142. package/lib/components/viewer3d/scene-creator.js +75 -37
  143. package/lib/components/viewer3d/viewer3d-first-person.js +24 -26
  144. package/lib/components/viewer3d/viewer3d.js +101 -110
  145. package/lib/constants.js +12 -7
  146. package/lib/devLiteRenderer.js +489 -148
  147. package/lib/index.js +592 -21
  148. package/lib/models.js +13 -8
  149. package/lib/plugins/SVGLoader.js +1419 -0
  150. package/lib/plugins/console-debugger.js +42 -0
  151. package/lib/plugins/export.js +25 -0
  152. package/lib/plugins/keyboard.js +117 -0
  153. package/lib/reducers/project-reducer.js +3 -0
  154. package/lib/reducers/viewer2d-reducer.js +3 -1
  155. package/lib/reducers/viewer3d-reducer.js +3 -1
  156. package/lib/styles/export.js +13 -0
  157. package/lib/styles/tabs.css +40 -0
  158. package/lib/utils/geometry.js +77 -119
  159. package/lib/utils/helper.js +40 -1
  160. package/lib/utils/isolate-event-handler.js +826 -605
  161. package/lib/utils/molding.js +458 -9
  162. package/package.json +20 -15
  163. package/es/mocks/appliancePayload.json +0 -27
  164. package/es/mocks/cabinetPayload.json +0 -1914
  165. package/es/mocks/cabinetPayload2.json +0 -76
  166. package/es/mocks/dataBundle2.json +0 -4
  167. package/es/mocks/distancePayload.json +0 -6
  168. package/es/mocks/doorStylePayload2.json +0 -84
  169. package/es/mocks/furnishingPayload.json +0 -23
  170. package/es/mocks/itemCDSPayload.json +0 -27
  171. package/es/mocks/lightingPayload.json +0 -23
  172. package/es/mocks/mockProps.json +0 -43
  173. package/es/mocks/mockProps2.json +0 -9
  174. package/es/mocks/moldingPayload.json +0 -19
  175. package/es/mocks/projectItemsCatalog.json +0 -133
  176. package/es/mocks/rectangleShape.json +0 -238
  177. package/es/mocks/replaceCabinetPayload.json +0 -81
  178. package/es/mocks/roomShapePayload.json +0 -5
  179. package/es/useAppContext.js +0 -8
  180. package/lib/mocks/appliancePayload.json +0 -27
  181. package/lib/mocks/cabinetPayload.json +0 -1914
  182. package/lib/mocks/cabinetPayload2.json +0 -76
  183. package/lib/mocks/dataBundle2.json +0 -4
  184. package/lib/mocks/distancePayload.json +0 -6
  185. package/lib/mocks/doorStylePayload2.json +0 -84
  186. package/lib/mocks/furnishingPayload.json +0 -23
  187. package/lib/mocks/itemCDSPayload.json +0 -27
  188. package/lib/mocks/lightingPayload.json +0 -23
  189. package/lib/mocks/mockProps.json +0 -43
  190. package/lib/mocks/mockProps2.json +0 -9
  191. package/lib/mocks/moldingPayload.json +0 -19
  192. package/lib/mocks/projectItemsCatalog.json +0 -133
  193. package/lib/mocks/rectangleShape.json +0 -238
  194. package/lib/mocks/replaceCabinetPayload.json +0 -81
  195. package/lib/mocks/roomShapePayload.json +0 -5
  196. package/lib/useAppContext.js +0 -16
@@ -12,6 +12,9 @@ exports.getItemRect = getItemRect;
12
12
  exports.getLinesFromItems = getLinesFromItems;
13
13
  exports.getLinesFromItems2 = getLinesFromItems2;
14
14
  exports.getLinesOfItem = getLinesOfItem;
15
+ exports.getLinesOfItem2 = getLinesOfItem2;
16
+ exports.getMoldingDataOfScene = getMoldingDataOfScene;
17
+ exports.getMoldingDataOfScene2 = getMoldingDataOfScene2;
15
18
  exports.hasMoldingLayout = hasMoldingLayout;
16
19
  exports.isAttachedWall = isAttachedWall;
17
20
  exports.isEnableItemForMolding = isEnableItemForMolding;
@@ -330,6 +333,74 @@ function getLinesOfItem(item, allLineRects, catalog) {
330
333
  }
331
334
  return lines;
332
335
  }
336
+ function getLinesOfItem2(item, allLineRects, catalog) {
337
+ var lines = [];
338
+ var outline = null;
339
+ var element = catalog.elements[item.get('type')];
340
+ if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
341
+ // get edge lines
342
+ var newWidth = item.properties.get('width').get('_length');
343
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
344
+ newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
345
+ var newDepth = item.properties.get('depth').get('_length');
346
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
347
+ newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
348
+ if (item) {
349
+ // Get Outline Data of Selected Item
350
+ outline = element.info.outline;
351
+ if (outline) {
352
+ // Extract Points from `outline`
353
+ var outlinePaths = outline.paths;
354
+ var outlineWidth = outline.svgWidth;
355
+ var outlineHeight = outline.svgHeight;
356
+ var outlinePoints = []; // Hold Points Of SVG
357
+ var _iterator3 = _createForOfIteratorHelper(outlinePaths),
358
+ _step3;
359
+ try {
360
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
361
+ var path = _step3.value;
362
+ var _iterator4 = _createForOfIteratorHelper(path.subPaths),
363
+ _step4;
364
+ try {
365
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
366
+ var subPath = _step4.value;
367
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
368
+ }
369
+ } catch (err) {
370
+ _iterator4.e(err);
371
+ } finally {
372
+ _iterator4.f();
373
+ }
374
+ }
375
+ } catch (err) {
376
+ _iterator3.e(err);
377
+ } finally {
378
+ _iterator3.f();
379
+ }
380
+ outline.reverse && outlinePoints.reverse();
381
+ for (var i = 0; i < outlinePoints.length - 1; i++) {
382
+ lines.push([_export.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), _export.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["default"].acquireID()]);
383
+ }
384
+ } else {
385
+ var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
386
+ for (var _i2 = 0; _i2 < 4; _i2++) {
387
+ lines.push([_export.GeometryUtils.rotatePointAroundPoint(pos[_i2][0] * newWidth / 2 + item.x, pos[_i2][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _export.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["default"].acquireID()]);
388
+ }
389
+ }
390
+ }
391
+ lines = lines.filter(function (line) {
392
+ return !_export.GeometryUtils.isSnappedLine({
393
+ rect: [{
394
+ x: 0,
395
+ y: 0
396
+ }, {
397
+ x: 0,
398
+ y: 0
399
+ }, line[0], line[1]]
400
+ }, allLineRects);
401
+ });
402
+ return lines;
403
+ }
333
404
  function isParallelLines(line1, line2) {
334
405
  var isParallel = false;
335
406
  if (Math.abs(line1[0].y - line1[1].y) <= _constants.EPSILON && Math.abs(line2[0].y - line2[1].y) <= _constants.EPSILON) isParallel = true;
@@ -511,20 +582,20 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
511
582
  // merge the collinear linked lines to one line
512
583
  var newMGlines = [];
513
584
  var filteredMGlines = MGlines;
514
- var _loop3 = function _loop3(_i2) {
585
+ var _loop3 = function _loop3(_i3) {
515
586
  if (filteredMGlines.length < 1) return 0; // break
516
587
  if (!filteredMGlines.some(function (v) {
517
- return v[2] === MGlines[_i2][2];
588
+ return v[2] === MGlines[_i3][2];
518
589
  })) return 1; // continue
519
- var mergedResult = getMergedLine(MGlines[_i2], filteredMGlines, 0);
590
+ var mergedResult = getMergedLine(MGlines[_i3], filteredMGlines, 0);
520
591
  if (mergedResult) {
521
592
  newMGlines.push(mergedResult.mergedLine);
522
593
  filteredMGlines = mergedResult.filteredMGlines;
523
594
  }
524
595
  },
525
596
  _ret;
526
- for (var _i2 = 0; _i2 < MGlines.length; _i2++) {
527
- _ret = _loop3(_i2);
597
+ for (var _i3 = 0; _i3 < MGlines.length; _i3++) {
598
+ _ret = _loop3(_i3);
528
599
  if (_ret === 0) break;
529
600
  if (_ret === 1) continue;
530
601
  }
@@ -613,11 +684,12 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
613
684
  };
614
685
  var bContourSeg = true;
615
686
  var _loop6 = function _loop6(j) {
687
+ 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;
616
688
  var destLine = {
617
- x1: otherLines[j][0].x,
618
- y1: otherLines[j][0].y,
619
- x2: otherLines[j][1].x,
620
- y2: otherLines[j][1].y
689
+ 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,
690
+ 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,
691
+ 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,
692
+ 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
621
693
  };
622
694
  var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
623
695
  if (rst.result == _constants.OVERLAP_SAME || rst.result == _constants.OVERLAP_INCLUDED) {
@@ -892,4 +964,381 @@ function createMonldingGroup(oldMG, layer, molding, catalog) {
892
964
  newMG.lines.reverse();
893
965
  newMG = getMDPoints(newMG);
894
966
  return newMG;
967
+ }
968
+ function getMoldingDataOfScene2(layer, catalog, doorStyle) {
969
+ var moldingData = [];
970
+ var items = layer.items.toArray();
971
+ var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
972
+
973
+ // get all molding line segments
974
+ var moldingLines = [];
975
+ items.forEach(function (item) {
976
+ if (item.category === _constants.ITEM_TYPE.CABINET) {
977
+ var _item$molding;
978
+ var MGlines = getLinesOfItem2(item, allLineRects, catalog); // exclude overlayed to wall
979
+ // z position of molding line
980
+ var z = item.properties.get('altitude').get('_length');
981
+ var zUnit = item.properties.get('altitude').get('_unit') || 'cm';
982
+ z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
983
+ var h = item.properties.get('height').get('_length');
984
+ var hUnit = item.properties.get('height').get('_unit') || 'cm';
985
+ h = (0, _convertUnitsLite.convert)(h).from(hUnit).to('cm');
986
+ if (!(0, _helper.isEmpty)(item.molding) && isEnableItemForMolding(layer, item)) {
987
+ // calc normal molding line
988
+ item === null || item === void 0 || item.molding.forEach(function (molding) {
989
+ var lineZ = z;
990
+ switch (molding.location_type) {
991
+ case _constants.TOP_MOLDING_LOCATION:
992
+ lineZ = z + h;
993
+ break;
994
+ case _constants.MIDDLE_MOLDING_LOCATION:
995
+ lineZ = z + h / 2;
996
+ break;
997
+ }
998
+ MGlines === null || MGlines === void 0 || MGlines.forEach(function (line) {
999
+ return moldingLines.push({
1000
+ molding: _objectSpread({}, molding),
1001
+ doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : !(0, _helper.isEmpty)(item.doorStyle) && item.doorStyle.toJS(),
1002
+ line: line,
1003
+ z: lineZ
1004
+ });
1005
+ });
1006
+ });
1007
+ } else if (
1008
+ // calc toe kick molding line
1009
+ item.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && ((0, _helper.isEmpty)(item.molding) || ((_item$molding = item.molding) === null || _item$molding === void 0 ? void 0 : _item$molding.length) < 1 || !isEnableItemForMolding(layer, item))) {
1010
+ var skuName = (0, _utils.getToeKickSKU)(item.doorStyle, catalog);
1011
+ var thumbnail = skuName ? skuName : '';
1012
+ MGlines === null || MGlines === void 0 || MGlines.forEach(function (line) {
1013
+ return moldingLines.push({
1014
+ molding: {
1015
+ name: _constants.TOE_KICK_MOLDING,
1016
+ sku: (0, _utils.getToeKickSKU)(item.doorStyle, catalog),
1017
+ thumbnail: thumbnail,
1018
+ category: 'molding',
1019
+ type: 'cabinet'
1020
+ },
1021
+ doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : !(0, _helper.isEmpty)(item.doorStyle) && item.doorStyle.toJS(),
1022
+ line: line,
1023
+ z: z
1024
+ });
1025
+ });
1026
+ }
1027
+ }
1028
+ });
1029
+
1030
+ // filter the real molding line segments
1031
+ var removeLineIds = []; // remove the line that fully overlapped to other line
1032
+ var newLines = []; // new countour line segment that except the overlapped part
1033
+ var _loop9 = function _loop9(i) {
1034
+ var srcLine = {
1035
+ x1: moldingLines[i].line[0].x,
1036
+ y1: moldingLines[i].line[0].y,
1037
+ x2: moldingLines[i].line[1].x,
1038
+ y2: moldingLines[i].line[1].y
1039
+ };
1040
+ var _loop1 = function _loop1(j) {
1041
+ if (i === j) return 0; // continue
1042
+ if (Math.abs(moldingLines[i].z - moldingLines[j].z) > _constants.EPSILON) return 0; // continue
1043
+ var destLine = {
1044
+ x1: moldingLines[j].line[0].x,
1045
+ y1: moldingLines[j].line[0].y,
1046
+ x2: moldingLines[j].line[1].x,
1047
+ y2: moldingLines[j].line[1].y
1048
+ };
1049
+ var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
1050
+ if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
1051
+ removeLineIds.push(i);
1052
+ return 1; // break
1053
+ } else if (rst.result === _constants.OVERLAP_SOME) {
1054
+ removeLineIds.push(i);
1055
+ var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, moldingLines.filter(function (v, idx) {
1056
+ return idx !== i && idx !== j && Math.abs(v.z - moldingLines[i].z) < _constants.EPSILON;
1057
+ }), 0);
1058
+ if (lineSegs.length > 0) {
1059
+ lineSegs.forEach(function (ls) {
1060
+ return newLines.push({
1061
+ molding: _objectSpread({}, moldingLines[i].molding),
1062
+ doorStyle: moldingLines[i].doorStyle,
1063
+ line: (0, _toConsumableArray2["default"])(ls),
1064
+ z: moldingLines[i].z
1065
+ });
1066
+ });
1067
+ }
1068
+ return 1; // break
1069
+ }
1070
+ },
1071
+ _ret4;
1072
+ for (var j = 0; j < moldingLines.length; j++) {
1073
+ _ret4 = _loop1(j);
1074
+ if (_ret4 === 0) continue;
1075
+ if (_ret4 === 1) break;
1076
+ }
1077
+ };
1078
+ for (var i = 0; i < moldingLines.length; i++) {
1079
+ _loop9(i);
1080
+ }
1081
+ moldingLines = moldingLines.filter(function (line, idx) {
1082
+ return !removeLineIds.some(function (id) {
1083
+ return idx === id;
1084
+ });
1085
+ });
1086
+ if (newLines.length > 0) moldingLines = [].concat((0, _toConsumableArray2["default"])(moldingLines), newLines);
1087
+ // console.log('moldingLines: ', moldingLines);
1088
+
1089
+ // make molding data with sorting molding & doorStyle
1090
+ var _loop0 = function _loop0() {
1091
+ var ml = moldingLines[k];
1092
+ var mlLength = (0, _convertUnitsLite.convert)(_export.GeometryUtils.verticesDistance(ml.line[0], ml.line[1])).from('cm').to('in');
1093
+ var idx = moldingData.findIndex(function (v) {
1094
+ var _ml$molding, _v$doorStyle, _ml$doorStyle;
1095
+ 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);
1096
+ });
1097
+ if (idx < 0) moldingData.push(_objectSpread(_objectSpread({}, ml.molding), {}, {
1098
+ doorStyle: ml.doorStyle,
1099
+ totalLength: mlLength,
1100
+ count: Math.ceil(mlLength * 1.1 / 96)
1101
+ }));else {
1102
+ moldingData[idx].totalLength += mlLength;
1103
+ moldingData[idx].count = Math.ceil(moldingData[idx].totalLength * 1.1 / 96);
1104
+ }
1105
+ };
1106
+ for (var k = 0; k < moldingLines.length; k++) {
1107
+ _loop0();
1108
+ }
1109
+ // console.log('moldingData: ', moldingData);
1110
+
1111
+ return moldingData;
1112
+ }
1113
+ function getMoldingDataOfScene(layer, catalog, doorStyle) {
1114
+ var moldingData = [];
1115
+ var items = layer.items.toArray();
1116
+ var moldings = [];
1117
+ // get all moldings info
1118
+ items.forEach(function (itemCat) {
1119
+ var _itemCat$molding;
1120
+ itemCat === null || itemCat === void 0 || (_itemCat$molding = itemCat.molding) === null || _itemCat$molding === void 0 || _itemCat$molding.forEach(function (molding) {
1121
+ if (!moldings.some(function (m) {
1122
+ return m.name === molding.name;
1123
+ })) moldings.push(molding);
1124
+ });
1125
+ });
1126
+
1127
+ // calc normal molding
1128
+ moldings.forEach(function (molding) {
1129
+ var itemGroups = [];
1130
+ var temp_items = [];
1131
+ items.forEach(function (item) {
1132
+ if (item.molding.some(function (mol) {
1133
+ return mol.itemID === molding.itemID;
1134
+ }) && isEnableItemForMolding(layer, item)) {
1135
+ temp_items.push(item);
1136
+ }
1137
+ });
1138
+ if (temp_items.length) {
1139
+ while (temp_items.length > 0) {
1140
+ var itemGroup = [temp_items[0]];
1141
+ var _loop10 = function _loop10(_idx) {
1142
+ if (!itemGroup.some(function (it) {
1143
+ return it.id === temp_items[_idx].id;
1144
+ }) && isItemSnappedGroup(temp_items[_idx], itemGroup)) {
1145
+ itemGroup.push(temp_items[_idx]);
1146
+ _idx = 0;
1147
+ }
1148
+ idx = _idx;
1149
+ };
1150
+ for (var idx = 0; idx < temp_items.length; idx++) {
1151
+ _loop10(idx);
1152
+ }
1153
+ itemGroup.forEach(function (item) {
1154
+ var index = temp_items.findIndex(function (it) {
1155
+ return it.id === item.id;
1156
+ });
1157
+ if (index > -1) {
1158
+ temp_items.splice(index, 1);
1159
+ }
1160
+ });
1161
+ itemGroups.push(itemGroup);
1162
+ }
1163
+ var molding_totalLength = 0;
1164
+ itemGroups.forEach(function (itemgroup) {
1165
+ var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
1166
+ var items = (0, _toConsumableArray2["default"])(itemgroup);
1167
+ var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
1168
+ items = sortItemsByDistance(items, items[0]);
1169
+ var _loop11 = function _loop11() {
1170
+ var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
1171
+ var temp_MGLines = [];
1172
+ MGlines.forEach(function (line) {
1173
+ var idx = itemLines.findIndex(function (itemLine) {
1174
+ return isLinesOverlapped(line, itemLine);
1175
+ });
1176
+ var curItemLine = itemLines[idx];
1177
+ if (idx > -1) {
1178
+ if (!(_export.GeometryUtils.samePoints(line[0], curItemLine[0]) && _export.GeometryUtils.samePoints(line[1], curItemLine[1]) || _export.GeometryUtils.samePoints(line[0], curItemLine[1]) && _export.GeometryUtils.samePoints(line[1], curItemLine[0]))) {
1179
+ var MGLine = mergeOverlappedLines(line, curItemLine);
1180
+ temp_MGLines.push(MGLine);
1181
+ }
1182
+ itemLines.splice(idx, 1);
1183
+ } else {
1184
+ temp_MGLines.push(line);
1185
+ }
1186
+ });
1187
+ itemLines.forEach(function (itemLine) {
1188
+ return temp_MGLines.push(itemLine);
1189
+ });
1190
+ MGlines = [].concat(temp_MGLines);
1191
+ };
1192
+ for (var i = 1; i < items.length; i++) {
1193
+ _loop11();
1194
+ }
1195
+ MGlines.forEach(function (line) {
1196
+ molding_totalLength += _export.GeometryUtils.verticesDistance(line[0], line[1]);
1197
+ });
1198
+ });
1199
+ molding_totalLength = (0, _convertUnitsLite.convert)(molding_totalLength).from('cm').to('in');
1200
+ moldingData.push(_objectSpread(_objectSpread({}, molding), {}, {
1201
+ doorStyle: doorStyle,
1202
+ count: Math.ceil(molding_totalLength * 1.1 / 96)
1203
+ }));
1204
+ }
1205
+ });
1206
+
1207
+ // calc toe kick molding
1208
+ var tmp = [];
1209
+ items.forEach(function (item) {
1210
+ if (item.category === 'cabinet' && !item.cabinet_category.toLowerCase().includes('microwave')) {
1211
+ tmp.push(item);
1212
+ }
1213
+ });
1214
+ var tmpMoldingData = [];
1215
+ var toedoorStyles = [];
1216
+ tmp.map(function (item) {
1217
+ var _item$molding2;
1218
+ if (item.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && ((0, _helper.isEmpty)(item.molding) || ((_item$molding2 = item.molding) === null || _item$molding2 === void 0 ? void 0 : _item$molding2.length) < 1 || !isEnableItemForMolding(layer, item))) {
1219
+ var w = item.properties.get('width').get('_length');
1220
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
1221
+ w = (0, _convertUnitsLite.convert)(w / 2).from(wUnit).to('cm');
1222
+ var h = item.properties.get('depth').get('_length');
1223
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
1224
+ h = (0, _convertUnitsLite.convert)(h / 2).from(hUnit).to('cm');
1225
+ var outline = null;
1226
+ var element = catalog.elements[item.get('type')];
1227
+ if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
1228
+ outline = element.info.outline;
1229
+ var len = 0;
1230
+ if (outline) {
1231
+ // Extract Points from `outline`
1232
+ var outlinePaths = outline.paths;
1233
+ var outlineWidth = outline.svgWidth;
1234
+ var outlineHeight = outline.svgHeight;
1235
+ var outlinePoints = []; // Hold Points Of SVG
1236
+ var _iterator5 = _createForOfIteratorHelper(outlinePaths),
1237
+ _step5;
1238
+ try {
1239
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1240
+ var path = _step5.value;
1241
+ var _iterator6 = _createForOfIteratorHelper(path.subPaths),
1242
+ _step6;
1243
+ try {
1244
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1245
+ var subPath = _step6.value;
1246
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
1247
+ }
1248
+ } catch (err) {
1249
+ _iterator6.e(err);
1250
+ } finally {
1251
+ _iterator6.f();
1252
+ }
1253
+ }
1254
+ } catch (err) {
1255
+ _iterator5.e(err);
1256
+ } finally {
1257
+ _iterator5.f();
1258
+ }
1259
+ var maxX = outlinePoints[0].x,
1260
+ minX = outlinePoints[0].x;
1261
+ var maxY = outlinePoints[0].y,
1262
+ minY = outlinePoints[0].y;
1263
+ outlinePoints.forEach(function (point) {
1264
+ if (point.x > maxX) {
1265
+ maxX = point.x;
1266
+ }
1267
+ if (point.x < minX) {
1268
+ minX = point.x;
1269
+ }
1270
+ if (point.y > maxY) {
1271
+ maxY = point.y;
1272
+ }
1273
+ if (point.y < minY) {
1274
+ minY = point.y;
1275
+ }
1276
+ });
1277
+ outlinePoints.forEach(function (point) {
1278
+ if (_export.GeometryUtils.isPointInRect([{
1279
+ x: minX,
1280
+ y: minY
1281
+ }, {
1282
+ x: minX,
1283
+ y: maxY
1284
+ }, {
1285
+ x: maxX,
1286
+ y: maxY
1287
+ }, {
1288
+ x: maxX,
1289
+ y: minY
1290
+ }], point)) {
1291
+ if (point.x > 10) len += (point.x / outlineWidth - 0.5) * w * 2 + h * 2 - (point.y / outlineHeight - 0.5) * h * 2;
1292
+ }
1293
+ });
1294
+ len = (0, _convertUnitsLite.convert)(len).from('cm').to('in');
1295
+ } else {
1296
+ w = (0, _convertUnitsLite.convert)(w * 2).from('cm').to('in');
1297
+ len += w;
1298
+ }
1299
+ var doorIndex = toedoorStyles.findIndex(function (a) {
1300
+ var iDS = item === null || item === void 0 ? void 0 : item.doorStyle;
1301
+ if (!iDS) return false;
1302
+ if (!iDS.hasOwnProperty('id')) {
1303
+ iDS = iDS.toJS();
1304
+ }
1305
+ return a.doorStyle.id === iDS.id && (0, _utils.isEqualInstallationType)(a.doorStyle, iDS);
1306
+ });
1307
+ if (doorIndex > -1) {
1308
+ toedoorStyles[doorIndex].totalLength += len;
1309
+ } else {
1310
+ toedoorStyles.push({
1311
+ doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : item.doorStyle && item.doorStyle.toJS(),
1312
+ totalLength: len
1313
+ });
1314
+ }
1315
+ }
1316
+ });
1317
+ toedoorStyles.forEach(function (doorStyle) {
1318
+ var skuName = (0, _utils.getToeKickSKU)(doorStyle.doorStyle, catalog);
1319
+ var thumbnail = skuName ? skuName : '';
1320
+ // moldings.forEach(molding => {
1321
+ // if (
1322
+ // molding.name ===
1323
+ // getToeKickSKU(
1324
+ // doorStyle.doorStyle,
1325
+ // catalog,
1326
+ // true
1327
+ // )
1328
+ // )
1329
+ // thumbnail = molding.thumbnail;
1330
+ // });
1331
+
1332
+ doorStyle.totalLength && tmpMoldingData.push({
1333
+ name: _constants.TOE_KICK_MOLDING,
1334
+ sku: (0, _utils.getToeKickSKU)(doorStyle.doorStyle, catalog),
1335
+ thumbnail: thumbnail,
1336
+ category: 'molding',
1337
+ type: 'cabinet',
1338
+ doorStyle: doorStyle.doorStyle,
1339
+ count: Math.ceil(doorStyle.totalLength * 1.1 / 96)
1340
+ });
1341
+ });
1342
+ if (tmpMoldingData.length > 0) moldingData = [].concat((0, _toConsumableArray2["default"])(moldingData), tmpMoldingData);
1343
+ return moldingData;
895
1344
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "4.0.8-react-18",
3
+ "version": "4.0.8",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -72,32 +72,41 @@
72
72
  "immutablediff": "0.4.4",
73
73
  "immutablepatch": "0.5.0",
74
74
  "invariant": "^2.0.0",
75
- "jwt-decode": "^2.2.0",
76
- "moment": "^2.30.1",
77
75
  "nanoid": "^5.1.6",
78
76
  "polylabel": "1.0.2",
79
77
  "posthog-js": "^1.271.0",
80
78
  "prop-types": "^15.8.1",
81
- "react-ga4": "^1.4.1",
79
+ "react": "^16.9.0",
80
+ "react-container-dimensions": "1.4.1",
81
+ "react-dom": "16.9.0",
82
82
  "react-hotjar": "^1.0.11",
83
83
  "react-icons": "3.5.0",
84
- "react-redux": "^9.2.0",
85
- "react-svg-pan-zoom": "^3.13.1",
86
- "react-use-measure": "^2.1.7",
87
- "redux": "^5.0.1",
84
+ "react-redux": "5.0.7",
85
+ "react-svg-pan-zoom": "2.18.0",
86
+ "redux": "4.0.1",
88
87
  "three": "0.166.0",
89
- "react": "^18.3.1",
90
- "react-dom": "^18.3.1"
88
+ "moment": "^2.30.1",
89
+ "jwt-decode": "^2.2.0",
90
+ "react-ga4": "^1.4.1",
91
+ "styled-components": "^5.2.0"
91
92
  },
92
93
  "devDependencies": {
94
+ "localstorage-slim": "^1.3.0",
95
+ "react-tabs": "3.0.0",
96
+ "sass": "^1.29.0",
97
+ "reactjs-popup": "^2.0.4",
98
+ "sass-loader": "^10.0.5",
99
+ "antd": "^4.24.16",
93
100
  "@babel/cli": "^7.28.3",
94
101
  "@babel/core": "^7.28.4",
95
102
  "@babel/plugin-transform-modules-commonjs": "^7.27.1",
96
103
  "@babel/plugin-transform-runtime": "^7.28.3",
97
104
  "@babel/preset-env": "^7.28.3",
98
105
  "@babel/preset-react": "^7.27.1",
106
+ "@material-ui/core": "^4.12.3",
107
+ "@material-ui/icons": "^4.11.2",
108
+ "@material-ui/lab": "^4.0.0-alpha.61",
99
109
  "@sentry/webpack-plugin": "^3.2.4",
100
- "antd": "^4.24.16",
101
110
  "assert": "^2.1.0",
102
111
  "babel-loader": "^9.1.3",
103
112
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -113,15 +122,11 @@
113
122
  "file-loader": "6.2.0",
114
123
  "html-webpack-plugin": "5.6.0",
115
124
  "immutable-devtools": "0.1.4",
116
- "localstorage-slim": "^1.3.0",
117
125
  "mobile-detect": "^1.4.5",
118
126
  "path-browserify": "^1.0.1",
119
127
  "react-query": "^3.39.3",
120
128
  "react-router-dom": "5.1.2",
121
- "reactjs-popup": "^2.0.4",
122
129
  "rimraf": "^2.6.3",
123
- "sass": "^1.29.0",
124
- "sass-loader": "^10.0.5",
125
130
  "stream-browserify": "^3.0.0",
126
131
  "style-loader": "*",
127
132
  "webpack": "5.92.1",
@@ -1,27 +0,0 @@
1
- {
2
- "itemID": "7",
3
- "long_name": "30\" Bottom Freezer",
4
- "name": "30\" Bottom Freezer",
5
- "sizeinfo": {
6
- "width": 30,
7
- "depth": 27,
8
- "height": 67
9
- },
10
- "description": "",
11
- "prototype": "items",
12
- "type": "appliance",
13
- "base": "https://media.test.diydesignspace.com/uploads/Appliance/202205121705_7/thumbnail/Bottom%20freezer%2030.webp",
14
- "shape_svg": "https://media.test.diydesignspace.com/uploads/Appliance/202205121705_7/shape_svg/Top%20Freezer%2030.svg",
15
- "structure_json": {
16
- "base": "https://media.test.diydesignspace.com/uploads/Appliance/202205121705_7/gltf/refrigerator_1_30inch.gltf"
17
- },
18
- "layoutpos": "Base",
19
- "is_corner": 0,
20
- "alti": 0,
21
- "obj_property": {
22
- "category": "Bottom Freezer",
23
- "sku_number": "#app_7",
24
- "skuArray": []
25
- },
26
- "initialPosition": { "mouseX": 100, "mouseY": 100 }
27
- }