kitchen-simulator 3.1.12 → 3.1.13

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.
@@ -2481,7 +2481,7 @@ function getAllItems2(curItem, layer) {
2481
2481
  height: height
2482
2482
  };
2483
2483
  if (curItem.get('id') !== item.id) {
2484
- var detectObjectsAtSameAltitudeFlag = item.layoutpos === 'Base' ? item.properties.getIn(['altitude', '_length']) <= curItem.get('properties').getIn(['altitude', '_length']) + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= curItem.get('properties').getIn(['altitude', '_length']);
2484
+ var detectObjectsAtSameAltitudeFlag = curItem.get('layoutpos') === 'Base' ? item.properties.getIn(['altitude', '_length']) <= curItem.get('properties').getIn(['altitude', '_length']) + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= curItem.get('properties').getIn(['altitude', '_length']);
2485
2485
  if (detectObjectsAtSameAltitudeFlag) {
2486
2486
  var x = val.pos.x;
2487
2487
  var y = val.pos.y;
@@ -2531,9 +2531,9 @@ export function calcDistancesFromItemToWalls(curItem, layer) {
2531
2531
  height = convert(curItem.info.sizeinfo.depth).from('in').to('cm');
2532
2532
  }
2533
2533
  var center_h = 3 * height / 8;
2534
- var center_x = x;
2534
+ var center_x = x; // middle of front line of cabinet rect
2535
2535
  var center_y = y;
2536
- var center_x1 = x - center_h * Math.sin(rotRad);
2536
+ var center_x1 = x - center_h * Math.sin(rotRad); // center point of cabinet rect
2537
2537
  var center_y1 = y + center_h * Math.cos(rotRad);
2538
2538
  var PointArray = [];
2539
2539
  var itemInfo = {
@@ -2552,20 +2552,33 @@ export function calcDistancesFromItemToWalls(curItem, layer) {
2552
2552
  var allLines = getAllLines(layer);
2553
2553
  var allLineRects = buildRectFromLines(layer, allLines);
2554
2554
  var allRect = allLineRects.concat(allItemRect.others);
2555
- curiteminfo.rectCenterPoint.forEach(function (centerpoint) {
2556
- var comparelength = [];
2555
+ var _loop = function _loop(i) {
2556
+ // [rectCenterPoint] has four middle points of cabinet rect edges
2557
+ var centerpoint = curiteminfo.rectCenterPoint[i];
2558
+ var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
2557
2559
  var a;
2558
- var RectLineFuction;
2560
+ var RectLineFuction; // normal line of cabinet rect edge
2559
2561
  if (centerpoint[1] === 180 || centerpoint[1] === 0) RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x1, center_y1);else RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y);
2560
2562
  allRect.forEach(function (linerect) {
2563
+ // calc distance to all other lines
2561
2564
  var p0 = clone_point(linerect.rect[2]);
2562
2565
  var p1 = clone_point(linerect.rect[3]);
2563
- var lineFunction = {};
2566
+ var lineFunction = {}; // other line function
2564
2567
  if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
2568
+ // intersection between normal line and other line
2565
2569
  var coordinatePoint = twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
2566
2570
  if (coordinatePoint !== undefined) {
2567
- if (pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
2568
- if (pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
2571
+ if (
2572
+ // intersection point is on the other line
2573
+ pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
2574
+ // check the intersection point is outside direction of edge
2575
+ var isOutside = true;
2576
+ for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
2577
+ if (j === i) continue;
2578
+ var otherCenterPoint = curiteminfo.rectCenterPoint[j];
2579
+ if (isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
2580
+ }
2581
+ if (isOutside && pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
2569
2582
  comparelength.push(pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
2570
2583
  a = Math.min.apply(null, comparelength);
2571
2584
  }
@@ -2573,7 +2586,10 @@ export function calcDistancesFromItemToWalls(curItem, layer) {
2573
2586
  }
2574
2587
  });
2575
2588
  PointArray.push([a, centerpoint[1]]);
2576
- });
2589
+ };
2590
+ for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
2591
+ _loop(i);
2592
+ }
2577
2593
  PointArray.forEach(function (pointElement, index) {
2578
2594
  if (pointElement[0] == undefined) PointArray[index][0] = 0;
2579
2595
  });
@@ -1039,14 +1039,14 @@ function movePan2D3D(props, payload, state) {
1039
1039
  case RIGHT:
1040
1040
  window.interval = setTimeout(function () {
1041
1041
  window.tDKeyDown({
1042
- keyCode: 39
1042
+ keyCode: 37
1043
1043
  });
1044
1044
  }, 50);
1045
1045
  break;
1046
1046
  case LEFT:
1047
1047
  window.interval = setTimeout(function () {
1048
1048
  window.tDKeyDown({
1049
- keyCode: 37
1049
+ keyCode: 39
1050
1050
  });
1051
1051
  }, 50);
1052
1052
  break;
@@ -1059,7 +1059,7 @@ export function handleExternalEvent(_x10) {
1059
1059
  function _handleExternalEvent() {
1060
1060
  _handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(props) {
1061
1061
  var _evt$payload3, _evt$payload4;
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
+ var evt, state, layerId, layer, _evt$payload, cdsItems, itemKeys, _loop3, i, _props$onInternalEven, sLineCnt, _state$getIn, element, cds, _cds$find, currentCdsId, _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;
1063
1063
  return _regeneratorRuntime.wrap(function (_context1) {
1064
1064
  while (1) switch (_context1.prev = _context1.next) {
1065
1065
  case 0:
@@ -1176,7 +1176,19 @@ function _handleExternalEvent() {
1176
1176
  _context1.next = 11;
1177
1177
  break;
1178
1178
  }
1179
- element = evt.payload;
1179
+ element = evt.payload; ///// filter the tempPlaceholders using layer-doorstyle-cds
1180
+ cds = (_state$getIn = state.getIn(['scene', 'layers', 'layer-1', 'doorStyle'])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.cds;
1181
+ if (cds) {
1182
+ currentCdsId = (_cds$find = cds.find(function (c) {
1183
+ return c.itemID === element.itemID;
1184
+ })) === null || _cds$find === void 0 ? void 0 : _cds$find.cabinet_door_style_id;
1185
+ if (currentCdsId && element.structure_json.tempPlaceholders.length > 0) {
1186
+ element.structure_json.tempPlaceholders[0] = element.structure_json.tempPlaceholders.find(function (tPlaceholder) {
1187
+ return tPlaceholder.id === currentCdsId;
1188
+ });
1189
+ }
1190
+ }
1191
+ /////
1180
1192
  _context1.next = 10;
1181
1193
  return addItemToCatalog(element, state, props.catalog, props.projectActions);
1182
1194
  case 10:
@@ -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();
@@ -13,12 +13,12 @@ var _constants = require("../../../constants");
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 cached3DWindow = null;
15
15
  var _default = exports["default"] = {
16
- name: 'Clear Window',
16
+ name: 'Window',
17
17
  prototype: 'holes',
18
18
  info: {
19
19
  title: 'Clear',
20
20
  tag: ['window'],
21
- description: 'Clear Window',
21
+ description: 'Window',
22
22
  image: '/assets/img/svg/window/Clear.svg',
23
23
  url: '/assets/gltf/window_clear.gltf'
24
24
  },