kitchen-simulator 1.1.1-test.7 → 1.1.1-test.70
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 +8 -2
- package/es/AppContext.js +8 -3
- package/es/KitchenConfigurator.js +93 -106
- package/es/KitchenConfiguratorApp.js +143 -154
- package/es/actions/area-actions.js +10 -5
- package/es/actions/export.js +27 -12
- package/es/actions/groups-actions.js +43 -27
- package/es/actions/holes-actions.js +53 -34
- package/es/actions/items-actions.js +143 -94
- package/es/actions/lines-actions.js +34 -21
- package/es/actions/project-actions.js +143 -94
- package/es/actions/scene-actions.js +19 -11
- package/es/actions/vertices-actions.js +13 -7
- package/es/actions/viewer2d-actions.js +34 -21
- package/es/actions/viewer3d-actions.js +16 -9
- package/es/catalog/areas/area/planner-element.js +16 -8
- package/es/catalog/catalog.js +19 -24
- package/es/catalog/factories/area-factory-3d.js +29 -22
- package/es/catalog/factories/area-factory.js +18 -14
- package/es/catalog/factories/export.js +12 -6
- package/es/catalog/factories/wall-factory-3d.js +39 -31
- package/es/catalog/factories/wall-factory.js +29 -21
- package/es/catalog/holes/door-closet/planner-element.js +22 -15
- package/es/catalog/holes/door-double/planner-element.js +22 -15
- package/es/catalog/holes/door-exterior/planner-element.js +23 -16
- package/es/catalog/holes/door-interior/planner-element.js +23 -16
- package/es/catalog/holes/door-panic/planner-element.js +14 -7
- package/es/catalog/holes/door-panic-double/planner-element.js +22 -15
- package/es/catalog/holes/door-sliding/planner-element.js +23 -16
- package/es/catalog/holes/doorway-framed/planner-element.js +18 -11
- package/es/catalog/holes/doorway-frameless/planner-element.js +14 -7
- package/es/catalog/holes/export.js +31 -13
- package/es/catalog/holes/window-clear/planner-element.js +17 -10
- package/es/catalog/holes/window-cross/planner-element.js +17 -10
- package/es/catalog/holes/window-double-hung/planner-element.js +17 -10
- package/es/catalog/holes/window-vertical/planner-element.js +17 -10
- package/es/catalog/lines/wall/planner-element.js +19 -11
- package/es/catalog/molding/molding-dcm/planner-element.js +12 -5
- package/es/catalog/molding/molding-fbm/planner-element.js +12 -5
- package/es/catalog/molding/molding-lrm/planner-element.js +12 -5
- package/es/catalog/properties/export.js +33 -20
- package/es/catalog/properties/property-checkbox.js +82 -35
- package/es/catalog/properties/property-color.js +21 -16
- package/es/catalog/properties/property-enum.js +70 -28
- package/es/catalog/properties/property-hidden.js +14 -9
- package/es/catalog/properties/property-lenght-measure.js +43 -39
- package/es/catalog/properties/property-length-measure.js +82 -34
- package/es/catalog/properties/property-length-measure_hole.js +43 -39
- package/es/catalog/properties/property-number.js +22 -17
- package/es/catalog/properties/property-read-only.js +21 -16
- package/es/catalog/properties/property-string.js +21 -16
- package/es/catalog/properties/property-toggle.js +21 -16
- package/es/catalog/properties/shared-property-style.js +5 -1
- package/es/catalog/utils/FuseUtils.js +13 -11
- package/es/catalog/utils/exporter.js +13 -11
- package/es/catalog/utils/geom-utils.js +27 -13
- package/es/catalog/utils/item-loader.js +95 -91
- package/es/catalog/utils/load-obj.js +26 -20
- package/es/catalog/utils/mtl-loader.js +7 -3
- package/es/catalog/utils/obj-loader.js +7 -3
- package/es/class/FuseUtils.js +13 -11
- package/es/class/area.js +26 -26
- package/es/class/export.js +38 -23
- package/es/class/group.js +57 -62
- package/es/class/guide.js +19 -19
- package/es/class/hole.js +87 -88
- package/es/class/item.js +148 -155
- package/es/class/layer.js +63 -63
- package/es/class/line.js +141 -144
- package/es/class/project.js +96 -94
- package/es/class/vertex.js +33 -33
- package/es/components/content.js +27 -19
- package/es/components/disclaimer/disclaimer.js +79 -93
- package/es/components/export.js +15 -8
- package/es/components/style/button.js +29 -30
- package/es/components/style/cancel-button.js +12 -8
- package/es/components/style/content-container.js +14 -12
- package/es/components/style/content-title.js +18 -15
- package/es/components/style/delete-button.js +15 -9
- package/es/components/style/export.js +48 -30
- package/es/components/style/form-block.js +13 -12
- package/es/components/style/form-color-input.js +12 -8
- package/es/components/style/form-label.js +13 -12
- package/es/components/style/form-number-input.js +71 -47
- package/es/components/style/form-number-input_2.js +42 -42
- package/es/components/style/form-select.js +58 -14
- package/es/components/style/form-slider.js +36 -16
- package/es/components/style/form-submit-button.js +15 -9
- package/es/components/style/form-text-input.js +55 -37
- package/es/components/viewer2d/area.js +22 -17
- package/es/components/viewer2d/export.js +48 -30
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +15 -11
- package/es/components/viewer2d/grids/grid-streak.js +15 -11
- package/es/components/viewer2d/grids/grid-vertical-streak.js +15 -11
- package/es/components/viewer2d/grids/grids.js +17 -15
- package/es/components/viewer2d/group.js +22 -15
- package/es/components/viewer2d/item.js +68 -68
- package/es/components/viewer2d/layer.js +28 -23
- package/es/components/viewer2d/line.js +109 -104
- package/es/components/viewer2d/ruler.js +27 -23
- package/es/components/viewer2d/rulerDist.js +26 -21
- package/es/components/viewer2d/rulerX.js +45 -45
- package/es/components/viewer2d/rulerY.js +43 -43
- package/es/components/viewer2d/scene.js +40 -46
- package/es/components/viewer2d/snap.js +20 -13
- package/es/components/viewer2d/state.js +25 -23
- package/es/components/viewer2d/utils.js +63 -21
- package/es/components/viewer2d/vertex.js +15 -8
- package/es/components/viewer2d/viewer2d.js +169 -166
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +21 -24
- package/es/components/viewer3d/dcm.js +5 -1
- package/es/components/viewer3d/fbm.js +5 -1
- package/es/components/viewer3d/front3D.js +19 -17
- package/es/components/viewer3d/grid-creator.js +15 -8
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +12 -6
- package/es/components/viewer3d/grids/grid-streak.js +11 -5
- package/es/components/viewer3d/grids/grid-vertical-streak.js +12 -6
- package/es/components/viewer3d/libs/first-person-controls.js +7 -2
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +5 -1
- package/es/components/viewer3d/libs/mtl-loader.js +6 -2
- package/es/components/viewer3d/libs/obj-loader.js +6 -2
- package/es/components/viewer3d/libs/orbit-controls.js +10 -5
- package/es/components/viewer3d/libs/pointer-lock-controls.js +9 -4
- package/es/components/viewer3d/lrm.js +5 -1
- package/es/components/viewer3d/model.js +5 -1
- package/es/components/viewer3d/pointer-lock-navigation.js +8 -3
- package/es/components/viewer3d/ruler-utils/itemRect.js +23 -18
- package/es/components/viewer3d/ruler-utils/layer3D.js +64 -59
- package/es/components/viewer3d/ruler-utils/ruler3D.js +44 -42
- package/es/components/viewer3d/ruler-utils/scene3D.js +16 -11
- package/es/components/viewer3d/ruler-utils/state3D.js +9 -4
- package/es/components/viewer3d/scene-creator.js +225 -198
- package/es/components/viewer3d/three-memory-cleaner.js +10 -3
- package/es/components/viewer3d/viewer3d-first-person.js +44 -46
- package/es/components/viewer3d/viewer3d.js +206 -209
- package/es/constants.js +356 -349
- package/es/index.js +20 -15
- package/es/models.js +183 -183
- package/es/plugins/SVGLoader.js +51 -48
- package/es/plugins/autosave.js +7 -3
- package/es/plugins/console-debugger.js +10 -8
- package/es/plugins/export.js +15 -8
- package/es/plugins/keyboard.js +33 -29
- package/es/reducers/areas-reducer.js +11 -7
- package/es/reducers/export.js +39 -24
- package/es/reducers/groups-reducer.js +35 -31
- package/es/reducers/holes-reducer.js +47 -43
- package/es/reducers/items-reducer.js +110 -109
- package/es/reducers/lines-reducer.js +32 -28
- package/es/reducers/project-reducer.js +109 -105
- package/es/reducers/reducer.js +21 -16
- package/es/reducers/scene-reducer.js +19 -15
- package/es/reducers/user-reducer.js +9 -6
- package/es/reducers/vertices-reducer.js +15 -11
- package/es/reducers/viewer2d-reducer.js +22 -18
- package/es/reducers/viewer3d-reducer.js +20 -16
- package/es/shared-style.js +14 -10
- package/es/styles/export.js +9 -3
- package/es/translator/en.js +5 -1
- package/es/translator/it.js +5 -1
- package/es/translator/ru.js +5 -1
- package/es/translator/translator.js +17 -17
- package/es/utils/browser.js +7 -2
- package/es/utils/convert-units-lite.js +33 -0
- package/es/utils/email-validator.js +5 -1
- package/es/utils/export.js +32 -15
- package/es/utils/geometry.js +277 -191
- package/es/utils/get-edges-of-subgraphs.js +7 -1
- package/es/utils/graph-cycles.js +9 -9
- package/es/utils/graph-inner-cycles.js +16 -10
- package/es/utils/graph.js +15 -12
- package/es/utils/helper.js +61 -109
- package/es/utils/history.js +13 -8
- package/es/utils/id-broker.js +13 -12
- package/es/utils/logger.js +5 -1
- package/es/utils/math.js +10 -5
- package/es/utils/molding.js +175 -158
- package/es/utils/name-generator.js +11 -11
- package/es/utils/objects-utils.js +17 -7
- package/es/utils/phone-validator.js +5 -1
- package/es/utils/process-black-list.js +8 -6
- package/es/utils/react-if.js +10 -6
- package/es/utils/snap-scene.js +32 -32
- package/es/utils/snap.js +57 -51
- package/es/utils/summarizeCart.js +5 -1
- package/es/utils/threeCSG.es6.js +20 -17
- package/es/version.js +5 -1
- package/lib/@history.js +3 -2
- package/lib/AppContext.js +3 -2
- package/lib/KitchenConfigurator.js +70 -88
- package/lib/KitchenConfiguratorApp.js +98 -113
- package/lib/actions/export.js +1 -1
- package/lib/catalog/areas/area/planner-element.js +13 -8
- package/lib/catalog/catalog.js +9 -16
- package/lib/catalog/factories/area-factory-3d.js +1 -1
- package/lib/catalog/factories/area-factory.js +6 -7
- package/lib/catalog/factories/export.js +1 -1
- package/lib/catalog/factories/wall-factory-3d.js +4 -4
- package/lib/catalog/factories/wall-factory.js +4 -3
- package/lib/catalog/holes/door-closet/planner-element.js +4 -3
- package/lib/catalog/holes/door-double/planner-element.js +4 -3
- package/lib/catalog/holes/door-exterior/planner-element.js +4 -3
- package/lib/catalog/holes/door-interior/planner-element.js +4 -3
- package/lib/catalog/holes/door-panic/planner-element.js +4 -3
- package/lib/catalog/holes/door-panic-double/planner-element.js +4 -3
- package/lib/catalog/holes/door-sliding/planner-element.js +4 -3
- package/lib/catalog/holes/doorway-framed/planner-element.js +4 -3
- package/lib/catalog/holes/doorway-frameless/planner-element.js +4 -3
- package/lib/catalog/holes/export.js +14 -14
- package/lib/catalog/holes/window-clear/planner-element.js +4 -3
- package/lib/catalog/holes/window-cross/planner-element.js +4 -3
- package/lib/catalog/holes/window-double-hung/planner-element.js +4 -3
- package/lib/catalog/holes/window-vertical/planner-element.js +4 -3
- package/lib/catalog/lines/wall/planner-element.js +16 -11
- package/lib/catalog/molding/molding-dcm/planner-element.js +4 -3
- package/lib/catalog/molding/molding-fbm/planner-element.js +4 -3
- package/lib/catalog/molding/molding-lrm/planner-element.js +4 -3
- package/lib/catalog/properties/export.js +1 -1
- package/lib/catalog/properties/property-checkbox.js +68 -25
- package/lib/catalog/properties/property-color.js +3 -2
- package/lib/catalog/properties/property-enum.js +54 -16
- package/lib/catalog/properties/property-hidden.js +3 -2
- package/lib/catalog/properties/property-lenght-measure.js +10 -10
- package/lib/catalog/properties/property-length-measure.js +61 -17
- package/lib/catalog/properties/property-length-measure_hole.js +10 -10
- package/lib/catalog/properties/property-number.js +3 -2
- package/lib/catalog/properties/property-read-only.js +3 -2
- package/lib/catalog/properties/property-string.js +3 -2
- package/lib/catalog/properties/property-toggle.js +3 -2
- package/lib/catalog/properties/shared-property-style.js +2 -1
- package/lib/catalog/utils/FuseUtils.js +10 -11
- package/lib/catalog/utils/exporter.js +10 -12
- package/lib/catalog/utils/geom-utils.js +1 -1
- package/lib/catalog/utils/item-loader.js +29 -35
- package/lib/catalog/utils/mtl-loader.js +7 -3
- package/lib/catalog/utils/obj-loader.js +7 -3
- package/lib/class/FuseUtils.js +10 -11
- package/lib/class/area.js +9 -11
- package/lib/class/export.js +1 -1
- package/lib/class/group.js +13 -20
- package/lib/class/guide.js +9 -12
- package/lib/class/hole.js +7 -9
- package/lib/class/item.js +25 -35
- package/lib/class/layer.js +7 -9
- package/lib/class/line.js +14 -20
- package/lib/class/project.js +10 -11
- package/lib/class/vertex.js +9 -11
- package/lib/components/content.js +5 -3
- package/lib/components/disclaimer/disclaimer.js +69 -88
- package/lib/components/export.js +1 -1
- package/lib/components/style/button.js +17 -22
- package/lib/components/style/cancel-button.js +7 -7
- package/lib/components/style/content-container.js +5 -7
- package/lib/components/style/content-title.js +10 -12
- package/lib/components/style/delete-button.js +8 -8
- package/lib/components/style/export.js +1 -1
- package/lib/components/style/form-block.js +9 -12
- package/lib/components/style/form-color-input.js +7 -7
- package/lib/components/style/form-label.js +9 -12
- package/lib/components/style/form-number-input.js +43 -23
- package/lib/components/style/form-number-input_2.js +15 -19
- package/lib/components/style/form-select.js +53 -15
- package/lib/components/style/form-slider.js +28 -12
- package/lib/components/style/form-submit-button.js +8 -8
- package/lib/components/style/form-text-input.js +46 -32
- package/lib/components/viewer2d/area.js +8 -7
- package/lib/components/viewer2d/export.js +1 -1
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +3 -3
- package/lib/components/viewer2d/grids/grid-streak.js +3 -3
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +3 -3
- package/lib/components/viewer2d/grids/grids.js +6 -10
- package/lib/components/viewer2d/group.js +4 -3
- package/lib/components/viewer2d/item.js +14 -19
- package/lib/components/viewer2d/layer.js +3 -2
- package/lib/components/viewer2d/line.js +4 -7
- package/lib/components/viewer2d/ruler.js +9 -9
- package/lib/components/viewer2d/rulerDist.js +7 -6
- package/lib/components/viewer2d/rulerX.js +15 -19
- package/lib/components/viewer2d/rulerY.js +15 -19
- package/lib/components/viewer2d/scene.js +24 -34
- package/lib/components/viewer2d/snap.js +4 -3
- package/lib/components/viewer2d/state.js +7 -11
- package/lib/components/viewer2d/utils.js +35 -2
- package/lib/components/viewer2d/vertex.js +4 -3
- package/lib/components/viewer2d/viewer2d.js +40 -41
- package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +14 -20
- package/lib/components/viewer3d/dcm.js +2 -1
- package/lib/components/viewer3d/fbm.js +2 -1
- package/lib/components/viewer3d/front3D.js +6 -10
- package/lib/components/viewer3d/grid-creator.js +4 -3
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +3 -2
- package/lib/components/viewer3d/grids/grid-streak.js +3 -2
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +3 -2
- package/lib/components/viewer3d/libs/mtl-loader.js +7 -2
- package/lib/components/viewer3d/libs/obj-loader.js +7 -2
- package/lib/components/viewer3d/libs/orbit-controls.js +10 -5
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +9 -4
- package/lib/components/viewer3d/lrm.js +2 -1
- package/lib/components/viewer3d/pointer-lock-navigation.js +1 -1
- package/lib/components/viewer3d/ruler-utils/itemRect.js +10 -9
- package/lib/components/viewer3d/ruler-utils/layer3D.js +35 -34
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +5 -7
- package/lib/components/viewer3d/ruler-utils/scene3D.js +4 -5
- package/lib/components/viewer3d/ruler-utils/state3D.js +3 -2
- package/lib/components/viewer3d/scene-creator.js +40 -45
- package/lib/components/viewer3d/three-memory-cleaner.js +1 -1
- package/lib/components/viewer3d/viewer3d-first-person.js +13 -17
- package/lib/components/viewer3d/viewer3d.js +34 -38
- package/lib/index.js +16 -88
- package/lib/models.js +58 -63
- package/lib/plugins/autosave.js +2 -1
- package/lib/plugins/console-debugger.js +5 -7
- package/lib/plugins/export.js +1 -1
- package/lib/plugins/keyboard.js +2 -1
- package/lib/reducers/areas-reducer.js +2 -1
- package/lib/reducers/export.js +1 -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 -2
- package/lib/reducers/vertices-reducer.js +2 -1
- package/lib/reducers/viewer2d-reducer.js +5 -5
- package/lib/reducers/viewer3d-reducer.js +5 -5
- package/lib/styles/export.js +1 -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 +7 -10
- package/lib/utils/convert-units-lite.js +35 -0
- package/lib/utils/export.js +2 -2
- package/lib/utils/geometry.js +20 -28
- package/lib/utils/get-edges-of-subgraphs.js +7 -1
- package/lib/utils/graph-cycles.js +9 -9
- package/lib/utils/graph-inner-cycles.js +1 -1
- package/lib/utils/graph.js +15 -12
- package/lib/utils/helper.js +14 -83
- package/lib/utils/history.js +1 -1
- package/lib/utils/id-broker.js +7 -10
- package/lib/utils/molding.js +66 -71
- package/lib/utils/name-generator.js +7 -9
- package/lib/utils/objects-utils.js +5 -3
- package/lib/utils/process-black-list.js +3 -5
- package/lib/utils/react-if.js +3 -2
- package/lib/utils/snap-scene.js +3 -7
- package/lib/utils/snap.js +22 -26
- package/lib/utils/threeCSG.es6.js +16 -15
- package/package.json +26 -54
- package/es/analytics/ga4.js +0 -191
- package/es/analytics/posthog.js +0 -60
- package/lib/analytics/ga4.js +0 -197
- package/lib/analytics/posthog.js +0 -68
package/es/class/line.js
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { END_DRAGGING_LINE, END_DRAGGING_VERTEX, END_DRAWING_LINE, EPSILON, MIN_ANGLE_DISALLOW_DRAW_WALL, MODE_DRAGGING_LINE, MODE_DRAWING_LINE, MODE_IDLE, MODE_WAITING_DRAWING_LINE, UNIT_ANGLE } from "../constants";
|
|
18
|
-
import { isEmpty } from "../utils/helper";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
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 Three = _interopRequireWildcard(require("three"));
|
|
14
|
+
var _constants = require("../constants");
|
|
15
|
+
var _helper = require("../utils/helper");
|
|
16
|
+
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); }
|
|
19
17
|
var timeGlobal = 0;
|
|
20
18
|
var TimeRecorder = /*#__PURE__*/function () {
|
|
21
19
|
function TimeRecorder(name) {
|
|
22
|
-
|
|
20
|
+
(0, _classCallCheck2["default"])(this, TimeRecorder);
|
|
23
21
|
this.name = name;
|
|
24
22
|
if (name === 'beginDrawingLine') {
|
|
25
23
|
console.log('time__ Start Drawing');
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
|
-
return
|
|
26
|
+
return (0, _createClass2["default"])(TimeRecorder, [{
|
|
29
27
|
key: "start",
|
|
30
28
|
value: function start() {
|
|
31
29
|
this.first = Date.now();
|
|
@@ -44,11 +42,11 @@ var TimeRecorder = /*#__PURE__*/function () {
|
|
|
44
42
|
}
|
|
45
43
|
}]);
|
|
46
44
|
}();
|
|
47
|
-
var Line = /*#__PURE__*/function () {
|
|
45
|
+
var Line = exports["default"] = /*#__PURE__*/function () {
|
|
48
46
|
function Line() {
|
|
49
|
-
|
|
47
|
+
(0, _classCallCheck2["default"])(this, Line);
|
|
50
48
|
}
|
|
51
|
-
return
|
|
49
|
+
return (0, _createClass2["default"])(Line, null, [{
|
|
52
50
|
key: "create",
|
|
53
51
|
value: function create(state, layerID, type, x0, y0, x1, y1, properties) {
|
|
54
52
|
var lineCreatedDateTime = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : new Date().getTime();
|
|
@@ -57,18 +55,18 @@ var Line = /*#__PURE__*/function () {
|
|
|
57
55
|
// return { updatedState: state };
|
|
58
56
|
// }
|
|
59
57
|
// ///////////////
|
|
60
|
-
var lineID = IDBroker.acquireID();
|
|
61
|
-
var _Vertex$add = Vertex.add(state, layerID, x0, y0, 'lines', lineID),
|
|
58
|
+
var lineID = _export2.IDBroker.acquireID();
|
|
59
|
+
var _Vertex$add = _export.Vertex.add(state, layerID, x0, y0, 'lines', lineID),
|
|
62
60
|
stateV0 = _Vertex$add.updatedState,
|
|
63
61
|
v0 = _Vertex$add.vertex;
|
|
64
|
-
var _Vertex$add2 = Vertex.add(stateV0, layerID, x1, y1, 'lines', lineID),
|
|
62
|
+
var _Vertex$add2 = _export.Vertex.add(stateV0, layerID, x1, y1, 'lines', lineID),
|
|
65
63
|
stateV1 = _Vertex$add2.updatedState,
|
|
66
64
|
v1 = _Vertex$add2.vertex;
|
|
67
65
|
state = stateV1;
|
|
68
66
|
var line = state.catalog.factoryElement(type, {
|
|
69
67
|
id: lineID,
|
|
70
|
-
name: NameGenerator.generateName('lines', state.catalog.getIn(['elements', type, 'info', 'title'])),
|
|
71
|
-
vertices: new List([v0.id, v1.id]),
|
|
68
|
+
name: _export2.NameGenerator.generateName('lines', state.catalog.getIn(['elements', type, 'info', 'title'])),
|
|
69
|
+
vertices: new _immutable.List([v0.id, v1.id]),
|
|
72
70
|
type: type
|
|
73
71
|
}, properties);
|
|
74
72
|
line = line.set('createdDateTime', lineCreatedDateTime !== undefined ? lineCreatedDateTime : new Date().getTime());
|
|
@@ -90,7 +88,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
90
88
|
value: function select(state, layerID, lineID) {
|
|
91
89
|
var _line$vertices, _line$vertices$get, _line$vertices2, _line$vertices2$get;
|
|
92
90
|
// Try selecting the layer first
|
|
93
|
-
var layerResult = Layer.select(state, layerID);
|
|
91
|
+
var layerResult = _export.Layer.select(state, layerID);
|
|
94
92
|
if (!layerResult || !layerResult.updatedState) {
|
|
95
93
|
return {
|
|
96
94
|
updatedState: state
|
|
@@ -107,7 +105,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
// Select the line element
|
|
110
|
-
var lineSelectResult = Layer.selectElement(state, layerID, 'lines', lineID);
|
|
108
|
+
var lineSelectResult = _export.Layer.selectElement(state, layerID, 'lines', lineID);
|
|
111
109
|
if (lineSelectResult !== null && lineSelectResult !== void 0 && lineSelectResult.updatedState) {
|
|
112
110
|
state = lineSelectResult.updatedState;
|
|
113
111
|
}
|
|
@@ -115,7 +113,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
115
113
|
// Select the first vertex (if available)
|
|
116
114
|
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);
|
|
117
115
|
if (firstVertex !== undefined) {
|
|
118
|
-
var v1Result = Layer.selectElement(state, layerID, 'vertices', firstVertex);
|
|
116
|
+
var v1Result = _export.Layer.selectElement(state, layerID, 'vertices', firstVertex);
|
|
119
117
|
if (v1Result !== null && v1Result !== void 0 && v1Result.updatedState) {
|
|
120
118
|
state = v1Result.updatedState;
|
|
121
119
|
}
|
|
@@ -124,7 +122,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
124
122
|
// Select the second vertex (if available)
|
|
125
123
|
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);
|
|
126
124
|
if (secondVertex !== undefined) {
|
|
127
|
-
var v2Result = Layer.selectElement(state, layerID, 'vertices', secondVertex);
|
|
125
|
+
var v2Result = _export.Layer.selectElement(state, layerID, 'vertices', secondVertex);
|
|
128
126
|
if (v2Result !== null && v2Result !== void 0 && v2Result.updatedState) {
|
|
129
127
|
state = v2Result.updatedState;
|
|
130
128
|
}
|
|
@@ -140,14 +138,14 @@ var Line = /*#__PURE__*/function () {
|
|
|
140
138
|
if (line) {
|
|
141
139
|
state = this.unselect(state, layerID, lineID).updatedState;
|
|
142
140
|
line.holes.forEach(function (holeID) {
|
|
143
|
-
return state = Hole.remove(state, layerID, holeID).updatedState;
|
|
141
|
+
return state = _export.Hole.remove(state, layerID, holeID).updatedState;
|
|
144
142
|
});
|
|
145
|
-
state = Layer.removeElement(state, layerID, 'lines', lineID).updatedState;
|
|
143
|
+
state = _export.Layer.removeElement(state, layerID, 'lines', lineID).updatedState;
|
|
146
144
|
line.vertices.forEach(function (vertexID) {
|
|
147
|
-
return state = Vertex.remove(state, layerID, vertexID, 'lines', lineID).updatedState;
|
|
145
|
+
return state = _export.Vertex.remove(state, layerID, vertexID, 'lines', lineID).updatedState;
|
|
148
146
|
});
|
|
149
147
|
state.getIn(['scene', 'groups']).forEach(function (group) {
|
|
150
|
-
return state = Group.removeElement(state, group.id, layerID, 'lines', lineID).updatedState;
|
|
148
|
+
return state = _export.Group.removeElement(state, group.id, layerID, 'lines', lineID).updatedState;
|
|
151
149
|
});
|
|
152
150
|
}
|
|
153
151
|
return {
|
|
@@ -177,9 +175,9 @@ var Line = /*#__PURE__*/function () {
|
|
|
177
175
|
value: function unselect(state, layerID, lineID) {
|
|
178
176
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
179
177
|
if (line) {
|
|
180
|
-
state = Layer.unselect(state, layerID, 'vertices', line.vertices.get(0)).updatedState;
|
|
181
|
-
state = Layer.unselect(state, layerID, 'vertices', line.vertices.get(1)).updatedState;
|
|
182
|
-
state = Layer.unselect(state, layerID, 'lines', lineID).updatedState;
|
|
178
|
+
state = _export.Layer.unselect(state, layerID, 'vertices', line.vertices.get(0)).updatedState;
|
|
179
|
+
state = _export.Layer.unselect(state, layerID, 'vertices', line.vertices.get(1)).updatedState;
|
|
180
|
+
state = _export.Layer.unselect(state, layerID, 'lines', lineID).updatedState;
|
|
183
181
|
}
|
|
184
182
|
return {
|
|
185
183
|
updatedState: state
|
|
@@ -202,8 +200,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
202
200
|
stateL2 = _Line$create2.updatedState,
|
|
203
201
|
line1 = _Line$create2.line;
|
|
204
202
|
state = stateL2;
|
|
205
|
-
var splitPointOffset = GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, x, y);
|
|
206
|
-
var minVertex = GeometryUtils.minVertex(v0, v1);
|
|
203
|
+
var splitPointOffset = _export2.GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, x, y);
|
|
204
|
+
var minVertex = _export2.GeometryUtils.minVertex(v0, v1);
|
|
207
205
|
line.holes.forEach(function (holeID) {
|
|
208
206
|
var hole = state.getIn(['scene', 'layers', layerID, 'holes', holeID]);
|
|
209
207
|
var holeOffset = hole.offset;
|
|
@@ -218,7 +216,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
218
216
|
offset = 1 - offset;
|
|
219
217
|
}
|
|
220
218
|
*/
|
|
221
|
-
state = Hole.create(state, layerID, hole.type, line0.id, offset, hole.properties).updatedState;
|
|
219
|
+
state = _export.Hole.create(state, layerID, hole.type, line0.id, offset, hole.properties).updatedState;
|
|
222
220
|
} else {
|
|
223
221
|
var _offset = (holeOffset - splitPointOffset) / (1 - splitPointOffset);
|
|
224
222
|
/*
|
|
@@ -226,7 +224,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
226
224
|
offset = 1 - offset;
|
|
227
225
|
}
|
|
228
226
|
*/
|
|
229
|
-
state = Hole.create(state, layerID, hole.type, line1.id, _offset, hole.properties).updatedState;
|
|
227
|
+
state = _export.Hole.create(state, layerID, hole.type, line1.id, _offset, hole.properties).updatedState;
|
|
230
228
|
}
|
|
231
229
|
});
|
|
232
230
|
|
|
@@ -236,13 +234,13 @@ var Line = /*#__PURE__*/function () {
|
|
|
236
234
|
return lines && lines.contains(lineID);
|
|
237
235
|
});
|
|
238
236
|
lineGroups.forEach(function (group) {
|
|
239
|
-
state = Group.addElement(state, group.id, layerID, 'lines', line0.id).updatedState;
|
|
240
|
-
state = Group.addElement(state, group.id, layerID, 'lines', line1.id).updatedState;
|
|
237
|
+
state = _export.Group.addElement(state, group.id, layerID, 'lines', line0.id).updatedState;
|
|
238
|
+
state = _export.Group.addElement(state, group.id, layerID, 'lines', line1.id).updatedState;
|
|
241
239
|
});
|
|
242
240
|
state = Line.remove(state, layerID, lineID).updatedState;
|
|
243
241
|
return {
|
|
244
242
|
updatedState: state,
|
|
245
|
-
lines: new List([line0, line1])
|
|
243
|
+
lines: new _immutable.List([line0, line1])
|
|
246
244
|
};
|
|
247
245
|
}
|
|
248
246
|
}, {
|
|
@@ -250,7 +248,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
250
248
|
value: function addFromPoints(state, layerID, type, points, properties, holes) {
|
|
251
249
|
var _this = this;
|
|
252
250
|
var lineCreatedDateTime = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new Date().getTime();
|
|
253
|
-
points = new List(points).sort(function (_ref, _ref2) {
|
|
251
|
+
points = new _immutable.List(points).sort(function (_ref, _ref2) {
|
|
254
252
|
var x1 = _ref.x,
|
|
255
253
|
y1 = _ref.y;
|
|
256
254
|
var x2 = _ref2.x,
|
|
@@ -258,7 +256,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
258
256
|
return x1 === x2 ? y1 - y2 : x1 - x2;
|
|
259
257
|
});
|
|
260
258
|
var pointsPair = points.zip(points.skip(1)).filterNot(function (_ref3) {
|
|
261
|
-
var _ref4 =
|
|
259
|
+
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
262
260
|
_ref4$ = _ref4[0],
|
|
263
261
|
x1 = _ref4$.x,
|
|
264
262
|
y1 = _ref4$.y,
|
|
@@ -269,7 +267,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
269
267
|
});
|
|
270
268
|
var lines = [];
|
|
271
269
|
pointsPair.forEach(function (_ref5) {
|
|
272
|
-
var _ref6 =
|
|
270
|
+
var _ref6 = (0, _slicedToArray2["default"])(_ref5, 2),
|
|
273
271
|
_ref6$ = _ref6[0],
|
|
274
272
|
x1 = _ref6$.x,
|
|
275
273
|
y1 = _ref6$.y,
|
|
@@ -280,10 +278,10 @@ var Line = /*#__PURE__*/function () {
|
|
|
280
278
|
stateL = _this$create.updatedState,
|
|
281
279
|
line = _this$create.line;
|
|
282
280
|
state = stateL;
|
|
283
|
-
var lineLength = GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
284
|
-
var alpha = GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
285
|
-
var cosAlpha = GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
286
|
-
var sinAlpha = GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
281
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(x1, y1, x2, y2);
|
|
282
|
+
var alpha = _export2.GeometryUtils.absAngleBetweenTwoPoints(x1, y1, x2, y2);
|
|
283
|
+
var cosAlpha = _export2.GeometryUtils.cosWithThreshold(Math.abs(alpha), 0.0000001);
|
|
284
|
+
var sinAlpha = _export2.GeometryUtils.sinWithThreshold(Math.abs(alpha), 0.0000001);
|
|
287
285
|
if (holes) {
|
|
288
286
|
holes.forEach(function (holeWithOffsetPoint) {
|
|
289
287
|
var offset = holeWithOffsetPoint.hole.toJS().offset;
|
|
@@ -291,16 +289,16 @@ var Line = /*#__PURE__*/function () {
|
|
|
291
289
|
var _holeWithOffsetPoint$ = holeWithOffsetPoint.offsetPosition,
|
|
292
290
|
xp = _holeWithOffsetPoint$.x,
|
|
293
291
|
yp = _holeWithOffsetPoint$.y;
|
|
294
|
-
if (GeometryUtils.isPointOnLineSegment(x1, y1, x2, y2, xp, yp)) {
|
|
295
|
-
var newOffset = GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp);
|
|
292
|
+
if (_export2.GeometryUtils.isPointOnLineSegment(x1, y1, x2, y2, xp, yp)) {
|
|
293
|
+
var newOffset = _export2.GeometryUtils.pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp);
|
|
296
294
|
if (newOffset >= 0 && newOffset <= 1) {
|
|
297
295
|
//add the position of hole
|
|
298
|
-
var temp = Hole.create(state, layerID, holeWithOffsetPoint.hole.type, line.id, newOffset, holeWithOffsetPoint.hole.properties, xp, yp);
|
|
296
|
+
var temp = _export.Hole.create(state, layerID, holeWithOffsetPoint.hole.type, line.id, newOffset, holeWithOffsetPoint.hole.properties, xp, yp);
|
|
299
297
|
state = temp.updatedState;
|
|
300
298
|
var holeX = 0,
|
|
301
299
|
holeY = 0,
|
|
302
300
|
holeID = temp.hole.id;
|
|
303
|
-
if (GeometryUtils.almostEqual(y1, y2)) {
|
|
301
|
+
if (_export2.GeometryUtils.almostEqual(y1, y2)) {
|
|
304
302
|
if (x1 > x2) {
|
|
305
303
|
holeX = x1 - lineLength * newOffset;
|
|
306
304
|
holeY = y1;
|
|
@@ -308,7 +306,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
308
306
|
holeX = x1 + lineLength * newOffset;
|
|
309
307
|
holeY = y1;
|
|
310
308
|
}
|
|
311
|
-
} else if (GeometryUtils.almostEqual(x1, x2)) {
|
|
309
|
+
} else if (_export2.GeometryUtils.almostEqual(x1, x2)) {
|
|
312
310
|
if (y1 > y2) {
|
|
313
311
|
holeX = x1;
|
|
314
312
|
holeY = y1 - lineLength * newOffset;
|
|
@@ -343,7 +341,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
343
341
|
});
|
|
344
342
|
return {
|
|
345
343
|
updatedState: state,
|
|
346
|
-
lines: new List(lines),
|
|
344
|
+
lines: new _immutable.List(lines),
|
|
347
345
|
newline: lines[0]
|
|
348
346
|
};
|
|
349
347
|
}
|
|
@@ -363,21 +361,21 @@ var Line = /*#__PURE__*/function () {
|
|
|
363
361
|
var _line$vertices$map$to = line.vertices.map(function (vertexID) {
|
|
364
362
|
return reducedState.getIn(['scene', 'layers', layerID, 'vertices']).get(vertexID);
|
|
365
363
|
}).toArray(),
|
|
366
|
-
_line$vertices$map$to2 =
|
|
364
|
+
_line$vertices$map$to2 = (0, _slicedToArray2["default"])(_line$vertices$map$to, 2),
|
|
367
365
|
v0 = _line$vertices$map$to2[0],
|
|
368
366
|
v1 = _line$vertices$map$to2[1];
|
|
369
|
-
var hasCommonEndpoint = GeometryUtils.samePoints(v0, points[0]) || GeometryUtils.samePoints(v0, points[1]) || GeometryUtils.samePoints(v1, points[0]) || GeometryUtils.samePoints(v1, points[1]);
|
|
370
|
-
var intersection = GeometryUtils.twoLineSegmentsIntersection(points[0], points[1], v0, v1);
|
|
367
|
+
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]);
|
|
368
|
+
var intersection = _export2.GeometryUtils.twoLineSegmentsIntersection(points[0], points[1], v0, v1);
|
|
371
369
|
if (intersection.type === 'colinear') {
|
|
372
370
|
if (!oldHoles) {
|
|
373
371
|
oldHoles = [];
|
|
374
372
|
}
|
|
375
|
-
var orderedVertices = GeometryUtils.orderVertices(points);
|
|
373
|
+
var orderedVertices = _export2.GeometryUtils.orderVertices(points);
|
|
376
374
|
reducedState.getIn(['scene', 'layers', layerID, 'lines', line.id, 'holes']).forEach(function (holeID) {
|
|
377
375
|
var hole = reducedState.getIn(['scene', 'layers', layerID, 'holes', holeID]);
|
|
378
|
-
var oldLineLength = GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
379
|
-
var offset = GeometryUtils.samePoints(orderedVertices[1], line.vertices.get(1)) ? 1 - hole.offset : hole.offset;
|
|
380
|
-
var offsetPosition = GeometryUtils.extendLine(v0.x, v0.y, v1.x, v1.y, oldLineLength * offset);
|
|
376
|
+
var oldLineLength = _export2.GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
377
|
+
var offset = _export2.GeometryUtils.samePoints(orderedVertices[1], line.vertices.get(1)) ? 1 - hole.offset : hole.offset;
|
|
378
|
+
var offsetPosition = _export2.GeometryUtils.extendLine(v0.x, v0.y, v1.x, v1.y, oldLineLength * offset);
|
|
381
379
|
oldHoles.push({
|
|
382
380
|
hole: hole,
|
|
383
381
|
offsetPosition: offsetPosition
|
|
@@ -406,8 +404,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
406
404
|
key: "replaceVertex",
|
|
407
405
|
value: function replaceVertex(state, layerID, lineID, vertexIndex, x, y) {
|
|
408
406
|
var vertexID = state.getIn(['scene', 'layers', layerID, 'lines', lineID, 'vertices', vertexIndex]);
|
|
409
|
-
state = Vertex.remove(state, layerID, vertexID, 'lines', lineID).updatedState;
|
|
410
|
-
var _Vertex$add3 = Vertex.add(state, layerID, x, y, 'lines', lineID),
|
|
407
|
+
state = _export.Vertex.remove(state, layerID, vertexID, 'lines', lineID).updatedState;
|
|
408
|
+
var _Vertex$add3 = _export.Vertex.add(state, layerID, x, y, 'lines', lineID),
|
|
411
409
|
stateV = _Vertex$add3.updatedState,
|
|
412
410
|
vertex = _Vertex$add3.vertex;
|
|
413
411
|
state = stateV;
|
|
@@ -423,8 +421,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
423
421
|
key: "selectToolDrawingLine",
|
|
424
422
|
value: function selectToolDrawingLine(state, sceneComponentType) {
|
|
425
423
|
state = state.merge({
|
|
426
|
-
mode: MODE_WAITING_DRAWING_LINE,
|
|
427
|
-
drawingSupport: new Map({
|
|
424
|
+
mode: _constants.MODE_WAITING_DRAWING_LINE,
|
|
425
|
+
drawingSupport: new _immutable.Map({
|
|
428
426
|
type: sceneComponentType
|
|
429
427
|
})
|
|
430
428
|
});
|
|
@@ -436,16 +434,16 @@ var Line = /*#__PURE__*/function () {
|
|
|
436
434
|
key: "beginDrawingLine",
|
|
437
435
|
value: function beginDrawingLine(state, layerID, x, y) {
|
|
438
436
|
// if end drawing by created area
|
|
439
|
-
if (state.mode == MODE_IDLE) {
|
|
437
|
+
if (state.mode == _constants.MODE_IDLE) {
|
|
440
438
|
return {
|
|
441
439
|
updatedState: state
|
|
442
440
|
};
|
|
443
441
|
}
|
|
444
442
|
// ///////////////
|
|
445
|
-
var snapElements = SnapSceneUtils.sceneSnapElements(state.scene, new List(), state.snapMask);
|
|
443
|
+
var snapElements = _export2.SnapSceneUtils.sceneSnapElements(state.scene, new _immutable.List(), state.snapMask);
|
|
446
444
|
var snap = null;
|
|
447
445
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
448
|
-
snap = SnapUtils.nearestSnap(snapElements, x, y, state.snapMask);
|
|
446
|
+
snap = _export2.SnapUtils.nearestSnap(snapElements, x, y, state.snapMask);
|
|
449
447
|
if (snap) {
|
|
450
448
|
var _snap$point = snap.point;
|
|
451
449
|
x = _snap$point.x;
|
|
@@ -453,36 +451,36 @@ var Line = /*#__PURE__*/function () {
|
|
|
453
451
|
}
|
|
454
452
|
snapElements = snapElements.withMutations(function (snapElements) {
|
|
455
453
|
var a, b, c;
|
|
456
|
-
var _GeometryUtils$horizo = GeometryUtils.horizontalLine(y);
|
|
454
|
+
var _GeometryUtils$horizo = _export2.GeometryUtils.horizontalLine(y);
|
|
457
455
|
a = _GeometryUtils$horizo.a;
|
|
458
456
|
b = _GeometryUtils$horizo.b;
|
|
459
457
|
c = _GeometryUtils$horizo.c;
|
|
460
|
-
SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
461
|
-
var _GeometryUtils$vertic = GeometryUtils.verticalLine(x);
|
|
458
|
+
_export2.SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
459
|
+
var _GeometryUtils$vertic = _export2.GeometryUtils.verticalLine(x);
|
|
462
460
|
a = _GeometryUtils$vertic.a;
|
|
463
461
|
b = _GeometryUtils$vertic.b;
|
|
464
462
|
c = _GeometryUtils$vertic.c;
|
|
465
|
-
SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
466
|
-
var _GeometryUtils$upcros = GeometryUtils.upcrossLine(x, y);
|
|
463
|
+
_export2.SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
464
|
+
var _GeometryUtils$upcros = _export2.GeometryUtils.upcrossLine(x, y);
|
|
467
465
|
a = _GeometryUtils$upcros.a;
|
|
468
466
|
b = _GeometryUtils$upcros.b;
|
|
469
467
|
c = _GeometryUtils$upcros.c;
|
|
470
|
-
SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
471
|
-
var _GeometryUtils$downcr = GeometryUtils.downcrossLine(x, y);
|
|
468
|
+
_export2.SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
469
|
+
var _GeometryUtils$downcr = _export2.GeometryUtils.downcrossLine(x, y);
|
|
472
470
|
a = _GeometryUtils$downcr.a;
|
|
473
471
|
b = _GeometryUtils$downcr.b;
|
|
474
472
|
c = _GeometryUtils$downcr.c;
|
|
475
|
-
SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
473
|
+
_export2.SnapUtils.addLineSnap(snapElements, a, b, c, 10, 3, null);
|
|
476
474
|
});
|
|
477
475
|
}
|
|
478
476
|
var drawingSupport = state.get('drawingSupport').set('layerID', layerID);
|
|
479
|
-
state = Layer.unselectAll(state, layerID).updatedState;
|
|
477
|
+
state = _export.Layer.unselectAll(state, layerID).updatedState;
|
|
480
478
|
var _Line$create3 = Line.create(state, layerID, drawingSupport.get('type'), x, y, x, y),
|
|
481
479
|
stateL = _Line$create3.updatedState,
|
|
482
480
|
line = _Line$create3.line;
|
|
483
481
|
state = Line.select(stateL, layerID, line.id).updatedState;
|
|
484
482
|
state = state.merge({
|
|
485
|
-
mode: MODE_DRAWING_LINE,
|
|
483
|
+
mode: _constants.MODE_DRAWING_LINE,
|
|
486
484
|
snapElements: snapElements,
|
|
487
485
|
activeSnapElement: snap ? snap.snap : null,
|
|
488
486
|
drawingSupport: drawingSupport
|
|
@@ -496,7 +494,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
496
494
|
value: function updateDrawingLine(state, x, y, relatedLines) {
|
|
497
495
|
var snap = null;
|
|
498
496
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
499
|
-
snap = SnapUtils.nearestSnap(state.snapElements, x, y, state.snapMask);
|
|
497
|
+
snap = _export2.SnapUtils.nearestSnap(state.snapElements, x, y, state.snapMask);
|
|
500
498
|
if (snap) {
|
|
501
499
|
var _snap$point2 = snap.point;
|
|
502
500
|
x = _snap$point2.x;
|
|
@@ -512,7 +510,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
512
510
|
var moveFlag = true;
|
|
513
511
|
var tx = vertices[drawingLine.vertices[1]].x;
|
|
514
512
|
var ty = vertices[drawingLine.vertices[1]].y;
|
|
515
|
-
if (!isEmpty(relatedLines)) {
|
|
513
|
+
if (!(0, _helper.isEmpty)(relatedLines)) {
|
|
516
514
|
vertices[drawingLine.vertices[1]].x = x;
|
|
517
515
|
vertices[drawingLine.vertices[1]].y = y;
|
|
518
516
|
}
|
|
@@ -522,12 +520,12 @@ var Line = /*#__PURE__*/function () {
|
|
|
522
520
|
if (drawingLine.vertices[0] !== drawingLine.vertices[1]) {
|
|
523
521
|
relatedLines.forEach(function (line) {
|
|
524
522
|
// get the points of two lines(drawing line and related line)
|
|
525
|
-
if (!isEmpty(line)) {
|
|
523
|
+
if (!(0, _helper.isEmpty)(line)) {
|
|
526
524
|
// the angle between two lines(line, drawingLine)
|
|
527
|
-
lineAngle = GeometryUtils.angleBetweenTwoLines(line, drawingLine, vertices);
|
|
525
|
+
lineAngle = _export2.GeometryUtils.angleBetweenTwoLines(line, drawingLine, vertices);
|
|
528
526
|
// check whether the angle is less than or bigger than specific value.
|
|
529
527
|
absAngle = Math.abs(lineAngle);
|
|
530
|
-
if (absAngle < MIN_ANGLE_DISALLOW_DRAW_WALL || absAngle > 360 - MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
528
|
+
if (absAngle < _constants.MIN_ANGLE_DISALLOW_DRAW_WALL || absAngle > 360 - _constants.MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
531
529
|
moveFlag = false;
|
|
532
530
|
} else moveFlag = true;
|
|
533
531
|
}
|
|
@@ -539,20 +537,20 @@ var Line = /*#__PURE__*/function () {
|
|
|
539
537
|
tx = x;
|
|
540
538
|
ty = y;
|
|
541
539
|
} else {
|
|
542
|
-
var rest = MIN_ANGLE_DISALLOW_DRAW_WALL - absAngle;
|
|
540
|
+
var rest = _constants.MIN_ANGLE_DISALLOW_DRAW_WALL - absAngle;
|
|
543
541
|
// the origin point of rotation(snapping)
|
|
544
542
|
var ox = vertices[drawingLine.vertices[0]].x;
|
|
545
543
|
var oy = vertices[drawingLine.vertices[0]].y;
|
|
546
544
|
// determine the direction of rotation.
|
|
547
545
|
rest = lineAngle > 0 ? -rest : rest;
|
|
548
546
|
// rotate the current point to last point around the first point of drawing line.
|
|
549
|
-
var res = GeometryUtils.rotatePointAroundPoint(x, y, ox, oy, rest);
|
|
547
|
+
var res = _export2.GeometryUtils.rotatePointAroundPoint(x, y, ox, oy, rest);
|
|
550
548
|
tx = res.x;
|
|
551
549
|
ty = res.y;
|
|
552
550
|
}
|
|
553
551
|
// angle snapping as a value of UNIT_ANGLE
|
|
554
|
-
if (moveFlag && !isEmpty(absAngle) && absAngle % UNIT_ANGLE !== 0) {
|
|
555
|
-
var result = GeometryUtils.snapAngleByUnit(lineAngle, vertices, drawingLine, tx, ty, drawingLine.vertices[1]);
|
|
552
|
+
if (moveFlag && !(0, _helper.isEmpty)(absAngle) && absAngle % _constants.UNIT_ANGLE !== 0) {
|
|
553
|
+
var result = _export2.GeometryUtils.snapAngleByUnit(lineAngle, vertices, drawingLine, tx, ty, drawingLine.vertices[1]);
|
|
556
554
|
tx = result.x;
|
|
557
555
|
ty = result.y;
|
|
558
556
|
}
|
|
@@ -582,9 +580,9 @@ var Line = /*#__PURE__*/function () {
|
|
|
582
580
|
var _layer$lines$get;
|
|
583
581
|
var holeOffset = [];
|
|
584
582
|
(_layer$lines$get = layer.lines.get(lineID)) === null || _layer$lines$get === void 0 || _layer$lines$get.holes.forEach(function (holeID) {
|
|
585
|
-
var lineLength = GeometryUtils.pointsDistance(nv0.x, nv0.y, nv1.x, nv1.y);
|
|
586
|
-
var minV = GeometryUtils.minVertex(nv0, nv1);
|
|
587
|
-
var maxV = GeometryUtils.maxVertex(nv0, nv1);
|
|
583
|
+
var lineLength = _export2.GeometryUtils.pointsDistance(nv0.x, nv0.y, nv1.x, nv1.y);
|
|
584
|
+
var minV = _export2.GeometryUtils.minVertex(nv0, nv1);
|
|
585
|
+
var maxV = _export2.GeometryUtils.maxVertex(nv0, nv1);
|
|
588
586
|
var alpha = Math.atan2(maxV.y - minV.y, maxV.x - minV.x);
|
|
589
587
|
var hole = layer.holes.get(holeID);
|
|
590
588
|
var pointOnLine = lineLength * hole.offset;
|
|
@@ -625,7 +623,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
625
623
|
return mgline.id === lineID;
|
|
626
624
|
});
|
|
627
625
|
});
|
|
628
|
-
if (!isEmpty(relatedLineID)) {
|
|
626
|
+
if (!(0, _helper.isEmpty)(relatedLineID)) {
|
|
629
627
|
var relatedLine = layer.lines.get(relatedLineID[0]);
|
|
630
628
|
var intersectionPoint = vertex;
|
|
631
629
|
var startPoint, endPoint;
|
|
@@ -642,8 +640,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
642
640
|
var tline2 = {
|
|
643
641
|
vertices: [intersectionPoint.id, endPoint.id]
|
|
644
642
|
};
|
|
645
|
-
var angle = Math.abs(GeometryUtils.angleBetweenTwoLines(tline1, tline2, allVertices.toJS()));
|
|
646
|
-
if (Math.abs(angle - 180) <= EPSILON) {
|
|
643
|
+
var angle = Math.abs(_export2.GeometryUtils.angleBetweenTwoLines(tline1, tline2, allVertices.toJS()));
|
|
644
|
+
if (Math.abs(angle - 180) <= _constants.EPSILON) {
|
|
647
645
|
selectedLineInfo.mergelines.push(relatedLine);
|
|
648
646
|
selectedLineInfo.points[0] = startPoint;
|
|
649
647
|
selectedLineInfo.points[1] = endPoint;
|
|
@@ -661,7 +659,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
661
659
|
var allVertices = state.getIn(['scene', 'layers', layerID, 'vertices']);
|
|
662
660
|
var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
|
|
663
661
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
664
|
-
if (isEmpty(line)) {
|
|
662
|
+
if ((0, _helper.isEmpty)(line)) {
|
|
665
663
|
return {
|
|
666
664
|
updatedState: state
|
|
667
665
|
};
|
|
@@ -693,13 +691,13 @@ var Line = /*#__PURE__*/function () {
|
|
|
693
691
|
var holesWithOffsetPosition = [];
|
|
694
692
|
var lineID = layer.getIn(['selected', 'lines']).first(); // lines : [id]
|
|
695
693
|
var line = layer.getIn(['lines', lineID]);
|
|
696
|
-
if (isEmpty(line)) {
|
|
694
|
+
if ((0, _helper.isEmpty)(line)) {
|
|
697
695
|
return {
|
|
698
696
|
updatedState: state
|
|
699
697
|
};
|
|
700
698
|
}
|
|
701
699
|
mergeInfo.mergelines.forEach(function (line) {
|
|
702
|
-
if ([END_DRAGGING_LINE, END_DRAGGING_VERTEX].includes(actionType)) {
|
|
700
|
+
if ([_constants.END_DRAGGING_LINE, _constants.END_DRAGGING_VERTEX].includes(actionType)) {
|
|
703
701
|
var tmpGroups = state //get groups membership if present
|
|
704
702
|
.getIn(['scene', 'groups']).filter(function (group) {
|
|
705
703
|
var lines = group.getIn(['elements', layerID, 'lines']);
|
|
@@ -718,20 +716,20 @@ var Line = /*#__PURE__*/function () {
|
|
|
718
716
|
state = Line.remove(state, layerID, line.id).updatedState;
|
|
719
717
|
});
|
|
720
718
|
var ret;
|
|
721
|
-
if (!GeometryUtils.samePoints(mergeInfo.points[0], mergeInfo.points[1])) {
|
|
719
|
+
if (!_export2.GeometryUtils.samePoints(mergeInfo.points[0], mergeInfo.points[1])) {
|
|
722
720
|
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);
|
|
723
721
|
state = ret.updatedState;
|
|
724
722
|
}
|
|
725
|
-
if ([END_DRAGGING_LINE, END_DRAGGING_VERTEX].includes(actionType)) {
|
|
723
|
+
if ([_constants.END_DRAGGING_LINE, _constants.END_DRAGGING_VERTEX].includes(actionType)) {
|
|
726
724
|
//re-add to old line's groups if present
|
|
727
725
|
ret.lines.forEach(function (addedLine) {
|
|
728
726
|
lineGroups.forEach(function (oldLineGroup) {
|
|
729
|
-
state = Group.addElement(state, oldLineGroup.id, layerID, 'lines', addedLine.id).updatedState;
|
|
727
|
+
state = _export.Group.addElement(state, oldLineGroup.id, layerID, 'lines', addedLine.id).updatedState;
|
|
730
728
|
});
|
|
731
729
|
});
|
|
732
730
|
}
|
|
733
|
-
state = Layer.removeZeroLengthLines(state, layerID).updatedState;
|
|
734
|
-
if (!isEmpty((_ret = ret) === null || _ret === void 0 ? void 0 : _ret.newline)) {
|
|
731
|
+
state = _export.Layer.removeZeroLengthLines(state, layerID).updatedState;
|
|
732
|
+
if (!(0, _helper.isEmpty)((_ret = ret) === null || _ret === void 0 ? void 0 : _ret.newline)) {
|
|
735
733
|
state = this.select(state, layerID, ret.newline.get('id')).updatedState;
|
|
736
734
|
}
|
|
737
735
|
return {
|
|
@@ -746,10 +744,10 @@ var Line = /*#__PURE__*/function () {
|
|
|
746
744
|
var lineID = layer.getIn(['selected', 'lines']).first(); // lines : [id]
|
|
747
745
|
var line = layer.getIn(['lines', lineID]);
|
|
748
746
|
var drawingInfo = {};
|
|
749
|
-
if (!isEmpty(line)) {
|
|
747
|
+
if (!(0, _helper.isEmpty)(line)) {
|
|
750
748
|
drawingInfo.drawingLine = line;
|
|
751
749
|
}
|
|
752
|
-
state = Layer.detectAndUpdateAreas(state, layerID, drawingInfo).updatedState;
|
|
750
|
+
state = _export.Layer.detectAndUpdateAreas(state, layerID, drawingInfo).updatedState;
|
|
753
751
|
return {
|
|
754
752
|
updatedState: state
|
|
755
753
|
};
|
|
@@ -771,16 +769,16 @@ var Line = /*#__PURE__*/function () {
|
|
|
771
769
|
var layerID = state.getIn(['scene', 'selectedLayer']);
|
|
772
770
|
var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
|
|
773
771
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
774
|
-
if (isEmpty(line)) {
|
|
772
|
+
if ((0, _helper.isEmpty)(line)) {
|
|
775
773
|
return {
|
|
776
774
|
updatedState: state
|
|
777
775
|
};
|
|
778
776
|
}
|
|
779
|
-
if (!isEmpty(v0)) {
|
|
777
|
+
if (!(0, _helper.isEmpty)(v0)) {
|
|
780
778
|
state = state.setIn(['scene', 'layers', layerID, 'vertices', line.vertices.get(0), 'x'], v0.x);
|
|
781
779
|
state = state.setIn(['scene', 'layers', layerID, 'vertices', line.vertices.get(0), 'y'], v0.y);
|
|
782
780
|
}
|
|
783
|
-
if (!isEmpty(v1)) {
|
|
781
|
+
if (!(0, _helper.isEmpty)(v1)) {
|
|
784
782
|
state = state.setIn(['scene', 'layers', layerID, 'vertices', line.vertices.get(1), 'x'], v1.x);
|
|
785
783
|
state = state.setIn(['scene', 'layers', layerID, 'vertices', line.vertices.get(1), 'y'], v1.y);
|
|
786
784
|
}
|
|
@@ -794,7 +792,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
794
792
|
key: "endDrawingLine",
|
|
795
793
|
value: function endDrawingLine(state, x, y) {
|
|
796
794
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
797
|
-
var snap = SnapUtils.nearestSnap(state.snapElements, x, y, state.snapMask);
|
|
795
|
+
var snap = _export2.SnapUtils.nearestSnap(state.snapElements, x, y, state.snapMask);
|
|
798
796
|
if (snap) {
|
|
799
797
|
var _snap$point3 = snap.point;
|
|
800
798
|
x = _snap$point3.x;
|
|
@@ -807,8 +805,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
807
805
|
if (drawingLine.vertices[0] === drawingLine.vertices[1]) {
|
|
808
806
|
state = Line.remove(state, layerID, lineID).updatedState;
|
|
809
807
|
state = state.merge({
|
|
810
|
-
mode: MODE_IDLE,
|
|
811
|
-
snapElements: new List(),
|
|
808
|
+
mode: _constants.MODE_IDLE,
|
|
809
|
+
snapElements: new _immutable.List(),
|
|
812
810
|
activeSnapElement: null
|
|
813
811
|
});
|
|
814
812
|
return {
|
|
@@ -819,10 +817,10 @@ var Line = /*#__PURE__*/function () {
|
|
|
819
817
|
x: x,
|
|
820
818
|
y: y
|
|
821
819
|
}, state).updatedState;
|
|
822
|
-
state = this.applyWallChanges(state, END_DRAWING_LINE).updatedState;
|
|
820
|
+
state = this.applyWallChanges(state, _constants.END_DRAWING_LINE).updatedState;
|
|
823
821
|
state = state.merge({
|
|
824
|
-
mode: MODE_WAITING_DRAWING_LINE,
|
|
825
|
-
snapElements: new List(),
|
|
822
|
+
mode: _constants.MODE_WAITING_DRAWING_LINE,
|
|
823
|
+
snapElements: new _immutable.List(),
|
|
826
824
|
activeSnapElement: null
|
|
827
825
|
});
|
|
828
826
|
return {
|
|
@@ -832,15 +830,15 @@ var Line = /*#__PURE__*/function () {
|
|
|
832
830
|
}, {
|
|
833
831
|
key: "beginDraggingLine",
|
|
834
832
|
value: function beginDraggingLine(state, layerID, lineID, x, y) {
|
|
835
|
-
var snapElements = SnapSceneUtils.sceneSnapElements(state.scene, new List(), state.snapMask);
|
|
833
|
+
var snapElements = _export2.SnapSceneUtils.sceneSnapElements(state.scene, new _immutable.List(), state.snapMask);
|
|
836
834
|
var layer = state.scene.layers.get(layerID);
|
|
837
835
|
var line = layer.lines.get(lineID);
|
|
838
836
|
var vertex0 = layer.vertices.get(line.vertices.get(0));
|
|
839
837
|
var vertex1 = layer.vertices.get(line.vertices.get(1));
|
|
840
838
|
state = state.merge({
|
|
841
|
-
mode: MODE_DRAGGING_LINE,
|
|
839
|
+
mode: _constants.MODE_DRAGGING_LINE,
|
|
842
840
|
snapElements: snapElements,
|
|
843
|
-
draggingSupport: Map({
|
|
841
|
+
draggingSupport: (0, _immutable.Map)({
|
|
844
842
|
layerID: layerID,
|
|
845
843
|
lineID: lineID,
|
|
846
844
|
startPointX: x,
|
|
@@ -878,7 +876,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
878
876
|
var vec1 = pos1.clone().sub(cen).normalize();
|
|
879
877
|
var vec2 = pos2.clone().sub(cen).normalize();
|
|
880
878
|
var angle = Math.floor(vec1.angle() * 180 / Math.PI - vec2.angle() * 180 / Math.PI + 0.5);
|
|
881
|
-
if (Math.abs(angle) < MIN_ANGLE_DISALLOW_DRAW_WALL || Math.abs(angle) > 360 - MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
879
|
+
if (Math.abs(angle) < _constants.MIN_ANGLE_DISALLOW_DRAW_WALL || Math.abs(angle) > 360 - _constants.MIN_ANGLE_DISALLOW_DRAW_WALL) {
|
|
882
880
|
mvFlag.push(false);
|
|
883
881
|
} else {
|
|
884
882
|
mvFlag.push(true);
|
|
@@ -918,8 +916,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
918
916
|
var curSnap0 = null,
|
|
919
917
|
curSnap1 = null;
|
|
920
918
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
921
|
-
curSnap0 = SnapUtils.nearestSnap(snapElements, newVertex0X, newVertex0Y, state.snapMask);
|
|
922
|
-
curSnap1 = SnapUtils.nearestSnap(snapElements, newVertex1X, newVertex1Y, state.snapMask);
|
|
919
|
+
curSnap0 = _export2.SnapUtils.nearestSnap(snapElements, newVertex0X, newVertex0Y, state.snapMask);
|
|
920
|
+
curSnap1 = _export2.SnapUtils.nearestSnap(snapElements, newVertex1X, newVertex1Y, state.snapMask);
|
|
923
921
|
}
|
|
924
922
|
var deltaX = 0,
|
|
925
923
|
deltaY = 0;
|
|
@@ -1003,8 +1001,8 @@ var Line = /*#__PURE__*/function () {
|
|
|
1003
1001
|
var newVertex1X = draggingSupport.get('startVertex1X') + diffX;
|
|
1004
1002
|
var newVertex1Y = draggingSupport.get('startVertex1Y') + diffY;
|
|
1005
1003
|
if (state.snapMask && !state.snapMask.isEmpty()) {
|
|
1006
|
-
var curSnap0 = SnapUtils.nearestSnap(state.snapElements, newVertex0X, newVertex0Y, state.snapMask);
|
|
1007
|
-
var curSnap1 = SnapUtils.nearestSnap(state.snapElements, newVertex1X, newVertex1Y, state.snapMask);
|
|
1004
|
+
var curSnap0 = _export2.SnapUtils.nearestSnap(state.snapElements, newVertex0X, newVertex0Y, state.snapMask);
|
|
1005
|
+
var curSnap1 = _export2.SnapUtils.nearestSnap(state.snapElements, newVertex1X, newVertex1Y, state.snapMask);
|
|
1008
1006
|
var deltaX = 0,
|
|
1009
1007
|
deltaY = 0;
|
|
1010
1008
|
if (curSnap0 && curSnap1) {
|
|
@@ -1041,9 +1039,9 @@ var Line = /*#__PURE__*/function () {
|
|
|
1041
1039
|
newVertex0Y = newResult.newVertex0Y;
|
|
1042
1040
|
newVertex1X = newResult.newVertex1X;
|
|
1043
1041
|
newVertex1Y = newResult.newVertex1Y;
|
|
1044
|
-
state = Layer.mergeEqualsVertices(state, layerID, line.vertices.get(0)).updatedState;
|
|
1045
|
-
state = Layer.mergeEqualsVertices(state, layerID, line.vertices.get(1)).updatedState;
|
|
1046
|
-
if (GeometryUtils.samePoints({
|
|
1042
|
+
state = _export.Layer.mergeEqualsVertices(state, layerID, line.vertices.get(0)).updatedState;
|
|
1043
|
+
state = _export.Layer.mergeEqualsVertices(state, layerID, line.vertices.get(1)).updatedState;
|
|
1044
|
+
if (_export2.GeometryUtils.samePoints({
|
|
1047
1045
|
newVertex0X: newVertex0X,
|
|
1048
1046
|
newVertex0Y: newVertex0Y
|
|
1049
1047
|
}, {
|
|
@@ -1059,13 +1057,13 @@ var Line = /*#__PURE__*/function () {
|
|
|
1059
1057
|
x: newVertex1X,
|
|
1060
1058
|
y: newVertex1Y
|
|
1061
1059
|
}, state).updatedState;
|
|
1062
|
-
state = this.applyWallChanges(state, END_DRAGGING_LINE).updatedState;
|
|
1060
|
+
state = this.applyWallChanges(state, _constants.END_DRAGGING_LINE).updatedState;
|
|
1063
1061
|
}
|
|
1064
1062
|
state = state.merge({
|
|
1065
|
-
mode: MODE_IDLE,
|
|
1063
|
+
mode: _constants.MODE_IDLE,
|
|
1066
1064
|
draggingSupport: null,
|
|
1067
1065
|
activeSnapElement: null,
|
|
1068
|
-
snapElements: new List()
|
|
1066
|
+
snapElements: new _immutable.List()
|
|
1069
1067
|
});
|
|
1070
1068
|
return {
|
|
1071
1069
|
updatedState: state
|
|
@@ -1082,7 +1080,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
1082
1080
|
}, {
|
|
1083
1081
|
key: "setJsProperties",
|
|
1084
1082
|
value: function setJsProperties(state, layerID, lineID, properties) {
|
|
1085
|
-
return this.setProperties(state, layerID, lineID, fromJS(properties));
|
|
1083
|
+
return this.setProperties(state, layerID, lineID, (0, _immutable.fromJS)(properties));
|
|
1086
1084
|
}
|
|
1087
1085
|
}, {
|
|
1088
1086
|
key: "updateProperties",
|
|
@@ -1097,7 +1095,7 @@ var Line = /*#__PURE__*/function () {
|
|
|
1097
1095
|
}, {
|
|
1098
1096
|
key: "updateJsProperties",
|
|
1099
1097
|
value: function updateJsProperties(state, layerID, lineID, properties) {
|
|
1100
|
-
return this.updateProperties(state, layerID, lineID, fromJS(properties));
|
|
1098
|
+
return this.updateProperties(state, layerID, lineID, (0, _immutable.fromJS)(properties));
|
|
1101
1099
|
}
|
|
1102
1100
|
}, {
|
|
1103
1101
|
key: "setAttributes",
|
|
@@ -1116,17 +1114,17 @@ var Line = /*#__PURE__*/function () {
|
|
|
1116
1114
|
delete lAttr['lineToExtend'];
|
|
1117
1115
|
delete lAttr['lineLength'];
|
|
1118
1116
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
1119
|
-
state = state.mergeIn(['scene', 'layers', layerID, 'lines', lineID], fromJS(lAttr)).mergeIn(['scene', 'layers', layerID, 'vertices', vertexOne.id], {
|
|
1117
|
+
state = state.mergeIn(['scene', 'layers', layerID, 'lines', lineID], (0, _immutable.fromJS)(lAttr)).mergeIn(['scene', 'layers', layerID, 'vertices', vertexOne.id], {
|
|
1120
1118
|
x: vertexOne.x,
|
|
1121
1119
|
y: vertexOne.y
|
|
1122
1120
|
}).mergeIn(['scene', 'layers', layerID, 'vertices', vertexTwo.id], {
|
|
1123
1121
|
x: vertexTwo.x,
|
|
1124
1122
|
y: vertexTwo.y
|
|
1125
|
-
}).mergeIn(['scene', 'layers', layerID, 'lines', lineID, 'misc'], new Map({
|
|
1123
|
+
}).mergeIn(['scene', 'layers', layerID, 'lines', lineID, 'misc'], new _immutable.Map({
|
|
1126
1124
|
_unitLength: lineLength._unit
|
|
1127
1125
|
})).mergeIn(['scene', 'layers', layerID, 'lines', lineID, 'focus'], true);
|
|
1128
1126
|
if (lineToExtend) {
|
|
1129
|
-
state = state.mergeIn(['scene', 'layers', layerID, 'lines', lineToExtend.id], fromJS(lAttr)).mergeIn(['scene', 'layers', layerID, 'lines', lineToExtend.id, 'misc'], new Map({
|
|
1127
|
+
state = state.mergeIn(['scene', 'layers', layerID, 'lines', lineToExtend.id], (0, _immutable.fromJS)(lAttr)).mergeIn(['scene', 'layers', layerID, 'lines', lineToExtend.id, 'misc'], new _immutable.Map({
|
|
1130
1128
|
_unitLength: lineLength._unit
|
|
1131
1129
|
}));
|
|
1132
1130
|
}
|
|
@@ -1142,14 +1140,14 @@ var Line = /*#__PURE__*/function () {
|
|
|
1142
1140
|
y: vertexFour.y
|
|
1143
1141
|
});
|
|
1144
1142
|
}
|
|
1145
|
-
state = Layer.mergeEqualsVertices(state, layerID, vertexOne.id).updatedState;
|
|
1143
|
+
state = _export.Layer.mergeEqualsVertices(state, layerID, vertexOne.id).updatedState;
|
|
1146
1144
|
if (vertexOne.x != vertexTwo.x && vertexOne.y != vertexTwo.y) {
|
|
1147
|
-
state = Layer.mergeEqualsVertices(state, layerID, vertexTwo.id).updatedState;
|
|
1145
|
+
state = _export.Layer.mergeEqualsVertices(state, layerID, vertexTwo.id).updatedState;
|
|
1148
1146
|
}
|
|
1149
1147
|
state = this.select(state, layerID, lineID).updatedState;
|
|
1150
|
-
state = this.applyWallChanges(state, END_DRAWING_LINE).updatedState;
|
|
1148
|
+
state = this.applyWallChanges(state, _constants.END_DRAWING_LINE).updatedState;
|
|
1151
1149
|
state = state.merge({
|
|
1152
|
-
sceneHistory: history.historyPush(state.sceneHistory, state.scene)
|
|
1150
|
+
sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
|
|
1153
1151
|
});
|
|
1154
1152
|
if (state.mode.endsWith('_LINE')) {
|
|
1155
1153
|
state = state.setIn(['scene', 'setLineAttributes'], true);
|
|
@@ -1163,11 +1161,11 @@ var Line = /*#__PURE__*/function () {
|
|
|
1163
1161
|
key: "setVerticesCoords",
|
|
1164
1162
|
value: function setVerticesCoords(state, layerID, lineID, x1, y1, x2, y2) {
|
|
1165
1163
|
var line = state.getIn(['scene', 'layers', layerID, 'lines', lineID]);
|
|
1166
|
-
state = Vertex.setAttributes(state, layerID, line.vertices.get(0), new Map({
|
|
1164
|
+
state = _export.Vertex.setAttributes(state, layerID, line.vertices.get(0), new _immutable.Map({
|
|
1167
1165
|
x: x1,
|
|
1168
1166
|
y: y1
|
|
1169
1167
|
})).updatedState;
|
|
1170
|
-
state = Vertex.setAttributes(state, layerID, line.vertices.get(1), new Map({
|
|
1168
|
+
state = _export.Vertex.setAttributes(state, layerID, line.vertices.get(1), new _immutable.Map({
|
|
1171
1169
|
x: x2,
|
|
1172
1170
|
y: y2
|
|
1173
1171
|
})).updatedState;
|
|
@@ -1176,5 +1174,4 @@ var Line = /*#__PURE__*/function () {
|
|
|
1176
1174
|
};
|
|
1177
1175
|
}
|
|
1178
1176
|
}]);
|
|
1179
|
-
}();
|
|
1180
|
-
export { Line as default };
|
|
1177
|
+
}();
|