kitchen-simulator 1.1.1-test.64 → 1.1.1-test.65
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 +10 -2
- package/es/AppContext.js +10 -3
- package/es/KitchenConfigurator.js +79 -70
- package/es/KitchenConfiguratorApp.js +107 -98
- package/es/actions/area-actions.js +12 -5
- package/es/actions/export.js +29 -12
- package/es/actions/groups-actions.js +45 -27
- package/es/actions/holes-actions.js +55 -34
- package/es/actions/items-actions.js +145 -94
- package/es/actions/lines-actions.js +36 -21
- package/es/actions/project-actions.js +145 -94
- package/es/actions/scene-actions.js +21 -11
- package/es/actions/vertices-actions.js +15 -7
- package/es/actions/viewer2d-actions.js +36 -21
- package/es/actions/viewer3d-actions.js +18 -9
- package/es/catalog/areas/area/planner-element.js +9 -2
- package/es/catalog/catalog.js +21 -15
- package/es/catalog/factories/area-factory-3d.js +31 -22
- package/es/catalog/factories/area-factory.js +20 -11
- package/es/catalog/factories/export.js +24 -6
- package/es/catalog/factories/wall-factory-3d.js +41 -31
- package/es/catalog/factories/wall-factory.js +31 -21
- package/es/catalog/holes/door-closet/planner-element.js +24 -15
- package/es/catalog/holes/door-double/planner-element.js +24 -15
- package/es/catalog/holes/door-exterior/planner-element.js +25 -16
- package/es/catalog/holes/door-interior/planner-element.js +25 -16
- package/es/catalog/holes/door-panic/planner-element.js +16 -7
- package/es/catalog/holes/door-panic-double/planner-element.js +24 -15
- package/es/catalog/holes/door-sliding/planner-element.js +25 -16
- package/es/catalog/holes/doorway-framed/planner-element.js +20 -11
- package/es/catalog/holes/doorway-frameless/planner-element.js +16 -7
- package/es/catalog/holes/export.js +97 -13
- package/es/catalog/holes/window-clear/planner-element.js +19 -10
- package/es/catalog/holes/window-cross/planner-element.js +19 -10
- package/es/catalog/holes/window-double-hung/planner-element.js +19 -10
- package/es/catalog/holes/window-vertical/planner-element.js +19 -10
- package/es/catalog/lines/wall/planner-element.js +9 -2
- package/es/catalog/molding/molding-dcm/planner-element.js +14 -5
- package/es/catalog/molding/molding-fbm/planner-element.js +14 -5
- package/es/catalog/molding/molding-lrm/planner-element.js +14 -5
- package/es/catalog/properties/export.js +80 -20
- package/es/catalog/properties/property-checkbox.js +31 -24
- package/es/catalog/properties/property-color.js +23 -16
- package/es/catalog/properties/property-enum.js +31 -24
- package/es/catalog/properties/property-hidden.js +16 -9
- package/es/catalog/properties/property-lenght-measure.js +45 -38
- package/es/catalog/properties/property-length-measure.js +43 -36
- package/es/catalog/properties/property-length-measure_hole.js +45 -38
- package/es/catalog/properties/property-number.js +24 -17
- package/es/catalog/properties/property-read-only.js +23 -16
- package/es/catalog/properties/property-string.js +23 -16
- package/es/catalog/properties/property-toggle.js +23 -16
- package/es/catalog/properties/shared-property-style.js +7 -1
- package/es/catalog/utils/FuseUtils.js +15 -8
- package/es/catalog/utils/exporter.js +15 -8
- package/es/catalog/utils/geom-utils.js +29 -13
- package/es/catalog/utils/item-loader.js +97 -84
- package/es/catalog/utils/load-obj.js +28 -20
- package/es/catalog/utils/mtl-loader.js +8 -3
- package/es/catalog/utils/obj-loader.js +8 -3
- package/es/class/FuseUtils.js +15 -8
- package/es/class/area.js +28 -22
- package/es/class/export.js +95 -23
- package/es/class/group.js +59 -53
- package/es/class/guide.js +21 -15
- package/es/class/hole.js +89 -83
- package/es/class/item.js +147 -141
- package/es/class/layer.js +65 -59
- package/es/class/line.js +143 -135
- package/es/class/project.js +98 -90
- package/es/class/vertex.js +35 -29
- package/es/components/content.js +28 -19
- package/es/components/disclaimer/disclaimer.js +18 -10
- package/es/components/export.js +32 -8
- package/es/components/style/button.js +31 -23
- package/es/components/style/cancel-button.js +14 -7
- package/es/components/style/content-container.js +16 -9
- package/es/components/style/content-title.js +20 -11
- package/es/components/style/delete-button.js +17 -8
- package/es/components/style/export.js +120 -30
- package/es/components/style/form-block.js +15 -8
- package/es/components/style/form-color-input.js +14 -7
- package/es/components/style/form-label.js +15 -8
- package/es/components/style/form-number-input.js +49 -41
- package/es/components/style/form-number-input_2.js +44 -36
- package/es/components/style/form-select.js +24 -17
- package/es/components/style/form-slider.js +17 -10
- package/es/components/style/form-submit-button.js +17 -8
- package/es/components/style/form-text-input.js +34 -26
- package/es/components/viewer2d/area.js +24 -17
- package/es/components/viewer2d/export.js +120 -30
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +17 -10
- package/es/components/viewer2d/grids/grid-streak.js +17 -10
- package/es/components/viewer2d/grids/grid-vertical-streak.js +17 -10
- package/es/components/viewer2d/grids/grids.js +19 -10
- package/es/components/viewer2d/group.js +24 -15
- package/es/components/viewer2d/item.js +70 -61
- package/es/components/viewer2d/layer.js +30 -23
- package/es/components/viewer2d/line.js +111 -101
- package/es/components/viewer2d/ruler.js +29 -22
- package/es/components/viewer2d/rulerDist.js +28 -21
- package/es/components/viewer2d/rulerX.js +47 -39
- package/es/components/viewer2d/rulerY.js +45 -37
- package/es/components/viewer2d/scene.js +38 -30
- package/es/components/viewer2d/snap.js +22 -13
- package/es/components/viewer2d/state.js +27 -18
- package/es/components/viewer2d/utils.js +37 -24
- package/es/components/viewer2d/vertex.js +17 -8
- package/es/components/viewer2d/viewer2d.js +163 -153
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +23 -17
- package/es/components/viewer3d/dcm.js +7 -1
- package/es/components/viewer3d/fbm.js +7 -1
- package/es/components/viewer3d/front3D.js +21 -12
- package/es/components/viewer3d/grid-creator.js +17 -8
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +14 -6
- package/es/components/viewer3d/grids/grid-streak.js +13 -5
- package/es/components/viewer3d/grids/grid-vertical-streak.js +14 -6
- package/es/components/viewer3d/libs/first-person-controls.js +9 -2
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +7 -1
- package/es/components/viewer3d/libs/mtl-loader.js +7 -1
- package/es/components/viewer3d/libs/obj-loader.js +7 -1
- package/es/components/viewer3d/libs/orbit-controls.js +8 -2
- package/es/components/viewer3d/libs/pointer-lock-controls.js +8 -2
- package/es/components/viewer3d/lrm.js +7 -1
- package/es/components/viewer3d/model.js +7 -1
- package/es/components/viewer3d/pointer-lock-navigation.js +10 -3
- package/es/components/viewer3d/ruler-utils/itemRect.js +25 -18
- package/es/components/viewer3d/ruler-utils/layer3D.js +66 -59
- package/es/components/viewer3d/ruler-utils/ruler3D.js +46 -39
- package/es/components/viewer3d/ruler-utils/scene3D.js +17 -9
- package/es/components/viewer3d/ruler-utils/state3D.js +11 -4
- package/es/components/viewer3d/scene-creator.js +226 -191
- package/es/components/viewer3d/three-memory-cleaner.js +12 -3
- package/es/components/viewer3d/viewer3d-first-person.js +46 -40
- package/es/components/viewer3d/viewer3d.js +202 -196
- package/es/constants.js +358 -349
- package/es/index.js +15 -7
- package/es/models.js +184 -177
- package/es/plugins/SVGLoader.js +53 -48
- package/es/plugins/autosave.js +9 -3
- package/es/plugins/console-debugger.js +12 -5
- package/es/plugins/export.js +32 -8
- package/es/plugins/keyboard.js +35 -29
- package/es/reducers/areas-reducer.js +13 -7
- package/es/reducers/export.js +96 -24
- package/es/reducers/groups-reducer.js +37 -31
- package/es/reducers/holes-reducer.js +49 -43
- package/es/reducers/items-reducer.js +112 -106
- package/es/reducers/lines-reducer.js +34 -28
- package/es/reducers/project-reducer.js +111 -105
- package/es/reducers/reducer.js +23 -16
- package/es/reducers/scene-reducer.js +21 -15
- package/es/reducers/user-reducer.js +11 -5
- package/es/reducers/vertices-reducer.js +17 -11
- package/es/reducers/viewer2d-reducer.js +24 -18
- package/es/reducers/viewer3d-reducer.js +22 -16
- package/es/shared-style.js +16 -10
- package/es/styles/export.js +11 -3
- package/es/translator/en.js +7 -1
- package/es/translator/it.js +7 -1
- package/es/translator/ru.js +7 -1
- package/es/translator/translator.js +19 -13
- package/es/utils/browser.js +9 -2
- package/es/utils/convert-units-lite.js +7 -1
- package/es/utils/email-validator.js +7 -1
- package/es/utils/export.js +46 -15
- package/es/utils/geometry.js +278 -181
- package/es/utils/get-edges-of-subgraphs.js +9 -2
- package/es/utils/graph-cycles.js +11 -8
- package/es/utils/graph-inner-cycles.js +18 -10
- package/es/utils/graph.js +17 -9
- package/es/utils/helper.js +63 -39
- package/es/utils/history.js +15 -8
- package/es/utils/id-broker.js +15 -8
- package/es/utils/logger.js +7 -1
- package/es/utils/math.js +12 -5
- package/es/utils/molding.js +144 -119
- package/es/utils/name-generator.js +13 -7
- package/es/utils/objects-utils.js +19 -7
- package/es/utils/phone-validator.js +7 -1
- package/es/utils/process-black-list.js +10 -3
- package/es/utils/react-if.js +12 -6
- package/es/utils/snap-scene.js +34 -27
- package/es/utils/snap.js +59 -45
- package/es/utils/summarizeCart.js +7 -1
- package/es/utils/threeCSG.es6.js +22 -13
- package/es/version.js +7 -1
- package/package.json +1 -1
package/es/class/hole.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
|
|
10
|
+
var _immutable = require("immutable");
|
|
11
|
+
var _export = require("./export");
|
|
12
|
+
var _export2 = require("../utils/export");
|
|
13
|
+
var _snap = require("../utils/snap");
|
|
14
|
+
var _constants = require("../constants");
|
|
15
|
+
var Hole = exports["default"] = /*#__PURE__*/function () {
|
|
9
16
|
function Hole() {
|
|
10
|
-
|
|
17
|
+
(0, _classCallCheck2["default"])(this, Hole);
|
|
11
18
|
}
|
|
12
|
-
return
|
|
19
|
+
return (0, _createClass2["default"])(Hole, null, [{
|
|
13
20
|
key: "create",
|
|
14
21
|
value: function create(state, layerID, type, lineID, offset, properties, holeX, holeY) {
|
|
15
|
-
var holeID = IDBroker.acquireID();
|
|
22
|
+
var holeID = _export2.IDBroker.acquireID();
|
|
16
23
|
var hole = state.catalog.factoryElement(type, {
|
|
17
24
|
id: holeID,
|
|
18
25
|
url: state.catalog.getIn(['elements', type, 'info', 'url']),
|
|
@@ -73,8 +80,8 @@ var Hole = /*#__PURE__*/function () {
|
|
|
73
80
|
}, {
|
|
74
81
|
key: "select",
|
|
75
82
|
value: function select(state, layerID, holeID) {
|
|
76
|
-
state = Layer.select(state, layerID).updatedState;
|
|
77
|
-
state = Layer.selectElement(state, layerID, 'holes', holeID).updatedState;
|
|
83
|
+
state = _export.Layer.select(state, layerID).updatedState;
|
|
84
|
+
state = _export.Layer.selectElement(state, layerID, 'holes', holeID).updatedState;
|
|
78
85
|
return {
|
|
79
86
|
updatedState: state
|
|
80
87
|
};
|
|
@@ -84,7 +91,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
84
91
|
value: function remove(state, layerID, holeID) {
|
|
85
92
|
var hole = state.getIn(['scene', 'layers', layerID, 'holes', holeID]);
|
|
86
93
|
state = this.unselect(state, layerID, holeID).updatedState;
|
|
87
|
-
state = Layer.removeElement(state, layerID, 'holes', holeID).updatedState;
|
|
94
|
+
state = _export.Layer.removeElement(state, layerID, 'holes', holeID).updatedState;
|
|
88
95
|
state = state.updateIn(['scene', 'layers', layerID, 'lines', hole.line, 'holes'], function (holes) {
|
|
89
96
|
var index = holes.findIndex(function (ID) {
|
|
90
97
|
return holeID === ID;
|
|
@@ -92,7 +99,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
92
99
|
return index !== -1 ? holes.remove(index) : holes;
|
|
93
100
|
});
|
|
94
101
|
state.getIn(['scene', 'groups']).forEach(function (group) {
|
|
95
|
-
return state = Group.removeElement(state, group.id, layerID, 'holes', holeID).updatedState;
|
|
102
|
+
return state = _export.Group.removeElement(state, group.id, layerID, 'holes', holeID).updatedState;
|
|
96
103
|
});
|
|
97
104
|
return {
|
|
98
105
|
updatedState: state
|
|
@@ -101,7 +108,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
101
108
|
}, {
|
|
102
109
|
key: "unselect",
|
|
103
110
|
value: function unselect(state, layerID, holeID) {
|
|
104
|
-
state = Layer.unselect(state, layerID, 'holes', holeID).updatedState;
|
|
111
|
+
state = _export.Layer.unselect(state, layerID, 'holes', holeID).updatedState;
|
|
105
112
|
return {
|
|
106
113
|
updatedState: state
|
|
107
114
|
};
|
|
@@ -109,7 +116,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
109
116
|
}, {
|
|
110
117
|
key: "selectToolDrawingHole",
|
|
111
118
|
value: function selectToolDrawingHole(state, sceneComponentType) {
|
|
112
|
-
var snapElements = new List().withMutations(function (snapElements) {
|
|
119
|
+
var snapElements = new _immutable.List().withMutations(function (snapElements) {
|
|
113
120
|
var _state$getIn = state.getIn(['scene', 'layers', state.scene.selectedLayer]),
|
|
114
121
|
lines = _state$getIn.lines,
|
|
115
122
|
vertices = _state$getIn.vertices;
|
|
@@ -120,13 +127,13 @@ var Hole = /*#__PURE__*/function () {
|
|
|
120
127
|
var _vertices$get2 = vertices.get(line.vertices.get(1)),
|
|
121
128
|
x2 = _vertices$get2.x,
|
|
122
129
|
y2 = _vertices$get2.y;
|
|
123
|
-
addLineSegmentSnap(snapElements, x1, y1, x2, y2, 20, 1, line.id);
|
|
130
|
+
(0, _snap.addLineSegmentSnap)(snapElements, x1, y1, x2, y2, 20, 1, line.id);
|
|
124
131
|
});
|
|
125
132
|
});
|
|
126
133
|
state = state.merge({
|
|
127
|
-
mode: MODE_DRAWING_HOLE,
|
|
134
|
+
mode: _constants.MODE_DRAWING_HOLE,
|
|
128
135
|
snapElements: snapElements,
|
|
129
|
-
drawingSupport: Map({
|
|
136
|
+
drawingSupport: (0, _immutable.Map)({
|
|
130
137
|
type: sceneComponentType
|
|
131
138
|
})
|
|
132
139
|
});
|
|
@@ -137,7 +144,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
137
144
|
}, {
|
|
138
145
|
key: "selectToolDrawingHole3D",
|
|
139
146
|
value: function selectToolDrawingHole3D(state, sceneComponentType) {
|
|
140
|
-
var snapElements = new List().withMutations(function (snapElements) {
|
|
147
|
+
var snapElements = new _immutable.List().withMutations(function (snapElements) {
|
|
141
148
|
var _state$getIn2 = state.getIn(['scene', 'layers', state.scene.selectedLayer]),
|
|
142
149
|
lines = _state$getIn2.lines,
|
|
143
150
|
vertices = _state$getIn2.vertices;
|
|
@@ -148,13 +155,13 @@ var Hole = /*#__PURE__*/function () {
|
|
|
148
155
|
var _vertices$get4 = vertices.get(line.vertices.get(1)),
|
|
149
156
|
x2 = _vertices$get4.x,
|
|
150
157
|
y2 = _vertices$get4.y;
|
|
151
|
-
addLineSegmentSnap(snapElements, x1, y1, x2, y2, 20, 1, line.id);
|
|
158
|
+
(0, _snap.addLineSegmentSnap)(snapElements, x1, y1, x2, y2, 20, 1, line.id);
|
|
152
159
|
});
|
|
153
160
|
});
|
|
154
161
|
state = state.merge({
|
|
155
|
-
mode: MODE_DRAWING_HOLE_3D,
|
|
162
|
+
mode: _constants.MODE_DRAWING_HOLE_3D,
|
|
156
163
|
snapElements: snapElements,
|
|
157
|
-
drawingSupport: Map({
|
|
164
|
+
drawingSupport: (0, _immutable.Map)({
|
|
158
165
|
type: sceneComponentType
|
|
159
166
|
})
|
|
160
167
|
});
|
|
@@ -169,7 +176,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
169
176
|
var catalog = state.catalog;
|
|
170
177
|
//calculate snap and overwrite coords if needed
|
|
171
178
|
//force snap to segment
|
|
172
|
-
var snap = nearestSnap(state.snapElements, x, y, state.snapMask.merge({
|
|
179
|
+
var snap = (0, _snap.nearestSnap)(state.snapElements, x, y, state.snapMask.merge({
|
|
173
180
|
SNAP_SEGMENT: true
|
|
174
181
|
}));
|
|
175
182
|
if (snap) {
|
|
@@ -189,14 +196,14 @@ var Hole = /*#__PURE__*/function () {
|
|
|
189
196
|
y2 = _state$getIn4.y;
|
|
190
197
|
|
|
191
198
|
// // I need min and max vertices on this line segment
|
|
192
|
-
var minVertex = GeometryUtils.minVertex({
|
|
199
|
+
var minVertex = _export2.GeometryUtils.minVertex({
|
|
193
200
|
x: x1,
|
|
194
201
|
y: y1
|
|
195
202
|
}, {
|
|
196
203
|
x: x2,
|
|
197
204
|
y: y2
|
|
198
205
|
});
|
|
199
|
-
var maxVertex = GeometryUtils.maxVertex({
|
|
206
|
+
var maxVertex = _export2.GeometryUtils.maxVertex({
|
|
200
207
|
x: x1,
|
|
201
208
|
y: y1
|
|
202
209
|
}, {
|
|
@@ -206,10 +213,10 @@ var Hole = /*#__PURE__*/function () {
|
|
|
206
213
|
var width = catalog.factoryElement(state.drawingSupport.get('type')).properties.getIn(['width', 'length']);
|
|
207
214
|
|
|
208
215
|
// // 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);
|
|
216
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
217
|
+
var alpha = _export2.GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
218
|
+
var cosAlpha = _export2.GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
219
|
+
var sinAlpha = _export2.GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
213
220
|
var minLeftVertexHole = {
|
|
214
221
|
x: minVertex.x + (state.mode.includes('ING_HOLE') ? width + 1 : width) / 2 * cosAlpha,
|
|
215
222
|
y: minVertex.y + (state.mode.includes('ING_HOLE') ? width + 1 : width) / 2 * sinAlpha
|
|
@@ -220,24 +227,24 @@ var Hole = /*#__PURE__*/function () {
|
|
|
220
227
|
};
|
|
221
228
|
var offset;
|
|
222
229
|
if (x < minLeftVertexHole.x) {
|
|
223
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
230
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
224
231
|
offset = minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
225
232
|
} else {
|
|
226
233
|
if (x > maxRightVertexHole.x) {
|
|
227
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
234
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
228
235
|
offset = minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
229
236
|
} else if (x === minLeftVertexHole.x && x === maxRightVertexHole.x) {
|
|
230
237
|
if (y < minLeftVertexHole.y) {
|
|
231
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
238
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
232
239
|
offset = minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
233
240
|
} else if (y > maxRightVertexHole.y) {
|
|
234
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
241
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
235
242
|
offset = minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
236
243
|
} else {
|
|
237
|
-
offset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
244
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
238
245
|
}
|
|
239
246
|
} else {
|
|
240
|
-
offset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
247
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
241
248
|
// offset =
|
|
242
249
|
// minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
243
250
|
}
|
|
@@ -358,7 +365,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
358
365
|
var catalog = state.catalog;
|
|
359
366
|
//calculate snap and overwrite coords if needed
|
|
360
367
|
//force snap to segment
|
|
361
|
-
var snap = nearestSnap(state.snapElements, x, y, state.snapMask.merge({
|
|
368
|
+
var snap = (0, _snap.nearestSnap)(state.snapElements, x, y, state.snapMask.merge({
|
|
362
369
|
SNAP_SEGMENT: true
|
|
363
370
|
}));
|
|
364
371
|
if (snap) {
|
|
@@ -378,14 +385,14 @@ var Hole = /*#__PURE__*/function () {
|
|
|
378
385
|
y2 = _state$getIn6.y;
|
|
379
386
|
|
|
380
387
|
// // I need min and max vertices on this line segment
|
|
381
|
-
var minVertex = GeometryUtils.minVertex({
|
|
388
|
+
var minVertex = _export2.GeometryUtils.minVertex({
|
|
382
389
|
x: x1,
|
|
383
390
|
y: y1
|
|
384
391
|
}, {
|
|
385
392
|
x: x2,
|
|
386
393
|
y: y2
|
|
387
394
|
});
|
|
388
|
-
var maxVertex = GeometryUtils.maxVertex({
|
|
395
|
+
var maxVertex = _export2.GeometryUtils.maxVertex({
|
|
389
396
|
x: x1,
|
|
390
397
|
y: y1
|
|
391
398
|
}, {
|
|
@@ -395,10 +402,10 @@ var Hole = /*#__PURE__*/function () {
|
|
|
395
402
|
var width = catalog.factoryElement(state.drawingSupport.get('type')).properties.getIn(['width', 'length']);
|
|
396
403
|
|
|
397
404
|
// // 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);
|
|
405
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
406
|
+
var alpha = _export2.GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
407
|
+
var cosAlpha = _export2.GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
408
|
+
var sinAlpha = _export2.GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
402
409
|
var minLeftVertexHole = {
|
|
403
410
|
x: minVertex.x + (state.mode.includes('ING_HOLE_3D') ? width + 1 : width) / 2 * cosAlpha,
|
|
404
411
|
y: minVertex.y + (state.mode.includes('ING_HOLE_3D') ? width + 1 : width) / 2 * sinAlpha
|
|
@@ -409,28 +416,28 @@ var Hole = /*#__PURE__*/function () {
|
|
|
409
416
|
};
|
|
410
417
|
var offset;
|
|
411
418
|
if (x < minLeftVertexHole.x) {
|
|
412
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
419
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
413
420
|
} else if (x > maxRightVertexHole.x) {
|
|
414
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
421
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
415
422
|
} else {
|
|
416
423
|
if (x === minLeftVertexHole.x && x === maxRightVertexHole.x) {
|
|
417
424
|
if (y < minLeftVertexHole.y) {
|
|
418
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
425
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
419
426
|
/*
|
|
420
427
|
offset =
|
|
421
428
|
minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
422
429
|
*/
|
|
423
430
|
} else if (y > maxRightVertexHole.y) {
|
|
424
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
431
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
425
432
|
/*
|
|
426
433
|
offset =
|
|
427
434
|
minVertex.x === x1 && minVertex.y === y1 ? offset : 1 - offset;
|
|
428
435
|
*/
|
|
429
436
|
} else {
|
|
430
|
-
offset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
437
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
431
438
|
}
|
|
432
439
|
} else {
|
|
433
|
-
offset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
440
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, x, y);
|
|
434
441
|
}
|
|
435
442
|
}
|
|
436
443
|
if (this.checkHoleCollide(state.getIn(['scene', 'layers', layerID]), lineID, selectedHole, x, y, width)) {
|
|
@@ -586,16 +593,16 @@ var Hole = /*#__PURE__*/function () {
|
|
|
586
593
|
key: "endDrawingHole",
|
|
587
594
|
value: function endDrawingHole(state, layerID, x, y) {
|
|
588
595
|
state = this.updateDrawingHole(state, layerID, x, y).updatedState;
|
|
589
|
-
state = Layer.unselectAll(state, layerID).updatedState;
|
|
596
|
+
state = _export.Layer.unselectAll(state, layerID).updatedState;
|
|
590
597
|
var popup = state.get('popup');
|
|
591
598
|
state = state.merge({
|
|
592
|
-
drawingSupport: Map({
|
|
599
|
+
drawingSupport: (0, _immutable.Map)({
|
|
593
600
|
type: state.drawingSupport.get('type')
|
|
594
601
|
}),
|
|
595
602
|
isOpen: !popup,
|
|
596
|
-
mode: MODE_IDLE
|
|
603
|
+
mode: _constants.MODE_IDLE
|
|
597
604
|
});
|
|
598
|
-
state = Layer.unselectAll(state, layerID).updatedState;
|
|
605
|
+
state = _export.Layer.unselectAll(state, layerID).updatedState;
|
|
599
606
|
return {
|
|
600
607
|
updatedState: state
|
|
601
608
|
};
|
|
@@ -604,17 +611,17 @@ var Hole = /*#__PURE__*/function () {
|
|
|
604
611
|
key: "endDrawingHole3D",
|
|
605
612
|
value: function endDrawingHole3D(state, layerID, x, y) {
|
|
606
613
|
state = state.merge({
|
|
607
|
-
mode: MODE_IDLE_3D
|
|
614
|
+
mode: _constants.MODE_IDLE_3D
|
|
608
615
|
});
|
|
609
616
|
state = this.updateDrawingHole3D(state, layerID, x, y).updatedState;
|
|
610
|
-
state = Layer.unselectAll(state, layerID).updatedState;
|
|
617
|
+
state = _export.Layer.unselectAll(state, layerID).updatedState;
|
|
611
618
|
var popup = state.get('popup');
|
|
612
619
|
state = state.merge({
|
|
613
|
-
drawingSupport: Map({
|
|
620
|
+
drawingSupport: (0, _immutable.Map)({
|
|
614
621
|
type: state.drawingSupport.get('type')
|
|
615
622
|
}),
|
|
616
623
|
isOpen: !popup,
|
|
617
|
-
mode: MODE_IDLE_3D
|
|
624
|
+
mode: _constants.MODE_IDLE_3D
|
|
618
625
|
});
|
|
619
626
|
return {
|
|
620
627
|
updatedState: state
|
|
@@ -628,11 +635,11 @@ var Hole = /*#__PURE__*/function () {
|
|
|
628
635
|
var line = layer.getIn(['lines', hole.line]);
|
|
629
636
|
var v0 = layer.getIn(['vertices', line.vertices.get(0)]);
|
|
630
637
|
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);
|
|
638
|
+
var snapElements = (0, _snap.addLineSegmentSnap)((0, _immutable.List)(), v0.x, v0.y, v1.x, v1.y, 9999999, 1, null);
|
|
632
639
|
state = state.merge({
|
|
633
|
-
mode: MODE_DRAGGING_HOLE,
|
|
640
|
+
mode: _constants.MODE_DRAGGING_HOLE,
|
|
634
641
|
snapElements: snapElements,
|
|
635
|
-
draggingSupport: Map({
|
|
642
|
+
draggingSupport: (0, _immutable.Map)({
|
|
636
643
|
layerID: layerID,
|
|
637
644
|
holeID: holeID,
|
|
638
645
|
startPointX: x,
|
|
@@ -651,7 +658,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
651
658
|
var line = layer.getIn(['lines', hole.line]);
|
|
652
659
|
var v0 = layer.getIn(['vertices', line.vertices.get(0)]);
|
|
653
660
|
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);
|
|
661
|
+
var snapElements = (0, _snap.addLineSegmentSnap)((0, _immutable.List)(), v0.x, v0.y, v1.x, v1.y, 9999999, 1, null);
|
|
655
662
|
state = state.updateIn(['scene', 'layers', layerID, 'lines', hole.line, 'holes'], function (holes) {
|
|
656
663
|
var index = holes.findIndex(function (ID) {
|
|
657
664
|
return holeID === ID;
|
|
@@ -659,9 +666,9 @@ var Hole = /*#__PURE__*/function () {
|
|
|
659
666
|
return index !== -1 ? holes.remove(index) : holes;
|
|
660
667
|
});
|
|
661
668
|
state = state.merge({
|
|
662
|
-
mode: MODE_DRAGGING_HOLE_3D,
|
|
669
|
+
mode: _constants.MODE_DRAGGING_HOLE_3D,
|
|
663
670
|
snapElements: snapElements,
|
|
664
|
-
draggingSupport: Map({
|
|
671
|
+
draggingSupport: (0, _immutable.Map)({
|
|
665
672
|
layerID: layerID,
|
|
666
673
|
holeID: holeID,
|
|
667
674
|
startPointX: x,
|
|
@@ -677,7 +684,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
677
684
|
value: function updateDraggingHole(state, x, y) {
|
|
678
685
|
//calculate snap and overwrite coords if needed
|
|
679
686
|
//force snap to segment
|
|
680
|
-
var snap = nearestSnap(state.snapElements, x, y, state.snapMask.merge({
|
|
687
|
+
var snap = (0, _snap.nearestSnap)(state.snapElements, x, y, state.snapMask.merge({
|
|
681
688
|
SNAP_SEGMENT: true
|
|
682
689
|
}));
|
|
683
690
|
if (!snap) return state;
|
|
@@ -697,13 +704,13 @@ var Hole = /*#__PURE__*/function () {
|
|
|
697
704
|
var _snap$point3 = snap.point;
|
|
698
705
|
x = _snap$point3.x;
|
|
699
706
|
y = _snap$point3.y;
|
|
700
|
-
var minVertex = GeometryUtils.minVertex(v0, v1);
|
|
701
|
-
var maxVertex = GeometryUtils.maxVertex(v0, v1);
|
|
707
|
+
var minVertex = _export2.GeometryUtils.minVertex(v0, v1);
|
|
708
|
+
var maxVertex = _export2.GeometryUtils.maxVertex(v0, v1);
|
|
702
709
|
|
|
703
710
|
// Now I need min and max possible coordinates for the hole on the line. They depend on the width of the hole
|
|
704
711
|
|
|
705
712
|
var width = hole.properties.get('width').get('length');
|
|
706
|
-
var lineLength = GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
713
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
707
714
|
var alpha = Math.atan2(v1.y - v0.y, Math.abs(v1.x - v0.x));
|
|
708
715
|
var alpha1 = Math.atan2(v1.y - v0.y, v1.x - v0.x);
|
|
709
716
|
var angle_temp;
|
|
@@ -735,27 +742,27 @@ var Hole = /*#__PURE__*/function () {
|
|
|
735
742
|
var offset;
|
|
736
743
|
if (x < minLeftVertexHole.x) {
|
|
737
744
|
// Snap point is previous the the line
|
|
738
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
745
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
739
746
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
740
747
|
} else {
|
|
741
748
|
// Snap point is after the line or on the line
|
|
742
749
|
if (x > maxRightVertexHole.x) {
|
|
743
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
750
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
744
751
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
745
752
|
} else if (x === minLeftVertexHole.x && x === maxRightVertexHole.x) {
|
|
746
753
|
// I am on a vertical line, I need to check y coordinates
|
|
747
754
|
if (y < minLeftVertexHole.y) {
|
|
748
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
755
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, minLeftVertexHole.x, minLeftVertexHole.y);
|
|
749
756
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
750
757
|
} else if (y > maxRightVertexHole.y) {
|
|
751
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
758
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, maxRightVertexHole.x, maxRightVertexHole.y);
|
|
752
759
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
753
760
|
} else {
|
|
754
|
-
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);
|
|
755
762
|
offset = minVertex === v0 ? offset : 1 - offset;
|
|
756
763
|
}
|
|
757
764
|
} else {
|
|
758
|
-
offset = GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, x, y);
|
|
765
|
+
offset = _export2.GeometryUtils.pointPositionOnLineSegment(minVertex.x, minVertex.y, maxVertex.x, maxVertex.y, x, y);
|
|
759
766
|
if (angle_temp > 90 && angle_temp < 270) {
|
|
760
767
|
offset = 1 - offset;
|
|
761
768
|
}
|
|
@@ -835,8 +842,8 @@ var Hole = /*#__PURE__*/function () {
|
|
|
835
842
|
return index === -1 ? holes.push(holeID) : holes;
|
|
836
843
|
});
|
|
837
844
|
state = state.merge({
|
|
838
|
-
mode: MODE_IDLE_3D,
|
|
839
|
-
draggingSupport: Map({})
|
|
845
|
+
mode: _constants.MODE_IDLE_3D,
|
|
846
|
+
draggingSupport: (0, _immutable.Map)({})
|
|
840
847
|
});
|
|
841
848
|
return {
|
|
842
849
|
updatedState: state
|
|
@@ -864,7 +871,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
864
871
|
value: function endDraggingHole(state, x, y) {
|
|
865
872
|
state = this.updateDraggingHole(state, x, y).updatedState;
|
|
866
873
|
state = state.merge({
|
|
867
|
-
mode: MODE_IDLE
|
|
874
|
+
mode: _constants.MODE_IDLE
|
|
868
875
|
});
|
|
869
876
|
return {
|
|
870
877
|
updatedState: state
|
|
@@ -881,7 +888,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
881
888
|
}, {
|
|
882
889
|
key: "setJsProperties",
|
|
883
890
|
value: function setJsProperties(state, layerID, holeID, properties) {
|
|
884
|
-
return this.setProperties(state, layerID, holeID, fromJS(properties));
|
|
891
|
+
return this.setProperties(state, layerID, holeID, (0, _immutable.fromJS)(properties));
|
|
885
892
|
}
|
|
886
893
|
}, {
|
|
887
894
|
key: "updateProperties",
|
|
@@ -896,7 +903,7 @@ var Hole = /*#__PURE__*/function () {
|
|
|
896
903
|
}, {
|
|
897
904
|
key: "updateJsProperties",
|
|
898
905
|
value: function updateJsProperties(state, layerID, holeID, properties) {
|
|
899
|
-
return this.updateProperties(state, layerID, holeID, fromJS(properties));
|
|
906
|
+
return this.updateProperties(state, layerID, holeID, (0, _immutable.fromJS)(properties));
|
|
900
907
|
}
|
|
901
908
|
}, {
|
|
902
909
|
key: "setAttributes",
|
|
@@ -908,11 +915,11 @@ var Hole = /*#__PURE__*/function () {
|
|
|
908
915
|
delete hAttr['offsetA'];
|
|
909
916
|
delete hAttr['offsetB'];
|
|
910
917
|
delete hAttr['offset'];
|
|
911
|
-
var misc = new Map({
|
|
918
|
+
var misc = new _immutable.Map({
|
|
912
919
|
_unitA: offsetA._unit,
|
|
913
920
|
_unitB: offsetB._unit
|
|
914
921
|
});
|
|
915
|
-
state = state.mergeIn(['scene', 'layers', layerID, 'holes', holeID], fromJS(hAttr)).mergeDeepIn(['scene', 'layers', layerID, 'holes', holeID], new Map({
|
|
922
|
+
state = state.mergeIn(['scene', 'layers', layerID, 'holes', holeID], (0, _immutable.fromJS)(hAttr)).mergeDeepIn(['scene', 'layers', layerID, 'holes', holeID], new _immutable.Map({
|
|
916
923
|
offset: offset,
|
|
917
924
|
misc: misc
|
|
918
925
|
}));
|
|
@@ -921,5 +928,4 @@ var Hole = /*#__PURE__*/function () {
|
|
|
921
928
|
};
|
|
922
929
|
}
|
|
923
930
|
}]);
|
|
924
|
-
}();
|
|
925
|
-
export { Hole as default };
|
|
931
|
+
}();
|