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