kitchen-simulator 3.1.11 → 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 +36 -12
- package/es/components/viewer3d/viewer3d.js +46 -71
- package/es/constants.js +1 -1
- package/es/devLiteRenderer.js +108 -98
- package/es/utils/geometry.js +50 -94
- package/es/utils/isolate-event-handler.js +23 -7
- 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 +36 -12
- package/lib/components/viewer3d/viewer3d.js +46 -71
- package/lib/constants.js +1 -1
- package/lib/devLiteRenderer.js +103 -93
- package/lib/utils/geometry.js +50 -94
- package/lib/utils/isolate-event-handler.js +23 -7
- package/package.json +1 -1
|
@@ -247,25 +247,38 @@ function Item(_ref, _ref2) {
|
|
|
247
247
|
*/
|
|
248
248
|
var getDistant = function getDistant(x, y, rotRad) {
|
|
249
249
|
var center_h = 3 * height / 8;
|
|
250
|
-
var center_x = x;
|
|
250
|
+
var center_x = x; // middle of front line of cabinet rect
|
|
251
251
|
var center_y = y;
|
|
252
|
-
var center_x1 = x - center_h * Math.sin(rotRad);
|
|
252
|
+
var center_x1 = x - center_h * Math.sin(rotRad); // center point of cabinet rect
|
|
253
253
|
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
254
254
|
var PointArray = [];
|
|
255
|
-
|
|
256
|
-
var
|
|
255
|
+
var _loop = function _loop(i) {
|
|
256
|
+
var centerpoint = curiteminfo.rectCenterPoint[i];
|
|
257
|
+
// [rectCenterPoint] has four middle points of cabinet rect edges
|
|
258
|
+
var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
|
|
257
259
|
var a;
|
|
258
|
-
var RectLineFuction;
|
|
260
|
+
var RectLineFuction; // normal line of cabinet rect edge
|
|
259
261
|
if (centerpoint[1] === 180 || centerpoint[1] === 0) RectLineFuction = _export.GeometryUtils.linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x1, center_y1);else RectLineFuction = _export.GeometryUtils.linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y);
|
|
260
262
|
allRect.forEach(function (linerect) {
|
|
263
|
+
// calc distance to all other lines
|
|
261
264
|
var p0 = _export.GeometryUtils.clone_point(linerect.rect[2]);
|
|
262
265
|
var p1 = _export.GeometryUtils.clone_point(linerect.rect[3]);
|
|
263
|
-
var lineFunction = {};
|
|
266
|
+
var lineFunction = {}; // other line function
|
|
264
267
|
if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = _export.GeometryUtils.linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
|
|
268
|
+
// intersection between normal line and other line
|
|
265
269
|
var coordinatePoint = _export.GeometryUtils.twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
266
270
|
if (coordinatePoint !== undefined) {
|
|
267
|
-
if (
|
|
268
|
-
|
|
271
|
+
if (
|
|
272
|
+
// intersection point is on the other line
|
|
273
|
+
_export.GeometryUtils.pointsDistance(p0.x, p0.y, p1.x, p1.y) > _export.GeometryUtils.pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && _export.GeometryUtils.pointsDistance(p0.x, p0.y, p1.x, p1.y) > _export.GeometryUtils.pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
|
|
274
|
+
// check the intersection point is outside direction of edge
|
|
275
|
+
var isOutside = true;
|
|
276
|
+
for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
|
|
277
|
+
if (j === i) continue;
|
|
278
|
+
var otherCenterPoint = curiteminfo.rectCenterPoint[j];
|
|
279
|
+
if (_export.GeometryUtils.isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
|
|
280
|
+
}
|
|
281
|
+
if (isOutside && _export.GeometryUtils.pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > _export.GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
269
282
|
comparelength.push(_export.GeometryUtils.pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
270
283
|
a = Math.min.apply(null, comparelength);
|
|
271
284
|
}
|
|
@@ -273,7 +286,10 @@ function Item(_ref, _ref2) {
|
|
|
273
286
|
}
|
|
274
287
|
});
|
|
275
288
|
PointArray.push([a, centerpoint[1]]);
|
|
276
|
-
}
|
|
289
|
+
};
|
|
290
|
+
for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
|
|
291
|
+
_loop(i);
|
|
292
|
+
}
|
|
277
293
|
return {
|
|
278
294
|
PointArray: PointArray
|
|
279
295
|
};
|
|
@@ -286,10 +302,18 @@ function Item(_ref, _ref2) {
|
|
|
286
302
|
var cat = catalog.elements[catid];
|
|
287
303
|
PointArray.forEach(function (pointElement, index) {
|
|
288
304
|
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
289
|
-
if (pointElement[1] === -90 && cat.info.is_corner !== 1) {
|
|
290
|
-
|
|
291
|
-
}
|
|
305
|
+
// if (pointElement[1] === -90 && cat.info.is_corner !== 1) {
|
|
306
|
+
// PointArray[index][0] -= 4;
|
|
307
|
+
// }
|
|
308
|
+
});
|
|
309
|
+
var cnt = 0;
|
|
310
|
+
PointArray.forEach(function (pointElement) {
|
|
311
|
+
if (pointElement[0] == 0) cnt++;
|
|
292
312
|
});
|
|
313
|
+
if (cnt == 4 || cnt == 3) {
|
|
314
|
+
PointArray[0][0] = 100;
|
|
315
|
+
PointArray[1][0] = 100;
|
|
316
|
+
}
|
|
293
317
|
if (Array.isArray(PointArray)) {
|
|
294
318
|
itemsActions.storeDistArray(layerID, id, PointArray);
|
|
295
319
|
}
|
|
@@ -1193,12 +1193,12 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1193
1193
|
var sendInternalEvent = function sendInternalEvent(evtType, evtElement) {
|
|
1194
1194
|
var pointArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
1195
1195
|
if (!(0, _helper.isEmpty)(evtType) && !(0, _helper.isEmpty)(evtElement)) {
|
|
1196
|
-
var
|
|
1196
|
+
var _this2$props$onIntern, _this2$props;
|
|
1197
1197
|
var payload = evtElement === null || evtElement === void 0 ? void 0 : evtElement.toJS();
|
|
1198
|
-
if ((
|
|
1198
|
+
if ((evtElement === null || evtElement === void 0 ? void 0 : evtElement.prototype) === 'lines') {
|
|
1199
1199
|
// caculating length of selected line//
|
|
1200
|
-
var v_a = layer.vertices.get(
|
|
1201
|
-
var v_b = layer.vertices.get(
|
|
1200
|
+
var v_a = layer.vertices.get(evtElement.vertices.get(0));
|
|
1201
|
+
var v_b = layer.vertices.get(evtElement.vertices.get(1));
|
|
1202
1202
|
var distance = _export.GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
1203
1203
|
var _length = (0, _convertUnitsLite.convert)(distance).from('cm').to('in');
|
|
1204
1204
|
payload.length = _length;
|
|
@@ -1302,7 +1302,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1302
1302
|
if (intersects[_i1] === undefined) {
|
|
1303
1303
|
if (transflag !== 0 && transflag !== 2) {
|
|
1304
1304
|
isSelected = false;
|
|
1305
|
-
|
|
1305
|
+
_this2.context.projectActions.unselectAll();
|
|
1306
1306
|
scene3D.remove(toolObj);
|
|
1307
1307
|
_this2.context.itemsActions.removeReplacingSupport();
|
|
1308
1308
|
return;
|
|
@@ -1369,16 +1369,11 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1369
1369
|
if (selectedFlag || toolIntersects.length > 0 && !(0, _helper.isElevationView)(mode)) {
|
|
1370
1370
|
cameraControls.mouseButtons.left = _cameraControls["default"].ACTION.NONE;
|
|
1371
1371
|
selectedFlag = false;
|
|
1372
|
-
} else {
|
|
1373
|
-
isSelected = false;
|
|
1374
|
-
// this.context.projectActions.unselectAll();
|
|
1375
|
-
scene3D.remove(toolObj);
|
|
1376
|
-
_this2.context.itemsActions.removeReplacingSupport();
|
|
1377
1372
|
}
|
|
1378
1373
|
}
|
|
1379
1374
|
} else {
|
|
1380
1375
|
isSelected = false;
|
|
1381
|
-
|
|
1376
|
+
_this2.context.projectActions.unselectAll();
|
|
1382
1377
|
scene3D.remove(toolObj);
|
|
1383
1378
|
_this2.context.itemsActions.removeReplacingSupport();
|
|
1384
1379
|
return;
|
|
@@ -1471,7 +1466,8 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1471
1466
|
});
|
|
1472
1467
|
});
|
|
1473
1468
|
var intersects = raycaster.intersectObjects(meshes, true);
|
|
1474
|
-
var _i10;
|
|
1469
|
+
var _i10; // index of warning object in intersects
|
|
1470
|
+
|
|
1475
1471
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
1476
1472
|
for (_i10 = 0; _i10 < intersects.length; _i10++) {
|
|
1477
1473
|
if (intersects[_i10].object.name === 'warningObj') break;
|
|
@@ -1499,6 +1495,19 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1499
1495
|
}
|
|
1500
1496
|
}
|
|
1501
1497
|
gridMatrix.copy(gridPlane.matrixWorld).invert();
|
|
1498
|
+
var addItemToolObj = function addItemToolObj() {
|
|
1499
|
+
var _intersects$_i;
|
|
1500
|
+
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1501
|
+
if ((0, _util.isUndefined)(selectedItem)) return;
|
|
1502
|
+
selectedElement = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1503
|
+
var itemPos = selectedItem.position.clone();
|
|
1504
|
+
if (((_intersects$_i = intersects[_i10]) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.object) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.userData) === null || _intersects$_i === void 0 ? void 0 : _intersects$_i.itemId) === selectedItem.userData.itemId) {
|
|
1505
|
+
toolObj.position.set(intersects[_i10].point.x, intersects[_i10].point.y, intersects[_i10].point.z);
|
|
1506
|
+
} else {
|
|
1507
|
+
toolObj.position.set(planData.plan.position.x + itemPos.x, selectedElement.category === 'lighting' ? -planData.plan.position.y - selectedElement.properties.get('height').get('length') : planData.plan.position.y + selectedItem.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
1508
|
+
}
|
|
1509
|
+
scene3D.add(toolObj);
|
|
1510
|
+
};
|
|
1502
1511
|
if (Math.abs(mouse.x - _this2.lastMousePosition.x) <= 0.02 && Math.abs(mouse.y - _this2.lastMousePosition.y) <= 0.02 || bMove) {
|
|
1503
1512
|
if (intersects.length > 0 && !isNaN(intersects[0].distance)) {
|
|
1504
1513
|
if (intersects[_i10] === undefined) {
|
|
@@ -1522,36 +1531,17 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1522
1531
|
isSelected = true;
|
|
1523
1532
|
setTimeout(function () {
|
|
1524
1533
|
(0, _sceneCreator.getDistances)(layer);
|
|
1525
|
-
|
|
1526
|
-
if ((0, _util.isUndefined)(selectedItem)) return;
|
|
1527
|
-
selectedElement = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1528
|
-
var itemPos = selectedItem.position.clone();
|
|
1529
|
-
if (intersects[_i10].object.parent && intersects[_i10].object.parent.parent.userData.itemId === selectedItem.userData.itemId) {
|
|
1530
|
-
toolObj.position.set(intersects[_i10].point.x, intersects[_i10].point.y, intersects[_i10].point.z);
|
|
1531
|
-
} else {
|
|
1532
|
-
toolObj.position.set(planData.plan.position.x + itemPos.x, selectedElement.category === 'lighting' ? -planData.plan.position.y - selectedElement.properties.get('height').get('length') : planData.plan.position.y + selectedItem.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
1533
|
-
}
|
|
1534
|
-
scene3D.add(toolObj);
|
|
1534
|
+
addItemToolObj();
|
|
1535
1535
|
_this2.setState({
|
|
1536
1536
|
toolObj: toolObj
|
|
1537
1537
|
});
|
|
1538
1538
|
// showItemButtons(layer.getIn(['items', selectedObject.itemID]), currentObject, event, camera, this.renderer);
|
|
1539
|
-
var pointArray = []
|
|
1540
|
-
|
|
1541
|
-
pointArray.push([
|
|
1542
|
-
pointArray.push([
|
|
1543
|
-
pointArray.push([
|
|
1544
|
-
pointArray.
|
|
1545
|
-
pointArray.forEach(function (pointElement, index) {
|
|
1546
|
-
if (pointElement[0] == undefined) pointArray[index][0] = 0;
|
|
1547
|
-
});
|
|
1548
|
-
pointArray.forEach(function (pointElement) {
|
|
1549
|
-
if (pointElement[0] == 0) cnt++;
|
|
1550
|
-
});
|
|
1551
|
-
if (cnt == 4 || cnt == 3) {
|
|
1552
|
-
pointArray[0][0] = 100;
|
|
1553
|
-
pointArray[1][0] = 100;
|
|
1554
|
-
}
|
|
1539
|
+
var pointArray = [];
|
|
1540
|
+
// pointArray.push([fVLine[0].userData.distance, 90]);
|
|
1541
|
+
// pointArray.push([fVLine[1].userData.distance, -90]);
|
|
1542
|
+
// pointArray.push([fVLine[2].userData.distance, 180]);
|
|
1543
|
+
// pointArray.push([fVLine[3].userData.distance, 0]);
|
|
1544
|
+
pointArray = _export.GeometryUtils.calcDistancesFromItemToWalls(selectedElement, layer).PointArray;
|
|
1555
1545
|
actions.itemsActions.storeDistArray(layer.id, selectedObject.itemID, pointArray);
|
|
1556
1546
|
internalType = internalType ? internalType : _constants.INTERNAL_EVENT_SELECT_ELEMENT;
|
|
1557
1547
|
sendInternalEvent(internalType, selectedElement, pointArray);
|
|
@@ -1584,15 +1574,20 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1584
1574
|
isSelected = false;
|
|
1585
1575
|
}
|
|
1586
1576
|
} else {
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1577
|
+
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1578
|
+
if (bMove && !(0, _helper.isEmpty)(selectedItem)) {
|
|
1579
|
+
addItemToolObj();
|
|
1580
|
+
} else {
|
|
1581
|
+
isSelected = false;
|
|
1582
|
+
_this2.context.projectActions.unselectAll();
|
|
1583
|
+
switch (true) {
|
|
1584
|
+
case 'holeID' in selectedObject:
|
|
1585
|
+
actions.holesActions.endDraggingHole3D(sPoint.x, sPoint.y);
|
|
1586
|
+
break;
|
|
1587
|
+
default:
|
|
1588
|
+
_this2.context.itemsActions.removeReplacingSupport();
|
|
1589
|
+
break;
|
|
1590
|
+
}
|
|
1596
1591
|
}
|
|
1597
1592
|
}
|
|
1598
1593
|
bMove = false;
|
|
@@ -1613,35 +1608,15 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1613
1608
|
}
|
|
1614
1609
|
getPoint(event, alti);
|
|
1615
1610
|
if (bRotate) {
|
|
1616
|
-
|
|
1617
|
-
var selectedItem = planData.sceneGraph.layers[selectedObject.layerID].items[selectedObject.itemID];
|
|
1618
|
-
if ((0, _util.isUndefined)(selectedItem)) return;
|
|
1619
|
-
selectedElement = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1620
|
-
var itemPos = selectedItem.position.clone();
|
|
1621
|
-
if (((_intersects$_i = intersects[_i10]) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.object) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.parent) === null || _intersects$_i === void 0 || (_intersects$_i = _intersects$_i.userData) === null || _intersects$_i === void 0 ? void 0 : _intersects$_i.itemId) === selectedItem.userData.itemId) {
|
|
1622
|
-
toolObj.position.set(intersects[_i10].point.x, intersects[_i10].point.y, intersects[_i10].point.z);
|
|
1623
|
-
} else {
|
|
1624
|
-
toolObj.position.set(planData.plan.position.x + itemPos.x, selectedElement.category === 'lighting' ? -planData.plan.position.y - selectedElement.properties.get('height').get('length') : planData.plan.position.y + selectedItem.children[0].position.y, planData.plan.position.z + itemPos.z);
|
|
1625
|
-
}
|
|
1626
|
-
scene3D.add(toolObj);
|
|
1611
|
+
addItemToolObj();
|
|
1627
1612
|
_this2.setState({
|
|
1628
1613
|
toolObj: toolObj
|
|
1629
1614
|
});
|
|
1630
1615
|
_this2.context.itemsActions.endRotatingItem3D(Point.x, Point.y);
|
|
1631
1616
|
bRotate = false;
|
|
1632
|
-
}
|
|
1633
|
-
if (bMove) {
|
|
1617
|
+
} else if (bMove) {
|
|
1634
1618
|
bMove = false;
|
|
1635
|
-
|
|
1636
|
-
if ((0, _util.isUndefined)(_selectedItem)) return;
|
|
1637
|
-
selectedElement = _this2.props.state.scene.layers.get(selectedObject.layerID).items.get(selectedObject.itemID);
|
|
1638
|
-
var _itemPos = _selectedItem.position.clone();
|
|
1639
|
-
if (intersects[_i10].object.parent.parent.userData.itemId === _selectedItem.userData.itemId) {
|
|
1640
|
-
toolObj.position.set(intersects[_i10].point.x, intersects[_i10].point.y, intersects[_i10].point.z);
|
|
1641
|
-
} else {
|
|
1642
|
-
toolObj.position.set(planData.plan.position.x + _itemPos.x, selectedElement.category === 'lighting' ? -planData.plan.position.y - selectedElement.properties.get('height').get('length') : planData.plan.position.y + _selectedItem.children[0].position.y, planData.plan.position.z + _itemPos.z);
|
|
1643
|
-
}
|
|
1644
|
-
scene3D.add(toolObj);
|
|
1619
|
+
addItemToolObj();
|
|
1645
1620
|
_this2.setState({
|
|
1646
1621
|
toolObj: toolObj
|
|
1647
1622
|
});
|
|
@@ -1661,7 +1636,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
1661
1636
|
_item3D.position.z = targetPoint.z;
|
|
1662
1637
|
_item3D.visible = true;
|
|
1663
1638
|
}
|
|
1664
|
-
}
|
|
1639
|
+
} else {}
|
|
1665
1640
|
if (bMoveUP) {
|
|
1666
1641
|
bMoveUP = false;
|
|
1667
1642
|
}
|
package/lib/constants.js
CHANGED
|
@@ -663,7 +663,7 @@ var PROJECT_SETTING_OPTION = exports.PROJECT_SETTING_OPTION = {
|
|
|
663
663
|
CHANGE_WINDOW_DOOR_MEASURE: CHANGE_WINDOW_DOOR_MEASURE
|
|
664
664
|
};
|
|
665
665
|
var HOLE_NAMES = exports.HOLE_NAMES = {
|
|
666
|
-
WINDOW_CLEAR: '
|
|
666
|
+
WINDOW_CLEAR: 'Window',
|
|
667
667
|
WINDOW_CROSS: 'Cross Window',
|
|
668
668
|
WINDOW_DOUBLE_HUNG: 'Double Hung Window',
|
|
669
669
|
WINDOW_VERTICAL: 'window-vertical',
|