kitchen-simulator 11.6.0 → 11.9.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.
@@ -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
@@ -97,7 +97,7 @@ export function getSideFaces(item, layer) {
97
97
  }
98
98
  function collectLayerItems(layer) {
99
99
  var _layer$items;
100
- var skinLayouts = new Set([BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS, VANITY_CABINET_LAYOUTPOS]);
100
+ var skinLayouts = new Set([BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS]);
101
101
  var skinPanelItems = [];
102
102
  var otherItems = [];
103
103
  layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 || _layer$items.forEach(function (it) {
@@ -368,6 +368,51 @@ function applyVerticalGrouping(faces) {
368
368
  function isMP3TallCabinet(sku) {
369
369
  return sku === null || sku === void 0 ? void 0 : sku.startsWith('MP3');
370
370
  }
371
+ function buildMP3SkinPanelArray(bottomHeight, topHeight, mp3SkinPanelArray) {
372
+ var skinPanelHeightArray = [],
373
+ bIndex = -1,
374
+ tIndex = -1,
375
+ hArray = [],
376
+ skinPanelTypeArray = [],
377
+ temp = 0;
378
+ // make skinPanelHeightArray : [0, sum(h1 + h2 +...+ hn)]
379
+ skinPanelHeightArray[0] = temp;
380
+ for (var i = 0; i < mp3SkinPanelArray.length; i++) {
381
+ temp += mp3SkinPanelArray[i][0];
382
+ skinPanelHeightArray.push(temp);
383
+ }
384
+ // calc the zBottom's index
385
+ for (var _i = 0; _i <= skinPanelHeightArray.length; _i++) {
386
+ if (bottomHeight < skinPanelHeightArray[_i]) {
387
+ bIndex = _i - 1;
388
+ break;
389
+ }
390
+ }
391
+ if (bIndex < 0) {
392
+ console.log('Error for bottomHeight in buildMP3SkinPanelArray');
393
+ return [];
394
+ }
395
+ // calc the zTop's index
396
+ for (var _i2 = 0; _i2 <= skinPanelHeightArray.length; _i2++) {
397
+ if (topHeight <= skinPanelHeightArray[_i2]) {
398
+ tIndex = _i2;
399
+ break;
400
+ }
401
+ }
402
+ if (tIndex < 0) {
403
+ console.log('Error for topHeight in buildMP3SkinPanelArray');
404
+ return [];
405
+ }
406
+ if (tIndex === 0 || bIndex === skinPanelHeightArray.length) return [];
407
+
408
+ // make the skinPanelTypeArray using zTop's index and zBottom's index
409
+ hArray = mp3SkinPanelArray.slice(bIndex, tIndex + 1);
410
+ for (var _i3 = 0; _i3 < hArray.length; _i3++) {
411
+ skinPanelTypeArray.push(hArray[_i3][1]);
412
+ }
413
+ // return skinPanelTypeArray : e.g. [SKIN_SKU_BSV_24, SKIN_SKU_WSV_2442]
414
+ return skinPanelTypeArray;
415
+ }
371
416
 
372
417
  /**
373
418
  * Decide which skin panel pieces are needed for a tall cabinet.
@@ -375,7 +420,14 @@ function isMP3TallCabinet(sku) {
375
420
  function resolveTallCabinetBundle(face) {
376
421
  var item = face.itemInfo;
377
422
  if (isMP3TallCabinet(item.sku_number)) {
378
- return [SKIN_SKU_BSV_24, SKIN_SKU_BSV_24, SKIN_SKU_WSV_2442];
423
+ var zBottom = face.zBottom;
424
+ var zTop = face.zTop;
425
+ var bottomHeight = convert(zBottom).from('cm').to('in');
426
+ var topHeight = convert(zTop).from('cm').to('in');
427
+ var mp3SkinPanelArray = [[34.5, SKIN_SKU_BSV_24],
428
+ // [height of skin panel, type of skin panel]
429
+ [item.properties.height._length - 76.5, SKIN_SKU_BSV_24], [42, SKIN_SKU_WSV_2442]];
430
+ return buildMP3SkinPanelArray(bottomHeight, topHeight, mp3SkinPanelArray);
379
431
  }
380
432
  if (face.height > SKIN_HEIGHT_53_25) {
381
433
  return [SKIN_SKU_USV245325, SKIN_SKU_WSV_2442];
@@ -445,9 +497,9 @@ function buildSkinPanelData(faces) {
445
497
  var removeIdxs = [];
446
498
  var newDatas = [];
447
499
  var _loop5 = function _loop5() {
448
- var iData = tempResult[_i];
500
+ var iData = tempResult[_i4];
449
501
  if (iData.isBackFace) {
450
- removeIdxs.push(_i);
502
+ removeIdxs.push(_i4);
451
503
  var count48 = Math.floor(iData.totalLength / 48);
452
504
  var count24 = iData.totalLength % 48 > 0 ? 1 : 0;
453
505
  var idx48 = tempResult.findIndex(function (v) {
@@ -486,7 +538,7 @@ function buildSkinPanelData(faces) {
486
538
  }
487
539
  }
488
540
  };
489
- for (var _i = 0; _i < tempResult.length; _i++) {
541
+ for (var _i4 = 0; _i4 < tempResult.length; _i4++) {
490
542
  _loop5();
491
543
  }
492
544
  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
@@ -105,7 +105,7 @@ function getSideFaces(item, layer) {
105
105
  }
106
106
  function collectLayerItems(layer) {
107
107
  var _layer$items;
108
- var skinLayouts = new Set([_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS, _constants.VANITY_CABINET_LAYOUTPOS]);
108
+ var skinLayouts = new Set([_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS]);
109
109
  var skinPanelItems = [];
110
110
  var otherItems = [];
111
111
  layer === null || layer === void 0 || (_layer$items = layer.items) === null || _layer$items === void 0 || _layer$items.forEach(function (it) {
@@ -376,6 +376,51 @@ function applyVerticalGrouping(faces) {
376
376
  function isMP3TallCabinet(sku) {
377
377
  return sku === null || sku === void 0 ? void 0 : sku.startsWith('MP3');
378
378
  }
379
+ function buildMP3SkinPanelArray(bottomHeight, topHeight, mp3SkinPanelArray) {
380
+ var skinPanelHeightArray = [],
381
+ bIndex = -1,
382
+ tIndex = -1,
383
+ hArray = [],
384
+ skinPanelTypeArray = [],
385
+ temp = 0;
386
+ // make skinPanelHeightArray : [0, sum(h1 + h2 +...+ hn)]
387
+ skinPanelHeightArray[0] = temp;
388
+ for (var i = 0; i < mp3SkinPanelArray.length; i++) {
389
+ temp += mp3SkinPanelArray[i][0];
390
+ skinPanelHeightArray.push(temp);
391
+ }
392
+ // calc the zBottom's index
393
+ for (var _i = 0; _i <= skinPanelHeightArray.length; _i++) {
394
+ if (bottomHeight < skinPanelHeightArray[_i]) {
395
+ bIndex = _i - 1;
396
+ break;
397
+ }
398
+ }
399
+ if (bIndex < 0) {
400
+ console.log('Error for bottomHeight in buildMP3SkinPanelArray');
401
+ return [];
402
+ }
403
+ // calc the zTop's index
404
+ for (var _i2 = 0; _i2 <= skinPanelHeightArray.length; _i2++) {
405
+ if (topHeight <= skinPanelHeightArray[_i2]) {
406
+ tIndex = _i2;
407
+ break;
408
+ }
409
+ }
410
+ if (tIndex < 0) {
411
+ console.log('Error for topHeight in buildMP3SkinPanelArray');
412
+ return [];
413
+ }
414
+ if (tIndex === 0 || bIndex === skinPanelHeightArray.length) return [];
415
+
416
+ // make the skinPanelTypeArray using zTop's index and zBottom's index
417
+ hArray = mp3SkinPanelArray.slice(bIndex, tIndex + 1);
418
+ for (var _i3 = 0; _i3 < hArray.length; _i3++) {
419
+ skinPanelTypeArray.push(hArray[_i3][1]);
420
+ }
421
+ // return skinPanelTypeArray : e.g. [SKIN_SKU_BSV_24, SKIN_SKU_WSV_2442]
422
+ return skinPanelTypeArray;
423
+ }
379
424
 
380
425
  /**
381
426
  * Decide which skin panel pieces are needed for a tall cabinet.
@@ -383,7 +428,14 @@ function isMP3TallCabinet(sku) {
383
428
  function resolveTallCabinetBundle(face) {
384
429
  var item = face.itemInfo;
385
430
  if (isMP3TallCabinet(item.sku_number)) {
386
- return [_skinPanel.SKIN_SKU_BSV_24, _skinPanel.SKIN_SKU_BSV_24, _skinPanel.SKIN_SKU_WSV_2442];
431
+ var zBottom = face.zBottom;
432
+ var zTop = face.zTop;
433
+ var bottomHeight = (0, _convertUnitsLite.convert)(zBottom).from('cm').to('in');
434
+ var topHeight = (0, _convertUnitsLite.convert)(zTop).from('cm').to('in');
435
+ var mp3SkinPanelArray = [[34.5, _skinPanel.SKIN_SKU_BSV_24],
436
+ // [height of skin panel, type of skin panel]
437
+ [item.properties.height._length - 76.5, _skinPanel.SKIN_SKU_BSV_24], [42, _skinPanel.SKIN_SKU_WSV_2442]];
438
+ return buildMP3SkinPanelArray(bottomHeight, topHeight, mp3SkinPanelArray);
387
439
  }
388
440
  if (face.height > _skinPanel.SKIN_HEIGHT_53_25) {
389
441
  return [_skinPanel.SKIN_SKU_USV245325, _skinPanel.SKIN_SKU_WSV_2442];
@@ -453,9 +505,9 @@ function buildSkinPanelData(faces) {
453
505
  var removeIdxs = [];
454
506
  var newDatas = [];
455
507
  var _loop5 = function _loop5() {
456
- var iData = tempResult[_i];
508
+ var iData = tempResult[_i4];
457
509
  if (iData.isBackFace) {
458
- removeIdxs.push(_i);
510
+ removeIdxs.push(_i4);
459
511
  var count48 = Math.floor(iData.totalLength / 48);
460
512
  var count24 = iData.totalLength % 48 > 0 ? 1 : 0;
461
513
  var idx48 = tempResult.findIndex(function (v) {
@@ -494,7 +546,7 @@ function buildSkinPanelData(faces) {
494
546
  }
495
547
  }
496
548
  };
497
- for (var _i = 0; _i < tempResult.length; _i++) {
549
+ for (var _i4 = 0; _i4 < tempResult.length; _i4++) {
498
550
  _loop5();
499
551
  }
500
552
  tempResult = tempResult.filter(function (data, idx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "11.6.0",
3
+ "version": "11.9.0",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",