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/hole.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports["default"] = void 0;
|
|
4
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
5
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
6
|
+
var _immutable = require("immutable");
|
|
7
|
+
var _export = require("./export");
|
|
8
|
+
var _export2 = require("../utils/export");
|
|
9
|
+
var _snap = require("../utils/snap");
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
var Hole = exports["default"] = /*#__PURE__*/function () {
|
|
9
12
|
function Hole() {
|
|
10
|
-
|
|
13
|
+
(0, _classCallCheck2["default"])(this, Hole);
|
|
11
14
|
}
|
|
12
|
-
return
|
|
15
|
+
return (0, _createClass2["default"])(Hole, null, [{
|
|
13
16
|
key: "create",
|
|
14
17
|
value: function create(state, layerID, type, lineID, offset, properties, holeX, holeY) {
|
|
15
|
-
var holeID = IDBroker.acquireID();
|
|
18
|
+
var holeID = _export2.IDBroker.acquireID();
|
|
16
19
|
var hole = state.catalog.factoryElement(type, {
|
|
17
20
|
id: holeID,
|
|
18
21
|
url: state.catalog.getIn(['elements', type, 'info', 'url']),
|
|
@@ -73,8 +76,8 @@ var Hole = /*#__PURE__*/function () {
|
|
|
73
76
|
}, {
|
|
74
77
|
key: "select",
|
|
75
78
|
value: function select(state, layerID, holeID) {
|
|
76
|
-
state = Layer.select(state, layerID).updatedState;
|
|
77
|
-
state = Layer.selectElement(state, layerID, 'holes', holeID).updatedState;
|
|
79
|
+
state = _export.Layer.select(state, layerID).updatedState;
|
|
80
|
+
state = _export.Layer.selectElement(state, layerID, 'holes', holeID).updatedState;
|
|
78
81
|
return {
|
|
79
82
|
updatedState: state
|
|
80
83
|
};
|
|
@@ -84,7 +87,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
84
87
|
value: function remove(state, layerID, holeID) {
|
|
85
88
|
var hole = state.getIn(['scene', 'layers', layerID, 'holes', holeID]);
|
|
86
89
|
state = this.unselect(state, layerID, holeID).updatedState;
|
|
87
|
-
state = Layer.removeElement(state, layerID, 'holes', holeID).updatedState;
|
|
90
|
+
state = _export.Layer.removeElement(state, layerID, 'holes', holeID).updatedState;
|
|
88
91
|
state = state.updateIn(['scene', 'layers', layerID, 'lines', hole.line, 'holes'], function (holes) {
|
|
89
92
|
var index = holes.findIndex(function (ID) {
|
|
90
93
|
return holeID === ID;
|
|
@@ -92,7 +95,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
92
95
|
return index !== -1 ? holes.remove(index) : holes;
|
|
93
96
|
});
|
|
94
97
|
state.getIn(['scene', 'groups']).forEach(function (group) {
|
|
95
|
-
return state = Group.removeElement(state, group.id, layerID, 'holes', holeID).updatedState;
|
|
98
|
+
return state = _export.Group.removeElement(state, group.id, layerID, 'holes', holeID).updatedState;
|
|
96
99
|
});
|
|
97
100
|
return {
|
|
98
101
|
updatedState: state
|
|
@@ -101,7 +104,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
101
104
|
}, {
|
|
102
105
|
key: "unselect",
|
|
103
106
|
value: function unselect(state, layerID, holeID) {
|
|
104
|
-
state = Layer.unselect(state, layerID, 'holes', holeID).updatedState;
|
|
107
|
+
state = _export.Layer.unselect(state, layerID, 'holes', holeID).updatedState;
|
|
105
108
|
return {
|
|
106
109
|
updatedState: state
|
|
107
110
|
};
|
|
@@ -109,7 +112,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
109
112
|
}, {
|
|
110
113
|
key: "selectToolDrawingHole",
|
|
111
114
|
value: function selectToolDrawingHole(state, sceneComponentType) {
|
|
112
|
-
var snapElements = new List().withMutations(function (snapElements) {
|
|
115
|
+
var snapElements = new _immutable.List().withMutations(function (snapElements) {
|
|
113
116
|
var _state$getIn = state.getIn(['scene', 'layers', state.scene.selectedLayer]),
|
|
114
117
|
lines = _state$getIn.lines,
|
|
115
118
|
vertices = _state$getIn.vertices;
|
|
@@ -120,13 +123,13 @@ var Hole = /*#__PURE__*/function () {
|
|
|
120
123
|
var _vertices$get2 = vertices.get(line.vertices.get(1)),
|
|
121
124
|
x2 = _vertices$get2.x,
|
|
122
125
|
y2 = _vertices$get2.y;
|
|
123
|
-
addLineSegmentSnap(snapElements, x1, y1, x2, y2, 20, 1, line.id);
|
|
126
|
+
(0, _snap.addLineSegmentSnap)(snapElements, x1, y1, x2, y2, 20, 1, line.id);
|
|
124
127
|
});
|
|
125
128
|
});
|
|
126
129
|
state = state.merge({
|
|
127
|
-
mode: MODE_DRAWING_HOLE,
|
|
130
|
+
mode: _constants.MODE_DRAWING_HOLE,
|
|
128
131
|
snapElements: snapElements,
|
|
129
|
-
drawingSupport: Map({
|
|
132
|
+
drawingSupport: (0, _immutable.Map)({
|
|
130
133
|
type: sceneComponentType
|
|
131
134
|
})
|
|
132
135
|
});
|
|
@@ -137,7 +140,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
137
140
|
}, {
|
|
138
141
|
key: "selectToolDrawingHole3D",
|
|
139
142
|
value: function selectToolDrawingHole3D(state, sceneComponentType) {
|
|
140
|
-
var snapElements = new List().withMutations(function (snapElements) {
|
|
143
|
+
var snapElements = new _immutable.List().withMutations(function (snapElements) {
|
|
141
144
|
var _state$getIn2 = state.getIn(['scene', 'layers', state.scene.selectedLayer]),
|
|
142
145
|
lines = _state$getIn2.lines,
|
|
143
146
|
vertices = _state$getIn2.vertices;
|
|
@@ -148,13 +151,13 @@ var Hole = /*#__PURE__*/function () {
|
|
|
148
151
|
var _vertices$get4 = vertices.get(line.vertices.get(1)),
|
|
149
152
|
x2 = _vertices$get4.x,
|
|
150
153
|
y2 = _vertices$get4.y;
|
|
151
|
-
addLineSegmentSnap(snapElements, x1, y1, x2, y2, 20, 1, line.id);
|
|
154
|
+
(0, _snap.addLineSegmentSnap)(snapElements, x1, y1, x2, y2, 20, 1, line.id);
|
|
152
155
|
});
|
|
153
156
|
});
|
|
154
157
|
state = state.merge({
|
|
155
|
-
mode: MODE_DRAWING_HOLE_3D,
|
|
158
|
+
mode: _constants.MODE_DRAWING_HOLE_3D,
|
|
156
159
|
snapElements: snapElements,
|
|
157
|
-
drawingSupport: Map({
|
|
160
|
+
drawingSupport: (0, _immutable.Map)({
|
|
158
161
|
type: sceneComponentType
|
|
159
162
|
})
|
|
160
163
|
});
|
|
@@ -169,7 +172,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
169
172
|
var catalog = state.catalog;
|
|
170
173
|
//calculate snap and overwrite coords if needed
|
|
171
174
|
//force snap to segment
|
|
172
|
-
var snap = nearestSnap(state.snapElements, x, y, state.snapMask.merge({
|
|
175
|
+
var snap = (0, _snap.nearestSnap)(state.snapElements, x, y, state.snapMask.merge({
|
|
173
176
|
SNAP_SEGMENT: true
|
|
174
177
|
}));
|
|
175
178
|
if (snap) {
|
|
@@ -189,14 +192,14 @@ var Hole = /*#__PURE__*/function () {
|
|
|
189
192
|
y2 = _state$getIn4.y;
|
|
190
193
|
|
|
191
194
|
// // I need min and max vertices on this line segment
|
|
192
|
-
var minVertex = GeometryUtils.minVertex({
|
|
195
|
+
var minVertex = _export2.GeometryUtils.minVertex({
|
|
193
196
|
x: x1,
|
|
194
197
|
y: y1
|
|
195
198
|
}, {
|
|
196
199
|
x: x2,
|
|
197
200
|
y: y2
|
|
198
201
|
});
|
|
199
|
-
var maxVertex = GeometryUtils.maxVertex({
|
|
202
|
+
var maxVertex = _export2.GeometryUtils.maxVertex({
|
|
200
203
|
x: x1,
|
|
201
204
|
y: y1
|
|
202
205
|
}, {
|
|
@@ -206,10 +209,10 @@ var Hole = /*#__PURE__*/function () {
|
|
|
206
209
|
var width = catalog.factoryElement(state.drawingSupport.get('type')).properties.getIn(['width', 'length']);
|
|
207
210
|
|
|
208
211
|
// // Now I need min and max possible coordinates for the hole on the line. They depend on the width of the hole
|
|
209
|
-
var lineLength = GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
210
|
-
var alpha = GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
211
|
-
var cosAlpha = GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
212
|
-
var sinAlpha = GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
212
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
213
|
+
var alpha = _export2.GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
214
|
+
var cosAlpha = _export2.GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
215
|
+
var sinAlpha = _export2.GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
213
216
|
var minLeftVertexHole = {
|
|
214
217
|
x: minVertex.x + (state.mode.includes('ING_HOLE') ? width + 1 : width) / 2 * cosAlpha,
|
|
215
218
|
y: minVertex.y + (state.mode.includes('ING_HOLE') ? width + 1 : width) / 2 * sinAlpha
|
|
@@ -220,24 +223,24 @@ var Hole = /*#__PURE__*/function () {
|
|
|
220
223
|
};
|
|
221
224
|
var offset;
|
|
222
225
|
if (x < minLeftVertexHole.x) {
|
|
223
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
226
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
224
227
|
offset = minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
225
228
|
} else {
|
|
226
229
|
if (x > maxRightVertexHole.x) {
|
|
227
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
230
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
228
231
|
offset = minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
229
232
|
} else if (x === minLeftVertexHole.x && x === maxRightVertexHole.x) {
|
|
230
233
|
if (y < minLeftVertexHole.y) {
|
|
231
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
234
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
232
235
|
offset = minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
233
236
|
} else if (y > maxRightVertexHole.y) {
|
|
234
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
237
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
235
238
|
offset = minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
236
239
|
} else {
|
|
237
|
-
offset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
240
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
238
241
|
}
|
|
239
242
|
} else {
|
|
240
|
-
offset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
243
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
241
244
|
// offset =
|
|
242
245
|
// minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
243
246
|
}
|
|
@@ -358,7 +361,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
358
361
|
var catalog = state.catalog;
|
|
359
362
|
//calculate snap and overwrite coords if needed
|
|
360
363
|
//force snap to segment
|
|
361
|
-
var snap = nearestSnap(state.snapElements, x, y, state.snapMask.merge({
|
|
364
|
+
var snap = (0, _snap.nearestSnap)(state.snapElements, x, y, state.snapMask.merge({
|
|
362
365
|
SNAP_SEGMENT: true
|
|
363
366
|
}));
|
|
364
367
|
if (snap) {
|
|
@@ -378,14 +381,14 @@ var Hole = /*#__PURE__*/function () {
|
|
|
378
381
|
y2 = _state$getIn6.y;
|
|
379
382
|
|
|
380
383
|
// // I need min and max vertices on this line segment
|
|
381
|
-
var minVertex = GeometryUtils.minVertex({
|
|
384
|
+
var minVertex = _export2.GeometryUtils.minVertex({
|
|
382
385
|
x: x1,
|
|
383
386
|
y: y1
|
|
384
387
|
}, {
|
|
385
388
|
x: x2,
|
|
386
389
|
y: y2
|
|
387
390
|
});
|
|
388
|
-
var maxVertex = GeometryUtils.maxVertex({
|
|
391
|
+
var maxVertex = _export2.GeometryUtils.maxVertex({
|
|
389
392
|
x: x1,
|
|
390
393
|
y: y1
|
|
391
394
|
}, {
|
|
@@ -395,10 +398,10 @@ var Hole = /*#__PURE__*/function () {
|
|
|
395
398
|
var width = catalog.factoryElement(state.drawingSupport.get('type')).properties.getIn(['width', 'length']);
|
|
396
399
|
|
|
397
400
|
// // Now I need min and max possible coordinates for the hole on the line. They depend on the width of the hole
|
|
398
|
-
var lineLength = GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
399
|
-
var alpha = GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
400
|
-
var cosAlpha = GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
401
|
-
var sinAlpha = GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
401
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
402
|
+
var alpha = _export2.GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
403
|
+
var cosAlpha = _export2.GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
404
|
+
var sinAlpha = _export2.GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
402
405
|
var minLeftVertexHole = {
|
|
403
406
|
x: minVertex.x + (state.mode.includes('ING_HOLE_3D') ? width + 1 : width) / 2 * cosAlpha,
|
|
404
407
|
y: minVertex.y + (state.mode.includes('ING_HOLE_3D') ? width + 1 : width) / 2 * sinAlpha
|
|
@@ -409,28 +412,28 @@ var Hole = /*#__PURE__*/function () {
|
|
|
409
412
|
};
|
|
410
413
|
var offset;
|
|
411
414
|
if (x < minLeftVertexHole.x) {
|
|
412
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
415
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
413
416
|
} else if (x > maxRightVertexHole.x) {
|
|
414
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
417
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
415
418
|
} else {
|
|
416
419
|
if (x === minLeftVertexHole.x && x === maxRightVertexHole.x) {
|
|
417
420
|
if (y < minLeftVertexHole.y) {
|
|
418
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
421
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
419
422
|
/*
|
|
420
423
|
offset =
|
|
421
424
|
minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
422
425
|
*/
|
|
423
426
|
} else if (y > maxRightVertexHole.y) {
|
|
424
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
427
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
425
428
|
/*
|
|
426
429
|
offset =
|
|
427
430
|
minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
428
431
|
*/
|
|
429
432
|
} else {
|
|
430
|
-
offset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
433
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
431
434
|
}
|
|
432
435
|
} else {
|
|
433
|
-
offset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
436
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
434
437
|
}
|
|
435
438
|
}
|
|
436
439
|
if (this.checkHoleCollide(state.getIn(['scene', 'layers', layerID]), lineID, selectedHole, x, y, width)) {
|
|
@@ -586,16 +589,16 @@ var Hole = /*#__PURE__*/function () {
|
|
|
586
589
|
key: "endDrawingHole",
|
|
587
590
|
value: function endDrawingHole(state, layerID, x, y) {
|
|
588
591
|
state = this.updateDrawingHole(state, layerID, x, y).updatedState;
|
|
589
|
-
state = Layer.unselectAll(state, layerID).updatedState;
|
|
592
|
+
state = _export.Layer.unselectAll(state, layerID).updatedState;
|
|
590
593
|
var popup = state.get('popup');
|
|
591
594
|
state = state.merge({
|
|
592
|
-
drawingSupport: Map({
|
|
595
|
+
drawingSupport: (0, _immutable.Map)({
|
|
593
596
|
type: state.drawingSupport.get('type')
|
|
594
597
|
}),
|
|
595
598
|
isOpen: !popup,
|
|
596
|
-
mode: MODE_IDLE
|
|
599
|
+
mode: _constants.MODE_IDLE
|
|
597
600
|
});
|
|
598
|
-
state = Layer.unselectAll(state, layerID).updatedState;
|
|
601
|
+
state = _export.Layer.unselectAll(state, layerID).updatedState;
|
|
599
602
|
return {
|
|
600
603
|
updatedState: state
|
|
601
604
|
};
|
|
@@ -604,17 +607,17 @@ var Hole = /*#__PURE__*/function () {
|
|
|
604
607
|
key: "endDrawingHole3D",
|
|
605
608
|
value: function endDrawingHole3D(state, layerID, x, y) {
|
|
606
609
|
state = state.merge({
|
|
607
|
-
mode: MODE_IDLE_3D
|
|
610
|
+
mode: _constants.MODE_IDLE_3D
|
|
608
611
|
});
|
|
609
612
|
state = this.updateDrawingHole3D(state, layerID, x, y).updatedState;
|
|
610
|
-
state = Layer.unselectAll(state, layerID).updatedState;
|
|
613
|
+
state = _export.Layer.unselectAll(state, layerID).updatedState;
|
|
611
614
|
var popup = state.get('popup');
|
|
612
615
|
state = state.merge({
|
|
613
|
-
drawingSupport: Map({
|
|
616
|
+
drawingSupport: (0, _immutable.Map)({
|
|
614
617
|
type: state.drawingSupport.get('type')
|
|
615
618
|
}),
|
|
616
619
|
isOpen: !popup,
|
|
617
|
-
mode: MODE_IDLE_3D
|
|
620
|
+
mode: _constants.MODE_IDLE_3D
|
|
618
621
|
});
|
|
619
622
|
return {
|
|
620
623
|
updatedState: state
|
|
@@ -628,11 +631,11 @@ var Hole = /*#__PURE__*/function () {
|
|
|
628
631
|
var line = layer.getIn(['lines', hole.line]);
|
|
629
632
|
var v0 = layer.getIn(['vertices', line.vertices.get(0)]);
|
|
630
633
|
var v1 = layer.getIn(['vertices', line.vertices.get(1)]);
|
|
631
|
-
var snapElements = addLineSegmentSnap(List(), v0.x, v0.y, v1.x, v1.y, 9999999, 1, null);
|
|
634
|
+
var snapElements = (0, _snap.addLineSegmentSnap)((0, _immutable.List)(), v0.x, v0.y, v1.x, v1.y, 9999999, 1, null);
|
|
632
635
|
state = state.merge({
|
|
633
|
-
mode: MODE_DRAGGING_HOLE,
|
|
636
|
+
mode: _constants.MODE_DRAGGING_HOLE,
|
|
634
637
|
snapElements: snapElements,
|
|
635
|
-
draggingSupport: Map({
|
|
638
|
+
draggingSupport: (0, _immutable.Map)({
|
|
636
639
|
layerID: layerID,
|
|
637
640
|
holeID: holeID,
|
|
638
641
|
startPointX: x,
|
|
@@ -651,7 +654,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
651
654
|
var line = layer.getIn(['lines', hole.line]);
|
|
652
655
|
var v0 = layer.getIn(['vertices', line.vertices.get(0)]);
|
|
653
656
|
var v1 = layer.getIn(['vertices', line.vertices.get(1)]);
|
|
654
|
-
var snapElements = addLineSegmentSnap(List(), v0.x, v0.y, v1.x, v1.y, 9999999, 1, null);
|
|
657
|
+
var snapElements = (0, _snap.addLineSegmentSnap)((0, _immutable.List)(), v0.x, v0.y, v1.x, v1.y, 9999999, 1, null);
|
|
655
658
|
state = state.updateIn(['scene', 'layers', layerID, 'lines', hole.line, 'holes'], function (holes) {
|
|
656
659
|
var index = holes.findIndex(function (ID) {
|
|
657
660
|
return holeID === ID;
|
|
@@ -659,9 +662,9 @@ var Hole = /*#__PURE__*/function () {
|
|
|
659
662
|
return index !== -1 ? holes.remove(index) : holes;
|
|
660
663
|
});
|
|
661
664
|
state = state.merge({
|
|
662
|
-
mode: MODE_DRAGGING_HOLE_3D,
|
|
665
|
+
mode: _constants.MODE_DRAGGING_HOLE_3D,
|
|
663
666
|
snapElements: snapElements,
|
|
664
|
-
draggingSupport: Map({
|
|
667
|
+
draggingSupport: (0, _immutable.Map)({
|
|
665
668
|
layerID: layerID,
|
|
666
669
|
holeID: holeID,
|
|
667
670
|
startPointX: x,
|
|
@@ -677,7 +680,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
677
680
|
value: function updateDraggingHole(state, x, y) {
|
|
678
681
|
//calculate snap and overwrite coords if needed
|
|
679
682
|
//force snap to segment
|
|
680
|
-
var snap = nearestSnap(state.snapElements, x, y, state.snapMask.merge({
|
|
683
|
+
var snap = (0, _snap.nearestSnap)(state.snapElements, x, y, state.snapMask.merge({
|
|
681
684
|
SNAP_SEGMENT: true
|
|
682
685
|
}));
|
|
683
686
|
if (!snap) return state;
|
|
@@ -697,13 +700,13 @@ var Hole = /*#__PURE__*/function () {
|
|
|
697
700
|
var _snap$point3 = snap.point;
|
|
698
701
|
x = _snap$point3.x;
|
|
699
702
|
y = _snap$point3.y;
|
|
700
|
-
var minVertex = GeometryUtils.minVertex(v0, v1);
|
|
701
|
-
var maxVertex = GeometryUtils.maxVertex(v0, v1);
|
|
703
|
+
var minVertex = _export2.GeometryUtils.minVertex(v0, v1);
|
|
704
|
+
var maxVertex = _export2.GeometryUtils.maxVertex(v0, v1);
|
|
702
705
|
|
|
703
706
|
// Now I need min and max possible coordinates for the hole on the line. They depend on the width of the hole
|
|
704
707
|
|
|
705
708
|
var width = hole.properties.get('width').get('length');
|
|
706
|
-
var lineLength = GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
709
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
707
710
|
var alpha = Math.atan2(v1.y - v0.y, Math.abs(v1.x - v0.x));
|
|
708
711
|
var alpha1 = Math.atan2(v1.y - v0.y, v1.x - v0.x);
|
|
709
712
|
var angle_temp;
|
|
@@ -735,27 +738,27 @@ var Hole = /*#__PURE__*/function () {
|
|
|
735
738
|
var offset;
|
|
736
739
|
if (x < minLeftVertexHole.x) {
|
|
737
740
|
// Snap point is previous the the line
|
|
738
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
741
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
739
742
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
740
743
|
} else {
|
|
741
744
|
// Snap point is after the line or on the line
|
|
742
745
|
if (x > maxRightVertexHole.x) {
|
|
743
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
746
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
744
747
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
745
748
|
} else if (x === minLeftVertexHole.x && x === maxRightVertexHole.x) {
|
|
746
749
|
// I am on a vertical line, I need to check y coordinates
|
|
747
750
|
if (y < minLeftVertexHole.y) {
|
|
748
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
751
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
749
752
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
750
753
|
} else if (y > maxRightVertexHole.y) {
|
|
751
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
754
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
752
755
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
753
756
|
} else {
|
|
754
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, x, y);
|
|
757
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, x, y);
|
|
755
758
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
756
759
|
}
|
|
757
760
|
} else {
|
|
758
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, x, y);
|
|
761
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, x, y);
|
|
759
762
|
if (angle_temp > 90 && angle_temp < 270) {
|
|
760
763
|
offset = 1 - offset;
|
|
761
764
|
}
|
|
@@ -835,8 +838,8 @@ var Hole = /*#__PURE__*/function () {
|
|
|
835
838
|
return index === -1 ? holes.push(holeID) : holes;
|
|
836
839
|
});
|
|
837
840
|
state = state.merge({
|
|
838
|
-
mode: MODE_IDLE_3D,
|
|
839
|
-
draggingSupport: Map({})
|
|
841
|
+
mode: _constants.MODE_IDLE_3D,
|
|
842
|
+
draggingSupport: (0, _immutable.Map)({})
|
|
840
843
|
});
|
|
841
844
|
return {
|
|
842
845
|
updatedState: state
|
|
@@ -864,7 +867,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
864
867
|
value: function endDraggingHole(state, x, y) {
|
|
865
868
|
state = this.updateDraggingHole(state, x, y).updatedState;
|
|
866
869
|
state = state.merge({
|
|
867
|
-
mode: MODE_IDLE
|
|
870
|
+
mode: _constants.MODE_IDLE
|
|
868
871
|
});
|
|
869
872
|
return {
|
|
870
873
|
updatedState: state
|
|
@@ -881,7 +884,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
881
884
|
}, {
|
|
882
885
|
key: "setJsProperties",
|
|
883
886
|
value: function setJsProperties(state, layerID, holeID, properties) {
|
|
884
|
-
return this.setProperties(state, layerID, holeID, fromJS(properties));
|
|
887
|
+
return this.setProperties(state, layerID, holeID, (0, _immutable.fromJS)(properties));
|
|
885
888
|
}
|
|
886
889
|
}, {
|
|
887
890
|
key: "updateProperties",
|
|
@@ -896,7 +899,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
896
899
|
}, {
|
|
897
900
|
key: "updateJsProperties",
|
|
898
901
|
value: function updateJsProperties(state, layerID, holeID, properties) {
|
|
899
|
-
return this.updateProperties(state, layerID, holeID, fromJS(properties));
|
|
902
|
+
return this.updateProperties(state, layerID, holeID, (0, _immutable.fromJS)(properties));
|
|
900
903
|
}
|
|
901
904
|
}, {
|
|
902
905
|
key: "setAttributes",
|
|
@@ -908,11 +911,11 @@ var Hole = /*#__PURE__*/function () {
|
|
|
908
911
|
delete hAttr['offsetA'];
|
|
909
912
|
delete hAttr['offsetB'];
|
|
910
913
|
delete hAttr['offset'];
|
|
911
|
-
var misc = new Map({
|
|
914
|
+
var misc = new _immutable.Map({
|
|
912
915
|
_unitA: offsetA._unit,
|
|
913
916
|
_unitB: offsetB._unit
|
|
914
917
|
});
|
|
915
|
-
state = state.mergeIn(['scene', 'layers', layerID, 'holes', holeID], fromJS(hAttr)).mergeDeepIn(['scene', 'layers', layerID, 'holes', holeID], new Map({
|
|
918
|
+
state = state.mergeIn(['scene', 'layers', layerID, 'holes', holeID], (0, _immutable.fromJS)(hAttr)).mergeDeepIn(['scene', 'layers', layerID, 'holes', holeID], new _immutable.Map({
|
|
916
919
|
offset: offset,
|
|
917
920
|
misc: misc
|
|
918
921
|
}));
|
|
@@ -921,5 +924,4 @@ var Hole = /*#__PURE__*/function () {
|
|
|
921
924
|
};
|
|
922
925
|
}
|
|
923
926
|
}]);
|
|
924
|
-
}();
|
|
925
|
-
export { Hole as default };
|
|
927
|
+
}();
|