kitchen-simulator 11.8.0 → 11.10.0
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/catalog/utils/item-loader.js +30 -31
- package/es/components/viewer2d/viewer2d.js +1 -1
- package/es/events/external/handleExternalEvent.util.js +3 -3
- package/es/utils/skinPanelEngine.js +74 -12
- package/lib/catalog/utils/item-loader.js +30 -31
- package/lib/components/viewer2d/viewer2d.js +1 -1
- package/lib/events/external/handleExternalEvent.util.js +3 -3
- package/lib/utils/skinPanelEngine.js +74 -12
- package/package.json +1 -1
|
@@ -1075,19 +1075,19 @@ export function render3DApplianceItem(element, layer, scene, sizeinfo, structure
|
|
|
1075
1075
|
var structure = structure_json;
|
|
1076
1076
|
var applianceMaterial = element.applianceMaterial;
|
|
1077
1077
|
if (applianceMaterial.metalness == undefined) applianceMaterial = applianceMaterial.toJS();
|
|
1078
|
+
var newAltitude = element.properties.get('altitude').get('_length');
|
|
1079
|
+
var newUnit = element.properties.get('altitude').get('_unit') || 'in';
|
|
1080
|
+
newAltitude = convert(newAltitude).from(newUnit).to(scene.unit);
|
|
1081
|
+
var newWidth = element.properties.get('width').get('_length');
|
|
1082
|
+
var newWidthUnit = element.properties.get('width').get('_unit') || 'in';
|
|
1083
|
+
newWidth = convert(newWidth).from(newWidthUnit).to('in');
|
|
1084
|
+
var newHeight = element.properties.get('height').get('_length');
|
|
1085
|
+
var newHeightUnit = element.properties.get('height').get('_unit') || 'in';
|
|
1086
|
+
newHeight = convert(newHeight).from(newHeightUnit).to('in');
|
|
1087
|
+
var newDepth = element.properties.get('depth').get('_length');
|
|
1088
|
+
var newDepthUnit = element.properties.get('depth').get('_unit') || 'in';
|
|
1089
|
+
newDepth = convert(newDepth).from(newDepthUnit).to('in');
|
|
1078
1090
|
var onLoadItem = function onLoadItem(object) {
|
|
1079
|
-
var newAltitude = element.properties.get('altitude').get('_length');
|
|
1080
|
-
var newUnit = element.properties.get('altitude').get('_unit') || 'in';
|
|
1081
|
-
newAltitude = convert(newAltitude).from(newUnit).to(scene.unit);
|
|
1082
|
-
var newWidth = element.properties.get('width').get('_length');
|
|
1083
|
-
var newWidthUnit = element.properties.get('width').get('_unit') || 'in';
|
|
1084
|
-
newWidth = convert(newWidth).from(newWidthUnit).to('in');
|
|
1085
|
-
var newHeight = element.properties.get('height').get('_length');
|
|
1086
|
-
var newHeightUnit = element.properties.get('height').get('_unit') || 'in';
|
|
1087
|
-
newHeight = convert(newHeight).from(newHeightUnit).to('in');
|
|
1088
|
-
var newDepth = element.properties.get('depth').get('_length');
|
|
1089
|
-
var newDepthUnit = element.properties.get('depth').get('_unit') || 'in';
|
|
1090
|
-
newDepth = convert(newDepth).from(newDepthUnit).to('in');
|
|
1091
1091
|
object.scale.set(100 * newWidth / sizeinfo.width, 100 * newHeight / sizeinfo.height, 100 * newDepth / sizeinfo.depth);
|
|
1092
1092
|
// Normalize the origin of the object
|
|
1093
1093
|
var boundingBox = new Three.Box3().setFromObject(object);
|
|
@@ -1344,26 +1344,25 @@ export function render3DApplianceItem(element, layer, scene, sizeinfo, structure
|
|
|
1344
1344
|
export function render3DLightingItem(element, layer, scene, sizeinfo, structure_json) {
|
|
1345
1345
|
var mode = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
1346
1346
|
var structure = structure_json;
|
|
1347
|
+
var width = {
|
|
1348
|
+
length: sizeinfo.width,
|
|
1349
|
+
unit: 'in'
|
|
1350
|
+
};
|
|
1351
|
+
var depth = {
|
|
1352
|
+
length: sizeinfo.depth,
|
|
1353
|
+
unit: 'in'
|
|
1354
|
+
};
|
|
1355
|
+
var height = {
|
|
1356
|
+
length: sizeinfo.height,
|
|
1357
|
+
unit: 'in'
|
|
1358
|
+
};
|
|
1359
|
+
var newWidth = convert(width.length).from(width.unit).to('cm');
|
|
1360
|
+
var newDepth = convert(depth.length).from(depth.unit).to('cm');
|
|
1361
|
+
var newHeight = convert(height.length).from(height.unit).to('cm');
|
|
1362
|
+
var newAltitude = element.properties.get('altitude').get('_length');
|
|
1363
|
+
var newUnit = element.properties.get('altitude').get('_unit') || 'in';
|
|
1364
|
+
newAltitude = convert(newAltitude).from(newUnit).to(scene.unit);
|
|
1347
1365
|
var onLoadItem = function onLoadItem(object) {
|
|
1348
|
-
var width = {
|
|
1349
|
-
length: sizeinfo.width,
|
|
1350
|
-
unit: 'in'
|
|
1351
|
-
};
|
|
1352
|
-
var depth = {
|
|
1353
|
-
length: sizeinfo.depth,
|
|
1354
|
-
unit: 'in'
|
|
1355
|
-
};
|
|
1356
|
-
var height = {
|
|
1357
|
-
length: sizeinfo.height,
|
|
1358
|
-
unit: 'in'
|
|
1359
|
-
};
|
|
1360
|
-
var newWidth = convert(width.length).from(width.unit).to('cm');
|
|
1361
|
-
var newDepth = convert(depth.length).from(depth.unit).to('cm');
|
|
1362
|
-
var newHeight = convert(height.length).from(height.unit).to('cm');
|
|
1363
|
-
var newAltitude = element.properties.get('altitude').get('_length');
|
|
1364
|
-
var newUnit = element.properties.get('altitude').get('_unit') || 'in';
|
|
1365
|
-
newAltitude = convert(newAltitude).from(newUnit).to(scene.unit);
|
|
1366
|
-
|
|
1367
1366
|
//object.scale.set(newWidth, newHeight, newDepth);
|
|
1368
1367
|
object.scale.set(100, 100, 100);
|
|
1369
1368
|
// Normalize the origin of the object
|
|
@@ -1226,7 +1226,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1226
1226
|
case constants.MODE_DRAWING_ITEM:
|
|
1227
1227
|
{
|
|
1228
1228
|
var itemData = state.getIn(['scene', 'layers', layerID, elementData === null || elementData === void 0 ? void 0 : elementData.prototype, elementData === null || elementData === void 0 ? void 0 : elementData.id]);
|
|
1229
|
-
itemsActions.endDrawingItem(layerID, itemData.isInitialPos ? itemData.x : endPoint.x, itemData.isInitialPos ? itemData.y : endPoint.y);
|
|
1229
|
+
if (!isEmpty(itemData)) itemsActions.endDrawingItem(layerID, itemData.isInitialPos ? itemData.x : endPoint.x, itemData.isInitialPos ? itemData.y : endPoint.y);
|
|
1230
1230
|
}
|
|
1231
1231
|
break;
|
|
1232
1232
|
case constants.MODE_DRAGGING_LINE:
|
|
@@ -109,10 +109,10 @@ function _parseTempPlaceholdersFromCabinetPayload() {
|
|
|
109
109
|
tempData['sink'].push(element.name);
|
|
110
110
|
// Resolve sink asset via ccdf.assets3d based on placeholder_name
|
|
111
111
|
var sinkPlaceholderName = sink_match[1]; // e.g. sink_farm_large
|
|
112
|
-
var assets3d = cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$ccdf_ = cabinetPayload.ccdf_list) === null || _cabinetPayload$ccdf_ === void 0
|
|
112
|
+
var assets3d = cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$ccdf_ = cabinetPayload.ccdf_list) === null || _cabinetPayload$ccdf_ === void 0 || (_cabinetPayload$ccdf_ = _cabinetPayload$ccdf_.find(function (ccdf) {
|
|
113
113
|
return ccdf.cabinet_id === cabinetPayload.itemID;
|
|
114
|
-
}).assets3d;
|
|
115
|
-
var sinkAsset = Array.isArray(assets3d) && assets3d.find(function (a) {
|
|
114
|
+
})) === null || _cabinetPayload$ccdf_ === void 0 ? void 0 : _cabinetPayload$ccdf_.assets3d;
|
|
115
|
+
var sinkAsset = !isEmpty(assets3d) && Array.isArray(assets3d) && assets3d.find(function (a) {
|
|
116
116
|
return a && (a.placeholder_name === sinkPlaceholderName || a.placeholder_name.startsWith('sink_')) && a.gltf;
|
|
117
117
|
});
|
|
118
118
|
if (sinkAsset !== null && sinkAsset !== void 0 && sinkAsset.gltf && cabinetPayload !== null && cabinetPayload !== void 0 && cabinetPayload.structure_json) cabinetPayload.structure_json.sink = sinkAsset.gltf;
|
|
@@ -31,8 +31,10 @@ export function getSideFaces(item, layer) {
|
|
|
31
31
|
var overlapList = [OVERLAP_INCLUDED, OVERLAP_SAME, OVERLAP_SOME];
|
|
32
32
|
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
33
33
|
for (var i = 0; i < 4; i++) {
|
|
34
|
-
if (
|
|
35
|
-
|
|
34
|
+
if (item.is_corner !== true) {
|
|
35
|
+
if (i === 0) continue; // only left & right & base cabinet's back
|
|
36
|
+
if (i === 2 && item.layoutpos !== BASE_CABINET_LAYOUTPOS) continue;
|
|
37
|
+
}
|
|
36
38
|
var isSnappedToWall = false;
|
|
37
39
|
var v0 = rotateCorner(pos[i], item, widthCm, depthCm);
|
|
38
40
|
var v1 = rotateCorner(pos[(i + 1) % 4], item, widthCm, depthCm);
|
|
@@ -97,7 +99,7 @@ export function getSideFaces(item, layer) {
|
|
|
97
99
|
}
|
|
98
100
|
function collectLayerItems(layer) {
|
|
99
101
|
var _layer$items;
|
|
100
|
-
var skinLayouts = new Set([BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS
|
|
102
|
+
var skinLayouts = new Set([BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS]);
|
|
101
103
|
var skinPanelItems = [];
|
|
102
104
|
var otherItems = [];
|
|
103
105
|
layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 || _layer$items.forEach(function (it) {
|
|
@@ -117,6 +119,11 @@ function collectFaces(items, layer) {
|
|
|
117
119
|
}
|
|
118
120
|
return faces;
|
|
119
121
|
}
|
|
122
|
+
function isSnappedWithCornerCabient(srcItem, desItem) {
|
|
123
|
+
if (srcItem.is_corner === true || desItem.is_corner === true) {
|
|
124
|
+
return true;
|
|
125
|
+
} else return false;
|
|
126
|
+
}
|
|
120
127
|
|
|
121
128
|
/**
|
|
122
129
|
* @param {*} faceSegs
|
|
@@ -142,9 +149,10 @@ function getTrimmedFaceSegs(faceSegs, otherFaces, cnt) {
|
|
|
142
149
|
bContourSeg = false;
|
|
143
150
|
return 0; // break
|
|
144
151
|
} else if (rst.result == OVERLAP_SOME) {
|
|
152
|
+
var isCornerFlag = isSnappedWithCornerCabient(iFace.itemInfo, otherFaces[j].itemInfo);
|
|
145
153
|
var trimmedFaceSegs = [];
|
|
146
154
|
rst.trimmedSegs.forEach(function (lineSeg) {
|
|
147
|
-
trimmedFaceSegs.push({
|
|
155
|
+
!isCornerFlag && trimmedFaceSegs.push({
|
|
148
156
|
sectionLine: lineSeg,
|
|
149
157
|
// cm unit
|
|
150
158
|
zBottom: iFace.zBottom,
|
|
@@ -204,7 +212,8 @@ function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
|
204
212
|
break;
|
|
205
213
|
} else if (verticallyOverlappedTopPart) {
|
|
206
214
|
removeIdxs.push(i);
|
|
207
|
-
var
|
|
215
|
+
var isCornerFlag = isSnappedWithCornerCabient(iFace.itemInfo, jFace.itemInfo);
|
|
216
|
+
var newFace = !isCornerFlag ? {
|
|
208
217
|
sectionLine: iFace.sectionLine,
|
|
209
218
|
// cm unit
|
|
210
219
|
zBottom: iFace.zBottom,
|
|
@@ -218,7 +227,7 @@ function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
|
218
227
|
isBackFace: iFace.isBackFace,
|
|
219
228
|
skinPanelSKU: iFace.skinPanelSKU,
|
|
220
229
|
itemInfo: iFace.itemInfo
|
|
221
|
-
};
|
|
230
|
+
} : {};
|
|
222
231
|
var contourFaces = filterFacesBlockedByFaces([newFace], sourceFaces === blockingFaces ? blockingFaces.filter(function (v, idx) {
|
|
223
232
|
return idx !== i;
|
|
224
233
|
}) : blockingFaces, 0);
|
|
@@ -226,7 +235,8 @@ function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
|
226
235
|
break;
|
|
227
236
|
} else if (verticallyOverlappedBottomPart) {
|
|
228
237
|
removeIdxs.push(i);
|
|
229
|
-
var
|
|
238
|
+
var _isCornerFlag = isSnappedWithCornerCabient(iFace.itemInfo, jFace.itemInfo);
|
|
239
|
+
var _newFace = !_isCornerFlag ? {
|
|
230
240
|
sectionLine: iFace.sectionLine,
|
|
231
241
|
// cm unit
|
|
232
242
|
zBottom: jFace.zTop,
|
|
@@ -240,7 +250,7 @@ function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
|
240
250
|
isBackFace: iFace.isBackFace,
|
|
241
251
|
skinPanelSKU: iFace.skinPanelSKU,
|
|
242
252
|
itemInfo: iFace.itemInfo
|
|
243
|
-
};
|
|
253
|
+
} : {};
|
|
244
254
|
var _contourFaces = filterFacesBlockedByFaces([_newFace], sourceFaces === blockingFaces ? blockingFaces.filter(function (v, idx) {
|
|
245
255
|
return idx !== i;
|
|
246
256
|
}) : blockingFaces, 0);
|
|
@@ -368,6 +378,51 @@ function applyVerticalGrouping(faces) {
|
|
|
368
378
|
function isMP3TallCabinet(sku) {
|
|
369
379
|
return sku === null || sku === void 0 ? void 0 : sku.startsWith('MP3');
|
|
370
380
|
}
|
|
381
|
+
function buildMP3SkinPanelArray(bottomHeight, topHeight, mp3SkinPanelArray) {
|
|
382
|
+
var skinPanelHeightArray = [],
|
|
383
|
+
bIndex = -1,
|
|
384
|
+
tIndex = -1,
|
|
385
|
+
hArray = [],
|
|
386
|
+
skinPanelTypeArray = [],
|
|
387
|
+
temp = 0;
|
|
388
|
+
// make skinPanelHeightArray : [0, sum(h1 + h2 +...+ hn)]
|
|
389
|
+
skinPanelHeightArray[0] = temp;
|
|
390
|
+
for (var i = 0; i < mp3SkinPanelArray.length; i++) {
|
|
391
|
+
temp += mp3SkinPanelArray[i][0];
|
|
392
|
+
skinPanelHeightArray.push(temp);
|
|
393
|
+
}
|
|
394
|
+
// calc the zBottom's index
|
|
395
|
+
for (var _i = 0; _i <= skinPanelHeightArray.length; _i++) {
|
|
396
|
+
if (bottomHeight < skinPanelHeightArray[_i]) {
|
|
397
|
+
bIndex = _i - 1;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (bIndex < 0) {
|
|
402
|
+
console.log('Error for bottomHeight in buildMP3SkinPanelArray');
|
|
403
|
+
return [];
|
|
404
|
+
}
|
|
405
|
+
// calc the zTop's index
|
|
406
|
+
for (var _i2 = 0; _i2 <= skinPanelHeightArray.length; _i2++) {
|
|
407
|
+
if (topHeight <= skinPanelHeightArray[_i2]) {
|
|
408
|
+
tIndex = _i2;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (tIndex < 0) {
|
|
413
|
+
console.log('Error for topHeight in buildMP3SkinPanelArray');
|
|
414
|
+
return [];
|
|
415
|
+
}
|
|
416
|
+
if (tIndex === 0 || bIndex === skinPanelHeightArray.length) return [];
|
|
417
|
+
|
|
418
|
+
// make the skinPanelTypeArray using zTop's index and zBottom's index
|
|
419
|
+
hArray = mp3SkinPanelArray.slice(bIndex, tIndex + 1);
|
|
420
|
+
for (var _i3 = 0; _i3 < hArray.length; _i3++) {
|
|
421
|
+
skinPanelTypeArray.push(hArray[_i3][1]);
|
|
422
|
+
}
|
|
423
|
+
// return skinPanelTypeArray : e.g. [SKIN_SKU_BSV_24, SKIN_SKU_WSV_2442]
|
|
424
|
+
return skinPanelTypeArray;
|
|
425
|
+
}
|
|
371
426
|
|
|
372
427
|
/**
|
|
373
428
|
* Decide which skin panel pieces are needed for a tall cabinet.
|
|
@@ -375,7 +430,14 @@ function isMP3TallCabinet(sku) {
|
|
|
375
430
|
function resolveTallCabinetBundle(face) {
|
|
376
431
|
var item = face.itemInfo;
|
|
377
432
|
if (isMP3TallCabinet(item.sku_number)) {
|
|
378
|
-
|
|
433
|
+
var zBottom = face.zBottom;
|
|
434
|
+
var zTop = face.zTop;
|
|
435
|
+
var bottomHeight = convert(zBottom).from('cm').to('in');
|
|
436
|
+
var topHeight = convert(zTop).from('cm').to('in');
|
|
437
|
+
var mp3SkinPanelArray = [[34.5, SKIN_SKU_BSV_24],
|
|
438
|
+
// [height of skin panel, type of skin panel]
|
|
439
|
+
[item.properties.height._length - 76.5, SKIN_SKU_BSV_24], [42, SKIN_SKU_WSV_2442]];
|
|
440
|
+
return buildMP3SkinPanelArray(bottomHeight, topHeight, mp3SkinPanelArray);
|
|
379
441
|
}
|
|
380
442
|
if (face.height > SKIN_HEIGHT_53_25) {
|
|
381
443
|
return [SKIN_SKU_USV245325, SKIN_SKU_WSV_2442];
|
|
@@ -445,9 +507,9 @@ function buildSkinPanelData(faces) {
|
|
|
445
507
|
var removeIdxs = [];
|
|
446
508
|
var newDatas = [];
|
|
447
509
|
var _loop5 = function _loop5() {
|
|
448
|
-
var iData = tempResult[
|
|
510
|
+
var iData = tempResult[_i4];
|
|
449
511
|
if (iData.isBackFace) {
|
|
450
|
-
removeIdxs.push(
|
|
512
|
+
removeIdxs.push(_i4);
|
|
451
513
|
var count48 = Math.floor(iData.totalLength / 48);
|
|
452
514
|
var count24 = iData.totalLength % 48 > 0 ? 1 : 0;
|
|
453
515
|
var idx48 = tempResult.findIndex(function (v) {
|
|
@@ -486,7 +548,7 @@ function buildSkinPanelData(faces) {
|
|
|
486
548
|
}
|
|
487
549
|
}
|
|
488
550
|
};
|
|
489
|
-
for (var
|
|
551
|
+
for (var _i4 = 0; _i4 < tempResult.length; _i4++) {
|
|
490
552
|
_loop5();
|
|
491
553
|
}
|
|
492
554
|
tempResult = tempResult.filter(function (data, idx) {
|
|
@@ -1089,19 +1089,19 @@ function render3DApplianceItem(element, layer, scene, sizeinfo, structure_json)
|
|
|
1089
1089
|
var structure = structure_json;
|
|
1090
1090
|
var applianceMaterial = element.applianceMaterial;
|
|
1091
1091
|
if (applianceMaterial.metalness == undefined) applianceMaterial = applianceMaterial.toJS();
|
|
1092
|
+
var newAltitude = element.properties.get('altitude').get('_length');
|
|
1093
|
+
var newUnit = element.properties.get('altitude').get('_unit') || 'in';
|
|
1094
|
+
newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(scene.unit);
|
|
1095
|
+
var newWidth = element.properties.get('width').get('_length');
|
|
1096
|
+
var newWidthUnit = element.properties.get('width').get('_unit') || 'in';
|
|
1097
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(newWidthUnit).to('in');
|
|
1098
|
+
var newHeight = element.properties.get('height').get('_length');
|
|
1099
|
+
var newHeightUnit = element.properties.get('height').get('_unit') || 'in';
|
|
1100
|
+
newHeight = (0, _convertUnitsLite.convert)(newHeight).from(newHeightUnit).to('in');
|
|
1101
|
+
var newDepth = element.properties.get('depth').get('_length');
|
|
1102
|
+
var newDepthUnit = element.properties.get('depth').get('_unit') || 'in';
|
|
1103
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(newDepthUnit).to('in');
|
|
1092
1104
|
var onLoadItem = function onLoadItem(object) {
|
|
1093
|
-
var newAltitude = element.properties.get('altitude').get('_length');
|
|
1094
|
-
var newUnit = element.properties.get('altitude').get('_unit') || 'in';
|
|
1095
|
-
newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(scene.unit);
|
|
1096
|
-
var newWidth = element.properties.get('width').get('_length');
|
|
1097
|
-
var newWidthUnit = element.properties.get('width').get('_unit') || 'in';
|
|
1098
|
-
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(newWidthUnit).to('in');
|
|
1099
|
-
var newHeight = element.properties.get('height').get('_length');
|
|
1100
|
-
var newHeightUnit = element.properties.get('height').get('_unit') || 'in';
|
|
1101
|
-
newHeight = (0, _convertUnitsLite.convert)(newHeight).from(newHeightUnit).to('in');
|
|
1102
|
-
var newDepth = element.properties.get('depth').get('_length');
|
|
1103
|
-
var newDepthUnit = element.properties.get('depth').get('_unit') || 'in';
|
|
1104
|
-
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(newDepthUnit).to('in');
|
|
1105
1105
|
object.scale.set(100 * newWidth / sizeinfo.width, 100 * newHeight / sizeinfo.height, 100 * newDepth / sizeinfo.depth);
|
|
1106
1106
|
// Normalize the origin of the object
|
|
1107
1107
|
var boundingBox = new Three.Box3().setFromObject(object);
|
|
@@ -1358,26 +1358,25 @@ function render3DApplianceItem(element, layer, scene, sizeinfo, structure_json)
|
|
|
1358
1358
|
function render3DLightingItem(element, layer, scene, sizeinfo, structure_json) {
|
|
1359
1359
|
var mode = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
1360
1360
|
var structure = structure_json;
|
|
1361
|
+
var width = {
|
|
1362
|
+
length: sizeinfo.width,
|
|
1363
|
+
unit: 'in'
|
|
1364
|
+
};
|
|
1365
|
+
var depth = {
|
|
1366
|
+
length: sizeinfo.depth,
|
|
1367
|
+
unit: 'in'
|
|
1368
|
+
};
|
|
1369
|
+
var height = {
|
|
1370
|
+
length: sizeinfo.height,
|
|
1371
|
+
unit: 'in'
|
|
1372
|
+
};
|
|
1373
|
+
var newWidth = (0, _convertUnitsLite.convert)(width.length).from(width.unit).to('cm');
|
|
1374
|
+
var newDepth = (0, _convertUnitsLite.convert)(depth.length).from(depth.unit).to('cm');
|
|
1375
|
+
var newHeight = (0, _convertUnitsLite.convert)(height.length).from(height.unit).to('cm');
|
|
1376
|
+
var newAltitude = element.properties.get('altitude').get('_length');
|
|
1377
|
+
var newUnit = element.properties.get('altitude').get('_unit') || 'in';
|
|
1378
|
+
newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(scene.unit);
|
|
1361
1379
|
var onLoadItem = function onLoadItem(object) {
|
|
1362
|
-
var width = {
|
|
1363
|
-
length: sizeinfo.width,
|
|
1364
|
-
unit: 'in'
|
|
1365
|
-
};
|
|
1366
|
-
var depth = {
|
|
1367
|
-
length: sizeinfo.depth,
|
|
1368
|
-
unit: 'in'
|
|
1369
|
-
};
|
|
1370
|
-
var height = {
|
|
1371
|
-
length: sizeinfo.height,
|
|
1372
|
-
unit: 'in'
|
|
1373
|
-
};
|
|
1374
|
-
var newWidth = (0, _convertUnitsLite.convert)(width.length).from(width.unit).to('cm');
|
|
1375
|
-
var newDepth = (0, _convertUnitsLite.convert)(depth.length).from(depth.unit).to('cm');
|
|
1376
|
-
var newHeight = (0, _convertUnitsLite.convert)(height.length).from(height.unit).to('cm');
|
|
1377
|
-
var newAltitude = element.properties.get('altitude').get('_length');
|
|
1378
|
-
var newUnit = element.properties.get('altitude').get('_unit') || 'in';
|
|
1379
|
-
newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(scene.unit);
|
|
1380
|
-
|
|
1381
1380
|
//object.scale.set(newWidth, newHeight, newDepth);
|
|
1382
1381
|
object.scale.set(100, 100, 100);
|
|
1383
1382
|
// Normalize the origin of the object
|
|
@@ -1235,7 +1235,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1235
1235
|
case constants.MODE_DRAWING_ITEM:
|
|
1236
1236
|
{
|
|
1237
1237
|
var itemData = state.getIn(['scene', 'layers', layerID, elementData === null || elementData === void 0 ? void 0 : elementData.prototype, elementData === null || elementData === void 0 ? void 0 : elementData.id]);
|
|
1238
|
-
itemsActions.endDrawingItem(layerID, itemData.isInitialPos ? itemData.x : endPoint.x, itemData.isInitialPos ? itemData.y : endPoint.y);
|
|
1238
|
+
if (!(0, _helper.isEmpty)(itemData)) itemsActions.endDrawingItem(layerID, itemData.isInitialPos ? itemData.x : endPoint.x, itemData.isInitialPos ? itemData.y : endPoint.y);
|
|
1239
1239
|
}
|
|
1240
1240
|
break;
|
|
1241
1241
|
case constants.MODE_DRAGGING_LINE:
|
|
@@ -122,10 +122,10 @@ function _parseTempPlaceholdersFromCabinetPayload() {
|
|
|
122
122
|
tempData['sink'].push(element.name);
|
|
123
123
|
// Resolve sink asset via ccdf.assets3d based on placeholder_name
|
|
124
124
|
var sinkPlaceholderName = sink_match[1]; // e.g. sink_farm_large
|
|
125
|
-
var assets3d = cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$ccdf_ = cabinetPayload.ccdf_list) === null || _cabinetPayload$ccdf_ === void 0
|
|
125
|
+
var assets3d = cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$ccdf_ = cabinetPayload.ccdf_list) === null || _cabinetPayload$ccdf_ === void 0 || (_cabinetPayload$ccdf_ = _cabinetPayload$ccdf_.find(function (ccdf) {
|
|
126
126
|
return ccdf.cabinet_id === cabinetPayload.itemID;
|
|
127
|
-
}).assets3d;
|
|
128
|
-
var sinkAsset = Array.isArray(assets3d) && assets3d.find(function (a) {
|
|
127
|
+
})) === null || _cabinetPayload$ccdf_ === void 0 ? void 0 : _cabinetPayload$ccdf_.assets3d;
|
|
128
|
+
var sinkAsset = !(0, _helper.isEmpty)(assets3d) && Array.isArray(assets3d) && assets3d.find(function (a) {
|
|
129
129
|
return a && (a.placeholder_name === sinkPlaceholderName || a.placeholder_name.startsWith('sink_')) && a.gltf;
|
|
130
130
|
});
|
|
131
131
|
if (sinkAsset !== null && sinkAsset !== void 0 && sinkAsset.gltf && cabinetPayload !== null && cabinetPayload !== void 0 && cabinetPayload.structure_json) cabinetPayload.structure_json.sink = sinkAsset.gltf;
|
|
@@ -39,8 +39,10 @@ function getSideFaces(item, layer) {
|
|
|
39
39
|
var overlapList = [_constants.OVERLAP_INCLUDED, _constants.OVERLAP_SAME, _constants.OVERLAP_SOME];
|
|
40
40
|
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
41
41
|
for (var i = 0; i < 4; i++) {
|
|
42
|
-
if (
|
|
43
|
-
|
|
42
|
+
if (item.is_corner !== true) {
|
|
43
|
+
if (i === 0) continue; // only left & right & base cabinet's back
|
|
44
|
+
if (i === 2 && item.layoutpos !== _constants.BASE_CABINET_LAYOUTPOS) continue;
|
|
45
|
+
}
|
|
44
46
|
var isSnappedToWall = false;
|
|
45
47
|
var v0 = rotateCorner(pos[i], item, widthCm, depthCm);
|
|
46
48
|
var v1 = rotateCorner(pos[(i + 1) % 4], item, widthCm, depthCm);
|
|
@@ -105,7 +107,7 @@ function getSideFaces(item, layer) {
|
|
|
105
107
|
}
|
|
106
108
|
function collectLayerItems(layer) {
|
|
107
109
|
var _layer$items;
|
|
108
|
-
var skinLayouts = new Set([_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS
|
|
110
|
+
var skinLayouts = new Set([_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS]);
|
|
109
111
|
var skinPanelItems = [];
|
|
110
112
|
var otherItems = [];
|
|
111
113
|
layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 || _layer$items.forEach(function (it) {
|
|
@@ -125,6 +127,11 @@ function collectFaces(items, layer) {
|
|
|
125
127
|
}
|
|
126
128
|
return faces;
|
|
127
129
|
}
|
|
130
|
+
function isSnappedWithCornerCabient(srcItem, desItem) {
|
|
131
|
+
if (srcItem.is_corner === true || desItem.is_corner === true) {
|
|
132
|
+
return true;
|
|
133
|
+
} else return false;
|
|
134
|
+
}
|
|
128
135
|
|
|
129
136
|
/**
|
|
130
137
|
* @param {*} faceSegs
|
|
@@ -150,9 +157,10 @@ function getTrimmedFaceSegs(faceSegs, otherFaces, cnt) {
|
|
|
150
157
|
bContourSeg = false;
|
|
151
158
|
return 0; // break
|
|
152
159
|
} else if (rst.result == _constants.OVERLAP_SOME) {
|
|
160
|
+
var isCornerFlag = isSnappedWithCornerCabient(iFace.itemInfo, otherFaces[j].itemInfo);
|
|
153
161
|
var trimmedFaceSegs = [];
|
|
154
162
|
rst.trimmedSegs.forEach(function (lineSeg) {
|
|
155
|
-
trimmedFaceSegs.push({
|
|
163
|
+
!isCornerFlag && trimmedFaceSegs.push({
|
|
156
164
|
sectionLine: lineSeg,
|
|
157
165
|
// cm unit
|
|
158
166
|
zBottom: iFace.zBottom,
|
|
@@ -212,7 +220,8 @@ function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
|
212
220
|
break;
|
|
213
221
|
} else if (verticallyOverlappedTopPart) {
|
|
214
222
|
removeIdxs.push(i);
|
|
215
|
-
var
|
|
223
|
+
var isCornerFlag = isSnappedWithCornerCabient(iFace.itemInfo, jFace.itemInfo);
|
|
224
|
+
var newFace = !isCornerFlag ? {
|
|
216
225
|
sectionLine: iFace.sectionLine,
|
|
217
226
|
// cm unit
|
|
218
227
|
zBottom: iFace.zBottom,
|
|
@@ -226,7 +235,7 @@ function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
|
226
235
|
isBackFace: iFace.isBackFace,
|
|
227
236
|
skinPanelSKU: iFace.skinPanelSKU,
|
|
228
237
|
itemInfo: iFace.itemInfo
|
|
229
|
-
};
|
|
238
|
+
} : {};
|
|
230
239
|
var contourFaces = filterFacesBlockedByFaces([newFace], sourceFaces === blockingFaces ? blockingFaces.filter(function (v, idx) {
|
|
231
240
|
return idx !== i;
|
|
232
241
|
}) : blockingFaces, 0);
|
|
@@ -234,7 +243,8 @@ function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
|
234
243
|
break;
|
|
235
244
|
} else if (verticallyOverlappedBottomPart) {
|
|
236
245
|
removeIdxs.push(i);
|
|
237
|
-
var
|
|
246
|
+
var _isCornerFlag = isSnappedWithCornerCabient(iFace.itemInfo, jFace.itemInfo);
|
|
247
|
+
var _newFace = !_isCornerFlag ? {
|
|
238
248
|
sectionLine: iFace.sectionLine,
|
|
239
249
|
// cm unit
|
|
240
250
|
zBottom: jFace.zTop,
|
|
@@ -248,7 +258,7 @@ function filterFacesBlockedByFaces(sourceFaces, blockingFaces) {
|
|
|
248
258
|
isBackFace: iFace.isBackFace,
|
|
249
259
|
skinPanelSKU: iFace.skinPanelSKU,
|
|
250
260
|
itemInfo: iFace.itemInfo
|
|
251
|
-
};
|
|
261
|
+
} : {};
|
|
252
262
|
var _contourFaces = filterFacesBlockedByFaces([_newFace], sourceFaces === blockingFaces ? blockingFaces.filter(function (v, idx) {
|
|
253
263
|
return idx !== i;
|
|
254
264
|
}) : blockingFaces, 0);
|
|
@@ -376,6 +386,51 @@ function applyVerticalGrouping(faces) {
|
|
|
376
386
|
function isMP3TallCabinet(sku) {
|
|
377
387
|
return sku === null || sku === void 0 ? void 0 : sku.startsWith('MP3');
|
|
378
388
|
}
|
|
389
|
+
function buildMP3SkinPanelArray(bottomHeight, topHeight, mp3SkinPanelArray) {
|
|
390
|
+
var skinPanelHeightArray = [],
|
|
391
|
+
bIndex = -1,
|
|
392
|
+
tIndex = -1,
|
|
393
|
+
hArray = [],
|
|
394
|
+
skinPanelTypeArray = [],
|
|
395
|
+
temp = 0;
|
|
396
|
+
// make skinPanelHeightArray : [0, sum(h1 + h2 +...+ hn)]
|
|
397
|
+
skinPanelHeightArray[0] = temp;
|
|
398
|
+
for (var i = 0; i < mp3SkinPanelArray.length; i++) {
|
|
399
|
+
temp += mp3SkinPanelArray[i][0];
|
|
400
|
+
skinPanelHeightArray.push(temp);
|
|
401
|
+
}
|
|
402
|
+
// calc the zBottom's index
|
|
403
|
+
for (var _i = 0; _i <= skinPanelHeightArray.length; _i++) {
|
|
404
|
+
if (bottomHeight < skinPanelHeightArray[_i]) {
|
|
405
|
+
bIndex = _i - 1;
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (bIndex < 0) {
|
|
410
|
+
console.log('Error for bottomHeight in buildMP3SkinPanelArray');
|
|
411
|
+
return [];
|
|
412
|
+
}
|
|
413
|
+
// calc the zTop's index
|
|
414
|
+
for (var _i2 = 0; _i2 <= skinPanelHeightArray.length; _i2++) {
|
|
415
|
+
if (topHeight <= skinPanelHeightArray[_i2]) {
|
|
416
|
+
tIndex = _i2;
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (tIndex < 0) {
|
|
421
|
+
console.log('Error for topHeight in buildMP3SkinPanelArray');
|
|
422
|
+
return [];
|
|
423
|
+
}
|
|
424
|
+
if (tIndex === 0 || bIndex === skinPanelHeightArray.length) return [];
|
|
425
|
+
|
|
426
|
+
// make the skinPanelTypeArray using zTop's index and zBottom's index
|
|
427
|
+
hArray = mp3SkinPanelArray.slice(bIndex, tIndex + 1);
|
|
428
|
+
for (var _i3 = 0; _i3 < hArray.length; _i3++) {
|
|
429
|
+
skinPanelTypeArray.push(hArray[_i3][1]);
|
|
430
|
+
}
|
|
431
|
+
// return skinPanelTypeArray : e.g. [SKIN_SKU_BSV_24, SKIN_SKU_WSV_2442]
|
|
432
|
+
return skinPanelTypeArray;
|
|
433
|
+
}
|
|
379
434
|
|
|
380
435
|
/**
|
|
381
436
|
* Decide which skin panel pieces are needed for a tall cabinet.
|
|
@@ -383,7 +438,14 @@ function isMP3TallCabinet(sku) {
|
|
|
383
438
|
function resolveTallCabinetBundle(face) {
|
|
384
439
|
var item = face.itemInfo;
|
|
385
440
|
if (isMP3TallCabinet(item.sku_number)) {
|
|
386
|
-
|
|
441
|
+
var zBottom = face.zBottom;
|
|
442
|
+
var zTop = face.zTop;
|
|
443
|
+
var bottomHeight = (0, _convertUnitsLite.convert)(zBottom).from('cm').to('in');
|
|
444
|
+
var topHeight = (0, _convertUnitsLite.convert)(zTop).from('cm').to('in');
|
|
445
|
+
var mp3SkinPanelArray = [[34.5, _skinPanel.SKIN_SKU_BSV_24],
|
|
446
|
+
// [height of skin panel, type of skin panel]
|
|
447
|
+
[item.properties.height._length - 76.5, _skinPanel.SKIN_SKU_BSV_24], [42, _skinPanel.SKIN_SKU_WSV_2442]];
|
|
448
|
+
return buildMP3SkinPanelArray(bottomHeight, topHeight, mp3SkinPanelArray);
|
|
387
449
|
}
|
|
388
450
|
if (face.height > _skinPanel.SKIN_HEIGHT_53_25) {
|
|
389
451
|
return [_skinPanel.SKIN_SKU_USV245325, _skinPanel.SKIN_SKU_WSV_2442];
|
|
@@ -453,9 +515,9 @@ function buildSkinPanelData(faces) {
|
|
|
453
515
|
var removeIdxs = [];
|
|
454
516
|
var newDatas = [];
|
|
455
517
|
var _loop5 = function _loop5() {
|
|
456
|
-
var iData = tempResult[
|
|
518
|
+
var iData = tempResult[_i4];
|
|
457
519
|
if (iData.isBackFace) {
|
|
458
|
-
removeIdxs.push(
|
|
520
|
+
removeIdxs.push(_i4);
|
|
459
521
|
var count48 = Math.floor(iData.totalLength / 48);
|
|
460
522
|
var count24 = iData.totalLength % 48 > 0 ? 1 : 0;
|
|
461
523
|
var idx48 = tempResult.findIndex(function (v) {
|
|
@@ -494,7 +556,7 @@ function buildSkinPanelData(faces) {
|
|
|
494
556
|
}
|
|
495
557
|
}
|
|
496
558
|
};
|
|
497
|
-
for (var
|
|
559
|
+
for (var _i4 = 0; _i4 < tempResult.length; _i4++) {
|
|
498
560
|
_loop5();
|
|
499
561
|
}
|
|
500
562
|
tempResult = tempResult.filter(function (data, idx) {
|