kitchen-simulator 4.0.11-react-18 → 4.1.0-react-18

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/lib/class/item.js CHANGED
@@ -18,6 +18,7 @@ var _helper = require("../utils/helper");
18
18
  var _util = require("util");
19
19
  var _molding = require("../utils/molding");
20
20
  var _utils = require("../components/viewer2d/utils");
21
+ var _history = require("../utils/history");
21
22
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
23
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
24
  var allItemRect;
@@ -1548,6 +1549,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1548
1549
  });
1549
1550
  }
1550
1551
  }
1552
+ state = state.merge({
1553
+ sceneHistory: (0, _history.historyPush)(state.sceneHistory, state.scene)
1554
+ });
1551
1555
  return {
1552
1556
  updatedState: state
1553
1557
  };
@@ -1670,6 +1674,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1670
1674
  updateSelectItemMolding();
1671
1675
  }
1672
1676
  }
1677
+ state = state.merge({
1678
+ sceneHistory: (0, _history.historyPush)(state.sceneHistory, state.scene)
1679
+ });
1673
1680
  return {
1674
1681
  updatedState: state
1675
1682
  };
@@ -1003,7 +1003,7 @@ function Viewer2D(_ref) {
1003
1003
  id: "ruler_numberInput",
1004
1004
  style: {
1005
1005
  position: 'absolute',
1006
- left: bbox.left - (150 - bbox.width) / 2,
1006
+ left: bbox.left - (200 - bbox.width) / 2,
1007
1007
  top: bbox.top - (50 - bbox.height) / 2,
1008
1008
  zIndex: 1000
1009
1009
  }
@@ -1035,7 +1035,7 @@ function Viewer2D(_ref) {
1035
1035
  id: "ruler_numberInput",
1036
1036
  style: {
1037
1037
  position: 'absolute',
1038
- left: bbox.left - (150 - bbox.width) / 2,
1038
+ left: bbox.left - (200 - bbox.width) / 2,
1039
1039
  top: bbox.top - (50 - bbox.height) / 2,
1040
1040
  zIndex: 1000
1041
1041
  }
@@ -1068,7 +1068,7 @@ function Viewer2D(_ref) {
1068
1068
  id: "ruler_numberInput",
1069
1069
  style: {
1070
1070
  position: 'absolute',
1071
- left: bbox.left - (150 - bbox.width) / 2,
1071
+ left: bbox.left - (200 - bbox.width) / 2,
1072
1072
  top: bbox.top - (50 - bbox.height) / 2,
1073
1073
  zIndex: 1000
1074
1074
  }
@@ -1101,7 +1101,7 @@ function Viewer2D(_ref) {
1101
1101
  id: "ruler_numberInput",
1102
1102
  style: {
1103
1103
  position: 'absolute',
1104
- left: bbox.left - (150 - bbox.width) / 2,
1104
+ left: bbox.left - (200 - bbox.width) / 2,
1105
1105
  top: bbox.top - (50 - bbox.height) / 2,
1106
1106
  zIndex: 1000
1107
1107
  }
@@ -1134,7 +1134,7 @@ function Viewer2D(_ref) {
1134
1134
  id: "ruler_numberInput",
1135
1135
  style: {
1136
1136
  position: 'absolute',
1137
- left: bbox.left - (150 - bbox.width) / 2,
1137
+ left: bbox.left - (200 - bbox.width) / 2,
1138
1138
  top: bbox.top - (50 - bbox.height) / 2,
1139
1139
  zIndex: 1000
1140
1140
  }
@@ -1167,7 +1167,7 @@ function Viewer2D(_ref) {
1167
1167
  id: "ruler_numberInput",
1168
1168
  style: {
1169
1169
  position: 'absolute',
1170
- left: bbox.left - (150 - bbox.width) / 2,
1170
+ left: bbox.left - (200 - bbox.width) / 2,
1171
1171
  top: bbox.top - (50 - bbox.height) / 2,
1172
1172
  zIndex: 1000
1173
1173
  }
@@ -1199,7 +1199,7 @@ function Viewer2D(_ref) {
1199
1199
  id: "ruler_numberInput",
1200
1200
  style: {
1201
1201
  position: 'absolute',
1202
- left: bbox.left - (150 - bbox.width) / 2,
1202
+ left: bbox.left - (200 - bbox.width) / 2,
1203
1203
  top: bbox.top - (50 - bbox.height) / 2,
1204
1204
  zIndex: 1000
1205
1205
  }
@@ -1192,10 +1192,18 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1192
1192
  };
1193
1193
  var sendInternalEvent = function sendInternalEvent(evtType, evtElement) {
1194
1194
  var pointArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1195
- if (!(0, _helper.isEmpty)(evtType)) {
1196
- var _this2$props$onIntern, _this2$props;
1195
+ if (!(0, _helper.isEmpty)(evtType) && !(0, _helper.isEmpty)(evtElement)) {
1196
+ var _currentObject, _this2$props$onIntern, _this2$props;
1197
1197
  var payload = evtElement === null || evtElement === void 0 ? void 0 : evtElement.toJS();
1198
- if ((evtElement === null || evtElement === void 0 ? void 0 : evtElement.prototype) === 'items') {
1198
+ if (((_currentObject = currentObject) === null || _currentObject === void 0 ? void 0 : _currentObject.prototype) === 'lines') {
1199
+ // caculating length of selected line//
1200
+ var v_a = layer.vertices.get(currentObject.vertices.get(0));
1201
+ var v_b = layer.vertices.get(currentObject.vertices.get(1));
1202
+ var distance = _export.GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
1203
+ var _length = (0, _convertUnitsLite.convert)(distance).from('cm').to('in');
1204
+ payload.length = _length;
1205
+ //////////////////////////////////////
1206
+ } else if ((evtElement === null || evtElement === void 0 ? void 0 : evtElement.prototype) === 'items') {
1199
1207
  // check this cabinet has warning box
1200
1208
  payload.isWarning = (0, _utils.isWarningItem)(evtElement);
1201
1209
  // check this item is available molding
@@ -1294,7 +1302,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1294
1302
  if (intersects[_i1] === undefined) {
1295
1303
  if (transflag !== 0 && transflag !== 2) {
1296
1304
  isSelected = false;
1297
- _this2.context.projectActions.unselectAll();
1305
+ // this.context.projectActions.unselectAll();
1298
1306
  scene3D.remove(toolObj);
1299
1307
  _this2.context.itemsActions.removeReplacingSupport();
1300
1308
  return;
@@ -1363,14 +1371,14 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1363
1371
  selectedFlag = false;
1364
1372
  } else {
1365
1373
  isSelected = false;
1366
- _this2.context.projectActions.unselectAll();
1374
+ // this.context.projectActions.unselectAll();
1367
1375
  scene3D.remove(toolObj);
1368
1376
  _this2.context.itemsActions.removeReplacingSupport();
1369
1377
  }
1370
1378
  }
1371
1379
  } else {
1372
1380
  isSelected = false;
1373
- _this2.context.projectActions.unselectAll();
1381
+ // this.context.projectActions.unselectAll();
1374
1382
  scene3D.remove(toolObj);
1375
1383
  _this2.context.itemsActions.removeReplacingSupport();
1376
1384
  return;
@@ -1418,11 +1426,18 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1418
1426
  }
1419
1427
  switch (_this2.props.state.mode) {
1420
1428
  case _constants.MODE_DRAGGING_ITEM_3D:
1429
+ case _constants.MODE_DRAGGING_HOLE_3D:
1421
1430
  internalType = _constants.INTERNAL_EVENT_DRAG_ELEMENT;
1422
1431
  break;
1423
1432
  case _constants.MODE_ROTATING_ITEM_3D:
1424
1433
  internalType = _constants.INTERNAL_EVENT_ROTATE_ELEMENT;
1425
1434
  break;
1435
+ case _constants.MODE_DRAWING_HOLE_3D:
1436
+ internalType = _constants.INTERNAL_EVENT_DRAW_ELEMENT;
1437
+ break;
1438
+ case _constants.MODE_IDLE_3D:
1439
+ internalType = _constants.INTERNAL_EVENT_SELECT_ELEMENT;
1440
+ break;
1426
1441
  }
1427
1442
  if (_this2.props.state.mode == _constants.MODE_DRAGGING_ITEM_3D) {
1428
1443
  _this2.context.itemsActions.endDraggingItem3D();
@@ -1547,16 +1562,17 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1547
1562
  var elementPrototype = null;
1548
1563
  switch (true) {
1549
1564
  case 'holeID' in selectedObject:
1550
- case 'lineID' in selectedObject:
1565
+ elementID = selectedObject.holeID;
1566
+ elementPrototype = 'holes';
1551
1567
  if (_this2.props.state.mode === _constants.MODE_DRAGGING_HOLE_3D) {
1552
1568
  actions.holesActions.endDraggingHole3D(sPoint.x, sPoint.y);
1553
- internalType = _constants.INTERNAL_EVENT_SELECT_ELEMENT;
1554
- elementID = selectedObject.holeID;
1555
- elementPrototype = 'holes';
1556
1569
  }
1557
1570
  break;
1571
+ case 'lineID' in selectedObject:
1572
+ elementID = selectedObject.lineID;
1573
+ elementPrototype = 'lines';
1574
+ break;
1558
1575
  case 'areaID' in selectedObject:
1559
- internalType = _constants.INTERNAL_EVENT_SELECT_ELEMENT;
1560
1576
  elementID = selectedObject.areaID;
1561
1577
  elementPrototype = 'areas';
1562
1578
  break;
@@ -2092,7 +2108,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
2092
2108
  if (minDis < snapDelta && !snapFlag) {
2093
2109
  _this2.snap(snapObj, layer);
2094
2110
  snapFlag = true;
2095
- (0, _sceneCreator.getDistances)(layer, true);
2111
+ (0, _sceneCreator.getDistances)(layer);
2096
2112
  var _i13 = 0;
2097
2113
  for (_i13 = 0; _i13 < _sceneCreator.fVLine.length; _i13++) {
2098
2114
  if (_sceneCreator.fVLine[_i13].userData.distance < snapDelta) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "4.0.11-react-18",
3
+ "version": "4.1.0-react-18",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",