kitchen-simulator 1.1.1-test.71 → 1.1.1-test.72
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/@history.js +5 -2
- package/es/AppContext.js +6 -3
- package/es/KitchenConfigurator.js +86 -87
- package/es/KitchenConfiguratorApp.js +128 -135
- package/es/actions/area-actions.js +8 -5
- package/es/actions/export.js +24 -12
- package/es/actions/groups-actions.js +41 -27
- package/es/actions/holes-actions.js +51 -34
- package/es/actions/items-actions.js +141 -94
- package/es/actions/lines-actions.js +32 -21
- package/es/actions/project-actions.js +141 -94
- package/es/actions/scene-actions.js +17 -11
- package/es/actions/vertices-actions.js +11 -7
- package/es/actions/viewer2d-actions.js +32 -21
- package/es/actions/viewer3d-actions.js +14 -9
- package/es/catalog/areas/area/planner-element.js +5 -2
- package/es/catalog/catalog.js +17 -15
- package/es/catalog/factories/area-factory-3d.js +26 -22
- package/es/catalog/factories/area-factory.js +15 -13
- package/es/catalog/factories/export.js +10 -6
- package/es/catalog/factories/wall-factory-3d.js +36 -31
- package/es/catalog/factories/wall-factory.js +26 -21
- package/es/catalog/holes/door-closet/planner-element.js +19 -15
- package/es/catalog/holes/door-double/planner-element.js +19 -15
- package/es/catalog/holes/door-exterior/planner-element.js +20 -16
- package/es/catalog/holes/door-interior/planner-element.js +20 -16
- package/es/catalog/holes/door-panic/planner-element.js +11 -7
- package/es/catalog/holes/door-panic-double/planner-element.js +19 -15
- package/es/catalog/holes/door-sliding/planner-element.js +21 -17
- package/es/catalog/holes/doorway-framed/planner-element.js +15 -11
- package/es/catalog/holes/doorway-frameless/planner-element.js +11 -7
- package/es/catalog/holes/export.js +29 -13
- package/es/catalog/holes/window-clear/planner-element.js +14 -10
- package/es/catalog/holes/window-cross/planner-element.js +14 -10
- package/es/catalog/holes/window-double-hung/planner-element.js +14 -10
- package/es/catalog/holes/window-vertical/planner-element.js +14 -10
- package/es/catalog/lines/wall/planner-element.js +5 -2
- package/es/catalog/molding/molding-dcm/planner-element.js +9 -5
- package/es/catalog/molding/molding-fbm/planner-element.js +9 -5
- package/es/catalog/molding/molding-lrm/planner-element.js +9 -5
- package/es/catalog/properties/export.js +31 -20
- package/es/catalog/properties/property-checkbox.js +29 -28
- package/es/catalog/properties/property-color.js +19 -16
- package/es/catalog/properties/property-enum.js +27 -24
- package/es/catalog/properties/property-hidden.js +12 -9
- package/es/catalog/properties/property-lenght-measure.js +41 -38
- package/es/catalog/properties/property-length-measure.js +39 -36
- package/es/catalog/properties/property-length-measure_hole.js +41 -38
- package/es/catalog/properties/property-number.js +20 -17
- package/es/catalog/properties/property-read-only.js +19 -16
- package/es/catalog/properties/property-string.js +19 -16
- package/es/catalog/properties/property-toggle.js +19 -16
- package/es/catalog/properties/shared-property-style.js +3 -1
- package/es/catalog/utils/FuseUtils.js +13 -12
- package/es/catalog/utils/exporter.js +11 -10
- package/es/catalog/utils/geom-utils.js +24 -13
- package/es/catalog/utils/item-loader.js +92 -86
- package/es/catalog/utils/load-obj.js +24 -20
- package/es/catalog/utils/mtl-loader.js +4 -3
- package/es/catalog/utils/obj-loader.js +4 -3
- package/es/class/FuseUtils.js +13 -12
- package/es/class/area.js +24 -24
- package/es/class/export.js +36 -23
- package/es/class/group.js +55 -53
- package/es/class/guide.js +17 -15
- package/es/class/hole.js +85 -83
- package/es/class/item.js +155 -155
- package/es/class/layer.js +61 -59
- package/es/class/line.js +138 -135
- package/es/class/project.js +94 -93
- package/es/class/vertex.js +31 -29
- package/es/components/content.js +23 -19
- package/es/components/disclaimer/disclaimer.js +13 -10
- package/es/components/export.js +13 -8
- package/es/components/style/button.js +25 -25
- package/es/components/style/cancel-button.js +10 -7
- package/es/components/style/content-container.js +12 -11
- package/es/components/style/content-title.js +15 -13
- package/es/components/style/delete-button.js +12 -8
- package/es/components/style/export.js +46 -30
- package/es/components/style/form-block.js +11 -10
- package/es/components/style/form-color-input.js +10 -7
- package/es/components/style/form-label.js +11 -10
- package/es/components/style/form-number-input.js +43 -45
- package/es/components/style/form-number-input_2.js +39 -41
- package/es/components/style/form-select.js +20 -19
- package/es/components/style/form-slider.js +13 -10
- package/es/components/style/form-submit-button.js +12 -8
- package/es/components/style/form-text-input.js +28 -30
- package/es/components/viewer2d/area.js +20 -17
- package/es/components/viewer2d/export.js +46 -30
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +13 -10
- package/es/components/viewer2d/grids/grid-streak.js +13 -10
- package/es/components/viewer2d/grids/grid-vertical-streak.js +13 -10
- package/es/components/viewer2d/grids/grids.js +14 -10
- package/es/components/viewer2d/group.js +19 -15
- package/es/components/viewer2d/item.js +65 -61
- package/es/components/viewer2d/layer.js +26 -23
- package/es/components/viewer2d/line.js +106 -101
- package/es/components/viewer2d/ruler.js +25 -22
- package/es/components/viewer2d/rulerDist.js +24 -21
- package/es/components/viewer2d/rulerX.js +44 -46
- package/es/components/viewer2d/rulerY.js +42 -44
- package/es/components/viewer2d/scene.js +34 -35
- package/es/components/viewer2d/snap.js +17 -13
- package/es/components/viewer2d/state.js +22 -18
- package/es/components/viewer2d/utils.js +33 -24
- package/es/components/viewer2d/vertex.js +12 -8
- package/es/components/viewer2d/viewer2d.js +159 -156
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +19 -21
- package/es/components/viewer3d/dcm.js +3 -1
- package/es/components/viewer3d/fbm.js +3 -1
- package/es/components/viewer3d/front3D.js +16 -12
- package/es/components/viewer3d/grid-creator.js +12 -8
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +9 -6
- package/es/components/viewer3d/grids/grid-streak.js +8 -5
- package/es/components/viewer3d/grids/grid-vertical-streak.js +9 -6
- package/es/components/viewer3d/libs/first-person-controls.js +5 -2
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +3 -1
- package/es/components/viewer3d/libs/mtl-loader.js +3 -1
- package/es/components/viewer3d/libs/obj-loader.js +3 -1
- package/es/components/viewer3d/libs/orbit-controls.js +4 -2
- package/es/components/viewer3d/libs/pointer-lock-controls.js +4 -2
- package/es/components/viewer3d/lrm.js +3 -1
- package/es/components/viewer3d/model.js +3 -1
- package/es/components/viewer3d/pointer-lock-navigation.js +6 -3
- package/es/components/viewer3d/ruler-utils/itemRect.js +21 -18
- package/es/components/viewer3d/ruler-utils/layer3D.js +62 -59
- package/es/components/viewer3d/ruler-utils/ruler3D.js +43 -42
- package/es/components/viewer3d/ruler-utils/scene3D.js +13 -9
- package/es/components/viewer3d/ruler-utils/state3D.js +7 -4
- package/es/components/viewer3d/scene-creator.js +223 -197
- package/es/components/viewer3d/three-memory-cleaner.js +7 -3
- package/es/components/viewer3d/viewer3d-first-person.js +42 -42
- package/es/components/viewer3d/viewer3d.js +198 -200
- package/es/constants.js +354 -349
- package/es/index.js +11 -7
- package/es/models.js +191 -193
- package/es/plugins/SVGLoader.js +49 -48
- package/es/plugins/autosave.js +5 -3
- package/es/plugins/console-debugger.js +7 -6
- package/es/plugins/export.js +13 -8
- package/es/plugins/keyboard.js +31 -29
- package/es/reducers/areas-reducer.js +9 -7
- package/es/reducers/export.js +37 -24
- package/es/reducers/groups-reducer.js +33 -31
- package/es/reducers/holes-reducer.js +45 -43
- package/es/reducers/items-reducer.js +108 -106
- package/es/reducers/lines-reducer.js +30 -28
- package/es/reducers/project-reducer.js +107 -105
- package/es/reducers/reducer.js +19 -16
- package/es/reducers/scene-reducer.js +17 -15
- package/es/reducers/user-reducer.js +7 -5
- package/es/reducers/vertices-reducer.js +13 -11
- package/es/reducers/viewer2d-reducer.js +20 -18
- package/es/reducers/viewer3d-reducer.js +18 -16
- package/es/shared-style.js +12 -10
- package/es/styles/export.js +6 -3
- package/es/translator/en.js +3 -1
- package/es/translator/it.js +3 -1
- package/es/translator/ru.js +3 -1
- package/es/translator/translator.js +15 -13
- package/es/utils/browser.js +5 -2
- package/es/utils/convert-units-lite.js +3 -1
- package/es/utils/email-validator.js +3 -1
- package/es/utils/export.js +29 -15
- package/es/utils/geometry.js +280 -190
- package/es/utils/get-edges-of-subgraphs.js +5 -2
- package/es/utils/graph-cycles.js +7 -8
- package/es/utils/graph-inner-cycles.js +14 -10
- package/es/utils/graph.js +13 -9
- package/es/utils/helper.js +58 -41
- package/es/utils/history.js +11 -8
- package/es/utils/id-broker.js +11 -8
- package/es/utils/logger.js +3 -1
- package/es/utils/math.js +8 -5
- package/es/utils/molding.js +146 -130
- package/es/utils/name-generator.js +9 -7
- package/es/utils/objects-utils.js +14 -7
- package/es/utils/phone-validator.js +3 -1
- package/es/utils/process-black-list.js +6 -5
- package/es/utils/react-if.js +9 -7
- package/es/utils/snap-scene.js +30 -27
- package/es/utils/snap.js +57 -53
- package/es/utils/summarizeCart.js +3 -1
- package/es/utils/threeCSG.es6.js +17 -13
- package/es/version.js +3 -1
- package/package.json +1 -1
package/es/class/line.js
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
2
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
6
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
8
|
+
var _immutable = require("immutable");
|
|
9
|
+
var _export = require("./export");
|
|
10
|
+
var _export2 = require("../utils/export");
|
|
11
|
+
var Three = _interopRequireWildcard(require("three"));
|
|
12
|
+
var _constants = require("../constants");
|
|
13
|
+
var _helper = require("../utils/helper");
|
|
10
14
|
var timeGlobal = 0;
|
|
11
15
|
var TimeRecorder = /*#__PURE__*/function () {
|
|
12
16
|
function TimeRecorder(name) {
|
|
13
|
-
|
|
17
|
+
(0, _classCallCheck2["default"])(this, TimeRecorder);
|
|
14
18
|
this.name = name;
|
|
15
19
|
if (name === 'beginDrawingLine') {
|
|
16
20
|
console.log('time__ Start Drawing');
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
|
-
return
|
|
23
|
+
return (0, _createClass2["default"])(TimeRecorder, [{
|
|
20
24
|
key: "start",
|
|
21
25
|
value: function start() {
|
|
22
26
|
this.first = Date.now();
|
|
@@ -35,11 +39,11 @@ var TimeRecorder = /*#__PURE__*/function () {
|
|
|
35
39
|
}
|
|
36
40
|
}]);
|
|
37
41
|
}();
|
|
38
|
-
var Line = /*#__PURE__*/function () {
|
|
42
|
+
var Line = exports["default"] = /*#__PURE__*/function () {
|
|
39
43
|
function Line() {
|
|
40
|
-
|
|
44
|
+
(0, _classCallCheck2["default"])(this, Line);
|
|
41
45
|
}
|
|
42
|
-
return
|
|
46
|
+
return (0, _createClass2["default"])(Line, null, [{
|
|
43
47
|
key: "create",
|
|
44
48
|
value: function create(state, layerID, type, x0, y0, x1, y1, properties) {
|
|
45
49
|
var lineCreatedDateTime = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : new Date().getTime();
|
|
@@ -48,18 +52,18 @@ var Line = /*#__PURE__*/function () {
|
|
|
48
52
|
// return { updatedState: state };
|
|
49
53
|
// }
|
|
50
54
|
// ///////////////
|
|
51
|
-
var lineID = IDBroker.acquireID();
|
|
52
|
-
var _Vertex$add = Vertex.add(state, layerID, x0, y0, 'lines', lineID),
|
|
55
|
+
var lineID = _export2.IDBroker.acquireID();
|
|
56
|
+
var _Vertex$add = _export.Vertex.add(state, layerID, x0, y0, 'lines', lineID),
|
|
53
57
|
stateV0 = _Vertex$add.updatedState,
|
|
54
58
|
v0 = _Vertex$add.vertex;
|
|
55
|
-
var _Vertex$add2 = Vertex.add(stateV0, layerID, x1, y1, 'lines', lineID),
|
|
59
|
+
var _Vertex$add2 = _export.Vertex.add(stateV0, layerID, x1, y1, 'lines', lineID),
|
|
56
60
|
stateV1 = _Vertex$add2.updatedState,
|
|
57
61
|
v1 = _Vertex$add2.vertex;
|
|
58
62
|
state = stateV1;
|
|
59
63
|
var line = state.catalog.factoryElement(type, {
|
|
60
64
|
id: lineID,
|
|
61
|
-
name: NameGenerator.generateName('lines', state.catalog.getIn(['elements', type, 'info', 'title'])),
|
|
62
|
-
vertices: new List([v0.id, v1.id]),
|
|
65
|
+
name: _export2.NameGenerator.generateName('lines', state.catalog.getIn(['elements', type, 'info', 'title'])),
|
|
66
|
+
vertices: new _immutable.List([v0.id, v1.id]),
|
|
63
67
|
type: type
|
|
64
68
|
}, properties);
|
|
65
69
|
line = line.set('createdDateTime', lineCreatedDateTime !== undefined ? lineCreatedDateTime : new Date().getTime());
|
|
@@ -81,7 +85,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
81
85
|
value: function select(state, layerID, lineID) {
|
|
82
86
|
var _line$vertices, _line$vertices$get, _line$vertices2, _line$vertices2$get;
|
|
83
87
|
// Try selecting the layer first
|
|
84
|
-
var layerResult = Layer.select(state, layerID);
|
|
88
|
+
var layerResult = _export.Layer.select(state, layerID);
|
|
85
89
|
if (!layerResult || !layerResult.updatedState) {
|
|
86
90
|
return {
|
|
87
91
|
updatedState: state
|
|
@@ -98,7 +102,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
// Select the line element
|
|
101
|
-
var lineSelectResult = Layer.selectElement(state, layerID, 'lines', lineID);
|
|
105
|
+
var lineSelectResult = _export.Layer.selectElement(state, layerID, 'lines', lineID);
|
|
102
106
|
if (lineSelectResult !== null && lineSelectResult !== void 0 && lineSelectResult.updatedState) {
|
|
103
107
|
state = lineSelectResult.updatedState;
|
|
104
108
|
}
|
|
@@ -106,7 +110,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
106
110
|
// Select the first vertex (if available)
|
|
107
111
|
var firstVertex = (_line$vertices = line.vertices) === null || _line$vertices === void 0 || (_line$vertices$get = _line$vertices.get) === null || _line$vertices$get === void 0 ? void 0 : _line$vertices$get.call(_line$vertices, 0);
|
|
108
112
|
if (firstVertex !== undefined) {
|
|
109
|
-
var v1Result = Layer.selectElement(state, layerID, 'vertices', firstVertex);
|
|
113
|
+
var v1Result = _export.Layer.selectElement(state, layerID, 'vertices', firstVertex);
|
|
110
114
|
if (v1Result !== null && v1Result !== void 0 && v1Result.updatedState) {
|
|
111
115
|
state = v1Result.updatedState;
|
|
112
116
|
}
|
|
@@ -115,7 +119,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
115
119
|
// Select the second vertex (if available)
|
|
116
120
|
var secondVertex = (_line$vertices2 = line.vertices) === null || _line$vertices2 === void 0 || (_line$vertices2$get = _line$vertices2.get) === null || _line$vertices2$get === void 0 ? void 0 : _line$vertices2$get.call(_line$vertices2, 1);
|
|
117
121
|
if (secondVertex !== undefined) {
|
|
118
|
-
var v2Result = Layer.selectElement(state, layerID, 'vertices', secondVertex);
|
|
122
|
+
var v2Result = _export.Layer.selectElement(state, layerID, 'vertices', secondVertex);
|
|
119
123
|
if (v2Result !== null && v2Result !== void 0 && v2Result.updatedState) {
|
|
120
124
|
state = v2Result.updatedState;
|
|
121
125
|
}
|
|
@@ -131,14 +135,14 @@ var Line = /*#__PURE__*/function () {
|
|
|
131
135
|
if (line) {
|
|
132
136
|
state = this.unselect(state, layerID, lineID).updatedState;
|
|
133
137
|
line.holes.forEach(function (holeID) {
|
|
134
|
-
return state = Hole.remove(state, layerID, holeID).updatedState;
|
|
138
|
+
return state = _export.Hole.remove(state, layerID, holeID).updatedState;
|
|
135
139
|
});
|
|
136
|
-
state = Layer.removeElement(state, layerID, 'lines', lineID).updatedState;
|
|
140
|
+
state = _export.Layer.removeElement(state, layerID, 'lines', lineID).updatedState;
|
|
137
141
|
line.vertices.forEach(function (vertexID) {
|
|
138
|
-
return state = Vertex.remove(state, layerID, vertexID, 'lines', lineID).updatedState;
|
|
142
|
+
return state = _export.Vertex.remove(state, layerID, vertexID, 'lines', lineID).updatedState;
|
|
139
143
|
});
|
|
140
144
|
state.getIn(['scene', 'groups']).forEach(function (group) {
|
|
141
|
-
return state = Group.removeElement(state, group.id, layerID, 'lines', lineID).updatedState;
|
|
145
|
+
return state = _export.Group.removeElement(state, group.id, layerID, 'lines', lineID).updatedState;
|
|
142
146
|
});
|
|
143
147
|
}
|
|
144
148
|
return {
|
|
@@ -168,9 +172,9 @@ var Line = /*#__PURE__*/function () {
|
|
|
168
172
|
value: function unselect(state, layerID, lineID) {
|
|
169
173
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
170
174
|
if (line) {
|
|
171
|
-
state = Layer.unselect(state, layerID, 'vertices', line.vertices.get(0)).updatedState;
|
|
172
|
-
state = Layer.unselect(state, layerID, 'vertices', line.vertices.get(1)).updatedState;
|
|
173
|
-
state = Layer.unselect(state, layerID, 'lines', lineID).updatedState;
|
|
175
|
+
state = _export.Layer.unselect(state, layerID, 'vertices', line.vertices.get(0)).updatedState;
|
|
176
|
+
state = _export.Layer.unselect(state, layerID, 'vertices', line.vertices.get(1)).updatedState;
|
|
177
|
+
state = _export.Layer.unselect(state, layerID, 'lines', lineID).updatedState;
|
|
174
178
|
}
|
|
175
179
|
return {
|
|
176
180
|
updatedState: state
|
|
@@ -193,8 +197,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
193
197
|
stateL2 = _Line$create2.updatedState,
|
|
194
198
|
line1 = _Line$create2.line;
|
|
195
199
|
state = stateL2;
|
|
196
|
-
var splitPointOffset = GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, x, y);
|
|
197
|
-
var minVertex = GeometryUtils.minVertex(v0, v1);
|
|
200
|
+
var splitPointOffset = _export2.GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, x, y);
|
|
201
|
+
var minVertex = _export2.GeometryUtils.minVertex(v0, v1);
|
|
198
202
|
line.holes.forEach(function (holeID) {
|
|
199
203
|
var hole = state.getIn(['scene', 'layers', layerID, 'holes', holeID]);
|
|
200
204
|
var holeOffset = hole.offset;
|
|
@@ -209,7 +213,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
209
213
|
offset = 1 - offset;
|
|
210
214
|
}
|
|
211
215
|
*/
|
|
212
|
-
state = Hole.create(state, layerID, hole.type, line0.id, offset, hole.properties).updatedState;
|
|
216
|
+
state = _export.Hole.create(state, layerID, hole.type, line0.id, offset, hole.properties).updatedState;
|
|
213
217
|
} else {
|
|
214
218
|
var _offset = (holeOffset - splitPointOffset) / (1 - splitPointOffset);
|
|
215
219
|
/*
|
|
@@ -217,7 +221,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
217
221
|
offset = 1 - offset;
|
|
218
222
|
}
|
|
219
223
|
*/
|
|
220
|
-
state = Hole.create(state, layerID, hole.type, line1.id, _offset, hole.properties).updatedState;
|
|
224
|
+
state = _export.Hole.create(state, layerID, hole.type, line1.id, _offset, hole.properties).updatedState;
|
|
221
225
|
}
|
|
222
226
|
});
|
|
223
227
|
|
|
@@ -227,13 +231,13 @@ var Line = /*#__PURE__*/function () {
|
|
|
227
231
|
return lines && lines.contains(lineID);
|
|
228
232
|
});
|
|
229
233
|
lineGroups.forEach(function (group) {
|
|
230
|
-
state = Group.addElement(state, group.id, layerID, 'lines', line0.id).updatedState;
|
|
231
|
-
state = Group.addElement(state, group.id, layerID, 'lines', line1.id).updatedState;
|
|
234
|
+
state = _export.Group.addElement(state, group.id, layerID, 'lines', line0.id).updatedState;
|
|
235
|
+
state = _export.Group.addElement(state, group.id, layerID, 'lines', line1.id).updatedState;
|
|
232
236
|
});
|
|
233
237
|
state = Line.remove(state, layerID, lineID).updatedState;
|
|
234
238
|
return {
|
|
235
239
|
updatedState: state,
|
|
236
|
-
lines: new List([line0, line1])
|
|
240
|
+
lines: new _immutable.List([line0, line1])
|
|
237
241
|
};
|
|
238
242
|
}
|
|
239
243
|
}, {
|
|
@@ -241,7 +245,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
241
245
|
value: function addFromPoints(state, layerID, type, points, properties, holes) {
|
|
242
246
|
var _this = this;
|
|
243
247
|
var lineCreatedDateTime = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new Date().getTime();
|
|
244
|
-
points = new List(points).sort(function (_ref, _ref2) {
|
|
248
|
+
points = new _immutable.List(points).sort(function (_ref, _ref2) {
|
|
245
249
|
var x1 = _ref.x,
|
|
246
250
|
y1 = _ref.y;
|
|
247
251
|
var x2 = _ref2.x,
|
|
@@ -249,7 +253,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
249
253
|
return x1 === x2 ? y1 - y2 : x1 - x2;
|
|
250
254
|
});
|
|
251
255
|
var pointsPair = points.zip(points.skip(1)).filterNot(function (_ref3) {
|
|
252
|
-
var _ref4 =
|
|
256
|
+
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
253
257
|
_ref4$ = _ref4[0],
|
|
254
258
|
x1 = _ref4$.x,
|
|
255
259
|
y1 = _ref4$.y,
|
|
@@ -260,7 +264,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
260
264
|
});
|
|
261
265
|
var lines = [];
|
|
262
266
|
pointsPair.forEach(function (_ref5) {
|
|
263
|
-
var _ref6 =
|
|
267
|
+
var _ref6 = (0, _slicedToArray2["default"])(_ref5, 2),
|
|
264
268
|
_ref6$ = _ref6[0],
|
|
265
269
|
x1 = _ref6$.x,
|
|
266
270
|
y1 = _ref6$.y,
|
|
@@ -271,10 +275,10 @@ var Line = /*#__PURE__*/function () {
|
|
|
271
275
|
stateL = _this$create.updatedState,
|
|
272
276
|
line = _this$create.line;
|
|
273
277
|
state = stateL;
|
|
274
|
-
var lineLength = GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
275
|
-
var alpha = GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
276
|
-
var cosAlpha = GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
277
|
-
var sinAlpha = GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
278
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
279
|
+
var alpha = _export2.GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
280
|
+
var cosAlpha = _export2.GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
281
|
+
var sinAlpha = _export2.GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
278
282
|
if (holes) {
|
|
279
283
|
holes.forEach(function (holeWithOffsetPoint) {
|
|
280
284
|
var offset = holeWithOffsetPoint.hole.toJS().offset;
|
|
@@ -282,16 +286,16 @@ var Line = /*#__PURE__*/function () {
|
|
|
282
286
|
var _holeWithOffsetPoint$ = holeWithOffsetPoint.offsetPosition,
|
|
283
287
|
xp = _holeWithOffsetPoint$.x,
|
|
284
288
|
yp = _holeWithOffsetPoint$.y;
|
|
285
|
-
if (GeometryUtils.isPointOnLineSegment(x1, y1, x2, y2, xp, yp)) {
|
|
286
|
-
var newOffset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp);
|
|
289
|
+
if (_export2.GeometryUtils.isPointOnLineSegment(x1, y1, x2, y2, xp, yp)) {
|
|
290
|
+
var newOffset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp);
|
|
287
291
|
if (newOffset >= 0 && newOffset <= 1) {
|
|
288
292
|
//add the position of hole
|
|
289
|
-
var temp = Hole.create(state, layerID, holeWithOffsetPoint.hole.type, line.id, newOffset, holeWithOffsetPoint.hole.properties, xp, yp);
|
|
293
|
+
var temp = _export.Hole.create(state, layerID, holeWithOffsetPoint.hole.type, line.id, newOffset, holeWithOffsetPoint.hole.properties, xp, yp);
|
|
290
294
|
state = temp.updatedState;
|
|
291
295
|
var holeX = 0,
|
|
292
296
|
holeY = 0,
|
|
293
297
|
holeID = temp.hole.id;
|
|
294
|
-
if (GeometryUtils.almostEqual(y1, y2)) {
|
|
298
|
+
if (_export2.GeometryUtils.almostEqual(y1, y2)) {
|
|
295
299
|
if (x1 > x2) {
|
|
296
300
|
holeX = x1 - lineLength * newOffset;
|
|
297
301
|
holeY = y1;
|
|
@@ -299,7 +303,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
299
303
|
holeX = x1 + lineLength * newOffset;
|
|
300
304
|
holeY = y1;
|
|
301
305
|
}
|
|
302
|
-
} else if (GeometryUtils.almostEqual(x1, x2)) {
|
|
306
|
+
} else if (_export2.GeometryUtils.almostEqual(x1, x2)) {
|
|
303
307
|
if (y1 > y2) {
|
|
304
308
|
holeX = x1;
|
|
305
309
|
holeY = y1 - lineLength * newOffset;
|
|
@@ -334,7 +338,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
334
338
|
});
|
|
335
339
|
return {
|
|
336
340
|
updatedState: state,
|
|
337
|
-
lines: new List(lines),
|
|
341
|
+
lines: new _immutable.List(lines),
|
|
338
342
|
newline: lines[0]
|
|
339
343
|
};
|
|
340
344
|
}
|
|
@@ -354,21 +358,21 @@ var Line = /*#__PURE__*/function () {
|
|
|
354
358
|
var _line$vertices$map$to = line.vertices.map(function (vertexID) {
|
|
355
359
|
return reducedState.getIn(['scene', 'layers', layerID, 'vertices']).get(vertexID);
|
|
356
360
|
}).toArray(),
|
|
357
|
-
_line$vertices$map$to2 =
|
|
361
|
+
_line$vertices$map$to2 = (0, _slicedToArray2["default"])(_line$vertices$map$to, 2),
|
|
358
362
|
v0 = _line$vertices$map$to2[0],
|
|
359
363
|
v1 = _line$vertices$map$to2[1];
|
|
360
|
-
var hasCommonEndpoint = GeometryUtils.samePoints(v0, points[0]) || GeometryUtils.samePoints(v0, points[1]) || GeometryUtils.samePoints(v1, points[0]) || GeometryUtils.samePoints(v1, points[1]);
|
|
361
|
-
var intersection = GeometryUtils.twoLineSegmentsIntersection(points[0], points[1], v0, v1);
|
|
364
|
+
var hasCommonEndpoint = _export2.GeometryUtils.samePoints(v0, points[0]) || _export2.GeometryUtils.samePoints(v0, points[1]) || _export2.GeometryUtils.samePoints(v1, points[0]) || _export2.GeometryUtils.samePoints(v1, points[1]);
|
|
365
|
+
var intersection = _export2.GeometryUtils.twoLineSegmentsIntersection(points[0], points[1], v0, v1);
|
|
362
366
|
if (intersection.type === 'colinear') {
|
|
363
367
|
if (!oldHoles) {
|
|
364
368
|
oldHoles = [];
|
|
365
369
|
}
|
|
366
|
-
var orderedVertices = GeometryUtils.orderVertices(points);
|
|
370
|
+
var orderedVertices = _export2.GeometryUtils.orderVertices(points);
|
|
367
371
|
reducedState.getIn(['scene', 'layers', layerID, 'lines', line.id, 'holes']).forEach(function (holeID) {
|
|
368
372
|
var hole = reducedState.getIn(['scene', 'layers', layerID, 'holes', holeID]);
|
|
369
|
-
var oldLineLength = GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
370
|
-
var offset = GeometryUtils.samePoints(orderedVertices[1], line.vertices.get(1)) ? 1 - hole.offset : hole.offset;
|
|
371
|
-
var offsetPosition = GeometryUtils.extendLine(v0.x, v0.y, v1.x, v1.y, oldLineLength * offset);
|
|
373
|
+
var oldLineLength = _export2.GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
374
|
+
var offset = _export2.GeometryUtils.samePoints(orderedVertices[1], line.vertices.get(1)) ? 1 - hole.offset : hole.offset;
|
|
375
|
+
var offsetPosition = _export2.GeometryUtils.extendLine(v0.x, v0.y, v1.x, v1.y, oldLineLength * offset);
|
|
372
376
|
oldHoles.push({
|
|
373
377
|
hole: hole,
|
|
374
378
|
offsetPosition: offsetPosition
|
|
@@ -397,8 +401,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
397
401
|
key: "replaceVertex",
|
|
398
402
|
value: function replaceVertex(state, layerID, lineID, vertexIndex, x, y) {
|
|
399
403
|
var vertexID = state.getIn(['scene', 'layers', layerID, 'lines', lineID, 'vertices', vertexIndex]);
|
|
400
|
-
state = Vertex.remove(state, layerID, vertexID, 'lines', lineID).updatedState;
|
|
401
|
-
var _Vertex$add3 = Vertex.add(state, layerID, x, y, 'lines', lineID),
|
|
404
|
+
state = _export.Vertex.remove(state, layerID, vertexID, 'lines', lineID).updatedState;
|
|
405
|
+
var _Vertex$add3 = _export.Vertex.add(state, layerID, x, y, 'lines', lineID),
|
|
402
406
|
stateV = _Vertex$add3.updatedState,
|
|
403
407
|
vertex = _Vertex$add3.vertex;
|
|
404
408
|
state = stateV;
|
|
@@ -414,8 +418,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
414
418
|
key: "selectToolDrawingLine",
|
|
415
419
|
value: function selectToolDrawingLine(state, sceneComponentType) {
|
|
416
420
|
state = state.merge({
|
|
417
|
-
mode: MODE_WAITING_DRAWING_LINE,
|
|
418
|
-
drawingSupport: new Map({
|
|
421
|
+
mode: _constants.MODE_WAITING_DRAWING_LINE,
|
|
422
|
+
drawingSupport: new _immutable.Map({
|
|
419
423
|
type: sceneComponentType
|
|
420
424
|
})
|
|
421
425
|
});
|
|
@@ -427,16 +431,16 @@ var Line = /*#__PURE__*/function () {
|
|
|
427
431
|
key: "beginDrawingLine",
|
|
428
432
|
value: function beginDrawingLine(state, layerID, x, y) {
|
|
429
433
|
// if end drawing by created area
|
|
430
|
-
if (state.mode == MODE_IDLE) {
|
|
434
|
+
if (state.mode == _constants.MODE_IDLE) {
|
|
431
435
|
return {
|
|
432
436
|
updatedState: state
|
|
433
437
|
};
|
|
434
438
|
}
|
|
435
439
|
// ///////////////
|
|
436
|
-
var snapElements = SnapSceneUtils.sceneSnapElements(state.scene, new List(), state.snapMask);
|
|
440
|
+
var snapElements = _export2.SnapSceneUtils.sceneSnapElements(state.scene, new _immutable.List(), state.snapMask);
|
|
437
441
|
var snap = null;
|
|
438
442
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
439
|
-
snap = SnapUtils.nearestSnap(snapElements, x, y, state.snapMask);
|
|
443
|
+
snap = _export2.SnapUtils.nearestSnap(snapElements, x, y, state.snapMask);
|
|
440
444
|
if (snap) {
|
|
441
445
|
var _snap$point = snap.point;
|
|
442
446
|
x = _snap$point.x;
|
|
@@ -444,36 +448,36 @@ var Line = /*#__PURE__*/function () {
|
|
|
444
448
|
}
|
|
445
449
|
snapElements = snapElements.withMutations(function (snapElements) {
|
|
446
450
|
var a, b, c;
|
|
447
|
-
var _GeometryUtils$horizo = GeometryUtils.horizontalLine(y);
|
|
451
|
+
var _GeometryUtils$horizo = _export2.GeometryUtils.horizontalLine(y);
|
|
448
452
|
a = _GeometryUtils$horizo.a;
|
|
449
453
|
b = _GeometryUtils$horizo.b;
|
|
450
454
|
c = _GeometryUtils$horizo.c;
|
|
451
|
-
SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
452
|
-
var _GeometryUtils$vertic = GeometryUtils.verticalLine(x);
|
|
455
|
+
_export2.SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
456
|
+
var _GeometryUtils$vertic = _export2.GeometryUtils.verticalLine(x);
|
|
453
457
|
a = _GeometryUtils$vertic.a;
|
|
454
458
|
b = _GeometryUtils$vertic.b;
|
|
455
459
|
c = _GeometryUtils$vertic.c;
|
|
456
|
-
SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
457
|
-
var _GeometryUtils$upcros = GeometryUtils.upcrossLine(x, y);
|
|
460
|
+
_export2.SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
461
|
+
var _GeometryUtils$upcros = _export2.GeometryUtils.upcrossLine(x, y);
|
|
458
462
|
a = _GeometryUtils$upcros.a;
|
|
459
463
|
b = _GeometryUtils$upcros.b;
|
|
460
464
|
c = _GeometryUtils$upcros.c;
|
|
461
|
-
SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
462
|
-
var _GeometryUtils$downcr = GeometryUtils.downcrossLine(x, y);
|
|
465
|
+
_export2.SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
466
|
+
var _GeometryUtils$downcr = _export2.GeometryUtils.downcrossLine(x, y);
|
|
463
467
|
a = _GeometryUtils$downcr.a;
|
|
464
468
|
b = _GeometryUtils$downcr.b;
|
|
465
469
|
c = _GeometryUtils$downcr.c;
|
|
466
|
-
SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
470
|
+
_export2.SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
467
471
|
});
|
|
468
472
|
}
|
|
469
473
|
var drawingSupport = state.get('drawingSupport').set('layerID', layerID);
|
|
470
|
-
state = Layer.unselectAll(state, layerID).updatedState;
|
|
474
|
+
state = _export.Layer.unselectAll(state, layerID).updatedState;
|
|
471
475
|
var _Line$create3 = Line.create(state, layerID, drawingSupport.get('type'), x, y, x, y),
|
|
472
476
|
stateL = _Line$create3.updatedState,
|
|
473
477
|
line = _Line$create3.line;
|
|
474
478
|
state = Line.select(stateL, layerID, line.id).updatedState;
|
|
475
479
|
state = state.merge({
|
|
476
|
-
mode: MODE_DRAWING_LINE,
|
|
480
|
+
mode: _constants.MODE_DRAWING_LINE,
|
|
477
481
|
snapElements: snapElements,
|
|
478
482
|
activeSnapElement: snap ? snap.snap : null,
|
|
479
483
|
drawingSupport: drawingSupport
|
|
@@ -487,7 +491,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
487
491
|
value: function updateDrawingLine(state, x, y, relatedLines) {
|
|
488
492
|
var snap = null;
|
|
489
493
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
490
|
-
snap = SnapUtils.nearestSnap(state.snapElements, x, y, state.snapMask);
|
|
494
|
+
snap = _export2.SnapUtils.nearestSnap(state.snapElements, x, y, state.snapMask);
|
|
491
495
|
if (snap) {
|
|
492
496
|
var _snap$point2 = snap.point;
|
|
493
497
|
x = _snap$point2.x;
|
|
@@ -503,7 +507,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
503
507
|
var moveFlag = true;
|
|
504
508
|
var tx = vertices[drawingLine.vertices[1]].x;
|
|
505
509
|
var ty = vertices[drawingLine.vertices[1]].y;
|
|
506
|
-
if (!isEmpty(relatedLines)) {
|
|
510
|
+
if (!(0, _helper.isEmpty)(relatedLines)) {
|
|
507
511
|
vertices[drawingLine.vertices[1]].x = x;
|
|
508
512
|
vertices[drawingLine.vertices[1]].y = y;
|
|
509
513
|
}
|
|
@@ -513,12 +517,12 @@ var Line = /*#__PURE__*/function () {
|
|
|
513
517
|
if (drawingLine.vertices[0] !== drawingLine.vertices[1]) {
|
|
514
518
|
relatedLines.forEach(function (line) {
|
|
515
519
|
// get the points of two lines(drawing line and related line)
|
|
516
|
-
if (!isEmpty(line)) {
|
|
520
|
+
if (!(0, _helper.isEmpty)(line)) {
|
|
517
521
|
// the angle between two lines(line, drawingLine)
|
|
518
|
-
lineAngle = GeometryUtils.angleBetweenTwoLines(line, drawingLine, vertices);
|
|
522
|
+
lineAngle = _export2.GeometryUtils.angleBetweenTwoLines(line, drawingLine, vertices);
|
|
519
523
|
// check whether the angle is less than or bigger than specific value.
|
|
520
524
|
absAngle = Math.abs(lineAngle);
|
|
521
|
-
if (absAngle < MIN_ANGLE_DISALLOW_DRAW_WALL || absAngle > 360 - MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
525
|
+
if (absAngle < _constants.MIN_ANGLE_DISALLOW_DRAW_WALL || absAngle > 360 - _constants.MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
522
526
|
moveFlag = false;
|
|
523
527
|
} else moveFlag = true;
|
|
524
528
|
}
|
|
@@ -530,20 +534,20 @@ var Line = /*#__PURE__*/function () {
|
|
|
530
534
|
tx = x;
|
|
531
535
|
ty = y;
|
|
532
536
|
} else {
|
|
533
|
-
var rest = MIN_ANGLE_DISALLOW_DRAW_WALL - absAngle;
|
|
537
|
+
var rest = _constants.MIN_ANGLE_DISALLOW_DRAW_WALL - absAngle;
|
|
534
538
|
// the origin point of rotation(snapping)
|
|
535
539
|
var ox = vertices[drawingLine.vertices[0]].x;
|
|
536
540
|
var oy = vertices[drawingLine.vertices[0]].y;
|
|
537
541
|
// determine the direction of rotation.
|
|
538
542
|
rest = lineAngle > 0 ? -rest : rest;
|
|
539
543
|
// rotate the current point to last point around the first point of drawing line.
|
|
540
|
-
var res = GeometryUtils.rotatePointAroundPoint(x, y, ox, oy, rest);
|
|
544
|
+
var res = _export2.GeometryUtils.rotatePointAroundPoint(x, y, ox, oy, rest);
|
|
541
545
|
tx = res.x;
|
|
542
546
|
ty = res.y;
|
|
543
547
|
}
|
|
544
548
|
// angle snapping as a value of UNIT_ANGLE
|
|
545
|
-
if (moveFlag && !isEmpty(absAngle) && absAngle % UNIT_ANGLE !== 0) {
|
|
546
|
-
var result = GeometryUtils.snapAngleByUnit(lineAngle, vertices, drawingLine, tx, ty, drawingLine.vertices[1]);
|
|
549
|
+
if (moveFlag && !(0, _helper.isEmpty)(absAngle) && absAngle % _constants.UNIT_ANGLE !== 0) {
|
|
550
|
+
var result = _export2.GeometryUtils.snapAngleByUnit(lineAngle, vertices, drawingLine, tx, ty, drawingLine.vertices[1]);
|
|
547
551
|
tx = result.x;
|
|
548
552
|
ty = result.y;
|
|
549
553
|
}
|
|
@@ -573,9 +577,9 @@ var Line = /*#__PURE__*/function () {
|
|
|
573
577
|
var _layer$lines$get;
|
|
574
578
|
var holeOffset = [];
|
|
575
579
|
(_layer$lines$get = layer.lines.get(lineID)) === null || _layer$lines$get === void 0 || _layer$lines$get.holes.forEach(function (holeID) {
|
|
576
|
-
var lineLength = GeometryUtils.pointsDistance(nv0.x, nv0.y, nv1.x, nv1.y);
|
|
577
|
-
var minV = GeometryUtils.minVertex(nv0, nv1);
|
|
578
|
-
var maxV = GeometryUtils.maxVertex(nv0, nv1);
|
|
580
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(nv0.x, nv0.y, nv1.x, nv1.y);
|
|
581
|
+
var minV = _export2.GeometryUtils.minVertex(nv0, nv1);
|
|
582
|
+
var maxV = _export2.GeometryUtils.maxVertex(nv0, nv1);
|
|
579
583
|
var alpha = Math.atan2(maxV.y - minV.y, maxV.x - minV.x);
|
|
580
584
|
var hole = layer.holes.get(holeID);
|
|
581
585
|
var pointOnLine = lineLength * hole.offset;
|
|
@@ -616,7 +620,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
616
620
|
return mgline.id === lineID;
|
|
617
621
|
});
|
|
618
622
|
});
|
|
619
|
-
if (!isEmpty(relatedLineID)) {
|
|
623
|
+
if (!(0, _helper.isEmpty)(relatedLineID)) {
|
|
620
624
|
var relatedLine = layer.lines.get(relatedLineID[0]);
|
|
621
625
|
var intersectionPoint = vertex;
|
|
622
626
|
var startPoint, endPoint;
|
|
@@ -633,8 +637,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
633
637
|
var tline2 = {
|
|
634
638
|
vertices: [intersectionPoint.id, endPoint.id]
|
|
635
639
|
};
|
|
636
|
-
var angle = Math.abs(GeometryUtils.angleBetweenTwoLines(tline1, tline2, allVertices.toJS()));
|
|
637
|
-
if (Math.abs(angle - 180) <= EPSILON) {
|
|
640
|
+
var angle = Math.abs(_export2.GeometryUtils.angleBetweenTwoLines(tline1, tline2, allVertices.toJS()));
|
|
641
|
+
if (Math.abs(angle - 180) <= _constants.EPSILON) {
|
|
638
642
|
selectedLineInfo.mergelines.push(relatedLine);
|
|
639
643
|
selectedLineInfo.points[0] = startPoint;
|
|
640
644
|
selectedLineInfo.points[1] = endPoint;
|
|
@@ -652,7 +656,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
652
656
|
var allVertices = state.getIn(['scene', 'layers', layerID, 'vertices']);
|
|
653
657
|
var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
|
|
654
658
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
655
|
-
if (isEmpty(line)) {
|
|
659
|
+
if ((0, _helper.isEmpty)(line)) {
|
|
656
660
|
return {
|
|
657
661
|
updatedState: state
|
|
658
662
|
};
|
|
@@ -684,13 +688,13 @@ var Line = /*#__PURE__*/function () {
|
|
|
684
688
|
var holesWithOffsetPosition = [];
|
|
685
689
|
var lineID = layer.getIn(['selected', 'lines']).first(); // lines : [id]
|
|
686
690
|
var line = layer.getIn(['lines', lineID]);
|
|
687
|
-
if (isEmpty(line)) {
|
|
691
|
+
if ((0, _helper.isEmpty)(line)) {
|
|
688
692
|
return {
|
|
689
693
|
updatedState: state
|
|
690
694
|
};
|
|
691
695
|
}
|
|
692
696
|
mergeInfo.mergelines.forEach(function (line) {
|
|
693
|
-
if ([END_DRAGGING_LINE, END_DRAGGING_VERTEX].includes(actionType)) {
|
|
697
|
+
if ([_constants.END_DRAGGING_LINE, _constants.END_DRAGGING_VERTEX].includes(actionType)) {
|
|
694
698
|
var tmpGroups = state //get groups membership if present
|
|
695
699
|
.getIn(['scene', 'groups']).filter(function (group) {
|
|
696
700
|
var lines = group.getIn(['elements', layerID, 'lines']);
|
|
@@ -709,20 +713,20 @@ var Line = /*#__PURE__*/function () {
|
|
|
709
713
|
state = Line.remove(state, layerID, line.id).updatedState;
|
|
710
714
|
});
|
|
711
715
|
var ret;
|
|
712
|
-
if (!GeometryUtils.samePoints(mergeInfo.points[0], mergeInfo.points[1])) {
|
|
716
|
+
if (!_export2.GeometryUtils.samePoints(mergeInfo.points[0], mergeInfo.points[1])) {
|
|
713
717
|
ret = Line.createAvoidingIntersections(state, layerID, line.type, mergeInfo.points[0].x, mergeInfo.points[0].y, mergeInfo.points[1].x, mergeInfo.points[1].y, line.properties, holesWithOffsetPosition, line.createdDateTime);
|
|
714
718
|
state = ret.updatedState;
|
|
715
719
|
}
|
|
716
|
-
if ([END_DRAGGING_LINE, END_DRAGGING_VERTEX].includes(actionType)) {
|
|
720
|
+
if ([_constants.END_DRAGGING_LINE, _constants.END_DRAGGING_VERTEX].includes(actionType)) {
|
|
717
721
|
//re-add to old line's groups if present
|
|
718
722
|
ret.lines.forEach(function (addedLine) {
|
|
719
723
|
lineGroups.forEach(function (oldLineGroup) {
|
|
720
|
-
state = Group.addElement(state, oldLineGroup.id, layerID, 'lines', addedLine.id).updatedState;
|
|
724
|
+
state = _export.Group.addElement(state, oldLineGroup.id, layerID, 'lines', addedLine.id).updatedState;
|
|
721
725
|
});
|
|
722
726
|
});
|
|
723
727
|
}
|
|
724
|
-
state = Layer.removeZeroLengthLines(state, layerID).updatedState;
|
|
725
|
-
if (!isEmpty((_ret = ret) === null || _ret === void 0 ? void 0 : _ret.newline)) {
|
|
728
|
+
state = _export.Layer.removeZeroLengthLines(state, layerID).updatedState;
|
|
729
|
+
if (!(0, _helper.isEmpty)((_ret = ret) === null || _ret === void 0 ? void 0 : _ret.newline)) {
|
|
726
730
|
state = this.select(state, layerID, ret.newline.get('id')).updatedState;
|
|
727
731
|
}
|
|
728
732
|
return {
|
|
@@ -737,10 +741,10 @@ var Line = /*#__PURE__*/function () {
|
|
|
737
741
|
var lineID = layer.getIn(['selected', 'lines']).first(); // lines : [id]
|
|
738
742
|
var line = layer.getIn(['lines', lineID]);
|
|
739
743
|
var drawingInfo = {};
|
|
740
|
-
if (!isEmpty(line)) {
|
|
744
|
+
if (!(0, _helper.isEmpty)(line)) {
|
|
741
745
|
drawingInfo.drawingLine = line;
|
|
742
746
|
}
|
|
743
|
-
state = Layer.detectAndUpdateAreas(state, layerID, drawingInfo).updatedState;
|
|
747
|
+
state = _export.Layer.detectAndUpdateAreas(state, layerID, drawingInfo).updatedState;
|
|
744
748
|
return {
|
|
745
749
|
updatedState: state
|
|
746
750
|
};
|
|
@@ -762,16 +766,16 @@ var Line = /*#__PURE__*/function () {
|
|
|
762
766
|
var layerID = state.getIn(['scene', 'selectedLayer']);
|
|
763
767
|
var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
|
|
764
768
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
765
|
-
if (isEmpty(line)) {
|
|
769
|
+
if ((0, _helper.isEmpty)(line)) {
|
|
766
770
|
return {
|
|
767
771
|
updatedState: state
|
|
768
772
|
};
|
|
769
773
|
}
|
|
770
|
-
if (!isEmpty(v0)) {
|
|
774
|
+
if (!(0, _helper.isEmpty)(v0)) {
|
|
771
775
|
state = state.setIn(['scene', 'layers', layerID, 'vertices', line.vertices.get(0), 'x'], v0.x);
|
|
772
776
|
state = state.setIn(['scene', 'layers', layerID, 'vertices', line.vertices.get(0), 'y'], v0.y);
|
|
773
777
|
}
|
|
774
|
-
if (!isEmpty(v1)) {
|
|
778
|
+
if (!(0, _helper.isEmpty)(v1)) {
|
|
775
779
|
state = state.setIn(['scene', 'layers', layerID, 'vertices', line.vertices.get(1), 'x'], v1.x);
|
|
776
780
|
state = state.setIn(['scene', 'layers', layerID, 'vertices', line.vertices.get(1), 'y'], v1.y);
|
|
777
781
|
}
|
|
@@ -785,7 +789,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
785
789
|
key: "endDrawingLine",
|
|
786
790
|
value: function endDrawingLine(state, x, y) {
|
|
787
791
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
788
|
-
var snap = SnapUtils.nearestSnap(state.snapElements, x, y, state.snapMask);
|
|
792
|
+
var snap = _export2.SnapUtils.nearestSnap(state.snapElements, x, y, state.snapMask);
|
|
789
793
|
if (snap) {
|
|
790
794
|
var _snap$point3 = snap.point;
|
|
791
795
|
x = _snap$point3.x;
|
|
@@ -798,8 +802,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
798
802
|
if (drawingLine.vertices[0] === drawingLine.vertices[1]) {
|
|
799
803
|
state = Line.remove(state, layerID, lineID).updatedState;
|
|
800
804
|
state = state.merge({
|
|
801
|
-
mode: MODE_IDLE,
|
|
802
|
-
snapElements: new List(),
|
|
805
|
+
mode: _constants.MODE_IDLE,
|
|
806
|
+
snapElements: new _immutable.List(),
|
|
803
807
|
activeSnapElement: null
|
|
804
808
|
});
|
|
805
809
|
return {
|
|
@@ -810,10 +814,10 @@ var Line = /*#__PURE__*/function () {
|
|
|
810
814
|
x: x,
|
|
811
815
|
y: y
|
|
812
816
|
}, state).updatedState;
|
|
813
|
-
state = this.applyWallChanges(state, END_DRAWING_LINE).updatedState;
|
|
817
|
+
state = this.applyWallChanges(state, _constants.END_DRAWING_LINE).updatedState;
|
|
814
818
|
state = state.merge({
|
|
815
|
-
mode: MODE_WAITING_DRAWING_LINE,
|
|
816
|
-
snapElements: new List(),
|
|
819
|
+
mode: _constants.MODE_WAITING_DRAWING_LINE,
|
|
820
|
+
snapElements: new _immutable.List(),
|
|
817
821
|
activeSnapElement: null
|
|
818
822
|
});
|
|
819
823
|
return {
|
|
@@ -823,15 +827,15 @@ var Line = /*#__PURE__*/function () {
|
|
|
823
827
|
}, {
|
|
824
828
|
key: "beginDraggingLine",
|
|
825
829
|
value: function beginDraggingLine(state, layerID, lineID, x, y) {
|
|
826
|
-
var snapElements = SnapSceneUtils.sceneSnapElements(state.scene, new List(), state.snapMask);
|
|
830
|
+
var snapElements = _export2.SnapSceneUtils.sceneSnapElements(state.scene, new _immutable.List(), state.snapMask);
|
|
827
831
|
var layer = state.scene.layers.get(layerID);
|
|
828
832
|
var line = layer.lines.get(lineID);
|
|
829
833
|
var vertex0 = layer.vertices.get(line.vertices.get(0));
|
|
830
834
|
var vertex1 = layer.vertices.get(line.vertices.get(1));
|
|
831
835
|
state = state.merge({
|
|
832
|
-
mode: MODE_DRAGGING_LINE,
|
|
836
|
+
mode: _constants.MODE_DRAGGING_LINE,
|
|
833
837
|
snapElements: snapElements,
|
|
834
|
-
draggingSupport: Map({
|
|
838
|
+
draggingSupport: (0, _immutable.Map)({
|
|
835
839
|
layerID: layerID,
|
|
836
840
|
lineID: lineID,
|
|
837
841
|
startPointX: x,
|
|
@@ -869,7 +873,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
869
873
|
var vec1 = pos1.clone().sub(cen).normalize();
|
|
870
874
|
var vec2 = pos2.clone().sub(cen).normalize();
|
|
871
875
|
var angle = Math.floor(vec1.angle() * 180 / Math.PI - vec2.angle() * 180 / Math.PI + 0.5);
|
|
872
|
-
if (Math.abs(angle) < MIN_ANGLE_DISALLOW_DRAW_WALL || Math.abs(angle) > 360 - MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
876
|
+
if (Math.abs(angle) < _constants.MIN_ANGLE_DISALLOW_DRAW_WALL || Math.abs(angle) > 360 - _constants.MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
873
877
|
mvFlag.push(false);
|
|
874
878
|
} else {
|
|
875
879
|
mvFlag.push(true);
|
|
@@ -909,8 +913,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
909
913
|
var curSnap0 = null,
|
|
910
914
|
curSnap1 = null;
|
|
911
915
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
912
|
-
curSnap0 = SnapUtils.nearestSnap(snapElements, newVertex0X, newVertex0Y, state.snapMask);
|
|
913
|
-
curSnap1 = SnapUtils.nearestSnap(snapElements, newVertex1X, newVertex1Y, state.snapMask);
|
|
916
|
+
curSnap0 = _export2.SnapUtils.nearestSnap(snapElements, newVertex0X, newVertex0Y, state.snapMask);
|
|
917
|
+
curSnap1 = _export2.SnapUtils.nearestSnap(snapElements, newVertex1X, newVertex1Y, state.snapMask);
|
|
914
918
|
}
|
|
915
919
|
var deltaX = 0,
|
|
916
920
|
deltaY = 0;
|
|
@@ -994,8 +998,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
994
998
|
var newVertex1X = draggingSupport.get('startVertex1X') + diffX;
|
|
995
999
|
var newVertex1Y = draggingSupport.get('startVertex1Y') + diffY;
|
|
996
1000
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
997
|
-
var curSnap0 = SnapUtils.nearestSnap(state.snapElements, newVertex0X, newVertex0Y, state.snapMask);
|
|
998
|
-
var curSnap1 = SnapUtils.nearestSnap(state.snapElements, newVertex1X, newVertex1Y, state.snapMask);
|
|
1001
|
+
var curSnap0 = _export2.SnapUtils.nearestSnap(state.snapElements, newVertex0X, newVertex0Y, state.snapMask);
|
|
1002
|
+
var curSnap1 = _export2.SnapUtils.nearestSnap(state.snapElements, newVertex1X, newVertex1Y, state.snapMask);
|
|
999
1003
|
var deltaX = 0,
|
|
1000
1004
|
deltaY = 0;
|
|
1001
1005
|
if (curSnap0 && curSnap1) {
|
|
@@ -1032,9 +1036,9 @@ var Line = /*#__PURE__*/function () {
|
|
|
1032
1036
|
newVertex0Y = newResult.newVertex0Y;
|
|
1033
1037
|
newVertex1X = newResult.newVertex1X;
|
|
1034
1038
|
newVertex1Y = newResult.newVertex1Y;
|
|
1035
|
-
state = Layer.mergeEqualsVertices(state, layerID, line.vertices.get(0)).updatedState;
|
|
1036
|
-
state = Layer.mergeEqualsVertices(state, layerID, line.vertices.get(1)).updatedState;
|
|
1037
|
-
if (GeometryUtils.samePoints({
|
|
1039
|
+
state = _export.Layer.mergeEqualsVertices(state, layerID, line.vertices.get(0)).updatedState;
|
|
1040
|
+
state = _export.Layer.mergeEqualsVertices(state, layerID, line.vertices.get(1)).updatedState;
|
|
1041
|
+
if (_export2.GeometryUtils.samePoints({
|
|
1038
1042
|
newVertex0X: newVertex0X,
|
|
1039
1043
|
newVertex0Y: newVertex0Y
|
|
1040
1044
|
}, {
|
|
@@ -1050,13 +1054,13 @@ var Line = /*#__PURE__*/function () {
|
|
|
1050
1054
|
x: newVertex1X,
|
|
1051
1055
|
y: newVertex1Y
|
|
1052
1056
|
}, state).updatedState;
|
|
1053
|
-
state = this.applyWallChanges(state, END_DRAGGING_LINE).updatedState;
|
|
1057
|
+
state = this.applyWallChanges(state, _constants.END_DRAGGING_LINE).updatedState;
|
|
1054
1058
|
}
|
|
1055
1059
|
state = state.merge({
|
|
1056
|
-
mode: MODE_IDLE,
|
|
1060
|
+
mode: _constants.MODE_IDLE,
|
|
1057
1061
|
draggingSupport: null,
|
|
1058
1062
|
activeSnapElement: null,
|
|
1059
|
-
snapElements: new List()
|
|
1063
|
+
snapElements: new _immutable.List()
|
|
1060
1064
|
});
|
|
1061
1065
|
return {
|
|
1062
1066
|
updatedState: state
|
|
@@ -1073,7 +1077,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
1073
1077
|
}, {
|
|
1074
1078
|
key: "setJsProperties",
|
|
1075
1079
|
value: function setJsProperties(state, layerID, lineID, properties) {
|
|
1076
|
-
return this.setProperties(state, layerID, lineID, fromJS(properties));
|
|
1080
|
+
return this.setProperties(state, layerID, lineID, (0, _immutable.fromJS)(properties));
|
|
1077
1081
|
}
|
|
1078
1082
|
}, {
|
|
1079
1083
|
key: "updateProperties",
|
|
@@ -1088,7 +1092,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
1088
1092
|
}, {
|
|
1089
1093
|
key: "updateJsProperties",
|
|
1090
1094
|
value: function updateJsProperties(state, layerID, lineID, properties) {
|
|
1091
|
-
return this.updateProperties(state, layerID, lineID, fromJS(properties));
|
|
1095
|
+
return this.updateProperties(state, layerID, lineID, (0, _immutable.fromJS)(properties));
|
|
1092
1096
|
}
|
|
1093
1097
|
}, {
|
|
1094
1098
|
key: "setAttributes",
|
|
@@ -1107,17 +1111,17 @@ var Line = /*#__PURE__*/function () {
|
|
|
1107
1111
|
delete lAttr['lineToExtend'];
|
|
1108
1112
|
delete lAttr['lineLength'];
|
|
1109
1113
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
1110
|
-
state = state.mergeIn(['scene', 'layers', layerID, 'lines', lineID], fromJS(lAttr)).mergeIn(['scene', 'layers', layerID, 'vertices', vertexOne.id], {
|
|
1114
|
+
state = state.mergeIn(['scene', 'layers', layerID, 'lines', lineID], (0, _immutable.fromJS)(lAttr)).mergeIn(['scene', 'layers', layerID, 'vertices', vertexOne.id], {
|
|
1111
1115
|
x: vertexOne.x,
|
|
1112
1116
|
y: vertexOne.y
|
|
1113
1117
|
}).mergeIn(['scene', 'layers', layerID, 'vertices', vertexTwo.id], {
|
|
1114
1118
|
x: vertexTwo.x,
|
|
1115
1119
|
y: vertexTwo.y
|
|
1116
|
-
}).mergeIn(['scene', 'layers', layerID, 'lines', lineID, 'misc'], new Map({
|
|
1120
|
+
}).mergeIn(['scene', 'layers', layerID, 'lines', lineID, 'misc'], new _immutable.Map({
|
|
1117
1121
|
_unitLength: lineLength._unit
|
|
1118
1122
|
})).mergeIn(['scene', 'layers', layerID, 'lines', lineID, 'focus'], true);
|
|
1119
1123
|
if (lineToExtend) {
|
|
1120
|
-
state = state.mergeIn(['scene', 'layers', layerID, 'lines', lineToExtend.id], fromJS(lAttr)).mergeIn(['scene', 'layers', layerID, 'lines', lineToExtend.id, 'misc'], new Map({
|
|
1124
|
+
state = state.mergeIn(['scene', 'layers', layerID, 'lines', lineToExtend.id], (0, _immutable.fromJS)(lAttr)).mergeIn(['scene', 'layers', layerID, 'lines', lineToExtend.id, 'misc'], new _immutable.Map({
|
|
1121
1125
|
_unitLength: lineLength._unit
|
|
1122
1126
|
}));
|
|
1123
1127
|
}
|
|
@@ -1133,14 +1137,14 @@ var Line = /*#__PURE__*/function () {
|
|
|
1133
1137
|
y: vertexFour.y
|
|
1134
1138
|
});
|
|
1135
1139
|
}
|
|
1136
|
-
state = Layer.mergeEqualsVertices(state, layerID, vertexOne.id).updatedState;
|
|
1140
|
+
state = _export.Layer.mergeEqualsVertices(state, layerID, vertexOne.id).updatedState;
|
|
1137
1141
|
if (vertexOne.x != vertexTwo.x && vertexOne.y != vertexTwo.y) {
|
|
1138
|
-
state = Layer.mergeEqualsVertices(state, layerID, vertexTwo.id).updatedState;
|
|
1142
|
+
state = _export.Layer.mergeEqualsVertices(state, layerID, vertexTwo.id).updatedState;
|
|
1139
1143
|
}
|
|
1140
1144
|
state = this.select(state, layerID, lineID).updatedState;
|
|
1141
|
-
state = this.applyWallChanges(state, END_DRAWING_LINE).updatedState;
|
|
1145
|
+
state = this.applyWallChanges(state, _constants.END_DRAWING_LINE).updatedState;
|
|
1142
1146
|
state = state.merge({
|
|
1143
|
-
sceneHistory: history.historyPush(state.sceneHistory, state.scene)
|
|
1147
|
+
sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
|
|
1144
1148
|
});
|
|
1145
1149
|
if (state.mode.endsWith('_LINE')) {
|
|
1146
1150
|
state = state.setIn(['scene', 'setLineAttributes'], true);
|
|
@@ -1154,11 +1158,11 @@ var Line = /*#__PURE__*/function () {
|
|
|
1154
1158
|
key: "setVerticesCoords",
|
|
1155
1159
|
value: function setVerticesCoords(state, layerID, lineID, x1, y1, x2, y2) {
|
|
1156
1160
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
1157
|
-
state = Vertex.setAttributes(state, layerID, line.vertices.get(0), new Map({
|
|
1161
|
+
state = _export.Vertex.setAttributes(state, layerID, line.vertices.get(0), new _immutable.Map({
|
|
1158
1162
|
x: x1,
|
|
1159
1163
|
y: y1
|
|
1160
1164
|
})).updatedState;
|
|
1161
|
-
state = Vertex.setAttributes(state, layerID, line.vertices.get(1), new Map({
|
|
1165
|
+
state = _export.Vertex.setAttributes(state, layerID, line.vertices.get(1), new _immutable.Map({
|
|
1162
1166
|
x: x2,
|
|
1163
1167
|
y: y2
|
|
1164
1168
|
})).updatedState;
|
|
@@ -1167,5 +1171,4 @@ var Line = /*#__PURE__*/function () {
|
|
|
1167
1171
|
};
|
|
1168
1172
|
}
|
|
1169
1173
|
}]);
|
|
1170
|
-
}();
|
|
1171
|
-
export { Line as default };
|
|
1174
|
+
}();
|