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