kitchen-simulator 4.3.3 → 4.3.4
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.
|
@@ -16,6 +16,7 @@ import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
|
16
16
|
import { SVGLoader } from 'three/addons/loaders/SVGLoader';
|
|
17
17
|
import { getMoldingDataOfScene2 } from "./molding";
|
|
18
18
|
import { Scene, State } from "../models";
|
|
19
|
+
import { calcDistancesFromHoleToNearestOneOrWall } from "./geometry";
|
|
19
20
|
var PRECISION = 2;
|
|
20
21
|
|
|
21
22
|
// ---- compatibility: supports old + optimized props shapes ----
|
|
@@ -884,7 +885,12 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
884
885
|
{
|
|
885
886
|
switch (attributeName) {
|
|
886
887
|
case ATT_HOLE_OFFSET_A:
|
|
888
|
+
case ATT_HOLE_OFFSET_B:
|
|
887
889
|
{
|
|
890
|
+
var _curHole$properties$g, _curHole$properties;
|
|
891
|
+
/**** changing left distance ****/
|
|
892
|
+
var curHole = element;
|
|
893
|
+
// parent line of curHole
|
|
888
894
|
var line = layer.lines.get(element.line);
|
|
889
895
|
var _layer$vertices$get3 = layer.vertices.get(line.vertices.get(0)),
|
|
890
896
|
x0 = _layer$vertices$get3.x,
|
|
@@ -893,70 +899,40 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
893
899
|
x1 = _layer$vertices$get4.x,
|
|
894
900
|
y1 = _layer$vertices$get4.y;
|
|
895
901
|
var alpha = GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
896
|
-
|
|
897
|
-
var
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
var
|
|
903
|
-
var yp = (lengthValue + halfWidthLength) * Math.sin(alpha) + y0;
|
|
902
|
+
// move curHole
|
|
903
|
+
var _calcDistancesFromHol = calcDistancesFromHoleToNearestOneOrWall(curHole, layer),
|
|
904
|
+
distLeft = _calcDistancesFromHol.distLeft,
|
|
905
|
+
distRight = _calcDistancesFromHol.distRight; // old distArray
|
|
906
|
+
var mDistance = attributeName === ATT_HOLE_OFFSET_A ? distLeft - value.get('length') : value.get('length') - distRight; // movement distance
|
|
907
|
+
var xp = curHole.x - mDistance * Math.cos(alpha);
|
|
908
|
+
var yp = curHole.y - mDistance * Math.sin(alpha);
|
|
904
909
|
var offset = GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, xp, yp);
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
});
|
|
921
|
-
attributesFormData = attributesFormData.set(attributeName, offsetAttribute);
|
|
922
|
-
break;
|
|
923
|
-
}
|
|
924
|
-
case ATT_HOLE_OFFSET_B:
|
|
925
|
-
{
|
|
926
|
-
var _line = layer.lines.get(element.line);
|
|
927
|
-
var _layer$vertices$get5 = layer.vertices.get(_line.vertices.get(0)),
|
|
928
|
-
_x9 = _layer$vertices$get5.x,
|
|
929
|
-
_y = _layer$vertices$get5.y;
|
|
930
|
-
var _layer$vertices$get6 = layer.vertices.get(_line.vertices.get(1)),
|
|
931
|
-
_x0 = _layer$vertices$get6.x,
|
|
932
|
-
_y2 = _layer$vertices$get6.y;
|
|
933
|
-
var _alpha = GeometryUtils.angleBetweenTwoPoints(_x9, _y, _x0, _y2);
|
|
934
|
-
var _lineLength = GeometryUtils.pointsDistance(_x9, _y, _x0, _y2);
|
|
935
|
-
var _widthLength = element.properties.get('width').get('length');
|
|
936
|
-
var _halfWidthLength = _widthLength / 2;
|
|
937
|
-
var _lengthValue = value.get('length');
|
|
938
|
-
_lengthValue = Math.max(_lengthValue, 0);
|
|
939
|
-
_lengthValue = Math.min(_lengthValue, _lineLength - _widthLength);
|
|
940
|
-
var _xp = _x0 - (_lengthValue + _halfWidthLength) * Math.cos(_alpha);
|
|
941
|
-
var _yp = _y2 - (_lengthValue + _halfWidthLength) * Math.sin(_alpha);
|
|
942
|
-
var _offset = GeometryUtils.pointPositionOnLineSegment(_x9, _y, _x0, _y2, _xp, _yp);
|
|
943
|
-
/*
|
|
944
|
-
if (x0 > x1) offset = 1 - offset;
|
|
945
|
-
*/
|
|
946
|
-
var startAt = MathUtils.toFixedFloat(_lineLength * _offset - _halfWidthLength, PRECISION);
|
|
947
|
-
var _offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
910
|
+
// make temp hole for calc new distArray
|
|
911
|
+
var newHole = {
|
|
912
|
+
id: curHole.id,
|
|
913
|
+
line: curHole.line,
|
|
914
|
+
offset: offset,
|
|
915
|
+
x: xp,
|
|
916
|
+
y: yp,
|
|
917
|
+
properties: new Map({
|
|
918
|
+
width: new Map({
|
|
919
|
+
length: (_curHole$properties$g = (_curHole$properties = curHole.properties) === null || _curHole$properties === void 0 || (_curHole$properties = _curHole$properties.get('width')) === null || _curHole$properties === void 0 ? void 0 : _curHole$properties.get('length')) !== null && _curHole$properties$g !== void 0 ? _curHole$properties$g : 0
|
|
920
|
+
})
|
|
921
|
+
})
|
|
922
|
+
};
|
|
923
|
+
var newDistArray = calcDistancesFromHoleToNearestOneOrWall(newHole, layer);
|
|
924
|
+
var offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
948
925
|
var offsetA = new Map({
|
|
949
|
-
length:
|
|
950
|
-
_length: convert(
|
|
951
|
-
_unit:
|
|
926
|
+
length: newDistArray.distLeft,
|
|
927
|
+
_length: convert(newDistArray.distLeft).from(UNIT_CENTIMETER).to(offsetUnit),
|
|
928
|
+
_unit: offsetUnit
|
|
952
929
|
});
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
_unit:
|
|
957
|
-
_length: MathUtils.toFixedFloat(convert(_lengthValue).from(UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
930
|
+
var offsetB = new Map({
|
|
931
|
+
length: newDistArray.distRight,
|
|
932
|
+
_length: convert(newDistArray.distRight).from(UNIT_CENTIMETER).to(offsetUnit),
|
|
933
|
+
_unit: offsetUnit
|
|
958
934
|
});
|
|
959
|
-
attributesFormData = attributesFormData.set(
|
|
935
|
+
attributesFormData = attributesFormData.set('offset', offset).set('offsetA', offsetA).set('offsetB', offsetB);
|
|
960
936
|
break;
|
|
961
937
|
}
|
|
962
938
|
default:
|
|
@@ -1055,7 +1031,7 @@ function getElement(objProps, state) {
|
|
|
1055
1031
|
}
|
|
1056
1032
|
return curObject;
|
|
1057
1033
|
}
|
|
1058
|
-
function loadMoldingSvg(
|
|
1034
|
+
function loadMoldingSvg(_x9) {
|
|
1059
1035
|
return _loadMoldingSvg.apply(this, arguments);
|
|
1060
1036
|
}
|
|
1061
1037
|
function _loadMoldingSvg() {
|
|
@@ -1228,7 +1204,7 @@ function mergeSameElements(projectItemsCatalog) {
|
|
|
1228
1204
|
}
|
|
1229
1205
|
return result;
|
|
1230
1206
|
}
|
|
1231
|
-
export function handleExternalEvent(
|
|
1207
|
+
export function handleExternalEvent(_x0) {
|
|
1232
1208
|
return _handleExternalEvent.apply(this, arguments);
|
|
1233
1209
|
}
|
|
1234
1210
|
function _handleExternalEvent() {
|
|
@@ -1339,7 +1315,7 @@ function _handleExternalEvent() {
|
|
|
1339
1315
|
}
|
|
1340
1316
|
}, _callee8);
|
|
1341
1317
|
}));
|
|
1342
|
-
return function (
|
|
1318
|
+
return function (_x1) {
|
|
1343
1319
|
return _ref3.apply(this, arguments);
|
|
1344
1320
|
};
|
|
1345
1321
|
}());
|
|
@@ -1485,7 +1461,7 @@ function _handleExternalEvent() {
|
|
|
1485
1461
|
}
|
|
1486
1462
|
}, _callee9);
|
|
1487
1463
|
}));
|
|
1488
|
-
return function (
|
|
1464
|
+
return function (_x10) {
|
|
1489
1465
|
return _ref4.apply(this, arguments);
|
|
1490
1466
|
};
|
|
1491
1467
|
}());
|
|
@@ -22,6 +22,7 @@ var _utils = require("../components/viewer2d/utils");
|
|
|
22
22
|
var _SVGLoader = require("three/addons/loaders/SVGLoader");
|
|
23
23
|
var _molding = require("./molding");
|
|
24
24
|
var _models = require("../models");
|
|
25
|
+
var _geometry = require("./geometry");
|
|
25
26
|
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; }
|
|
26
27
|
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; }
|
|
27
28
|
var PRECISION = 2;
|
|
@@ -892,7 +893,12 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
892
893
|
{
|
|
893
894
|
switch (attributeName) {
|
|
894
895
|
case _constants.ATT_HOLE_OFFSET_A:
|
|
896
|
+
case _constants.ATT_HOLE_OFFSET_B:
|
|
895
897
|
{
|
|
898
|
+
var _curHole$properties$g, _curHole$properties;
|
|
899
|
+
/**** changing left distance ****/
|
|
900
|
+
var curHole = element;
|
|
901
|
+
// parent line of curHole
|
|
896
902
|
var line = layer.lines.get(element.line);
|
|
897
903
|
var _layer$vertices$get3 = layer.vertices.get(line.vertices.get(0)),
|
|
898
904
|
x0 = _layer$vertices$get3.x,
|
|
@@ -901,70 +907,40 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
901
907
|
x1 = _layer$vertices$get4.x,
|
|
902
908
|
y1 = _layer$vertices$get4.y;
|
|
903
909
|
var alpha = _export.GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
904
|
-
|
|
905
|
-
var
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
var
|
|
911
|
-
var yp = (lengthValue + halfWidthLength) * Math.sin(alpha) + y0;
|
|
910
|
+
// move curHole
|
|
911
|
+
var _calcDistancesFromHol = (0, _geometry.calcDistancesFromHoleToNearestOneOrWall)(curHole, layer),
|
|
912
|
+
distLeft = _calcDistancesFromHol.distLeft,
|
|
913
|
+
distRight = _calcDistancesFromHol.distRight; // old distArray
|
|
914
|
+
var mDistance = attributeName === _constants.ATT_HOLE_OFFSET_A ? distLeft - value.get('length') : value.get('length') - distRight; // movement distance
|
|
915
|
+
var xp = curHole.x - mDistance * Math.cos(alpha);
|
|
916
|
+
var yp = curHole.y - mDistance * Math.sin(alpha);
|
|
912
917
|
var offset = _export.GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, xp, yp);
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
});
|
|
929
|
-
attributesFormData = attributesFormData.set(attributeName, offsetAttribute);
|
|
930
|
-
break;
|
|
931
|
-
}
|
|
932
|
-
case _constants.ATT_HOLE_OFFSET_B:
|
|
933
|
-
{
|
|
934
|
-
var _line = layer.lines.get(element.line);
|
|
935
|
-
var _layer$vertices$get5 = layer.vertices.get(_line.vertices.get(0)),
|
|
936
|
-
_x9 = _layer$vertices$get5.x,
|
|
937
|
-
_y = _layer$vertices$get5.y;
|
|
938
|
-
var _layer$vertices$get6 = layer.vertices.get(_line.vertices.get(1)),
|
|
939
|
-
_x0 = _layer$vertices$get6.x,
|
|
940
|
-
_y2 = _layer$vertices$get6.y;
|
|
941
|
-
var _alpha = _export.GeometryUtils.angleBetweenTwoPoints(_x9, _y, _x0, _y2);
|
|
942
|
-
var _lineLength = _export.GeometryUtils.pointsDistance(_x9, _y, _x0, _y2);
|
|
943
|
-
var _widthLength = element.properties.get('width').get('length');
|
|
944
|
-
var _halfWidthLength = _widthLength / 2;
|
|
945
|
-
var _lengthValue = value.get('length');
|
|
946
|
-
_lengthValue = Math.max(_lengthValue, 0);
|
|
947
|
-
_lengthValue = Math.min(_lengthValue, _lineLength - _widthLength);
|
|
948
|
-
var _xp = _x0 - (_lengthValue + _halfWidthLength) * Math.cos(_alpha);
|
|
949
|
-
var _yp = _y2 - (_lengthValue + _halfWidthLength) * Math.sin(_alpha);
|
|
950
|
-
var _offset = _export.GeometryUtils.pointPositionOnLineSegment(_x9, _y, _x0, _y2, _xp, _yp);
|
|
951
|
-
/*
|
|
952
|
-
if (x0 > x1) offset = 1 - offset;
|
|
953
|
-
*/
|
|
954
|
-
var startAt = _export.MathUtils.toFixedFloat(_lineLength * _offset - _halfWidthLength, PRECISION);
|
|
955
|
-
var _offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
918
|
+
// make temp hole for calc new distArray
|
|
919
|
+
var newHole = {
|
|
920
|
+
id: curHole.id,
|
|
921
|
+
line: curHole.line,
|
|
922
|
+
offset: offset,
|
|
923
|
+
x: xp,
|
|
924
|
+
y: yp,
|
|
925
|
+
properties: new _immutable.Map({
|
|
926
|
+
width: new _immutable.Map({
|
|
927
|
+
length: (_curHole$properties$g = (_curHole$properties = curHole.properties) === null || _curHole$properties === void 0 || (_curHole$properties = _curHole$properties.get('width')) === null || _curHole$properties === void 0 ? void 0 : _curHole$properties.get('length')) !== null && _curHole$properties$g !== void 0 ? _curHole$properties$g : 0
|
|
928
|
+
})
|
|
929
|
+
})
|
|
930
|
+
};
|
|
931
|
+
var newDistArray = (0, _geometry.calcDistancesFromHoleToNearestOneOrWall)(newHole, layer);
|
|
932
|
+
var offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
956
933
|
var offsetA = new _immutable.Map({
|
|
957
|
-
length:
|
|
958
|
-
_length: (0, _convertUnitsLite.convert)(
|
|
959
|
-
_unit:
|
|
934
|
+
length: newDistArray.distLeft,
|
|
935
|
+
_length: (0, _convertUnitsLite.convert)(newDistArray.distLeft).from(_constants.UNIT_CENTIMETER).to(offsetUnit),
|
|
936
|
+
_unit: offsetUnit
|
|
960
937
|
});
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
_unit:
|
|
965
|
-
_length: _export.MathUtils.toFixedFloat((0, _convertUnitsLite.convert)(_lengthValue).from(_constants.UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
938
|
+
var offsetB = new _immutable.Map({
|
|
939
|
+
length: newDistArray.distRight,
|
|
940
|
+
_length: (0, _convertUnitsLite.convert)(newDistArray.distRight).from(_constants.UNIT_CENTIMETER).to(offsetUnit),
|
|
941
|
+
_unit: offsetUnit
|
|
966
942
|
});
|
|
967
|
-
attributesFormData = attributesFormData.set(
|
|
943
|
+
attributesFormData = attributesFormData.set('offset', offset).set('offsetA', offsetA).set('offsetB', offsetB);
|
|
968
944
|
break;
|
|
969
945
|
}
|
|
970
946
|
default:
|
|
@@ -1063,7 +1039,7 @@ function getElement(objProps, state) {
|
|
|
1063
1039
|
}
|
|
1064
1040
|
return curObject;
|
|
1065
1041
|
}
|
|
1066
|
-
function loadMoldingSvg(
|
|
1042
|
+
function loadMoldingSvg(_x9) {
|
|
1067
1043
|
return _loadMoldingSvg.apply(this, arguments);
|
|
1068
1044
|
}
|
|
1069
1045
|
function _loadMoldingSvg() {
|
|
@@ -1236,7 +1212,7 @@ function mergeSameElements(projectItemsCatalog) {
|
|
|
1236
1212
|
}
|
|
1237
1213
|
return result;
|
|
1238
1214
|
}
|
|
1239
|
-
function handleExternalEvent(
|
|
1215
|
+
function handleExternalEvent(_x0) {
|
|
1240
1216
|
return _handleExternalEvent.apply(this, arguments);
|
|
1241
1217
|
}
|
|
1242
1218
|
function _handleExternalEvent() {
|
|
@@ -1347,7 +1323,7 @@ function _handleExternalEvent() {
|
|
|
1347
1323
|
}
|
|
1348
1324
|
}, _callee8);
|
|
1349
1325
|
}));
|
|
1350
|
-
return function (
|
|
1326
|
+
return function (_x1) {
|
|
1351
1327
|
return _ref3.apply(this, arguments);
|
|
1352
1328
|
};
|
|
1353
1329
|
}());
|
|
@@ -1493,7 +1469,7 @@ function _handleExternalEvent() {
|
|
|
1493
1469
|
}
|
|
1494
1470
|
}, _callee9);
|
|
1495
1471
|
}));
|
|
1496
|
-
return function (
|
|
1472
|
+
return function (_x10) {
|
|
1497
1473
|
return _ref4.apply(this, arguments);
|
|
1498
1474
|
};
|
|
1499
1475
|
}());
|