kitchen-simulator 3.1.14 → 4.0.0-alpha.12
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 +204 -24
- package/es/LiteRenderer.js +277 -12
- package/es/actions/items-actions.js +6 -10
- package/es/actions/lines-actions.js +1 -3
- package/es/actions/project-actions.js +5 -15
- package/es/assets/Window.hdr +2100 -0
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/1.jpg +0 -0
- package/es/catalog/areas/area/planner-element.js +5 -10
- package/es/catalog/catalog.js +4 -1
- package/es/catalog/factories/area-factory-3d.js +17 -18
- package/es/catalog/factories/wall-factory-3d.js +2 -2
- package/es/catalog/factories/wall-factory.js +8 -8
- package/es/catalog/lines/wall/planner-element.js +9 -18
- package/es/catalog/utils/exporter.js +3 -6
- package/es/catalog/utils/item-loader.js +197 -202
- package/es/catalog/utils/mtl-loader.js +2 -2
- package/es/catalog/utils/obj-loader.js +2 -2
- package/es/class/item.js +127 -107
- package/es/class/line.js +2 -14
- package/es/class/project.js +44 -150
- package/es/components/content.js +6 -19
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/item.js +51 -84
- package/es/components/viewer2d/line.js +243 -315
- package/es/components/viewer2d/ruler.js +36 -16
- package/es/components/viewer2d/rulerDist.js +75 -44
- package/es/components/viewer2d/utils.js +0 -6
- package/es/components/viewer2d/viewer2d.js +205 -301
- package/es/components/viewer3d/front3D.js +2 -3
- package/es/components/viewer3d/libs/mtl-loader.js +2 -2
- package/es/components/viewer3d/libs/obj-loader.js +2 -2
- package/es/components/viewer3d/libs/orbit-controls.js +4 -3
- package/es/components/viewer3d/libs/pointer-lock-controls.js +7 -6
- package/es/components/viewer3d/viewer3d.js +80 -127
- package/es/constants.js +3 -110
- package/es/devLiteRenderer.js +38 -597
- package/es/index.js +86 -16
- package/es/models.js +5 -8
- package/es/plugins/SVGLoader.js +5 -7
- package/es/plugins/keyboard.js +6 -15
- package/es/reducers/items-reducer.js +5 -5
- package/es/reducers/lines-reducer.js +1 -1
- package/es/reducers/project-reducer.js +3 -5
- package/es/shared-style.js +4 -4
- package/es/utils/geometry.js +0 -161
- package/es/utils/get-edges-of-subgraphs.js +1 -1
- package/es/utils/graph-cycles.js +1 -1
- package/es/utils/graph.js +1 -1
- package/es/utils/helper.js +2 -67
- package/es/utils/isolate-event-handler.js +124 -1367
- package/es/utils/molding.js +2 -238
- package/lib/LiteKitchenConfigurator.js +205 -25
- package/lib/LiteRenderer.js +278 -13
- package/lib/actions/items-actions.js +6 -10
- package/lib/actions/lines-actions.js +1 -3
- package/lib/actions/project-actions.js +4 -15
- package/lib/assets/Window.hdr +2100 -0
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/1.jpg +0 -0
- package/lib/catalog/areas/area/planner-element.js +5 -11
- package/lib/catalog/catalog.js +4 -1
- package/lib/catalog/factories/area-factory-3d.js +14 -15
- package/lib/catalog/factories/wall-factory-3d.js +2 -2
- package/lib/catalog/factories/wall-factory.js +8 -8
- package/lib/catalog/lines/wall/planner-element.js +9 -19
- package/lib/catalog/utils/exporter.js +3 -6
- package/lib/catalog/utils/item-loader.js +194 -199
- package/lib/catalog/utils/mtl-loader.js +2 -9
- package/lib/catalog/utils/obj-loader.js +2 -10
- package/lib/class/item.js +125 -105
- package/lib/class/line.js +1 -13
- package/lib/class/project.js +43 -149
- package/lib/components/content.js +6 -19
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/item.js +50 -83
- package/lib/components/viewer2d/line.js +242 -315
- package/lib/components/viewer2d/ruler.js +35 -15
- package/lib/components/viewer2d/rulerDist.js +75 -44
- package/lib/components/viewer2d/utils.js +0 -7
- package/lib/components/viewer2d/viewer2d.js +205 -299
- package/lib/components/viewer3d/front3D.js +2 -3
- package/lib/components/viewer3d/libs/mtl-loader.js +2 -9
- package/lib/components/viewer3d/libs/obj-loader.js +2 -9
- package/lib/components/viewer3d/libs/orbit-controls.js +5 -11
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +7 -13
- package/lib/components/viewer3d/viewer3d.js +79 -125
- package/lib/constants.js +7 -115
- package/lib/devLiteRenderer.js +33 -592
- package/lib/index.js +86 -16
- package/lib/models.js +5 -8
- package/lib/plugins/SVGLoader.js +5 -7
- package/lib/plugins/keyboard.js +6 -15
- package/lib/reducers/items-reducer.js +5 -5
- package/lib/reducers/lines-reducer.js +1 -1
- package/lib/reducers/project-reducer.js +2 -4
- package/lib/shared-style.js +4 -4
- package/lib/utils/geometry.js +0 -162
- package/lib/utils/get-edges-of-subgraphs.js +1 -6
- package/lib/utils/graph-cycles.js +8 -7
- package/lib/utils/graph.js +1 -6
- package/lib/utils/helper.js +3 -70
- package/lib/utils/isolate-event-handler.js +121 -1364
- package/lib/utils/molding.js +0 -238
- package/package.json +1 -1
package/lib/utils/molding.js
CHANGED
|
@@ -12,9 +12,7 @@ exports.getItemRect = getItemRect;
|
|
|
12
12
|
exports.getLinesFromItems = getLinesFromItems;
|
|
13
13
|
exports.getLinesFromItems2 = getLinesFromItems2;
|
|
14
14
|
exports.getLinesOfItem = getLinesOfItem;
|
|
15
|
-
exports.getMoldingDataOfScene = getMoldingDataOfScene;
|
|
16
15
|
exports.hasMoldingLayout = hasMoldingLayout;
|
|
17
|
-
exports.isAttachedWall = isAttachedWall;
|
|
18
16
|
exports.isEnableItemForMolding = isEnableItemForMolding;
|
|
19
17
|
exports.isItemSameItemByLocation = isItemSameItemByLocation;
|
|
20
18
|
exports.isItemSnappedGroup = isItemSnappedGroup;
|
|
@@ -89,10 +87,6 @@ function isEnableItemForMolding(layer, selItem) {
|
|
|
89
87
|
// check this item is enable for specified molding
|
|
90
88
|
else return result && hasMoldingLayout(molding, selItem.layoutpos);
|
|
91
89
|
}
|
|
92
|
-
function isAttachedWall(layer, selItem) {
|
|
93
|
-
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
94
|
-
return _export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects);
|
|
95
|
-
}
|
|
96
90
|
|
|
97
91
|
/**
|
|
98
92
|
* Check two line segments are overlap. The direction of the two line segments must be opposite.
|
|
@@ -893,236 +887,4 @@ function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
|
893
887
|
newMG.lines.reverse();
|
|
894
888
|
newMG = getMDPoints(newMG);
|
|
895
889
|
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;
|
|
1128
890
|
}
|