kitchen-simulator 4.1.7-react-18 → 4.2.2
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.
- package/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +171 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/actions/project-actions.js +2 -1
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/factories/wall-factory.js +1 -1
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +24 -11
- package/es/catalog/utils/item-loader.js +224 -220
- package/es/class/hole.js +0 -2
- package/es/class/item.js +92 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +96 -81
- package/es/components/content.js +10 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +29 -29
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +22 -54
- package/es/components/viewer2d/ruler.js +16 -11
- package/es/components/viewer2d/rulerDist.js +38 -51
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +17 -12
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/vertex.js +3 -2
- package/es/components/viewer2d/viewer2d.js +81 -118
- package/es/components/viewer3d/front3D.js +13 -1
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +270 -69
- package/es/components/viewer3d/viewer3d-first-person.js +26 -32
- package/es/components/viewer3d/viewer3d.js +110 -130
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +589 -62
- package/es/models.js +13 -8
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +4 -1
- package/es/reducers/viewer2d-reducer.js +3 -1
- package/es/reducers/viewer3d-reducer.js +3 -1
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +77 -119
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +829 -609
- package/es/utils/molding.js +489 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +170 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/actions/project-actions.js +2 -1
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/factories/wall-factory.js +1 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +24 -11
- package/lib/catalog/utils/item-loader.js +221 -217
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +90 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +96 -81
- package/lib/components/content.js +10 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +29 -29
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +22 -54
- package/lib/components/viewer2d/ruler.js +15 -10
- package/lib/components/viewer2d/rulerDist.js +38 -51
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +17 -12
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/vertex.js +3 -2
- package/lib/components/viewer2d/viewer2d.js +79 -115
- package/lib/components/viewer3d/front3D.js +13 -1
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +267 -66
- package/lib/components/viewer3d/viewer3d-first-person.js +26 -32
- package/lib/components/viewer3d/viewer3d.js +107 -126
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +591 -62
- package/lib/models.js +13 -8
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +4 -1
- package/lib/reducers/viewer2d-reducer.js +3 -1
- package/lib/reducers/viewer3d-reducer.js +3 -1
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +77 -119
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +829 -608
- package/lib/utils/molding.js +490 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +21 -20
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
package/lib/utils/molding.js
CHANGED
|
@@ -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,76 @@ function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
330
333
|
}
|
|
331
334
|
return lines;
|
|
332
335
|
}
|
|
336
|
+
function getLinesOfItem2(item, allLineRects, catalog) {
|
|
337
|
+
var _lines;
|
|
338
|
+
var lines = [];
|
|
339
|
+
var outline = null;
|
|
340
|
+
var element = catalog.elements[item.get('type')];
|
|
341
|
+
if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
|
|
342
|
+
// get edge lines
|
|
343
|
+
var newWidth = item.properties.get('width').get('_length');
|
|
344
|
+
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
345
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
|
|
346
|
+
var newDepth = item.properties.get('depth').get('_length');
|
|
347
|
+
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
348
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
|
|
349
|
+
if (item) {
|
|
350
|
+
var _element;
|
|
351
|
+
// Get Outline Data of Selected Item
|
|
352
|
+
outline = (_element = element) === null || _element === void 0 ? void 0 : _element.info.outline;
|
|
353
|
+
if (outline) {
|
|
354
|
+
// Extract Points from `outline`
|
|
355
|
+
var outlinePaths = outline.paths;
|
|
356
|
+
var outlineWidth = outline.svgWidth;
|
|
357
|
+
var outlineHeight = outline.svgHeight;
|
|
358
|
+
var outlinePoints = []; // Hold Points Of SVG
|
|
359
|
+
var _iterator3 = _createForOfIteratorHelper(outlinePaths),
|
|
360
|
+
_step3;
|
|
361
|
+
try {
|
|
362
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
363
|
+
var path = _step3.value;
|
|
364
|
+
var _iterator4 = _createForOfIteratorHelper(path.subPaths),
|
|
365
|
+
_step4;
|
|
366
|
+
try {
|
|
367
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
368
|
+
var subPath = _step4.value;
|
|
369
|
+
outlinePoints = outlinePoints.concat(subPath.getPoints());
|
|
370
|
+
}
|
|
371
|
+
} catch (err) {
|
|
372
|
+
_iterator4.e(err);
|
|
373
|
+
} finally {
|
|
374
|
+
_iterator4.f();
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} catch (err) {
|
|
378
|
+
_iterator3.e(err);
|
|
379
|
+
} finally {
|
|
380
|
+
_iterator3.f();
|
|
381
|
+
}
|
|
382
|
+
outline.reverse && outlinePoints.reverse();
|
|
383
|
+
for (var i = 0; i < outlinePoints.length - 1; i++) {
|
|
384
|
+
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()]);
|
|
385
|
+
}
|
|
386
|
+
} else {
|
|
387
|
+
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
388
|
+
for (var _i2 = 0; _i2 < 4; _i2++) {
|
|
389
|
+
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()]);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
lines = (_lines = lines) === null || _lines === void 0 ? void 0 : _lines.filter(function (line) {
|
|
394
|
+
return !_export.GeometryUtils.isSnappedLine({
|
|
395
|
+
rect: [{
|
|
396
|
+
x: 0,
|
|
397
|
+
y: 0
|
|
398
|
+
}, {
|
|
399
|
+
x: 0,
|
|
400
|
+
y: 0
|
|
401
|
+
}, line[0], line[1]]
|
|
402
|
+
}, allLineRects);
|
|
403
|
+
});
|
|
404
|
+
return lines;
|
|
405
|
+
}
|
|
333
406
|
function isParallelLines(line1, line2) {
|
|
334
407
|
var isParallel = false;
|
|
335
408
|
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 +584,20 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
511
584
|
// merge the collinear linked lines to one line
|
|
512
585
|
var newMGlines = [];
|
|
513
586
|
var filteredMGlines = MGlines;
|
|
514
|
-
var _loop3 = function _loop3(
|
|
587
|
+
var _loop3 = function _loop3(_i3) {
|
|
515
588
|
if (filteredMGlines.length < 1) return 0; // break
|
|
516
589
|
if (!filteredMGlines.some(function (v) {
|
|
517
|
-
return v[2] === MGlines[
|
|
590
|
+
return v[2] === MGlines[_i3][2];
|
|
518
591
|
})) return 1; // continue
|
|
519
|
-
var mergedResult = getMergedLine(MGlines[
|
|
592
|
+
var mergedResult = getMergedLine(MGlines[_i3], filteredMGlines, 0);
|
|
520
593
|
if (mergedResult) {
|
|
521
594
|
newMGlines.push(mergedResult.mergedLine);
|
|
522
595
|
filteredMGlines = mergedResult.filteredMGlines;
|
|
523
596
|
}
|
|
524
597
|
},
|
|
525
598
|
_ret;
|
|
526
|
-
for (var
|
|
527
|
-
_ret = _loop3(
|
|
599
|
+
for (var _i3 = 0; _i3 < MGlines.length; _i3++) {
|
|
600
|
+
_ret = _loop3(_i3);
|
|
528
601
|
if (_ret === 0) break;
|
|
529
602
|
if (_ret === 1) continue;
|
|
530
603
|
}
|
|
@@ -613,11 +686,12 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
613
686
|
};
|
|
614
687
|
var bContourSeg = true;
|
|
615
688
|
var _loop6 = function _loop6(j) {
|
|
689
|
+
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
690
|
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
|
|
691
|
+
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,
|
|
692
|
+
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,
|
|
693
|
+
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,
|
|
694
|
+
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
695
|
};
|
|
622
696
|
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
623
697
|
if (rst.result == _constants.OVERLAP_SAME || rst.result == _constants.OVERLAP_INCLUDED) {
|
|
@@ -892,4 +966,411 @@ function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
|
892
966
|
newMG.lines.reverse();
|
|
893
967
|
newMG = getMDPoints(newMG);
|
|
894
968
|
return newMG;
|
|
969
|
+
}
|
|
970
|
+
function getMoldingDataOfScene2(layer, catalog, doorStyle) {
|
|
971
|
+
var _layer$items;
|
|
972
|
+
var moldingData = [];
|
|
973
|
+
var items = layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 ? void 0 : _layer$items.toArray();
|
|
974
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
975
|
+
|
|
976
|
+
// get all molding line segments
|
|
977
|
+
var moldingLines = [];
|
|
978
|
+
items === null || items === void 0 || items.forEach(function (item) {
|
|
979
|
+
if (item.category === _constants.ITEM_TYPE.CABINET) {
|
|
980
|
+
var _item$properties$get$, _item$properties$get$2, _item$properties$get$3, _item$molding;
|
|
981
|
+
var MGlines = getLinesOfItem2(item, allLineRects, catalog); // exclude overlayed to wall
|
|
982
|
+
// id & width
|
|
983
|
+
var parentId = item.id;
|
|
984
|
+
var inchWidth = (0, _convertUnitsLite.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');
|
|
985
|
+
// z position of molding line
|
|
986
|
+
var z = item.properties.get('altitude').get('_length');
|
|
987
|
+
var zUnit = (_item$properties$get$2 = item.properties.get('altitude').get('_unit')) !== null && _item$properties$get$2 !== void 0 ? _item$properties$get$2 : 'in';
|
|
988
|
+
z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
|
|
989
|
+
var h = item.properties.get('height').get('_length');
|
|
990
|
+
var hUnit = (_item$properties$get$3 = item.properties.get('height').get('_unit')) !== null && _item$properties$get$3 !== void 0 ? _item$properties$get$3 : 'in';
|
|
991
|
+
h = (0, _convertUnitsLite.convert)(h).from(hUnit).to('cm');
|
|
992
|
+
if (!(0, _helper.isEmpty)(item.molding) && isEnableItemForMolding(layer, item)) {
|
|
993
|
+
// calc normal molding line
|
|
994
|
+
item === null || item === void 0 || item.molding.forEach(function (molding) {
|
|
995
|
+
var lineZ = z;
|
|
996
|
+
switch (molding.location_type) {
|
|
997
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
998
|
+
lineZ = z + h;
|
|
999
|
+
break;
|
|
1000
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
1001
|
+
lineZ = z + h / 2;
|
|
1002
|
+
break;
|
|
1003
|
+
}
|
|
1004
|
+
MGlines === null || MGlines === void 0 || MGlines.forEach(function (line) {
|
|
1005
|
+
return moldingLines.push({
|
|
1006
|
+
molding: _objectSpread({}, molding),
|
|
1007
|
+
doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : !(0, _helper.isEmpty)(item.doorStyle) && item.doorStyle.toJS(),
|
|
1008
|
+
line: line,
|
|
1009
|
+
z: lineZ,
|
|
1010
|
+
parentId: parentId,
|
|
1011
|
+
inchWidth: inchWidth
|
|
1012
|
+
});
|
|
1013
|
+
});
|
|
1014
|
+
});
|
|
1015
|
+
} else if (
|
|
1016
|
+
// calc toe kick molding line
|
|
1017
|
+
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))) {
|
|
1018
|
+
var skuName = (0, _utils.getToeKickSKU)(item.doorStyle, catalog);
|
|
1019
|
+
var thumbnail = skuName ? skuName : '';
|
|
1020
|
+
MGlines === null || MGlines === void 0 || MGlines.forEach(function (line) {
|
|
1021
|
+
return moldingLines.push({
|
|
1022
|
+
molding: {
|
|
1023
|
+
name: _constants.TOE_KICK_MOLDING,
|
|
1024
|
+
sku: (0, _utils.getToeKickSKU)(item.doorStyle, catalog),
|
|
1025
|
+
thumbnail: thumbnail,
|
|
1026
|
+
category: 'molding',
|
|
1027
|
+
type: 'cabinet'
|
|
1028
|
+
},
|
|
1029
|
+
doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : !(0, _helper.isEmpty)(item.doorStyle) && item.doorStyle.toJS(),
|
|
1030
|
+
line: line,
|
|
1031
|
+
z: z,
|
|
1032
|
+
parentId: parentId,
|
|
1033
|
+
inchWidth: inchWidth
|
|
1034
|
+
});
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
|
|
1040
|
+
// filter the real molding line segments
|
|
1041
|
+
var removeLineIds = []; // remove the line that fully overlapped to other line
|
|
1042
|
+
var newLines = []; // new countour line segment that except the overlapped part
|
|
1043
|
+
var _loop9 = function _loop9(i) {
|
|
1044
|
+
var srcLine = {
|
|
1045
|
+
x1: moldingLines[i].line[0].x,
|
|
1046
|
+
y1: moldingLines[i].line[0].y,
|
|
1047
|
+
x2: moldingLines[i].line[1].x,
|
|
1048
|
+
y2: moldingLines[i].line[1].y
|
|
1049
|
+
};
|
|
1050
|
+
var _loop1 = function _loop1(_j) {
|
|
1051
|
+
if (i === _j) return 0; // continue
|
|
1052
|
+
if (Math.abs(moldingLines[i].z - moldingLines[_j].z) > _constants.EPSILON) return 0; // continue
|
|
1053
|
+
var destLine = {
|
|
1054
|
+
x1: moldingLines[_j].line[0].x,
|
|
1055
|
+
y1: moldingLines[_j].line[0].y,
|
|
1056
|
+
x2: moldingLines[_j].line[1].x,
|
|
1057
|
+
y2: moldingLines[_j].line[1].y
|
|
1058
|
+
};
|
|
1059
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
1060
|
+
if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
|
|
1061
|
+
removeLineIds.push(i);
|
|
1062
|
+
return 1; // break
|
|
1063
|
+
} else if (rst.result === _constants.OVERLAP_SOME) {
|
|
1064
|
+
removeLineIds.push(i);
|
|
1065
|
+
var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, moldingLines.filter(function (v, idx) {
|
|
1066
|
+
return idx !== i && idx !== _j && Math.abs(v.z - moldingLines[i].z) < _constants.EPSILON;
|
|
1067
|
+
}), 0);
|
|
1068
|
+
if (lineSegs.length > 0) {
|
|
1069
|
+
lineSegs.forEach(function (ls) {
|
|
1070
|
+
return newLines.push({
|
|
1071
|
+
molding: _objectSpread({}, moldingLines[i].molding),
|
|
1072
|
+
doorStyle: moldingLines[i].doorStyle,
|
|
1073
|
+
line: (0, _toConsumableArray2["default"])(ls),
|
|
1074
|
+
z: moldingLines[i].z,
|
|
1075
|
+
parentId: moldingLines[i].parentId,
|
|
1076
|
+
inchWidth: moldingLines[i].inchWidth
|
|
1077
|
+
});
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
return 1; // break
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
_ret4;
|
|
1084
|
+
for (var _j = 0; _j < moldingLines.length; _j++) {
|
|
1085
|
+
_ret4 = _loop1(_j);
|
|
1086
|
+
if (_ret4 === 0) continue;
|
|
1087
|
+
if (_ret4 === 1) break;
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
for (var i = 0; i < moldingLines.length; i++) {
|
|
1091
|
+
_loop9(i);
|
|
1092
|
+
}
|
|
1093
|
+
moldingLines = moldingLines.filter(function (line, idx) {
|
|
1094
|
+
return !removeLineIds.some(function (id) {
|
|
1095
|
+
return idx === id;
|
|
1096
|
+
});
|
|
1097
|
+
});
|
|
1098
|
+
if (newLines.length > 0) moldingLines = [].concat((0, _toConsumableArray2["default"])(moldingLines), newLines);
|
|
1099
|
+
|
|
1100
|
+
// filter again for toe kick molding lines
|
|
1101
|
+
// only remain one line per toe kick molding item
|
|
1102
|
+
var duplicatedLineIdxs = [];
|
|
1103
|
+
for (var _i4 = 0; _i4 < moldingLines.length; _i4++) {
|
|
1104
|
+
var _iml$molding;
|
|
1105
|
+
if (duplicatedLineIdxs.includes(_i4)) continue;
|
|
1106
|
+
var iml = moldingLines[_i4];
|
|
1107
|
+
if (((_iml$molding = iml.molding) === null || _iml$molding === void 0 ? void 0 : _iml$molding.name) !== _constants.TOE_KICK_MOLDING) continue;
|
|
1108
|
+
for (var j = 0; j < moldingLines.length; j++) {
|
|
1109
|
+
if (_i4 === j) continue;
|
|
1110
|
+
var jml = moldingLines[j];
|
|
1111
|
+
if (jml.parentId === iml.parentId) duplicatedLineIdxs.push(j);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
moldingLines = moldingLines.filter(function (line, idx) {
|
|
1115
|
+
return !duplicatedLineIdxs.some(function (id) {
|
|
1116
|
+
return idx === id;
|
|
1117
|
+
});
|
|
1118
|
+
});
|
|
1119
|
+
// console.log('moldingLines: ', moldingLines);
|
|
1120
|
+
|
|
1121
|
+
// make molding data with sorting molding & doorStyle
|
|
1122
|
+
var _loop0 = function _loop0() {
|
|
1123
|
+
var ml = moldingLines[k];
|
|
1124
|
+
var mlLength = ml.molding.name === _constants.TOE_KICK_MOLDING ? ml.inchWidth : (0, _convertUnitsLite.convert)(_export.GeometryUtils.verticesDistance(ml.line[0], ml.line[1])).from('cm').to('in');
|
|
1125
|
+
var idx = moldingData.findIndex(function (v) {
|
|
1126
|
+
var _ml$molding, _v$doorStyle, _ml$doorStyle;
|
|
1127
|
+
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);
|
|
1128
|
+
});
|
|
1129
|
+
if (idx < 0) moldingData.push(_objectSpread(_objectSpread({}, ml.molding), {}, {
|
|
1130
|
+
doorStyle: ml.doorStyle,
|
|
1131
|
+
totalLength: mlLength,
|
|
1132
|
+
count: Math.ceil(mlLength * 1.1 / 96)
|
|
1133
|
+
}));else {
|
|
1134
|
+
moldingData[idx].totalLength += mlLength;
|
|
1135
|
+
moldingData[idx].count = Math.ceil(moldingData[idx].totalLength * 1.1 / 96);
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
for (var k = 0; k < moldingLines.length; k++) {
|
|
1139
|
+
_loop0();
|
|
1140
|
+
}
|
|
1141
|
+
// console.log('moldingData: ', moldingData);
|
|
1142
|
+
|
|
1143
|
+
return moldingData;
|
|
1144
|
+
}
|
|
1145
|
+
function getMoldingDataOfScene(layer, catalog, doorStyle) {
|
|
1146
|
+
var moldingData = [];
|
|
1147
|
+
var items = layer.items.toArray();
|
|
1148
|
+
var moldings = [];
|
|
1149
|
+
// get all moldings info
|
|
1150
|
+
items.forEach(function (itemCat) {
|
|
1151
|
+
var _itemCat$molding;
|
|
1152
|
+
itemCat === null || itemCat === void 0 || (_itemCat$molding = itemCat.molding) === null || _itemCat$molding === void 0 || _itemCat$molding.forEach(function (molding) {
|
|
1153
|
+
if (!moldings.some(function (m) {
|
|
1154
|
+
return m.name === molding.name;
|
|
1155
|
+
})) moldings.push(molding);
|
|
1156
|
+
});
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
// calc normal molding
|
|
1160
|
+
moldings.forEach(function (molding) {
|
|
1161
|
+
var itemGroups = [];
|
|
1162
|
+
var temp_items = [];
|
|
1163
|
+
items.forEach(function (item) {
|
|
1164
|
+
if (item.molding.some(function (mol) {
|
|
1165
|
+
return mol.itemID === molding.itemID;
|
|
1166
|
+
}) && isEnableItemForMolding(layer, item)) {
|
|
1167
|
+
temp_items.push(item);
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
if (temp_items.length) {
|
|
1171
|
+
while (temp_items.length > 0) {
|
|
1172
|
+
var itemGroup = [temp_items[0]];
|
|
1173
|
+
var _loop10 = function _loop10(_idx) {
|
|
1174
|
+
if (!itemGroup.some(function (it) {
|
|
1175
|
+
return it.id === temp_items[_idx].id;
|
|
1176
|
+
}) && isItemSnappedGroup(temp_items[_idx], itemGroup)) {
|
|
1177
|
+
itemGroup.push(temp_items[_idx]);
|
|
1178
|
+
_idx = 0;
|
|
1179
|
+
}
|
|
1180
|
+
idx = _idx;
|
|
1181
|
+
};
|
|
1182
|
+
for (var idx = 0; idx < temp_items.length; idx++) {
|
|
1183
|
+
_loop10(idx);
|
|
1184
|
+
}
|
|
1185
|
+
itemGroup.forEach(function (item) {
|
|
1186
|
+
var index = temp_items.findIndex(function (it) {
|
|
1187
|
+
return it.id === item.id;
|
|
1188
|
+
});
|
|
1189
|
+
if (index > -1) {
|
|
1190
|
+
temp_items.splice(index, 1);
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
itemGroups.push(itemGroup);
|
|
1194
|
+
}
|
|
1195
|
+
var molding_totalLength = 0;
|
|
1196
|
+
itemGroups.forEach(function (itemgroup) {
|
|
1197
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
1198
|
+
var items = (0, _toConsumableArray2["default"])(itemgroup);
|
|
1199
|
+
var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
|
|
1200
|
+
items = sortItemsByDistance(items, items[0]);
|
|
1201
|
+
var _loop11 = function _loop11() {
|
|
1202
|
+
var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
|
|
1203
|
+
var temp_MGLines = [];
|
|
1204
|
+
MGlines.forEach(function (line) {
|
|
1205
|
+
var idx = itemLines.findIndex(function (itemLine) {
|
|
1206
|
+
return isLinesOverlapped(line, itemLine);
|
|
1207
|
+
});
|
|
1208
|
+
var curItemLine = itemLines[idx];
|
|
1209
|
+
if (idx > -1) {
|
|
1210
|
+
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]))) {
|
|
1211
|
+
var MGLine = mergeOverlappedLines(line, curItemLine);
|
|
1212
|
+
temp_MGLines.push(MGLine);
|
|
1213
|
+
}
|
|
1214
|
+
itemLines.splice(idx, 1);
|
|
1215
|
+
} else {
|
|
1216
|
+
temp_MGLines.push(line);
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
itemLines.forEach(function (itemLine) {
|
|
1220
|
+
return temp_MGLines.push(itemLine);
|
|
1221
|
+
});
|
|
1222
|
+
MGlines = [].concat(temp_MGLines);
|
|
1223
|
+
};
|
|
1224
|
+
for (var i = 1; i < items.length; i++) {
|
|
1225
|
+
_loop11();
|
|
1226
|
+
}
|
|
1227
|
+
MGlines.forEach(function (line) {
|
|
1228
|
+
molding_totalLength += _export.GeometryUtils.verticesDistance(line[0], line[1]);
|
|
1229
|
+
});
|
|
1230
|
+
});
|
|
1231
|
+
molding_totalLength = (0, _convertUnitsLite.convert)(molding_totalLength).from('cm').to('in');
|
|
1232
|
+
moldingData.push(_objectSpread(_objectSpread({}, molding), {}, {
|
|
1233
|
+
doorStyle: doorStyle,
|
|
1234
|
+
count: Math.ceil(molding_totalLength * 1.1 / 96)
|
|
1235
|
+
}));
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1238
|
+
|
|
1239
|
+
// calc toe kick molding
|
|
1240
|
+
var tmp = [];
|
|
1241
|
+
items.forEach(function (item) {
|
|
1242
|
+
if (item.category === 'cabinet' && !item.cabinet_category.toLowerCase().includes('microwave')) {
|
|
1243
|
+
tmp.push(item);
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
var tmpMoldingData = [];
|
|
1247
|
+
var toedoorStyles = [];
|
|
1248
|
+
tmp.map(function (item) {
|
|
1249
|
+
var _item$molding2;
|
|
1250
|
+
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))) {
|
|
1251
|
+
var w = item.properties.get('width').get('_length');
|
|
1252
|
+
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
1253
|
+
w = (0, _convertUnitsLite.convert)(w / 2).from(wUnit).to('cm');
|
|
1254
|
+
var h = item.properties.get('depth').get('_length');
|
|
1255
|
+
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
1256
|
+
h = (0, _convertUnitsLite.convert)(h / 2).from(hUnit).to('cm');
|
|
1257
|
+
var outline = null;
|
|
1258
|
+
var element = catalog.elements[item.get('type')];
|
|
1259
|
+
if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
|
|
1260
|
+
outline = element.info.outline;
|
|
1261
|
+
var len = 0;
|
|
1262
|
+
if (outline) {
|
|
1263
|
+
// Extract Points from `outline`
|
|
1264
|
+
var outlinePaths = outline.paths;
|
|
1265
|
+
var outlineWidth = outline.svgWidth;
|
|
1266
|
+
var outlineHeight = outline.svgHeight;
|
|
1267
|
+
var outlinePoints = []; // Hold Points Of SVG
|
|
1268
|
+
var _iterator5 = _createForOfIteratorHelper(outlinePaths),
|
|
1269
|
+
_step5;
|
|
1270
|
+
try {
|
|
1271
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1272
|
+
var path = _step5.value;
|
|
1273
|
+
var _iterator6 = _createForOfIteratorHelper(path.subPaths),
|
|
1274
|
+
_step6;
|
|
1275
|
+
try {
|
|
1276
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
1277
|
+
var subPath = _step6.value;
|
|
1278
|
+
outlinePoints = outlinePoints.concat(subPath.getPoints());
|
|
1279
|
+
}
|
|
1280
|
+
} catch (err) {
|
|
1281
|
+
_iterator6.e(err);
|
|
1282
|
+
} finally {
|
|
1283
|
+
_iterator6.f();
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
} catch (err) {
|
|
1287
|
+
_iterator5.e(err);
|
|
1288
|
+
} finally {
|
|
1289
|
+
_iterator5.f();
|
|
1290
|
+
}
|
|
1291
|
+
var maxX = outlinePoints[0].x,
|
|
1292
|
+
minX = outlinePoints[0].x;
|
|
1293
|
+
var maxY = outlinePoints[0].y,
|
|
1294
|
+
minY = outlinePoints[0].y;
|
|
1295
|
+
outlinePoints.forEach(function (point) {
|
|
1296
|
+
if (point.x > maxX) {
|
|
1297
|
+
maxX = point.x;
|
|
1298
|
+
}
|
|
1299
|
+
if (point.x < minX) {
|
|
1300
|
+
minX = point.x;
|
|
1301
|
+
}
|
|
1302
|
+
if (point.y > maxY) {
|
|
1303
|
+
maxY = point.y;
|
|
1304
|
+
}
|
|
1305
|
+
if (point.y < minY) {
|
|
1306
|
+
minY = point.y;
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
outlinePoints.forEach(function (point) {
|
|
1310
|
+
if (_export.GeometryUtils.isPointInRect([{
|
|
1311
|
+
x: minX,
|
|
1312
|
+
y: minY
|
|
1313
|
+
}, {
|
|
1314
|
+
x: minX,
|
|
1315
|
+
y: maxY
|
|
1316
|
+
}, {
|
|
1317
|
+
x: maxX,
|
|
1318
|
+
y: maxY
|
|
1319
|
+
}, {
|
|
1320
|
+
x: maxX,
|
|
1321
|
+
y: minY
|
|
1322
|
+
}], point)) {
|
|
1323
|
+
if (point.x > 10) len += (point.x / outlineWidth - 0.5) * w * 2 + h * 2 - (point.y / outlineHeight - 0.5) * h * 2;
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
len = (0, _convertUnitsLite.convert)(len).from('cm').to('in');
|
|
1327
|
+
} else {
|
|
1328
|
+
w = (0, _convertUnitsLite.convert)(w * 2).from('cm').to('in');
|
|
1329
|
+
len += w;
|
|
1330
|
+
}
|
|
1331
|
+
var doorIndex = toedoorStyles.findIndex(function (a) {
|
|
1332
|
+
var iDS = item === null || item === void 0 ? void 0 : item.doorStyle;
|
|
1333
|
+
if (!iDS) return false;
|
|
1334
|
+
if (!iDS.hasOwnProperty('id')) {
|
|
1335
|
+
iDS = iDS.toJS();
|
|
1336
|
+
}
|
|
1337
|
+
return a.doorStyle.id === iDS.id && (0, _utils.isEqualInstallationType)(a.doorStyle, iDS);
|
|
1338
|
+
});
|
|
1339
|
+
if (doorIndex > -1) {
|
|
1340
|
+
toedoorStyles[doorIndex].totalLength += len;
|
|
1341
|
+
} else {
|
|
1342
|
+
toedoorStyles.push({
|
|
1343
|
+
doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : item.doorStyle && item.doorStyle.toJS(),
|
|
1344
|
+
totalLength: len
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
});
|
|
1349
|
+
toedoorStyles.forEach(function (doorStyle) {
|
|
1350
|
+
var skuName = (0, _utils.getToeKickSKU)(doorStyle.doorStyle, catalog);
|
|
1351
|
+
var thumbnail = skuName ? skuName : '';
|
|
1352
|
+
// moldings.forEach(molding => {
|
|
1353
|
+
// if (
|
|
1354
|
+
// molding.name ===
|
|
1355
|
+
// getToeKickSKU(
|
|
1356
|
+
// doorStyle.doorStyle,
|
|
1357
|
+
// catalog,
|
|
1358
|
+
// true
|
|
1359
|
+
// )
|
|
1360
|
+
// )
|
|
1361
|
+
// thumbnail = molding.thumbnail;
|
|
1362
|
+
// });
|
|
1363
|
+
|
|
1364
|
+
doorStyle.totalLength && tmpMoldingData.push({
|
|
1365
|
+
name: _constants.TOE_KICK_MOLDING,
|
|
1366
|
+
sku: (0, _utils.getToeKickSKU)(doorStyle.doorStyle, catalog),
|
|
1367
|
+
thumbnail: thumbnail,
|
|
1368
|
+
category: 'molding',
|
|
1369
|
+
type: 'cabinet',
|
|
1370
|
+
doorStyle: doorStyle.doorStyle,
|
|
1371
|
+
count: Math.ceil(doorStyle.totalLength * 1.1 / 96)
|
|
1372
|
+
});
|
|
1373
|
+
});
|
|
1374
|
+
if (tmpMoldingData.length > 0) moldingData = [].concat((0, _toConsumableArray2["default"])(moldingData), tmpMoldingData);
|
|
1375
|
+
return moldingData;
|
|
895
1376
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRulerDisplayData = getRulerDisplayData;
|
|
7
|
+
var _convertUnitsLite = require("../utils/convert-units-lite.js");
|
|
8
|
+
var _constants = require("../constants");
|
|
9
|
+
// Below this length, the measurement LINE is hidden
|
|
10
|
+
var MIN_LENGTH_TO_SHOW_RULER_LINE_INCH = 13;
|
|
11
|
+
|
|
12
|
+
// Below this length, the measurement VALUE (text) is hidden
|
|
13
|
+
var MIN_LENGTH_TO_SHOW_RULER_VALUE_INCH = 5;
|
|
14
|
+
function formatDistance(value, fixed) {
|
|
15
|
+
// format with fixed decimals first
|
|
16
|
+
var text = value.toFixed(fixed);
|
|
17
|
+
|
|
18
|
+
// remove trailing zeros AFTER decimal, then remove trailing dot if needed
|
|
19
|
+
// examples:
|
|
20
|
+
// 2.00 -> 2
|
|
21
|
+
// 2.50 -> 2.5
|
|
22
|
+
// 200.00 -> 200
|
|
23
|
+
text = text.replace(/\.?0+$/, '');
|
|
24
|
+
return text;
|
|
25
|
+
}
|
|
26
|
+
function getUnitString(unit) {
|
|
27
|
+
if (unit === 'cm' || unit === 'mm') return '';
|
|
28
|
+
if (unit === 'in') return '"';
|
|
29
|
+
return unit;
|
|
30
|
+
}
|
|
31
|
+
function getRulerDisplayData(_ref) {
|
|
32
|
+
var length = _ref.length,
|
|
33
|
+
unit = _ref.unit,
|
|
34
|
+
rulerUnit = _ref.rulerUnit,
|
|
35
|
+
layerUnit = _ref.layerUnit,
|
|
36
|
+
_ref$charWidth = _ref.charWidth,
|
|
37
|
+
charWidth = _ref$charWidth === void 0 ? 8 : _ref$charWidth;
|
|
38
|
+
// 7.62 cm -> ruLength 2.99 in
|
|
39
|
+
var ruLength = (0, _convertUnitsLite.convert)(length).from(unit).to(rulerUnit);
|
|
40
|
+
var fixedLength = layerUnit === _constants.UNIT_MILLIMETER ? 0 : layerUnit === _constants.UNIT_CENTIMETER ? 1 : 2;
|
|
41
|
+
|
|
42
|
+
// 2.99 in -> valueInLayerUnit 2.99 in
|
|
43
|
+
var valueInLayerUnit = (0, _convertUnitsLite.convert)(ruLength).from(rulerUnit).to(layerUnit);
|
|
44
|
+
|
|
45
|
+
// 2.99 -> "3"
|
|
46
|
+
var distanceText = formatDistance(valueInLayerUnit, fixedLength);
|
|
47
|
+
var unitStr = getUnitString(layerUnit);
|
|
48
|
+
var textCount = distanceText.length + unitStr.length;
|
|
49
|
+
// textLength = (3 + ") * 8 = 16
|
|
50
|
+
var textLength = textCount * charWidth;
|
|
51
|
+
|
|
52
|
+
// lengthInInch = 7.62 cm -> 2.99 inch
|
|
53
|
+
var lengthInInch = (0, _convertUnitsLite.convert)(length).from(unit).to(_constants.UNIT_INCH);
|
|
54
|
+
var bShowText = lengthInInch > MIN_LENGTH_TO_SHOW_RULER_VALUE_INCH && length - textLength + 24 > 0;
|
|
55
|
+
var bShowLine = lengthInInch > MIN_LENGTH_TO_SHOW_RULER_LINE_INCH && length - textLength - 8 > 0;
|
|
56
|
+
return {
|
|
57
|
+
distanceText: distanceText,
|
|
58
|
+
unitStr: unitStr,
|
|
59
|
+
textLength: textLength,
|
|
60
|
+
bShowText: bShowText,
|
|
61
|
+
bShowLine: bShowLine
|
|
62
|
+
};
|
|
63
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kitchen-simulator",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"description": "It is a kitchen simulator (self-contained micro-frontend).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -72,36 +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
|
|
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": "
|
|
85
|
-
"react-svg-pan-zoom": "
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
"react-dom": "^18.3.1"
|
|
84
|
+
"react-redux": "5.0.7",
|
|
85
|
+
"react-svg-pan-zoom": "2.18.0",
|
|
86
|
+
"redux": "4.0.1",
|
|
87
|
+
"three": "0.166.0",
|
|
88
|
+
"moment": "^2.30.1",
|
|
89
|
+
"jwt-decode": "^2.2.0",
|
|
90
|
+
"react-ga4": "^1.4.1",
|
|
91
|
+
"styled-components": "^5.2.0"
|
|
93
92
|
},
|
|
94
93
|
"devDependencies": {
|
|
95
|
-
"
|
|
96
|
-
"react-
|
|
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",
|
|
97
100
|
"@babel/cli": "^7.28.3",
|
|
98
101
|
"@babel/core": "^7.28.4",
|
|
99
102
|
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
|
|
100
103
|
"@babel/plugin-transform-runtime": "^7.28.3",
|
|
101
104
|
"@babel/preset-env": "^7.28.3",
|
|
102
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",
|
|
103
109
|
"@sentry/webpack-plugin": "^3.2.4",
|
|
104
|
-
"antd": "^4.24.16",
|
|
105
110
|
"assert": "^2.1.0",
|
|
106
111
|
"babel-loader": "^9.1.3",
|
|
107
112
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
@@ -117,15 +122,11 @@
|
|
|
117
122
|
"file-loader": "6.2.0",
|
|
118
123
|
"html-webpack-plugin": "5.6.0",
|
|
119
124
|
"immutable-devtools": "0.1.4",
|
|
120
|
-
"localstorage-slim": "^1.3.0",
|
|
121
125
|
"mobile-detect": "^1.4.5",
|
|
122
126
|
"path-browserify": "^1.0.1",
|
|
123
127
|
"react-query": "^3.39.3",
|
|
124
128
|
"react-router-dom": "5.1.2",
|
|
125
|
-
"reactjs-popup": "^2.0.4",
|
|
126
129
|
"rimraf": "^2.6.3",
|
|
127
|
-
"sass": "^1.29.0",
|
|
128
|
-
"sass-loader": "^10.0.5",
|
|
129
130
|
"stream-browserify": "^3.0.0",
|
|
130
131
|
"style-loader": "*",
|
|
131
132
|
"webpack": "5.92.1",
|