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.
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/utils/item-loader.js +197 -197
- package/es/components/viewer2d/item.js +25 -9
- package/es/components/viewer3d/viewer3d.js +35 -55
- package/es/constants.js +1 -1
- package/es/devLiteRenderer.js +108 -98
- package/es/utils/geometry.js +26 -10
- package/es/utils/isolate-event-handler.js +16 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/utils/item-loader.js +194 -194
- package/lib/components/viewer2d/item.js +25 -9
- package/lib/components/viewer3d/viewer3d.js +35 -55
- package/lib/constants.js +1 -1
- package/lib/devLiteRenderer.js +103 -93
- package/lib/utils/geometry.js +26 -10
- package/lib/utils/isolate-event-handler.js +16 -4
- package/package.json +1 -1
package/lib/utils/geometry.js
CHANGED
|
@@ -2581,7 +2581,7 @@ function getAllItems2(curItem, layer) {
|
|
|
2581
2581
|
height: height
|
|
2582
2582
|
};
|
|
2583
2583
|
if (curItem.get('id') !== item.id) {
|
|
2584
|
-
var detectObjectsAtSameAltitudeFlag =
|
|
2584
|
+
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']);
|
|
2585
2585
|
if (detectObjectsAtSameAltitudeFlag) {
|
|
2586
2586
|
var x = val.pos.x;
|
|
2587
2587
|
var y = val.pos.y;
|
|
@@ -2631,9 +2631,9 @@ function calcDistancesFromItemToWalls(curItem, layer) {
|
|
|
2631
2631
|
height = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.depth).from('in').to('cm');
|
|
2632
2632
|
}
|
|
2633
2633
|
var center_h = 3 * height / 8;
|
|
2634
|
-
var center_x = x;
|
|
2634
|
+
var center_x = x; // middle of front line of cabinet rect
|
|
2635
2635
|
var center_y = y;
|
|
2636
|
-
var center_x1 = x - center_h * Math.sin(rotRad);
|
|
2636
|
+
var center_x1 = x - center_h * Math.sin(rotRad); // center point of cabinet rect
|
|
2637
2637
|
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
2638
2638
|
var PointArray = [];
|
|
2639
2639
|
var itemInfo = {
|
|
@@ -2652,20 +2652,33 @@ function calcDistancesFromItemToWalls(curItem, layer) {
|
|
|
2652
2652
|
var allLines = getAllLines(layer);
|
|
2653
2653
|
var allLineRects = buildRectFromLines(layer, allLines);
|
|
2654
2654
|
var allRect = allLineRects.concat(allItemRect.others);
|
|
2655
|
-
|
|
2656
|
-
|
|
2655
|
+
var _loop = function _loop(i) {
|
|
2656
|
+
// [rectCenterPoint] has four middle points of cabinet rect edges
|
|
2657
|
+
var centerpoint = curiteminfo.rectCenterPoint[i];
|
|
2658
|
+
var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
|
|
2657
2659
|
var a;
|
|
2658
|
-
var RectLineFuction;
|
|
2660
|
+
var RectLineFuction; // normal line of cabinet rect edge
|
|
2659
2661
|
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);
|
|
2660
2662
|
allRect.forEach(function (linerect) {
|
|
2663
|
+
// calc distance to all other lines
|
|
2661
2664
|
var p0 = clone_point(linerect.rect[2]);
|
|
2662
2665
|
var p1 = clone_point(linerect.rect[3]);
|
|
2663
|
-
var lineFunction = {};
|
|
2666
|
+
var lineFunction = {}; // other line function
|
|
2664
2667
|
if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
|
|
2668
|
+
// intersection between normal line and other line
|
|
2665
2669
|
var coordinatePoint = twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
2666
2670
|
if (coordinatePoint !== undefined) {
|
|
2667
|
-
if (
|
|
2668
|
-
|
|
2671
|
+
if (
|
|
2672
|
+
// intersection point is on the other line
|
|
2673
|
+
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)) {
|
|
2674
|
+
// check the intersection point is outside direction of edge
|
|
2675
|
+
var isOutside = true;
|
|
2676
|
+
for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
|
|
2677
|
+
if (j === i) continue;
|
|
2678
|
+
var otherCenterPoint = curiteminfo.rectCenterPoint[j];
|
|
2679
|
+
if (isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
|
|
2680
|
+
}
|
|
2681
|
+
if (isOutside && pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
2669
2682
|
comparelength.push(pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
2670
2683
|
a = Math.min.apply(null, comparelength);
|
|
2671
2684
|
}
|
|
@@ -2673,7 +2686,10 @@ function calcDistancesFromItemToWalls(curItem, layer) {
|
|
|
2673
2686
|
}
|
|
2674
2687
|
});
|
|
2675
2688
|
PointArray.push([a, centerpoint[1]]);
|
|
2676
|
-
}
|
|
2689
|
+
};
|
|
2690
|
+
for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
|
|
2691
|
+
_loop(i);
|
|
2692
|
+
}
|
|
2677
2693
|
PointArray.forEach(function (pointElement, index) {
|
|
2678
2694
|
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
2679
2695
|
});
|
|
@@ -1046,14 +1046,14 @@ function movePan2D3D(props, payload, state) {
|
|
|
1046
1046
|
case _constants.RIGHT:
|
|
1047
1047
|
window.interval = setTimeout(function () {
|
|
1048
1048
|
window.tDKeyDown({
|
|
1049
|
-
keyCode:
|
|
1049
|
+
keyCode: 37
|
|
1050
1050
|
});
|
|
1051
1051
|
}, 50);
|
|
1052
1052
|
break;
|
|
1053
1053
|
case _constants.LEFT:
|
|
1054
1054
|
window.interval = setTimeout(function () {
|
|
1055
1055
|
window.tDKeyDown({
|
|
1056
|
-
keyCode:
|
|
1056
|
+
keyCode: 39
|
|
1057
1057
|
});
|
|
1058
1058
|
}, 50);
|
|
1059
1059
|
break;
|
|
@@ -1066,7 +1066,7 @@ function handleExternalEvent(_x10) {
|
|
|
1066
1066
|
function _handleExternalEvent() {
|
|
1067
1067
|
_handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(props) {
|
|
1068
1068
|
var _evt$payload3, _evt$payload4;
|
|
1069
|
-
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;
|
|
1069
|
+
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;
|
|
1070
1070
|
return _regenerator["default"].wrap(function (_context1) {
|
|
1071
1071
|
while (1) switch (_context1.prev = _context1.next) {
|
|
1072
1072
|
case 0:
|
|
@@ -1183,7 +1183,19 @@ function _handleExternalEvent() {
|
|
|
1183
1183
|
_context1.next = 11;
|
|
1184
1184
|
break;
|
|
1185
1185
|
}
|
|
1186
|
-
element = evt.payload;
|
|
1186
|
+
element = evt.payload; ///// filter the tempPlaceholders using layer-doorstyle-cds
|
|
1187
|
+
cds = (_state$getIn = state.getIn(['scene', 'layers', 'layer-1', 'doorStyle'])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.cds;
|
|
1188
|
+
if (cds) {
|
|
1189
|
+
currentCdsId = (_cds$find = cds.find(function (c) {
|
|
1190
|
+
return c.itemID === element.itemID;
|
|
1191
|
+
})) === null || _cds$find === void 0 ? void 0 : _cds$find.cabinet_door_style_id;
|
|
1192
|
+
if (currentCdsId && element.structure_json.tempPlaceholders.length > 0) {
|
|
1193
|
+
element.structure_json.tempPlaceholders[0] = element.structure_json.tempPlaceholders.find(function (tPlaceholder) {
|
|
1194
|
+
return tPlaceholder.id === currentCdsId;
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
/////
|
|
1187
1199
|
_context1.next = 10;
|
|
1188
1200
|
return addItemToCatalog(element, state, props.catalog, props.projectActions);
|
|
1189
1201
|
case 10:
|