kitchen-simulator 4.3.3 → 4.3.5
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/utils/geometry.js +17 -8
- package/es/utils/isolate-event-handler.js +40 -63
- package/lib/utils/geometry.js +17 -8
- package/lib/utils/isolate-event-handler.js +40 -63
- package/package.json +1 -1
package/es/utils/geometry.js
CHANGED
|
@@ -2621,18 +2621,23 @@ export function calcDistancesFromHoleToNearestOneOrWall(curHole, layer) {
|
|
|
2621
2621
|
var line = (_layer$lines = layer.lines) === null || _layer$lines === void 0 ? void 0 : _layer$lines.get(curHole.line);
|
|
2622
2622
|
var v0 = (_layer$vertices2 = layer.vertices) === null || _layer$vertices2 === void 0 ? void 0 : _layer$vertices2.get(line === null || line === void 0 || (_line$vertices = line.vertices) === null || _line$vertices === void 0 ? void 0 : _line$vertices.get(0));
|
|
2623
2623
|
var v1 = (_layer$vertices3 = layer.vertices) === null || _layer$vertices3 === void 0 ? void 0 : _layer$vertices3.get(line === null || line === void 0 || (_line$vertices2 = line.vertices) === null || _line$vertices2 === void 0 ? void 0 : _line$vertices2.get(1));
|
|
2624
|
+
var lineLength = pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
2624
2625
|
if (isEmpty(line) || isEmpty(v0) || isEmpty(v1)) return distArray;
|
|
2625
2626
|
var angle = angleBetweenTwoPoints(v0.x, v0.y, v1.x, v1.y);
|
|
2626
2627
|
|
|
2627
2628
|
// start point and end point of current hole
|
|
2628
2629
|
var chw = (_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;
|
|
2630
|
+
var chPt = {
|
|
2631
|
+
x: v0.x + lineLength * curHole.offset * Math.cos(angle),
|
|
2632
|
+
y: v0.y + lineLength * curHole.offset * Math.sin(angle)
|
|
2633
|
+
};
|
|
2629
2634
|
var chsp = {
|
|
2630
|
-
x:
|
|
2631
|
-
y:
|
|
2635
|
+
x: chPt.x - chw / 2 * Math.cos(angle),
|
|
2636
|
+
y: chPt.y - chw / 2 * Math.sin(angle)
|
|
2632
2637
|
};
|
|
2633
2638
|
var chep = {
|
|
2634
|
-
x:
|
|
2635
|
-
y:
|
|
2639
|
+
x: chPt.x + chw / 2 * Math.cos(angle),
|
|
2640
|
+
y: chPt.y + chw / 2 * Math.sin(angle)
|
|
2636
2641
|
};
|
|
2637
2642
|
distArray.distLeft = pointsDistance(v0.x, v0.y, chsp.x, chsp.y);
|
|
2638
2643
|
distArray.distRight = pointsDistance(v1.x, v1.y, chep.x, chep.y);
|
|
@@ -2642,13 +2647,17 @@ export function calcDistancesFromHoleToNearestOneOrWall(curHole, layer) {
|
|
|
2642
2647
|
var hole = (_layer$holes = layer.holes) === null || _layer$holes === void 0 ? void 0 : _layer$holes.get(hId);
|
|
2643
2648
|
// start point and end point of other hole
|
|
2644
2649
|
var hw = (_hole$properties$get$ = (_hole$properties = hole.properties) === null || _hole$properties === void 0 || (_hole$properties = _hole$properties.get('width')) === null || _hole$properties === void 0 ? void 0 : _hole$properties.get('length')) !== null && _hole$properties$get$ !== void 0 ? _hole$properties$get$ : 0;
|
|
2650
|
+
var hPt = {
|
|
2651
|
+
x: v0.x + lineLength * hole.offset * Math.cos(angle),
|
|
2652
|
+
y: v0.y + lineLength * hole.offset * Math.sin(angle)
|
|
2653
|
+
};
|
|
2645
2654
|
var hsp = {
|
|
2646
|
-
x:
|
|
2647
|
-
y:
|
|
2655
|
+
x: hPt.x - hw / 2 * Math.cos(angle),
|
|
2656
|
+
y: hPt.y - hw / 2 * Math.sin(angle)
|
|
2648
2657
|
};
|
|
2649
2658
|
var hep = {
|
|
2650
|
-
x:
|
|
2651
|
-
y:
|
|
2659
|
+
x: hPt.x + hw / 2 * Math.cos(angle),
|
|
2660
|
+
y: hPt.y + hw / 2 * Math.sin(angle)
|
|
2652
2661
|
};
|
|
2653
2662
|
var relation = relationshipOfTwoOverlappedLines({
|
|
2654
2663
|
x1: chsp.x,
|
|
@@ -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,
|
|
@@ -894,69 +900,40 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
894
900
|
y1 = _layer$vertices$get4.y;
|
|
895
901
|
var alpha = GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
896
902
|
var lineLength = GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
897
|
-
|
|
898
|
-
var
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
var xp =
|
|
903
|
-
var yp =
|
|
903
|
+
// move curHole
|
|
904
|
+
var _calcDistancesFromHol = calcDistancesFromHoleToNearestOneOrWall(curHole, layer),
|
|
905
|
+
distLeft = _calcDistancesFromHol.distLeft,
|
|
906
|
+
distRight = _calcDistancesFromHol.distRight; // old distArray
|
|
907
|
+
var mDistance = attributeName === ATT_HOLE_OFFSET_A ? distLeft - value.get('length') : value.get('length') - distRight; // movement distance
|
|
908
|
+
var xp = x0 + (lineLength * curHole.offset - mDistance) * Math.cos(alpha);
|
|
909
|
+
var yp = y0 + (lineLength * curHole.offset - mDistance) * Math.sin(alpha);
|
|
904
910
|
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']);
|
|
911
|
+
// make temp hole for calc new distArray
|
|
912
|
+
var newHole = {
|
|
913
|
+
id: curHole.id,
|
|
914
|
+
line: curHole.line,
|
|
915
|
+
offset: offset,
|
|
916
|
+
x: xp,
|
|
917
|
+
y: yp,
|
|
918
|
+
properties: new Map({
|
|
919
|
+
width: new Map({
|
|
920
|
+
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
|
|
921
|
+
})
|
|
922
|
+
})
|
|
923
|
+
};
|
|
924
|
+
var newDistArray = calcDistancesFromHoleToNearestOneOrWall(newHole, layer);
|
|
925
|
+
var offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
948
926
|
var offsetA = new Map({
|
|
949
|
-
length:
|
|
950
|
-
_length: convert(
|
|
951
|
-
_unit:
|
|
927
|
+
length: newDistArray.distLeft,
|
|
928
|
+
_length: convert(newDistArray.distLeft).from(UNIT_CENTIMETER).to(offsetUnit),
|
|
929
|
+
_unit: offsetUnit
|
|
952
930
|
});
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
_unit:
|
|
957
|
-
_length: MathUtils.toFixedFloat(convert(_lengthValue).from(UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
931
|
+
var offsetB = new Map({
|
|
932
|
+
length: newDistArray.distRight,
|
|
933
|
+
_length: convert(newDistArray.distRight).from(UNIT_CENTIMETER).to(offsetUnit),
|
|
934
|
+
_unit: offsetUnit
|
|
958
935
|
});
|
|
959
|
-
attributesFormData = attributesFormData.set(
|
|
936
|
+
attributesFormData = attributesFormData.set('offset', offset).set('offsetA', offsetA).set('offsetB', offsetB);
|
|
960
937
|
break;
|
|
961
938
|
}
|
|
962
939
|
default:
|
|
@@ -1055,7 +1032,7 @@ function getElement(objProps, state) {
|
|
|
1055
1032
|
}
|
|
1056
1033
|
return curObject;
|
|
1057
1034
|
}
|
|
1058
|
-
function loadMoldingSvg(
|
|
1035
|
+
function loadMoldingSvg(_x9) {
|
|
1059
1036
|
return _loadMoldingSvg.apply(this, arguments);
|
|
1060
1037
|
}
|
|
1061
1038
|
function _loadMoldingSvg() {
|
|
@@ -1228,7 +1205,7 @@ function mergeSameElements(projectItemsCatalog) {
|
|
|
1228
1205
|
}
|
|
1229
1206
|
return result;
|
|
1230
1207
|
}
|
|
1231
|
-
export function handleExternalEvent(
|
|
1208
|
+
export function handleExternalEvent(_x0) {
|
|
1232
1209
|
return _handleExternalEvent.apply(this, arguments);
|
|
1233
1210
|
}
|
|
1234
1211
|
function _handleExternalEvent() {
|
|
@@ -1339,7 +1316,7 @@ function _handleExternalEvent() {
|
|
|
1339
1316
|
}
|
|
1340
1317
|
}, _callee8);
|
|
1341
1318
|
}));
|
|
1342
|
-
return function (
|
|
1319
|
+
return function (_x1) {
|
|
1343
1320
|
return _ref3.apply(this, arguments);
|
|
1344
1321
|
};
|
|
1345
1322
|
}());
|
|
@@ -1485,7 +1462,7 @@ function _handleExternalEvent() {
|
|
|
1485
1462
|
}
|
|
1486
1463
|
}, _callee9);
|
|
1487
1464
|
}));
|
|
1488
|
-
return function (
|
|
1465
|
+
return function (_x10) {
|
|
1489
1466
|
return _ref4.apply(this, arguments);
|
|
1490
1467
|
};
|
|
1491
1468
|
}());
|
package/lib/utils/geometry.js
CHANGED
|
@@ -2723,18 +2723,23 @@ function calcDistancesFromHoleToNearestOneOrWall(curHole, layer) {
|
|
|
2723
2723
|
var line = (_layer$lines = layer.lines) === null || _layer$lines === void 0 ? void 0 : _layer$lines.get(curHole.line);
|
|
2724
2724
|
var v0 = (_layer$vertices2 = layer.vertices) === null || _layer$vertices2 === void 0 ? void 0 : _layer$vertices2.get(line === null || line === void 0 || (_line$vertices = line.vertices) === null || _line$vertices === void 0 ? void 0 : _line$vertices.get(0));
|
|
2725
2725
|
var v1 = (_layer$vertices3 = layer.vertices) === null || _layer$vertices3 === void 0 ? void 0 : _layer$vertices3.get(line === null || line === void 0 || (_line$vertices2 = line.vertices) === null || _line$vertices2 === void 0 ? void 0 : _line$vertices2.get(1));
|
|
2726
|
+
var lineLength = pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
2726
2727
|
if ((0, _helper.isEmpty)(line) || (0, _helper.isEmpty)(v0) || (0, _helper.isEmpty)(v1)) return distArray;
|
|
2727
2728
|
var angle = angleBetweenTwoPoints(v0.x, v0.y, v1.x, v1.y);
|
|
2728
2729
|
|
|
2729
2730
|
// start point and end point of current hole
|
|
2730
2731
|
var chw = (_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;
|
|
2732
|
+
var chPt = {
|
|
2733
|
+
x: v0.x + lineLength * curHole.offset * Math.cos(angle),
|
|
2734
|
+
y: v0.y + lineLength * curHole.offset * Math.sin(angle)
|
|
2735
|
+
};
|
|
2731
2736
|
var chsp = {
|
|
2732
|
-
x:
|
|
2733
|
-
y:
|
|
2737
|
+
x: chPt.x - chw / 2 * Math.cos(angle),
|
|
2738
|
+
y: chPt.y - chw / 2 * Math.sin(angle)
|
|
2734
2739
|
};
|
|
2735
2740
|
var chep = {
|
|
2736
|
-
x:
|
|
2737
|
-
y:
|
|
2741
|
+
x: chPt.x + chw / 2 * Math.cos(angle),
|
|
2742
|
+
y: chPt.y + chw / 2 * Math.sin(angle)
|
|
2738
2743
|
};
|
|
2739
2744
|
distArray.distLeft = pointsDistance(v0.x, v0.y, chsp.x, chsp.y);
|
|
2740
2745
|
distArray.distRight = pointsDistance(v1.x, v1.y, chep.x, chep.y);
|
|
@@ -2744,13 +2749,17 @@ function calcDistancesFromHoleToNearestOneOrWall(curHole, layer) {
|
|
|
2744
2749
|
var hole = (_layer$holes = layer.holes) === null || _layer$holes === void 0 ? void 0 : _layer$holes.get(hId);
|
|
2745
2750
|
// start point and end point of other hole
|
|
2746
2751
|
var hw = (_hole$properties$get$ = (_hole$properties = hole.properties) === null || _hole$properties === void 0 || (_hole$properties = _hole$properties.get('width')) === null || _hole$properties === void 0 ? void 0 : _hole$properties.get('length')) !== null && _hole$properties$get$ !== void 0 ? _hole$properties$get$ : 0;
|
|
2752
|
+
var hPt = {
|
|
2753
|
+
x: v0.x + lineLength * hole.offset * Math.cos(angle),
|
|
2754
|
+
y: v0.y + lineLength * hole.offset * Math.sin(angle)
|
|
2755
|
+
};
|
|
2747
2756
|
var hsp = {
|
|
2748
|
-
x:
|
|
2749
|
-
y:
|
|
2757
|
+
x: hPt.x - hw / 2 * Math.cos(angle),
|
|
2758
|
+
y: hPt.y - hw / 2 * Math.sin(angle)
|
|
2750
2759
|
};
|
|
2751
2760
|
var hep = {
|
|
2752
|
-
x:
|
|
2753
|
-
y:
|
|
2761
|
+
x: hPt.x + hw / 2 * Math.cos(angle),
|
|
2762
|
+
y: hPt.y + hw / 2 * Math.sin(angle)
|
|
2754
2763
|
};
|
|
2755
2764
|
var relation = relationshipOfTwoOverlappedLines({
|
|
2756
2765
|
x1: chsp.x,
|
|
@@ -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,
|
|
@@ -902,69 +908,40 @@ function updateAttributeOfSelectedElement(element, attrPayload, state, layer, ca
|
|
|
902
908
|
y1 = _layer$vertices$get4.y;
|
|
903
909
|
var alpha = _export.GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
904
910
|
var lineLength = _export.GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
905
|
-
|
|
906
|
-
var
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
var xp =
|
|
911
|
-
var yp =
|
|
911
|
+
// move curHole
|
|
912
|
+
var _calcDistancesFromHol = (0, _geometry.calcDistancesFromHoleToNearestOneOrWall)(curHole, layer),
|
|
913
|
+
distLeft = _calcDistancesFromHol.distLeft,
|
|
914
|
+
distRight = _calcDistancesFromHol.distRight; // old distArray
|
|
915
|
+
var mDistance = attributeName === _constants.ATT_HOLE_OFFSET_A ? distLeft - value.get('length') : value.get('length') - distRight; // movement distance
|
|
916
|
+
var xp = x0 + (lineLength * curHole.offset - mDistance) * Math.cos(alpha);
|
|
917
|
+
var yp = y0 + (lineLength * curHole.offset - mDistance) * Math.sin(alpha);
|
|
912
918
|
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']);
|
|
919
|
+
// make temp hole for calc new distArray
|
|
920
|
+
var newHole = {
|
|
921
|
+
id: curHole.id,
|
|
922
|
+
line: curHole.line,
|
|
923
|
+
offset: offset,
|
|
924
|
+
x: xp,
|
|
925
|
+
y: yp,
|
|
926
|
+
properties: new _immutable.Map({
|
|
927
|
+
width: new _immutable.Map({
|
|
928
|
+
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
|
|
929
|
+
})
|
|
930
|
+
})
|
|
931
|
+
};
|
|
932
|
+
var newDistArray = (0, _geometry.calcDistancesFromHoleToNearestOneOrWall)(newHole, layer);
|
|
933
|
+
var offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
956
934
|
var offsetA = new _immutable.Map({
|
|
957
|
-
length:
|
|
958
|
-
_length: (0, _convertUnitsLite.convert)(
|
|
959
|
-
_unit:
|
|
935
|
+
length: newDistArray.distLeft,
|
|
936
|
+
_length: (0, _convertUnitsLite.convert)(newDistArray.distLeft).from(_constants.UNIT_CENTIMETER).to(offsetUnit),
|
|
937
|
+
_unit: offsetUnit
|
|
960
938
|
});
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
_unit:
|
|
965
|
-
_length: _export.MathUtils.toFixedFloat((0, _convertUnitsLite.convert)(_lengthValue).from(_constants.UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
939
|
+
var offsetB = new _immutable.Map({
|
|
940
|
+
length: newDistArray.distRight,
|
|
941
|
+
_length: (0, _convertUnitsLite.convert)(newDistArray.distRight).from(_constants.UNIT_CENTIMETER).to(offsetUnit),
|
|
942
|
+
_unit: offsetUnit
|
|
966
943
|
});
|
|
967
|
-
attributesFormData = attributesFormData.set(
|
|
944
|
+
attributesFormData = attributesFormData.set('offset', offset).set('offsetA', offsetA).set('offsetB', offsetB);
|
|
968
945
|
break;
|
|
969
946
|
}
|
|
970
947
|
default:
|
|
@@ -1063,7 +1040,7 @@ function getElement(objProps, state) {
|
|
|
1063
1040
|
}
|
|
1064
1041
|
return curObject;
|
|
1065
1042
|
}
|
|
1066
|
-
function loadMoldingSvg(
|
|
1043
|
+
function loadMoldingSvg(_x9) {
|
|
1067
1044
|
return _loadMoldingSvg.apply(this, arguments);
|
|
1068
1045
|
}
|
|
1069
1046
|
function _loadMoldingSvg() {
|
|
@@ -1236,7 +1213,7 @@ function mergeSameElements(projectItemsCatalog) {
|
|
|
1236
1213
|
}
|
|
1237
1214
|
return result;
|
|
1238
1215
|
}
|
|
1239
|
-
function handleExternalEvent(
|
|
1216
|
+
function handleExternalEvent(_x0) {
|
|
1240
1217
|
return _handleExternalEvent.apply(this, arguments);
|
|
1241
1218
|
}
|
|
1242
1219
|
function _handleExternalEvent() {
|
|
@@ -1347,7 +1324,7 @@ function _handleExternalEvent() {
|
|
|
1347
1324
|
}
|
|
1348
1325
|
}, _callee8);
|
|
1349
1326
|
}));
|
|
1350
|
-
return function (
|
|
1327
|
+
return function (_x1) {
|
|
1351
1328
|
return _ref3.apply(this, arguments);
|
|
1352
1329
|
};
|
|
1353
1330
|
}());
|
|
@@ -1493,7 +1470,7 @@ function _handleExternalEvent() {
|
|
|
1493
1470
|
}
|
|
1494
1471
|
}, _callee9);
|
|
1495
1472
|
}));
|
|
1496
|
-
return function (
|
|
1473
|
+
return function (_x10) {
|
|
1497
1474
|
return _ref4.apply(this, arguments);
|
|
1498
1475
|
};
|
|
1499
1476
|
}());
|