kitchen-simulator 3.1.2 → 3.1.11
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/es/LiteKitchenConfigurator.js +2 -1
- package/es/assets/img/png/helper/video_preview_start.png +0 -0
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/utils/item-loader.js +197 -197
- package/es/class/item.js +7 -0
- package/es/components/viewer2d/viewer2d.js +7 -7
- package/es/components/viewer3d/viewer3d.js +28 -12
- package/es/devLiteRenderer.js +98 -98
- package/es/utils/isolate-event-handler.js +20 -14
- package/es/utils/molding.js +234 -2
- package/lib/LiteKitchenConfigurator.js +2 -1
- package/lib/assets/img/png/helper/video_preview_start.png +0 -0
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/utils/item-loader.js +194 -194
- package/lib/class/item.js +7 -0
- package/lib/components/viewer2d/viewer2d.js +7 -7
- package/lib/components/viewer3d/viewer3d.js +28 -12
- package/lib/devLiteRenderer.js +93 -93
- package/lib/utils/isolate-event-handler.js +20 -14
- package/lib/utils/molding.js +233 -0
- package/package.json +1 -1
package/lib/utils/molding.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.getItemRect = getItemRect;
|
|
|
12
12
|
exports.getLinesFromItems = getLinesFromItems;
|
|
13
13
|
exports.getLinesFromItems2 = getLinesFromItems2;
|
|
14
14
|
exports.getLinesOfItem = getLinesOfItem;
|
|
15
|
+
exports.getMoldingDataOfScene = getMoldingDataOfScene;
|
|
15
16
|
exports.hasMoldingLayout = hasMoldingLayout;
|
|
16
17
|
exports.isAttachedWall = isAttachedWall;
|
|
17
18
|
exports.isEnableItemForMolding = isEnableItemForMolding;
|
|
@@ -892,4 +893,236 @@ function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
|
892
893
|
newMG.lines.reverse();
|
|
893
894
|
newMG = getMDPoints(newMG);
|
|
894
895
|
return newMG;
|
|
896
|
+
}
|
|
897
|
+
function getMoldingDataOfScene(layer, catalog, doorStyle) {
|
|
898
|
+
var moldingData = [];
|
|
899
|
+
var items = layer.items.toArray();
|
|
900
|
+
var moldings = [];
|
|
901
|
+
// get all moldings info
|
|
902
|
+
items.forEach(function (itemCat) {
|
|
903
|
+
var _itemCat$molding;
|
|
904
|
+
itemCat === null || itemCat === void 0 || (_itemCat$molding = itemCat.molding) === null || _itemCat$molding === void 0 || _itemCat$molding.forEach(function (molding) {
|
|
905
|
+
if (!moldings.some(function (m) {
|
|
906
|
+
return m.name === molding.name;
|
|
907
|
+
})) moldings.push(molding);
|
|
908
|
+
});
|
|
909
|
+
});
|
|
910
|
+
|
|
911
|
+
// calc normal molding
|
|
912
|
+
moldings.forEach(function (molding) {
|
|
913
|
+
var itemGroups = [];
|
|
914
|
+
var temp_items = [];
|
|
915
|
+
items.forEach(function (item) {
|
|
916
|
+
if (item.molding.some(function (mol) {
|
|
917
|
+
return mol.itemID === molding.itemID;
|
|
918
|
+
}) && isEnableItemForMolding(layer, item)) {
|
|
919
|
+
temp_items.push(item);
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
if (temp_items.length) {
|
|
923
|
+
while (temp_items.length > 0) {
|
|
924
|
+
var itemGroup = [temp_items[0]];
|
|
925
|
+
var _loop9 = function _loop9(_idx) {
|
|
926
|
+
if (!itemGroup.some(function (it) {
|
|
927
|
+
return it.id === temp_items[_idx].id;
|
|
928
|
+
}) && isItemSnappedGroup(temp_items[_idx], itemGroup)) {
|
|
929
|
+
itemGroup.push(temp_items[_idx]);
|
|
930
|
+
_idx = 0;
|
|
931
|
+
}
|
|
932
|
+
idx = _idx;
|
|
933
|
+
};
|
|
934
|
+
for (var idx = 0; idx < temp_items.length; idx++) {
|
|
935
|
+
_loop9(idx);
|
|
936
|
+
}
|
|
937
|
+
itemGroup.forEach(function (item) {
|
|
938
|
+
var index = temp_items.findIndex(function (it) {
|
|
939
|
+
return it.id === item.id;
|
|
940
|
+
});
|
|
941
|
+
if (index > -1) {
|
|
942
|
+
temp_items.splice(index, 1);
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
itemGroups.push(itemGroup);
|
|
946
|
+
}
|
|
947
|
+
var molding_totalLength = 0;
|
|
948
|
+
itemGroups.forEach(function (itemgroup) {
|
|
949
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
950
|
+
var items = (0, _toConsumableArray2["default"])(itemgroup);
|
|
951
|
+
var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
|
|
952
|
+
items = sortItemsByDistance(items, items[0]);
|
|
953
|
+
var _loop0 = function _loop0() {
|
|
954
|
+
var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
|
|
955
|
+
var temp_MGLines = [];
|
|
956
|
+
MGlines.forEach(function (line) {
|
|
957
|
+
var idx = itemLines.findIndex(function (itemLine) {
|
|
958
|
+
return isLinesOverlapped(line, itemLine);
|
|
959
|
+
});
|
|
960
|
+
var curItemLine = itemLines[idx];
|
|
961
|
+
if (idx > -1) {
|
|
962
|
+
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]))) {
|
|
963
|
+
var MGLine = mergeOverlappedLines(line, curItemLine);
|
|
964
|
+
temp_MGLines.push(MGLine);
|
|
965
|
+
}
|
|
966
|
+
itemLines.splice(idx, 1);
|
|
967
|
+
} else {
|
|
968
|
+
temp_MGLines.push(line);
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
itemLines.forEach(function (itemLine) {
|
|
972
|
+
return temp_MGLines.push(itemLine);
|
|
973
|
+
});
|
|
974
|
+
MGlines = [].concat(temp_MGLines);
|
|
975
|
+
};
|
|
976
|
+
for (var i = 1; i < items.length; i++) {
|
|
977
|
+
_loop0();
|
|
978
|
+
}
|
|
979
|
+
MGlines.forEach(function (line) {
|
|
980
|
+
molding_totalLength += _export.GeometryUtils.verticesDistance(line[0], line[1]);
|
|
981
|
+
});
|
|
982
|
+
});
|
|
983
|
+
molding_totalLength = (0, _convertUnitsLite.convert)(molding_totalLength).from('cm').to('in');
|
|
984
|
+
moldingData.push(_objectSpread(_objectSpread({}, molding), {}, {
|
|
985
|
+
doorStyle: doorStyle,
|
|
986
|
+
count: Math.ceil(molding_totalLength * 1.1 / 96)
|
|
987
|
+
}));
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
|
|
991
|
+
// calc toe kick molding
|
|
992
|
+
var tmp = [];
|
|
993
|
+
items.forEach(function (item) {
|
|
994
|
+
if (item.category === 'cabinet' && !item.cabinet_category.toLowerCase().includes('microwave')) {
|
|
995
|
+
tmp.push(item);
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
var tmpMoldingData = [];
|
|
999
|
+
var toedoorStyles = [];
|
|
1000
|
+
tmp.map(function (item) {
|
|
1001
|
+
var _item$molding;
|
|
1002
|
+
if (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))) {
|
|
1003
|
+
var w = item.properties.get('width').get('_length');
|
|
1004
|
+
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
1005
|
+
w = (0, _convertUnitsLite.convert)(w / 2).from(wUnit).to('cm');
|
|
1006
|
+
var h = item.properties.get('depth').get('_length');
|
|
1007
|
+
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
1008
|
+
h = (0, _convertUnitsLite.convert)(h / 2).from(hUnit).to('cm');
|
|
1009
|
+
var outline = null;
|
|
1010
|
+
var element = catalog.elements[item.get('type')];
|
|
1011
|
+
if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
|
|
1012
|
+
outline = element.info.outline;
|
|
1013
|
+
var len = 0;
|
|
1014
|
+
if (outline) {
|
|
1015
|
+
// Extract Points from `outline`
|
|
1016
|
+
var outlinePaths = outline.paths;
|
|
1017
|
+
var outlineWidth = outline.svgWidth;
|
|
1018
|
+
var outlineHeight = outline.svgHeight;
|
|
1019
|
+
var outlinePoints = []; // Hold Points Of SVG
|
|
1020
|
+
var _iterator3 = _createForOfIteratorHelper(outlinePaths),
|
|
1021
|
+
_step3;
|
|
1022
|
+
try {
|
|
1023
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
1024
|
+
var path = _step3.value;
|
|
1025
|
+
var _iterator4 = _createForOfIteratorHelper(path.subPaths),
|
|
1026
|
+
_step4;
|
|
1027
|
+
try {
|
|
1028
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1029
|
+
var subPath = _step4.value;
|
|
1030
|
+
outlinePoints = outlinePoints.concat(subPath.getPoints());
|
|
1031
|
+
}
|
|
1032
|
+
} catch (err) {
|
|
1033
|
+
_iterator4.e(err);
|
|
1034
|
+
} finally {
|
|
1035
|
+
_iterator4.f();
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
} catch (err) {
|
|
1039
|
+
_iterator3.e(err);
|
|
1040
|
+
} finally {
|
|
1041
|
+
_iterator3.f();
|
|
1042
|
+
}
|
|
1043
|
+
var maxX = outlinePoints[0].x,
|
|
1044
|
+
minX = outlinePoints[0].x;
|
|
1045
|
+
var maxY = outlinePoints[0].y,
|
|
1046
|
+
minY = outlinePoints[0].y;
|
|
1047
|
+
outlinePoints.forEach(function (point) {
|
|
1048
|
+
if (point.x > maxX) {
|
|
1049
|
+
maxX = point.x;
|
|
1050
|
+
}
|
|
1051
|
+
if (point.x < minX) {
|
|
1052
|
+
minX = point.x;
|
|
1053
|
+
}
|
|
1054
|
+
if (point.y > maxY) {
|
|
1055
|
+
maxY = point.y;
|
|
1056
|
+
}
|
|
1057
|
+
if (point.y < minY) {
|
|
1058
|
+
minY = point.y;
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
outlinePoints.forEach(function (point) {
|
|
1062
|
+
if (_export.GeometryUtils.isPointInRect([{
|
|
1063
|
+
x: minX,
|
|
1064
|
+
y: minY
|
|
1065
|
+
}, {
|
|
1066
|
+
x: minX,
|
|
1067
|
+
y: maxY
|
|
1068
|
+
}, {
|
|
1069
|
+
x: maxX,
|
|
1070
|
+
y: maxY
|
|
1071
|
+
}, {
|
|
1072
|
+
x: maxX,
|
|
1073
|
+
y: minY
|
|
1074
|
+
}], point)) {
|
|
1075
|
+
if (point.x > 10) len += (point.x / outlineWidth - 0.5) * w * 2 + h * 2 - (point.y / outlineHeight - 0.5) * h * 2;
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
len = (0, _convertUnitsLite.convert)(len).from('cm').to('in');
|
|
1079
|
+
} else {
|
|
1080
|
+
w = (0, _convertUnitsLite.convert)(w * 2).from('cm').to('in');
|
|
1081
|
+
len += w;
|
|
1082
|
+
}
|
|
1083
|
+
var doorIndex = toedoorStyles.findIndex(function (a) {
|
|
1084
|
+
var iDS = item === null || item === void 0 ? void 0 : item.doorStyle;
|
|
1085
|
+
if (!iDS) return false;
|
|
1086
|
+
if (!iDS.hasOwnProperty('id')) {
|
|
1087
|
+
iDS = iDS.toJS();
|
|
1088
|
+
}
|
|
1089
|
+
return a.doorStyle.id === iDS.id && (0, _utils.isEqualInstallationType)(a.doorStyle, iDS);
|
|
1090
|
+
});
|
|
1091
|
+
if (doorIndex > -1) {
|
|
1092
|
+
toedoorStyles[doorIndex].totalLength += len;
|
|
1093
|
+
} else {
|
|
1094
|
+
toedoorStyles.push({
|
|
1095
|
+
doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : item.doorStyle && item.doorStyle.toJS(),
|
|
1096
|
+
totalLength: len
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
toedoorStyles.forEach(function (doorStyle) {
|
|
1102
|
+
var skuName = (0, _utils.getToeKickSKU)(doorStyle.doorStyle, catalog);
|
|
1103
|
+
var thumbnail = skuName ? skuName : '';
|
|
1104
|
+
// moldings.forEach(molding => {
|
|
1105
|
+
// if (
|
|
1106
|
+
// molding.name ===
|
|
1107
|
+
// getToeKickSKU(
|
|
1108
|
+
// doorStyle.doorStyle,
|
|
1109
|
+
// catalog,
|
|
1110
|
+
// true
|
|
1111
|
+
// )
|
|
1112
|
+
// )
|
|
1113
|
+
// thumbnail = molding.thumbnail;
|
|
1114
|
+
// });
|
|
1115
|
+
|
|
1116
|
+
doorStyle.totalLength && tmpMoldingData.push({
|
|
1117
|
+
name: _constants.TOE_KICK_MOLDING,
|
|
1118
|
+
sku: (0, _utils.getToeKickSKU)(doorStyle.doorStyle, catalog),
|
|
1119
|
+
thumbnail: thumbnail,
|
|
1120
|
+
category: 'molding',
|
|
1121
|
+
type: 'cabinet',
|
|
1122
|
+
doorStyle: doorStyle.doorStyle,
|
|
1123
|
+
count: Math.ceil(doorStyle.totalLength * 1.1 / 96)
|
|
1124
|
+
});
|
|
1125
|
+
});
|
|
1126
|
+
if (tmpMoldingData.length > 0) moldingData = [].concat((0, _toConsumableArray2["default"])(moldingData), tmpMoldingData);
|
|
1127
|
+
return moldingData;
|
|
895
1128
|
}
|