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.
@@ -13,6 +13,7 @@ import { convert } from "./convert-units-lite";
13
13
  import { GeometryUtils, MathUtils } from "./export";
14
14
  import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
15
15
  import { SVGLoader } from 'three/addons/loaders/SVGLoader';
16
+ import { getMoldingDataOfScene } from "./molding";
16
17
  var PRECISION = 2;
17
18
  function loadJSON(_x) {
18
19
  return _loadJSON.apply(this, arguments);
@@ -1058,13 +1059,15 @@ export function handleExternalEvent(_x10) {
1058
1059
  function _handleExternalEvent() {
1059
1060
  _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(props) {
1060
1061
  var _evt$payload3, _evt$payload4;
1061
- var evt, state, _evt$payload, cdsItems, itemKeys, _loop3, i, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _Object$keys, _evt$payload5, doorStyle, itemCDS, isAll, layerId, _cdsItems, allItems, selectedItemId, _itemKeys, _loop4, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId, layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, _t5;
1062
+ var evt, state, layerId, layer, _evt$payload, cdsItems, itemKeys, _loop3, i, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _Object$keys, _evt$payload5, doorStyle, itemCDS, isAll, _layerId, _cdsItems, allItems, selectedItemId, _itemKeys, _loop4, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t5;
1062
1063
  return _regeneratorRuntime.wrap(function (_context1) {
1063
1064
  while (1) switch (_context1.prev = _context1.next) {
1064
1065
  case 0:
1065
1066
  // console.log('***external event****', props);
1066
1067
  evt = props.externalEvent;
1067
1068
  state = props.state.get('KitchenConfigurator');
1069
+ layerId = state.getIn(['scene', 'selectedLayer']);
1070
+ layer = state.getIn(['scene', 'layers', layerId]);
1068
1071
  _t5 = evt === null || evt === void 0 ? void 0 : evt.type;
1069
1072
  _context1.next = _t5 === EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 5 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 6 : _t5 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 7 : _t5 === EXTERNAL_EVENT_ADD_WALL ? 8 : _t5 === EXTERNAL_EVENT_ADD_ITEM ? 9 : _t5 === EXTERNAL_EVENT_ADD_HOLE ? 12 : _t5 === EXTERNAL_EVENT_MOVE_PAN ? 13 : _t5 === EXTERNAL_EVENT_NEW_PROJECT ? 14 : _t5 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 15 : _t5 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 19 : _t5 === EXTERNAL_EVENT_ZOOM_IN ? 20 : _t5 === EXTERNAL_EVENT_ZOOM_OUT ? 21 : _t5 === EXTERNAL_EVENT_CENTERING_2D ? 22 : _t5 === EXTERNAL_EVENT_UNDO ? 23 : _t5 === EXTERNAL_EVENT_REDO ? 24 : _t5 === EXTERNAL_EVENT_SET_MOLDING ? 25 : _t5 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 27 : _t5 === EXTERNAL_EVENT_DELETE_ELEMENT ? 28 : _t5 === EXTERNAL_EVENT_PROJECT_SETTING ? 29 : _t5 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 30 : _t5 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 30 : _t5 === EXTERNAL_EVENT_REPLACE_CABINET ? 31 : _t5 === EXTERNAL_EVENT_SET_FINISHING ? 33 : _t5 === EXTERNAL_EVENT_SYNC_SCENE ? 34 : 35;
1070
1073
  break;
@@ -1155,7 +1158,7 @@ function _handleExternalEvent() {
1155
1158
  props.projectActions.setMode(MODE_IDLE);
1156
1159
  return _context1.abrupt("continue", 35);
1157
1160
  case 7:
1158
- sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
1161
+ sLineCnt = layer.selected.lines.size;
1159
1162
  if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
1160
1163
  return _context1.abrupt("continue", 35);
1161
1164
  case 8:
@@ -1208,10 +1211,10 @@ function _handleExternalEvent() {
1208
1211
  return _context1.abrupt("continue", 35);
1209
1212
  case 15:
1210
1213
  _evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, isAll = _evt$payload5.isAll; // prepare item data request
1211
- layerId = state.getIn(['scene', 'selectedLayer']);
1214
+ _layerId = state.getIn(['scene', 'selectedLayer']);
1212
1215
  _cdsItems = [];
1213
- allItems = state.getIn(['scene', 'layers', layerId, 'items']).toJS();
1214
- selectedItemId = state.getIn(['scene', 'layers', layerId]).selected.items.toJS()[0];
1216
+ allItems = state.getIn(['scene', 'layers', _layerId, 'items']).toJS();
1217
+ selectedItemId = state.getIn(['scene', 'layers', _layerId]).selected.items.toJS()[0];
1215
1218
  _itemKeys = isAll ? (_Object$keys = Object.keys(allItems)) !== null && _Object$keys !== void 0 ? _Object$keys : [] : [selectedItemId];
1216
1219
  _loop4 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop4() {
1217
1220
  var _itemCDS$find;
@@ -1351,18 +1354,18 @@ function _handleExternalEvent() {
1351
1354
  }
1352
1355
  return _context1.abrupt("continue", 35);
1353
1356
  case 30:
1354
- _layerId = state.getIn(['scene', 'selectedLayer']);
1355
- layer = state.getIn(['scene', 'layers', _layerId]);
1356
- _layer$getIn = layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
1357
- for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, state, layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1358
- for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, state, layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1359
- for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, state, layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1357
+ _layerId2 = state.getIn(['scene', 'selectedLayer']);
1358
+ _layer = state.getIn(['scene', 'layers', _layerId2]);
1359
+ _layer$getIn = _layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
1360
+ for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1361
+ for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1362
+ for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, props.catalog, props.projectActions, evt.callback);
1360
1363
  return _context1.abrupt("continue", 35);
1361
1364
  case 31:
1362
1365
  _layerID = state.scene.selectedLayer;
1363
- _layer = state.scene.getIn(['layers', _layerID]).toJS();
1366
+ _layer2 = state.scene.getIn(['layers', _layerID]).toJS();
1364
1367
  orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
1365
- originalItem = _layer === null || _layer === void 0 ? void 0 : _layer.items[orginalItemInfo.id];
1368
+ originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
1366
1369
  _context1.next = 32;
1367
1370
  return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
1368
1371
  case 32:
@@ -1384,11 +1387,14 @@ function _handleExternalEvent() {
1384
1387
  case 33:
1385
1388
  setFinishing(props, state, evt.payload);
1386
1389
  case 34:
1390
+ sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
1391
+ currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
1392
+ sceneData.layers[layerId].moldingData = getMoldingDataOfScene(layer, props.catalog, currentTexture);
1387
1393
  // send scene object from 3DTool to HostApp using internalEvent
1388
1394
  (_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
1389
1395
  type: INTERNAL_EVENT_SYNC_SCENE,
1390
1396
  value: {
1391
- scene: state.scene.toJS()
1397
+ scene: sceneData
1392
1398
  }
1393
1399
  });
1394
1400
  return _context1.abrupt("continue", 35);
@@ -5,11 +5,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
6
6
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
7
7
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
8
- import { BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, EPSILON, MIDDLE_MOLDING_LOCATION, MOLDING_LOCATIONS, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_SAME, OVERLAP_SOME, TALL_CABINET_LAYOUTPOS, TOP_MOLDING_LOCATION, WALL_CABINET_LAYOUTPOS } from "../constants";
8
+ import { BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, EPSILON, MIDDLE_MOLDING_LOCATION, MOLDING_LOCATIONS, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_SAME, OVERLAP_SOME, TALL_CABINET_LAYOUTPOS, TOE_KICK_MOLDING, TOP_MOLDING_LOCATION, WALL_CABINET_LAYOUTPOS } from "../constants";
9
9
  import * as Three from 'three';
10
10
  import { convert } from "./convert-units-lite";
11
11
  import IDBroker from "./id-broker";
12
- import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
12
+ import { getToeKickSKU, isEqualInstallationType, returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
13
13
  import { GeometryUtils } from "./export";
14
14
  import { isEmpty } from "./helper";
15
15
  export function getItemRect(item) {
@@ -866,4 +866,236 @@ export function createMonldingGroup(oldMG, layer, molding, catalog) {
866
866
  newMG.lines.reverse();
867
867
  newMG = getMDPoints(newMG);
868
868
  return newMG;
869
+ }
870
+ export function getMoldingDataOfScene(layer, catalog, doorStyle) {
871
+ var moldingData = [];
872
+ var items = layer.items.toArray();
873
+ var moldings = [];
874
+ // get all moldings info
875
+ items.forEach(function (itemCat) {
876
+ var _itemCat$molding;
877
+ itemCat === null || itemCat === void 0 || (_itemCat$molding = itemCat.molding) === null || _itemCat$molding === void 0 || _itemCat$molding.forEach(function (molding) {
878
+ if (!moldings.some(function (m) {
879
+ return m.name === molding.name;
880
+ })) moldings.push(molding);
881
+ });
882
+ });
883
+
884
+ // calc normal molding
885
+ moldings.forEach(function (molding) {
886
+ var itemGroups = [];
887
+ var temp_items = [];
888
+ items.forEach(function (item) {
889
+ if (item.molding.some(function (mol) {
890
+ return mol.itemID === molding.itemID;
891
+ }) && isEnableItemForMolding(layer, item)) {
892
+ temp_items.push(item);
893
+ }
894
+ });
895
+ if (temp_items.length) {
896
+ while (temp_items.length > 0) {
897
+ var itemGroup = [temp_items[0]];
898
+ var _loop9 = function _loop9(_idx) {
899
+ if (!itemGroup.some(function (it) {
900
+ return it.id === temp_items[_idx].id;
901
+ }) && isItemSnappedGroup(temp_items[_idx], itemGroup)) {
902
+ itemGroup.push(temp_items[_idx]);
903
+ _idx = 0;
904
+ }
905
+ idx = _idx;
906
+ };
907
+ for (var idx = 0; idx < temp_items.length; idx++) {
908
+ _loop9(idx);
909
+ }
910
+ itemGroup.forEach(function (item) {
911
+ var index = temp_items.findIndex(function (it) {
912
+ return it.id === item.id;
913
+ });
914
+ if (index > -1) {
915
+ temp_items.splice(index, 1);
916
+ }
917
+ });
918
+ itemGroups.push(itemGroup);
919
+ }
920
+ var molding_totalLength = 0;
921
+ itemGroups.forEach(function (itemgroup) {
922
+ var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
923
+ var items = _toConsumableArray(itemgroup);
924
+ var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
925
+ items = sortItemsByDistance(items, items[0]);
926
+ var _loop0 = function _loop0() {
927
+ var itemLines = getLinesOfItem(items[i], allLineRects, catalog);
928
+ var temp_MGLines = [];
929
+ MGlines.forEach(function (line) {
930
+ var idx = itemLines.findIndex(function (itemLine) {
931
+ return isLinesOverlapped(line, itemLine);
932
+ });
933
+ var curItemLine = itemLines[idx];
934
+ if (idx > -1) {
935
+ if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
936
+ var MGLine = mergeOverlappedLines(line, curItemLine);
937
+ temp_MGLines.push(MGLine);
938
+ }
939
+ itemLines.splice(idx, 1);
940
+ } else {
941
+ temp_MGLines.push(line);
942
+ }
943
+ });
944
+ itemLines.forEach(function (itemLine) {
945
+ return temp_MGLines.push(itemLine);
946
+ });
947
+ MGlines = [].concat(temp_MGLines);
948
+ };
949
+ for (var i = 1; i < items.length; i++) {
950
+ _loop0();
951
+ }
952
+ MGlines.forEach(function (line) {
953
+ molding_totalLength += GeometryUtils.verticesDistance(line[0], line[1]);
954
+ });
955
+ });
956
+ molding_totalLength = convert(molding_totalLength).from('cm').to('in');
957
+ moldingData.push(_objectSpread(_objectSpread({}, molding), {}, {
958
+ doorStyle: doorStyle,
959
+ count: Math.ceil(molding_totalLength * 1.1 / 96)
960
+ }));
961
+ }
962
+ });
963
+
964
+ // calc toe kick molding
965
+ var tmp = [];
966
+ items.forEach(function (item) {
967
+ if (item.category === 'cabinet' && !item.cabinet_category.toLowerCase().includes('microwave')) {
968
+ tmp.push(item);
969
+ }
970
+ });
971
+ var tmpMoldingData = [];
972
+ var toedoorStyles = [];
973
+ tmp.map(function (item) {
974
+ var _item$molding;
975
+ if (item.layoutpos === BASE_CABINET_LAYOUTPOS && (isEmpty(item.molding) || ((_item$molding = item.molding) === null || _item$molding === void 0 ? void 0 : _item$molding.length) < 1 || !isEnableItemForMolding(layer, item))) {
976
+ var w = item.properties.get('width').get('_length');
977
+ var wUnit = item.properties.get('width').get('_unit') || 'cm';
978
+ w = convert(w / 2).from(wUnit).to('cm');
979
+ var h = item.properties.get('depth').get('_length');
980
+ var hUnit = item.properties.get('depth').get('_unit') || 'cm';
981
+ h = convert(h / 2).from(hUnit).to('cm');
982
+ var outline = null;
983
+ var element = catalog.elements[item.get('type')];
984
+ if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
985
+ outline = element.info.outline;
986
+ var len = 0;
987
+ if (outline) {
988
+ // Extract Points from `outline`
989
+ var outlinePaths = outline.paths;
990
+ var outlineWidth = outline.svgWidth;
991
+ var outlineHeight = outline.svgHeight;
992
+ var outlinePoints = []; // Hold Points Of SVG
993
+ var _iterator3 = _createForOfIteratorHelper(outlinePaths),
994
+ _step3;
995
+ try {
996
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
997
+ var path = _step3.value;
998
+ var _iterator4 = _createForOfIteratorHelper(path.subPaths),
999
+ _step4;
1000
+ try {
1001
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1002
+ var subPath = _step4.value;
1003
+ outlinePoints = outlinePoints.concat(subPath.getPoints());
1004
+ }
1005
+ } catch (err) {
1006
+ _iterator4.e(err);
1007
+ } finally {
1008
+ _iterator4.f();
1009
+ }
1010
+ }
1011
+ } catch (err) {
1012
+ _iterator3.e(err);
1013
+ } finally {
1014
+ _iterator3.f();
1015
+ }
1016
+ var maxX = outlinePoints[0].x,
1017
+ minX = outlinePoints[0].x;
1018
+ var maxY = outlinePoints[0].y,
1019
+ minY = outlinePoints[0].y;
1020
+ outlinePoints.forEach(function (point) {
1021
+ if (point.x > maxX) {
1022
+ maxX = point.x;
1023
+ }
1024
+ if (point.x < minX) {
1025
+ minX = point.x;
1026
+ }
1027
+ if (point.y > maxY) {
1028
+ maxY = point.y;
1029
+ }
1030
+ if (point.y < minY) {
1031
+ minY = point.y;
1032
+ }
1033
+ });
1034
+ outlinePoints.forEach(function (point) {
1035
+ if (GeometryUtils.isPointInRect([{
1036
+ x: minX,
1037
+ y: minY
1038
+ }, {
1039
+ x: minX,
1040
+ y: maxY
1041
+ }, {
1042
+ x: maxX,
1043
+ y: maxY
1044
+ }, {
1045
+ x: maxX,
1046
+ y: minY
1047
+ }], point)) {
1048
+ if (point.x > 10) len += (point.x / outlineWidth - 0.5) * w * 2 + h * 2 - (point.y / outlineHeight - 0.5) * h * 2;
1049
+ }
1050
+ });
1051
+ len = convert(len).from('cm').to('in');
1052
+ } else {
1053
+ w = convert(w * 2).from('cm').to('in');
1054
+ len += w;
1055
+ }
1056
+ var doorIndex = toedoorStyles.findIndex(function (a) {
1057
+ var iDS = item === null || item === void 0 ? void 0 : item.doorStyle;
1058
+ if (!iDS) return false;
1059
+ if (!iDS.hasOwnProperty('id')) {
1060
+ iDS = iDS.toJS();
1061
+ }
1062
+ return a.doorStyle.id === iDS.id && isEqualInstallationType(a.doorStyle, iDS);
1063
+ });
1064
+ if (doorIndex > -1) {
1065
+ toedoorStyles[doorIndex].totalLength += len;
1066
+ } else {
1067
+ toedoorStyles.push({
1068
+ doorStyle: item.doorStyle.hasOwnProperty('id') ? item.doorStyle : item.doorStyle && item.doorStyle.toJS(),
1069
+ totalLength: len
1070
+ });
1071
+ }
1072
+ }
1073
+ });
1074
+ toedoorStyles.forEach(function (doorStyle) {
1075
+ var skuName = getToeKickSKU(doorStyle.doorStyle, catalog);
1076
+ var thumbnail = skuName ? skuName : '';
1077
+ // moldings.forEach(molding => {
1078
+ // if (
1079
+ // molding.name ===
1080
+ // getToeKickSKU(
1081
+ // doorStyle.doorStyle,
1082
+ // catalog,
1083
+ // true
1084
+ // )
1085
+ // )
1086
+ // thumbnail = molding.thumbnail;
1087
+ // });
1088
+
1089
+ doorStyle.totalLength && tmpMoldingData.push({
1090
+ name: TOE_KICK_MOLDING,
1091
+ sku: getToeKickSKU(doorStyle.doorStyle, catalog),
1092
+ thumbnail: thumbnail,
1093
+ category: 'molding',
1094
+ type: 'cabinet',
1095
+ doorStyle: doorStyle.doorStyle,
1096
+ count: Math.ceil(doorStyle.totalLength * 1.1 / 96)
1097
+ });
1098
+ });
1099
+ if (tmpMoldingData.length > 0) moldingData = [].concat(_toConsumableArray(moldingData), tmpMoldingData);
1100
+ return moldingData;
869
1101
  }
@@ -417,7 +417,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
417
417
  style: _objectSpread(_objectSpread({}, wrapperStyle), {}, {
418
418
  height: height,
419
419
  display: 'flex',
420
- justifyContent: 'center'
420
+ justifyContent: 'center',
421
+ position: 'relative'
421
422
  })
422
423
  }, /*#__PURE__*/_react["default"].createElement(_export2.Content, (0, _extends2["default"])({
423
424
  width: contentW,
@@ -12,7 +12,7 @@ var SharedStyle = _interopRequireWildcard(require("../../shared-style"));
12
12
  var _RGBELoader = require("three/examples/jsm/loaders/RGBELoader");
13
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
14
  var params = {
15
- envMap: 'HDR',
15
+ envMap: "HDR",
16
16
  roughness: 0.9,
17
17
  metalness: 0.8,
18
18
  exposure: 1.0
@@ -67,7 +67,7 @@ var assignUVs = function assignUVs(geometry) {
67
67
  var y3 = position.getY(i + 2);
68
68
  uvArray.push((x1 + offset.x) / range.x, (y1 + offset.y) / range.y, (x2 + offset.x) / range.x, (y2 + offset.y) / range.y, (x3 + offset.x) / range.x, (y3 + offset.y) / range.y);
69
69
  }
70
- geometry.setAttribute('uv', new Three.BufferAttribute(new Float32Array(uvArray), 2));
70
+ geometry.setAttribute("uv", new Three.BufferAttribute(new Float32Array(uvArray), 2));
71
71
  geometry.needsUpdate = true;
72
72
  };
73
73
  function createArea(element, layer, scene, textures) {
@@ -78,15 +78,15 @@ function createArea(element, layer, scene, textures) {
78
78
  var texture = element.texture;
79
79
  texture.lengthRepeatScale = 0.01;
80
80
  texture.heightRepeatScale = 0.01;
81
- var color = element.properties.get('patternColor');
81
+ var color = element.properties.get("patternColor");
82
82
  if (element.selected) {
83
83
  color = SharedStyle.AREA_MESH_COLOR.selected;
84
84
  } else {
85
85
  color = SharedStyle.AREA_MESH_COLOR.unselected;
86
86
  }
87
- if (texture.uri === undefined || texture.uri == '') {
87
+ if (texture.uri === undefined || texture.uri == "") {
88
88
  // @todo THIS IS A TEMPORARY FIX TO HAVE A DEFAULT FLOOR TEXTURE
89
- texture.uri = layer.floorStyle.uri || 'https://media.test.diydesignspace.com/uploads/CountTop/202203162950_2/texture/oak-barcelona-s.jpg';
89
+ texture.uri = layer.floorStyle.uri || "https://media.test.diydesignspace.com/uploads/CountTop/202203162950_2/texture/oak-barcelona-s.jpg";
90
90
  }
91
91
  var shape = new _three.Shape();
92
92
  shape.moveTo(vertices[0].x, vertices[0].y);
@@ -94,7 +94,7 @@ function createArea(element, layer, scene, textures) {
94
94
  shape.lineTo(vertices[i].x, vertices[i].y);
95
95
  }
96
96
  function loadFloorENV() {
97
- return new _RGBELoader.RGBELoader().load('/assets/Window.hdr', function (texture) {
97
+ return new _RGBELoader.RGBELoader().load("/assets/Window.hdr", function (texture) {
98
98
  texture.mapping = Three.EquirectangularReflectionMapping;
99
99
  return texture;
100
100
  });
@@ -114,8 +114,8 @@ function createArea(element, layer, scene, textures) {
114
114
  /* Create holes for the area */
115
115
  element.holes.forEach(function (holeID) {
116
116
  var holeCoords = [];
117
- layer.getIn(['areas', holeID, 'vertices']).forEach(function (vertexID) {
118
- var _layer$getIn = layer.getIn(['vertices', vertexID]),
117
+ layer.getIn(["areas", holeID, "vertices"]).forEach(function (vertexID) {
118
+ var _layer$getIn = layer.getIn(["vertices", vertexID]),
119
119
  x = _layer$getIn.x,
120
120
  y = _layer$getIn.y;
121
121
  holeCoords.push([x, y]);
@@ -142,7 +142,7 @@ function createArea(element, layer, scene, textures) {
142
142
  var area = new _three.Mesh(shapeGeometry, areaMaterial);
143
143
  area.rotation.x -= Math.PI / 2;
144
144
  area.receiveShadow = true;
145
- area.name = 'floor';
145
+ area.name = "floor";
146
146
  // This mesh is use for creating ceiling mesh
147
147
 
148
148
  var shapeGeometry2 = new Three.ShapeGeometry(shape);
@@ -153,7 +153,7 @@ function createArea(element, layer, scene, textures) {
153
153
  area2.castShadow = true;
154
154
  area2.rotation.x -= Math.PI / 2;
155
155
  area2.receiveShadow = true;
156
- area2.name = 'floorSupport';
156
+ area2.name = "floorSupport";
157
157
  var floorSupport = area2.clone();
158
158
  area.userData.floorSupport = floorSupport;
159
159
  return Promise.resolve(area);
@@ -163,13 +163,13 @@ function updatedArea(element, layer, scene, textures, mesh, oldElement, differen
163
163
  selfDestroy();
164
164
  return selfBuild();
165
165
  };
166
- var floor = mesh.getObjectByName('floor');
166
+ var floor = mesh.getObjectByName("floor");
167
167
  floor.receiveShadow = true;
168
- if (differences[0] == 'selected') {
168
+ if (differences[0] == "selected") {
169
169
  var color = element.selected ? SharedStyle.AREA_MESH_COLOR.selected : SharedStyle.AREA_MESH_COLOR.unselected;
170
170
  floor.material.color.set(color);
171
- } else if (differences[0] == 'properties') {
172
- if (differences[1] === 'texture') {
171
+ } else if (differences[0] == "properties") {
172
+ if (differences[1] === "texture") {
173
173
  return noPerf();
174
174
  }
175
175
  } else return noPerf();