kitchen-simulator 1.1.1-test.63 → 1.1.1-test.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/@history.js +10 -2
- package/es/AppContext.js +10 -3
- package/es/KitchenConfigurator.js +79 -70
- package/es/KitchenConfiguratorApp.js +107 -98
- package/es/actions/area-actions.js +12 -5
- package/es/actions/export.js +29 -12
- package/es/actions/groups-actions.js +45 -27
- package/es/actions/holes-actions.js +55 -34
- package/es/actions/items-actions.js +145 -94
- package/es/actions/lines-actions.js +36 -21
- package/es/actions/project-actions.js +145 -94
- package/es/actions/scene-actions.js +21 -11
- package/es/actions/vertices-actions.js +15 -7
- package/es/actions/viewer2d-actions.js +36 -21
- package/es/actions/viewer3d-actions.js +18 -9
- package/es/catalog/areas/area/planner-element.js +9 -2
- package/es/catalog/catalog.js +21 -15
- package/es/catalog/factories/area-factory-3d.js +31 -22
- package/es/catalog/factories/area-factory.js +20 -11
- package/es/catalog/factories/export.js +24 -6
- package/es/catalog/factories/wall-factory-3d.js +41 -31
- package/es/catalog/factories/wall-factory.js +31 -21
- package/es/catalog/holes/door-closet/planner-element.js +24 -15
- package/es/catalog/holes/door-double/planner-element.js +24 -15
- package/es/catalog/holes/door-exterior/planner-element.js +25 -16
- package/es/catalog/holes/door-interior/planner-element.js +25 -16
- package/es/catalog/holes/door-panic/planner-element.js +16 -7
- package/es/catalog/holes/door-panic-double/planner-element.js +24 -15
- package/es/catalog/holes/door-sliding/planner-element.js +25 -16
- package/es/catalog/holes/doorway-framed/planner-element.js +20 -11
- package/es/catalog/holes/doorway-frameless/planner-element.js +16 -7
- package/es/catalog/holes/export.js +97 -13
- package/es/catalog/holes/window-clear/planner-element.js +19 -10
- package/es/catalog/holes/window-cross/planner-element.js +19 -10
- package/es/catalog/holes/window-double-hung/planner-element.js +19 -10
- package/es/catalog/holes/window-vertical/planner-element.js +19 -10
- package/es/catalog/lines/wall/planner-element.js +9 -2
- package/es/catalog/molding/molding-dcm/planner-element.js +14 -5
- package/es/catalog/molding/molding-fbm/planner-element.js +14 -5
- package/es/catalog/molding/molding-lrm/planner-element.js +14 -5
- package/es/catalog/properties/export.js +80 -20
- package/es/catalog/properties/property-checkbox.js +31 -24
- package/es/catalog/properties/property-color.js +23 -16
- package/es/catalog/properties/property-enum.js +31 -24
- package/es/catalog/properties/property-hidden.js +16 -9
- package/es/catalog/properties/property-lenght-measure.js +45 -38
- package/es/catalog/properties/property-length-measure.js +43 -36
- package/es/catalog/properties/property-length-measure_hole.js +45 -38
- package/es/catalog/properties/property-number.js +24 -17
- package/es/catalog/properties/property-read-only.js +23 -16
- package/es/catalog/properties/property-string.js +23 -16
- package/es/catalog/properties/property-toggle.js +23 -16
- package/es/catalog/properties/shared-property-style.js +7 -1
- package/es/catalog/utils/FuseUtils.js +15 -8
- package/es/catalog/utils/exporter.js +15 -8
- package/es/catalog/utils/geom-utils.js +29 -13
- package/es/catalog/utils/item-loader.js +97 -84
- package/es/catalog/utils/load-obj.js +28 -20
- package/es/catalog/utils/mtl-loader.js +8 -3
- package/es/catalog/utils/obj-loader.js +8 -3
- package/es/class/FuseUtils.js +15 -8
- package/es/class/area.js +28 -22
- package/es/class/export.js +95 -23
- package/es/class/group.js +59 -53
- package/es/class/guide.js +21 -15
- package/es/class/hole.js +89 -83
- package/es/class/item.js +147 -141
- package/es/class/layer.js +65 -59
- package/es/class/line.js +143 -135
- package/es/class/project.js +98 -90
- package/es/class/vertex.js +35 -29
- package/es/components/content.js +28 -19
- package/es/components/disclaimer/disclaimer.js +18 -10
- package/es/components/export.js +32 -8
- package/es/components/style/button.js +31 -23
- package/es/components/style/cancel-button.js +14 -7
- package/es/components/style/content-container.js +16 -9
- package/es/components/style/content-title.js +20 -11
- package/es/components/style/delete-button.js +17 -8
- package/es/components/style/export.js +120 -30
- package/es/components/style/form-block.js +15 -8
- package/es/components/style/form-color-input.js +14 -7
- package/es/components/style/form-label.js +15 -8
- package/es/components/style/form-number-input.js +49 -41
- package/es/components/style/form-number-input_2.js +44 -36
- package/es/components/style/form-select.js +24 -17
- package/es/components/style/form-slider.js +17 -10
- package/es/components/style/form-submit-button.js +17 -8
- package/es/components/style/form-text-input.js +34 -26
- package/es/components/viewer2d/area.js +24 -17
- package/es/components/viewer2d/export.js +120 -30
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +17 -10
- package/es/components/viewer2d/grids/grid-streak.js +17 -10
- package/es/components/viewer2d/grids/grid-vertical-streak.js +17 -10
- package/es/components/viewer2d/grids/grids.js +19 -10
- package/es/components/viewer2d/group.js +24 -15
- package/es/components/viewer2d/item.js +70 -61
- package/es/components/viewer2d/layer.js +30 -23
- package/es/components/viewer2d/line.js +111 -101
- package/es/components/viewer2d/ruler.js +29 -22
- package/es/components/viewer2d/rulerDist.js +28 -21
- package/es/components/viewer2d/rulerX.js +47 -39
- package/es/components/viewer2d/rulerY.js +45 -37
- package/es/components/viewer2d/scene.js +38 -30
- package/es/components/viewer2d/snap.js +22 -13
- package/es/components/viewer2d/state.js +27 -18
- package/es/components/viewer2d/utils.js +37 -24
- package/es/components/viewer2d/vertex.js +17 -8
- package/es/components/viewer2d/viewer2d.js +163 -153
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +23 -17
- package/es/components/viewer3d/dcm.js +7 -1
- package/es/components/viewer3d/fbm.js +7 -1
- package/es/components/viewer3d/front3D.js +21 -12
- package/es/components/viewer3d/grid-creator.js +17 -8
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +14 -6
- package/es/components/viewer3d/grids/grid-streak.js +13 -5
- package/es/components/viewer3d/grids/grid-vertical-streak.js +14 -6
- package/es/components/viewer3d/libs/first-person-controls.js +9 -2
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +7 -1
- package/es/components/viewer3d/libs/mtl-loader.js +7 -1
- package/es/components/viewer3d/libs/obj-loader.js +7 -1
- package/es/components/viewer3d/libs/orbit-controls.js +8 -2
- package/es/components/viewer3d/libs/pointer-lock-controls.js +8 -2
- package/es/components/viewer3d/lrm.js +7 -1
- package/es/components/viewer3d/model.js +7 -1
- package/es/components/viewer3d/pointer-lock-navigation.js +10 -3
- package/es/components/viewer3d/ruler-utils/itemRect.js +25 -18
- package/es/components/viewer3d/ruler-utils/layer3D.js +66 -59
- package/es/components/viewer3d/ruler-utils/ruler3D.js +46 -39
- package/es/components/viewer3d/ruler-utils/scene3D.js +17 -9
- package/es/components/viewer3d/ruler-utils/state3D.js +11 -4
- package/es/components/viewer3d/scene-creator.js +226 -191
- package/es/components/viewer3d/three-memory-cleaner.js +12 -3
- package/es/components/viewer3d/viewer3d-first-person.js +46 -40
- package/es/components/viewer3d/viewer3d.js +202 -196
- package/es/constants.js +358 -349
- package/es/index.js +15 -7
- package/es/models.js +184 -177
- package/es/plugins/SVGLoader.js +53 -48
- package/es/plugins/autosave.js +9 -3
- package/es/plugins/console-debugger.js +12 -5
- package/es/plugins/export.js +32 -8
- package/es/plugins/keyboard.js +35 -29
- package/es/reducers/areas-reducer.js +13 -7
- package/es/reducers/export.js +96 -24
- package/es/reducers/groups-reducer.js +37 -31
- package/es/reducers/holes-reducer.js +49 -43
- package/es/reducers/items-reducer.js +112 -106
- package/es/reducers/lines-reducer.js +34 -28
- package/es/reducers/project-reducer.js +111 -105
- package/es/reducers/reducer.js +23 -16
- package/es/reducers/scene-reducer.js +21 -15
- package/es/reducers/user-reducer.js +11 -5
- package/es/reducers/vertices-reducer.js +17 -11
- package/es/reducers/viewer2d-reducer.js +24 -18
- package/es/reducers/viewer3d-reducer.js +22 -16
- package/es/shared-style.js +16 -10
- package/es/styles/export.js +11 -3
- package/es/translator/en.js +7 -1
- package/es/translator/it.js +7 -1
- package/es/translator/ru.js +7 -1
- package/es/translator/translator.js +19 -13
- package/es/utils/browser.js +9 -2
- package/es/utils/convert-units-lite.js +7 -1
- package/es/utils/email-validator.js +7 -1
- package/es/utils/export.js +46 -15
- package/es/utils/geometry.js +278 -181
- package/es/utils/get-edges-of-subgraphs.js +9 -2
- package/es/utils/graph-cycles.js +11 -8
- package/es/utils/graph-inner-cycles.js +18 -10
- package/es/utils/graph.js +17 -9
- package/es/utils/helper.js +63 -39
- package/es/utils/history.js +15 -8
- package/es/utils/id-broker.js +15 -8
- package/es/utils/logger.js +7 -1
- package/es/utils/math.js +12 -5
- package/es/utils/molding.js +144 -119
- package/es/utils/name-generator.js +13 -7
- package/es/utils/objects-utils.js +19 -7
- package/es/utils/phone-validator.js +7 -1
- package/es/utils/process-black-list.js +10 -3
- package/es/utils/react-if.js +12 -6
- package/es/utils/snap-scene.js +34 -27
- package/es/utils/snap.js +59 -45
- package/es/utils/summarizeCart.js +7 -1
- package/es/utils/threeCSG.es6.js +22 -13
- package/es/version.js +7 -1
- package/lib/@history.js +2 -1
- package/lib/AppContext.js +2 -1
- package/lib/KitchenConfigurator.js +2 -1
- package/lib/KitchenConfiguratorApp.js +2 -1
- package/lib/catalog/areas/area/planner-element.js +2 -1
- package/lib/catalog/catalog.js +2 -1
- package/lib/catalog/factories/area-factory.js +2 -1
- package/lib/catalog/factories/wall-factory.js +2 -1
- package/lib/catalog/holes/door-closet/planner-element.js +2 -1
- package/lib/catalog/holes/door-double/planner-element.js +2 -1
- package/lib/catalog/holes/door-exterior/planner-element.js +2 -1
- package/lib/catalog/holes/door-interior/planner-element.js +2 -1
- package/lib/catalog/holes/door-panic/planner-element.js +2 -1
- package/lib/catalog/holes/door-panic-double/planner-element.js +2 -1
- package/lib/catalog/holes/door-sliding/planner-element.js +2 -1
- package/lib/catalog/holes/doorway-framed/planner-element.js +2 -1
- package/lib/catalog/holes/doorway-frameless/planner-element.js +2 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -1
- package/lib/catalog/holes/window-cross/planner-element.js +2 -1
- package/lib/catalog/holes/window-double-hung/planner-element.js +2 -1
- package/lib/catalog/holes/window-vertical/planner-element.js +2 -1
- package/lib/catalog/lines/wall/planner-element.js +2 -1
- package/lib/catalog/molding/molding-dcm/planner-element.js +2 -1
- package/lib/catalog/molding/molding-fbm/planner-element.js +2 -1
- package/lib/catalog/molding/molding-lrm/planner-element.js +2 -1
- package/lib/catalog/properties/property-checkbox.js +2 -1
- package/lib/catalog/properties/property-color.js +2 -1
- package/lib/catalog/properties/property-enum.js +2 -1
- package/lib/catalog/properties/property-hidden.js +2 -1
- package/lib/catalog/properties/property-lenght-measure.js +2 -1
- package/lib/catalog/properties/property-length-measure.js +2 -1
- package/lib/catalog/properties/property-length-measure_hole.js +2 -1
- package/lib/catalog/properties/property-number.js +2 -1
- package/lib/catalog/properties/property-read-only.js +2 -1
- package/lib/catalog/properties/property-string.js +2 -1
- package/lib/catalog/properties/property-toggle.js +2 -1
- package/lib/catalog/properties/shared-property-style.js +2 -1
- package/lib/catalog/utils/FuseUtils.js +2 -1
- package/lib/catalog/utils/exporter.js +2 -1
- package/lib/class/FuseUtils.js +2 -1
- package/lib/class/area.js +2 -1
- package/lib/class/group.js +2 -1
- package/lib/class/hole.js +2 -1
- package/lib/class/item.js +2 -1
- package/lib/class/layer.js +2 -1
- package/lib/class/line.js +2 -1
- package/lib/class/project.js +2 -1
- package/lib/class/vertex.js +2 -1
- package/lib/components/content.js +2 -1
- package/lib/components/disclaimer/disclaimer.js +2 -1
- package/lib/components/style/button.js +2 -1
- package/lib/components/style/cancel-button.js +2 -1
- package/lib/components/style/content-container.js +2 -1
- package/lib/components/style/content-title.js +2 -1
- package/lib/components/style/delete-button.js +2 -1
- package/lib/components/style/form-block.js +2 -1
- package/lib/components/style/form-color-input.js +2 -1
- package/lib/components/style/form-label.js +2 -1
- package/lib/components/style/form-number-input.js +2 -1
- package/lib/components/style/form-number-input_2.js +2 -1
- package/lib/components/style/form-select.js +2 -1
- package/lib/components/style/form-slider.js +2 -1
- package/lib/components/style/form-submit-button.js +2 -1
- package/lib/components/style/form-text-input.js +2 -1
- package/lib/components/viewer2d/area.js +2 -1
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +2 -1
- package/lib/components/viewer2d/grids/grid-streak.js +2 -1
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +2 -1
- package/lib/components/viewer2d/grids/grids.js +2 -1
- package/lib/components/viewer2d/group.js +2 -1
- package/lib/components/viewer2d/item.js +2 -1
- package/lib/components/viewer2d/layer.js +2 -1
- package/lib/components/viewer2d/ruler.js +2 -1
- package/lib/components/viewer2d/rulerDist.js +2 -1
- package/lib/components/viewer2d/rulerX.js +2 -1
- package/lib/components/viewer2d/rulerY.js +2 -1
- package/lib/components/viewer2d/scene.js +2 -1
- package/lib/components/viewer2d/snap.js +2 -1
- package/lib/components/viewer2d/state.js +2 -1
- package/lib/components/viewer2d/vertex.js +2 -1
- package/lib/components/viewer2d/viewer2d.js +2 -1
- package/lib/components/viewer3d/dcm.js +2 -1
- package/lib/components/viewer3d/fbm.js +2 -1
- package/lib/components/viewer3d/front3D.js +2 -1
- package/lib/components/viewer3d/grid-creator.js +2 -1
- package/lib/components/viewer3d/grids/grid-horizontal-streak.js +2 -1
- package/lib/components/viewer3d/grids/grid-streak.js +2 -1
- package/lib/components/viewer3d/grids/grid-vertical-streak.js +2 -1
- package/lib/components/viewer3d/libs/mtl-loader.js +2 -1
- package/lib/components/viewer3d/libs/obj-loader.js +2 -1
- package/lib/components/viewer3d/lrm.js +2 -1
- package/lib/components/viewer3d/ruler-utils/itemRect.js +2 -1
- package/lib/components/viewer3d/ruler-utils/layer3D.js +2 -1
- package/lib/components/viewer3d/ruler-utils/ruler3D.js +2 -1
- package/lib/components/viewer3d/ruler-utils/state3D.js +2 -1
- package/lib/components/viewer3d/viewer3d-first-person.js +2 -1
- package/lib/components/viewer3d/viewer3d.js +2 -1
- package/lib/plugins/autosave.js +2 -1
- package/lib/plugins/console-debugger.js +2 -1
- package/lib/plugins/keyboard.js +2 -1
- package/lib/reducers/areas-reducer.js +2 -1
- package/lib/reducers/groups-reducer.js +2 -1
- package/lib/reducers/holes-reducer.js +2 -1
- package/lib/reducers/items-reducer.js +2 -1
- package/lib/reducers/lines-reducer.js +2 -1
- package/lib/reducers/project-reducer.js +2 -1
- package/lib/reducers/scene-reducer.js +2 -1
- package/lib/reducers/user-reducer.js +2 -1
- package/lib/reducers/vertices-reducer.js +2 -1
- package/lib/reducers/viewer2d-reducer.js +2 -1
- package/lib/reducers/viewer3d-reducer.js +2 -1
- package/lib/translator/en.js +2 -1
- package/lib/translator/it.js +2 -1
- package/lib/translator/ru.js +2 -1
- package/lib/translator/translator.js +2 -1
- package/lib/utils/name-generator.js +2 -1
- package/lib/utils/react-if.js +2 -1
- package/lib/utils/threeCSG.es6.js +2 -1
- package/package.json +2 -1
package/es/utils/molding.js
CHANGED
|
@@ -1,27 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createMonldingGroup = createMonldingGroup;
|
|
9
|
+
exports.getAllMoldingGroups = getAllMoldingGroups;
|
|
10
|
+
exports.getItemGroupFromMolding = getItemGroupFromMolding;
|
|
11
|
+
exports.getItemRect = getItemRect;
|
|
12
|
+
exports.getLinesFromItems = getLinesFromItems;
|
|
13
|
+
exports.getLinesFromItems2 = getLinesFromItems2;
|
|
14
|
+
exports.getLinesOfItem = getLinesOfItem;
|
|
15
|
+
exports.hasMoldingLayout = hasMoldingLayout;
|
|
16
|
+
exports.isEnableItemForMolding = isEnableItemForMolding;
|
|
17
|
+
exports.isItemSameItemByLocation = isItemSameItemByLocation;
|
|
18
|
+
exports.isItemSnappedGroup = isItemSnappedGroup;
|
|
19
|
+
exports.isItemSnappedItem = isItemSnappedItem;
|
|
20
|
+
exports.isLinesOverlapped = isLinesOverlapped;
|
|
21
|
+
exports.isSameMoldingLayoutpos = isSameMoldingLayoutpos;
|
|
22
|
+
exports.mergeOverlappedLines = mergeOverlappedLines;
|
|
23
|
+
exports.sortItemsByDistance = sortItemsByDistance;
|
|
24
|
+
exports.tryMergeMDItem = tryMergeMDItem;
|
|
25
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
26
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
27
|
+
var _constants = require("../constants");
|
|
28
|
+
var Three = _interopRequireWildcard(require("three"));
|
|
29
|
+
var _convertUnitsLite = require("./convert-units-lite");
|
|
30
|
+
var _idBroker = _interopRequireDefault(require("./id-broker"));
|
|
31
|
+
var _utils = require("../components/viewer2d/utils");
|
|
32
|
+
var _export = require("./export");
|
|
33
|
+
var _helper = require("./helper");
|
|
34
|
+
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); }
|
|
3
35
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
36
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
37
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
6
38
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
39
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
-
|
|
9
|
-
import * as Three from 'three';
|
|
10
|
-
import { convert } from "./convert-units-lite";
|
|
11
|
-
import IDBroker from "./id-broker";
|
|
12
|
-
import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils";
|
|
13
|
-
import { GeometryUtils } from "./export";
|
|
14
|
-
import { isEmpty } from "./helper";
|
|
15
|
-
export function getItemRect(item) {
|
|
40
|
+
function getItemRect(item) {
|
|
16
41
|
var x = item.x;
|
|
17
42
|
var y = item.y;
|
|
18
43
|
var rotRad = item.rotation / 180 * Math.PI;
|
|
19
44
|
var itemWidth = item.properties.get('width').get('_length');
|
|
20
45
|
var itemWidthUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
21
|
-
itemWidth = convert(itemWidth / 2).from(itemWidthUnit).to('cm');
|
|
46
|
+
itemWidth = (0, _convertUnitsLite.convert)(itemWidth / 2).from(itemWidthUnit).to('cm');
|
|
22
47
|
var itemDepth = item.properties.get('depth').get('_length');
|
|
23
48
|
var itemDepthUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
24
|
-
itemDepth = convert(itemDepth / 2).from(itemDepthUnit).to('cm');
|
|
49
|
+
itemDepth = (0, _convertUnitsLite.convert)(itemDepth / 2).from(itemDepthUnit).to('cm');
|
|
25
50
|
var mx = x - itemWidth * Math.cos(rotRad);
|
|
26
51
|
var my = y - itemWidth * Math.sin(rotRad);
|
|
27
52
|
var x0 = mx + itemDepth * Math.sin(rotRad);
|
|
@@ -48,17 +73,17 @@ export function getItemRect(item) {
|
|
|
48
73
|
}]
|
|
49
74
|
};
|
|
50
75
|
}
|
|
51
|
-
|
|
76
|
+
function hasMoldingLayout(molding, layoutpos) {
|
|
52
77
|
var types = molding === null || molding === void 0 ? void 0 : molding.molding_type;
|
|
53
78
|
return (Array.isArray(types) || typeof types === 'string') && types.includes(layoutpos);
|
|
54
79
|
}
|
|
55
|
-
|
|
80
|
+
function isEnableItemForMolding(layer, selItem) {
|
|
56
81
|
var molding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
57
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
58
|
-
var result = !isEmpty(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === BASE_CABINET_LAYOUTPOS && !GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === WALL_CABINET_LAYOUTPOS || selItem.layoutpos === TALL_CABINET_LAYOUTPOS) && GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
|
|
82
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
83
|
+
var result = !(0, _helper.isEmpty)(selItem) && selItem.category === 'cabinet' && (selItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && !_export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects) || (selItem.layoutpos === _constants.WALL_CABINET_LAYOUTPOS || selItem.layoutpos === _constants.TALL_CABINET_LAYOUTPOS) && _export.GeometryUtils.isSnappedLine(getItemRect(selItem), allLineRects));
|
|
59
84
|
|
|
60
85
|
// check this item is enable for any molding
|
|
61
|
-
if (isEmpty(molding)) return result;
|
|
86
|
+
if ((0, _helper.isEmpty)(molding)) return result;
|
|
62
87
|
// check this item is enable for specified molding
|
|
63
88
|
else return result && hasMoldingLayout(molding, selItem.layoutpos);
|
|
64
89
|
}
|
|
@@ -82,66 +107,66 @@ function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
|
|
|
82
107
|
// GeometryUtils.verticesDistance(curRectPos2, curRectPos1) -
|
|
83
108
|
// GeometryUtils.verticesDistance(selRectPos1, selRectPos2)
|
|
84
109
|
// )
|
|
85
|
-
Math.abs(GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
|
|
110
|
+
Math.abs(_export.GeometryUtils.verticesDistance(curRectPos1, selRectPos1) + _export.GeometryUtils.verticesDistance(selRectPos2, curRectPos2) - _export.GeometryUtils.verticesDistance(curRectPos2, curRectPos1) - _export.GeometryUtils.verticesDistance(selRectPos1, selRectPos2))
|
|
86
111
|
);
|
|
87
112
|
}
|
|
88
|
-
|
|
113
|
+
function isItemSnappedItem(selItem, curItem) {
|
|
89
114
|
var selRect = getItemRect(selItem).rect;
|
|
90
115
|
var curRect = getItemRect(curItem).rect;
|
|
91
|
-
var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < EPSILON;
|
|
92
|
-
var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < EPSILON;
|
|
93
|
-
var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < EPSILON;
|
|
94
|
-
var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < EPSILON;
|
|
95
|
-
var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < EPSILON;
|
|
116
|
+
var flag30 = getDelta(selRect[3], selRect[0], curRect[1], curRect[2]) < _constants.EPSILON;
|
|
117
|
+
var flag21 = getDelta(selRect[2], selRect[1], curRect[0], curRect[3]) < _constants.EPSILON;
|
|
118
|
+
var flag23 = getDelta(selRect[2], selRect[3], curRect[2], curRect[3]) < _constants.EPSILON;
|
|
119
|
+
var flag01 = getDelta(selRect[1], selRect[0], curRect[0], curRect[3]) < _constants.EPSILON;
|
|
120
|
+
var flag03 = getDelta(selRect[0], selRect[3], curRect[1], curRect[0]) < _constants.EPSILON;
|
|
96
121
|
return flag30 || flag21 || flag23 || flag01 || flag03;
|
|
97
122
|
}
|
|
98
|
-
|
|
123
|
+
function isItemSnappedGroup(selItem, itemGroup) {
|
|
99
124
|
return itemGroup.some(function (curItem) {
|
|
100
125
|
return isItemSnappedItem(selItem, curItem);
|
|
101
126
|
});
|
|
102
127
|
}
|
|
103
|
-
|
|
128
|
+
function sortItemsByDistance(items, selItem) {
|
|
104
129
|
items.sort(function (a, b) {
|
|
105
|
-
return GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
|
|
130
|
+
return _export.GeometryUtils.pointsDistance(a.x, a.y, selItem.x, selItem.y) - _export.GeometryUtils.pointsDistance(b.x, b.y, selItem.x, selItem.y);
|
|
106
131
|
});
|
|
107
132
|
return items;
|
|
108
133
|
}
|
|
109
|
-
|
|
110
|
-
return curItem.layoutpos === BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
|
|
134
|
+
function isSameMoldingLayoutpos(curItem, item) {
|
|
135
|
+
return curItem.layoutpos === _constants.BASE_CABINET_LAYOUTPOS && curItem.layoutpos === item.layoutpos || [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(curItem.layoutpos) && [_constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos);
|
|
111
136
|
}
|
|
112
|
-
|
|
137
|
+
function isItemSameItemByLocation(item1, item2, location) {
|
|
113
138
|
var item1Altitude = item1.properties.get('altitude').get('_length');
|
|
114
139
|
var item1AltitudeUnit = item1.properties.get('altitude').get('_unit');
|
|
115
|
-
item1Altitude = convert(item1Altitude).from(item1AltitudeUnit).to('cm');
|
|
140
|
+
item1Altitude = (0, _convertUnitsLite.convert)(item1Altitude).from(item1AltitudeUnit).to('cm');
|
|
116
141
|
var item1Height = item1.properties.get('height').get('_length');
|
|
117
142
|
var item1HeightUnit = item1.properties.get('height').get('_unit');
|
|
118
|
-
item1Height = convert(item1Height).from(item1HeightUnit).to('cm');
|
|
143
|
+
item1Height = (0, _convertUnitsLite.convert)(item1Height).from(item1HeightUnit).to('cm');
|
|
119
144
|
var item2Altitude = item2.properties.get('altitude').get('_length');
|
|
120
145
|
var item2AltitudeUnit = item2.properties.get('altitude').get('_unit');
|
|
121
|
-
item2Altitude = convert(item2Altitude).from(item2AltitudeUnit).to('cm');
|
|
146
|
+
item2Altitude = (0, _convertUnitsLite.convert)(item2Altitude).from(item2AltitudeUnit).to('cm');
|
|
122
147
|
var item2Height = item2.properties.get('height').get('_length');
|
|
123
148
|
var item2HeightUnit = item2.properties.get('height').get('_unit');
|
|
124
|
-
item2Height = convert(item2Height).from(item2HeightUnit).to('cm');
|
|
149
|
+
item2Height = (0, _convertUnitsLite.convert)(item2Height).from(item2HeightUnit).to('cm');
|
|
125
150
|
var flag = false;
|
|
126
151
|
switch (location) {
|
|
127
|
-
case TOP_MOLDING_LOCATION:
|
|
128
|
-
if (GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
|
|
152
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
153
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude + item1Height, item2Altitude + item2Height)) flag = true;
|
|
129
154
|
break;
|
|
130
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
131
|
-
if (GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
|
|
155
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
156
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude + item1Height / 2, item2Altitude + item2Height / 2)) flag = true;
|
|
132
157
|
break;
|
|
133
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
134
|
-
if (GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
|
|
158
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
159
|
+
if (_export.GeometryUtils.sameDistances(item1Altitude, item2Altitude)) flag = true;
|
|
135
160
|
break;
|
|
136
161
|
}
|
|
137
162
|
return flag;
|
|
138
163
|
}
|
|
139
|
-
|
|
164
|
+
function tryMergeMDItem(layer, selItem, curItem, itemGroup, molding) {
|
|
140
165
|
return isSameMoldingLayoutpos(selItem, curItem) && isEnableItemForMolding(layer, curItem, molding) && isItemSnappedGroup(curItem, itemGroup) && !itemGroup.some(function (item) {
|
|
141
166
|
return item.id === curItem.id;
|
|
142
167
|
}) && isItemSameItemByLocation(selItem, curItem, molding.location_type);
|
|
143
168
|
}
|
|
144
|
-
|
|
169
|
+
function getItemGroupFromMolding(layer, curItem, molding) {
|
|
145
170
|
var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
|
|
146
171
|
var itemGroup = [curItem];
|
|
147
172
|
var temp_layer_items = layer.items.toArray().filter(function (item) {
|
|
@@ -168,7 +193,7 @@ function tryMergeItemWithLocation(curItem, itemGroup, location) {
|
|
|
168
193
|
* @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
|
|
169
194
|
* @returns MG array
|
|
170
195
|
*/
|
|
171
|
-
|
|
196
|
+
function getAllMoldingGroups(layer) {
|
|
172
197
|
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
173
198
|
if (items === null) items = layer.items.toArray();
|
|
174
199
|
var MGArray = [];
|
|
@@ -190,7 +215,7 @@ export function getAllMoldingGroups(layer) {
|
|
|
190
215
|
return it.category === 'cabinet' && isSameMoldingLayoutpos(curItem, it) && it.id !== curItem.id;
|
|
191
216
|
});
|
|
192
217
|
temp_items = sortItemsByDistance(temp_items, curItem);
|
|
193
|
-
MOLDING_LOCATIONS.forEach(function (location) {
|
|
218
|
+
_constants.MOLDING_LOCATIONS.forEach(function (location) {
|
|
194
219
|
if (!MGArray.some(function (mg) {
|
|
195
220
|
return mg.items.some(function (it) {
|
|
196
221
|
return it.id === curItem.id;
|
|
@@ -213,7 +238,7 @@ export function getAllMoldingGroups(layer) {
|
|
|
213
238
|
}
|
|
214
239
|
} while (isChangedItemGroup);
|
|
215
240
|
MGArray.push({
|
|
216
|
-
id:
|
|
241
|
+
id: _idBroker["default"].acquireID(),
|
|
217
242
|
items: itemGroup,
|
|
218
243
|
location_type: location,
|
|
219
244
|
molding: null,
|
|
@@ -230,18 +255,18 @@ export function getAllMoldingGroups(layer) {
|
|
|
230
255
|
});
|
|
231
256
|
return MGArray;
|
|
232
257
|
}
|
|
233
|
-
|
|
258
|
+
function getLinesOfItem(item, allLineRects, catalog) {
|
|
234
259
|
var lines = [];
|
|
235
260
|
var outline = null;
|
|
236
261
|
var element = catalog.elements[item.get('type')];
|
|
237
|
-
if (!element) element = catalog.elements[returnReplaceableDeepSearchType(item.get('type'))];
|
|
262
|
+
if (!element) element = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(item.get('type'))];
|
|
238
263
|
// get edge lines
|
|
239
264
|
var newWidth = item.properties.get('width').get('_length');
|
|
240
265
|
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
241
|
-
newWidth = convert(newWidth).from(wUnit).to('cm');
|
|
266
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
|
|
242
267
|
var newDepth = item.properties.get('depth').get('_length');
|
|
243
268
|
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
244
|
-
newDepth = convert(newDepth).from(hUnit).to('cm');
|
|
269
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
|
|
245
270
|
if (item) {
|
|
246
271
|
// Get Outline Data of Selected Item
|
|
247
272
|
outline = element.info.outline;
|
|
@@ -276,18 +301,18 @@ export function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
276
301
|
}
|
|
277
302
|
outline.reverse && outlinePoints.reverse();
|
|
278
303
|
for (var i = 0; i < outlinePoints.length - 1; i++) {
|
|
279
|
-
lines.push([GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90),
|
|
304
|
+
lines.push([_export.GeometryUtils.rotatePointAroundPoint((outlinePoints[i].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), _export.GeometryUtils.rotatePointAroundPoint((outlinePoints[i + 1].x / outlineWidth - 0.5) * newWidth + item.x, (outlinePoints[i + 1].y / outlineHeight - 0.5) * newDepth + item.y, item.x, item.y, item.rotation + 90), _idBroker["default"].acquireID()]);
|
|
280
305
|
}
|
|
281
306
|
} else {
|
|
282
307
|
var pos = [[-1, -1], [1, -1], [1, 1], [-1, 1]];
|
|
283
308
|
for (var _i = 0; _i < 4; _i++) {
|
|
284
|
-
lines.push([GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation),
|
|
309
|
+
lines.push([_export.GeometryUtils.rotatePointAroundPoint(pos[_i][0] * newWidth / 2 + item.x, pos[_i][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _export.GeometryUtils.rotatePointAroundPoint(pos[(_i + 1) % 4][0] * newWidth / 2 + item.x, pos[(_i + 1) % 4][1] * newDepth / 2 + item.y, item.x, item.y, item.rotation), _idBroker["default"].acquireID()]);
|
|
285
310
|
}
|
|
286
311
|
}
|
|
287
312
|
}
|
|
288
|
-
if (item.layoutpos !== BASE_CABINET_LAYOUTPOS) {
|
|
313
|
+
if (item.layoutpos !== _constants.BASE_CABINET_LAYOUTPOS) {
|
|
289
314
|
lines = lines.filter(function (line) {
|
|
290
|
-
return !GeometryUtils.isSnappedLine({
|
|
315
|
+
return !_export.GeometryUtils.isSnappedLine({
|
|
291
316
|
rect: [{
|
|
292
317
|
x: 0,
|
|
293
318
|
y: 0
|
|
@@ -302,29 +327,29 @@ export function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
302
327
|
}
|
|
303
328
|
function isParallelLines(line1, line2) {
|
|
304
329
|
var isParallel = false;
|
|
305
|
-
if (Math.abs(line1[0].y - line1[1].y) <= EPSILON && Math.abs(line2[0].y - line2[1].y) <= EPSILON) isParallel = true;
|
|
306
|
-
if (Math.abs(line1[0].x - line1[1].x) <= EPSILON && Math.abs(line2[0].x - line2[1].x) <= EPSILON) isParallel = true;
|
|
307
|
-
if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= EPSILON) isParallel = true;
|
|
330
|
+
if (Math.abs(line1[0].y - line1[1].y) <= _constants.EPSILON && Math.abs(line2[0].y - line2[1].y) <= _constants.EPSILON) isParallel = true;
|
|
331
|
+
if (Math.abs(line1[0].x - line1[1].x) <= _constants.EPSILON && Math.abs(line2[0].x - line2[1].x) <= _constants.EPSILON) isParallel = true;
|
|
332
|
+
if (Math.abs((line1[0].x - line1[1].x) / (line1[0].y - line1[1].y) - (line2[0].x - line2[1].x) / (line2[0].y - line2[1].y)) <= _constants.EPSILON) isParallel = true;
|
|
308
333
|
if (isParallel) {
|
|
309
334
|
return true;
|
|
310
335
|
}
|
|
311
336
|
return false;
|
|
312
337
|
}
|
|
313
|
-
|
|
338
|
+
function isLinesOverlapped(line1, line2) {
|
|
314
339
|
return isParallelLines(line1, line2) && line1.some(function (l1) {
|
|
315
340
|
return line2.some(function (l2) {
|
|
316
|
-
return GeometryUtils.samePoints(l1, l2);
|
|
341
|
+
return _export.GeometryUtils.samePoints(l1, l2);
|
|
317
342
|
});
|
|
318
343
|
});
|
|
319
344
|
}
|
|
320
|
-
|
|
345
|
+
function mergeOverlappedLines(line1, line2) {
|
|
321
346
|
var line1_idx = 0,
|
|
322
347
|
line2_idx = 0;
|
|
323
348
|
line1.forEach(function (l1, idx1) {
|
|
324
349
|
if (idx1 !== line1.length - 1) {
|
|
325
350
|
line2.forEach(function (l2, idx2) {
|
|
326
351
|
if (idx2 !== line2.length - 1) {
|
|
327
|
-
if (GeometryUtils.samePoints(l1, l2)) {
|
|
352
|
+
if (_export.GeometryUtils.samePoints(l1, l2)) {
|
|
328
353
|
line1_idx = idx1;
|
|
329
354
|
line2_idx = idx2;
|
|
330
355
|
}
|
|
@@ -335,9 +360,9 @@ export function mergeOverlappedLines(line1, line2) {
|
|
|
335
360
|
//If line1 's end point and line2 's start point is same, two lines merge into a line with
|
|
336
361
|
//the line1's start point as the start point and line2's end point as the end point.
|
|
337
362
|
if (line1_idx === 1) {
|
|
338
|
-
return [line1[1 - line1_idx], line2[1 - line2_idx],
|
|
363
|
+
return [line1[1 - line1_idx], line2[1 - line2_idx], _idBroker["default"].acquireID()];
|
|
339
364
|
} else {
|
|
340
|
-
return [line2[1 - line2_idx], line1[1 - line1_idx],
|
|
365
|
+
return [line2[1 - line2_idx], line1[1 - line1_idx], _idBroker["default"].acquireID()];
|
|
341
366
|
}
|
|
342
367
|
}
|
|
343
368
|
|
|
@@ -348,12 +373,12 @@ export function mergeOverlappedLines(line1, line2) {
|
|
|
348
373
|
* @param {*} catalog
|
|
349
374
|
* @returns contour line array of moldingGroup items
|
|
350
375
|
*/
|
|
351
|
-
|
|
376
|
+
function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
352
377
|
// wall lines
|
|
353
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
378
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
354
379
|
var MGlines = [];
|
|
355
380
|
var MGlinesOtherSnapped = [];
|
|
356
|
-
var items =
|
|
381
|
+
var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
|
|
357
382
|
// The other item's lines (these items are snapped to the moldingGroup items)
|
|
358
383
|
var itemsOtherSnapped = layer.items.toArray().filter(function (item) {
|
|
359
384
|
if (items.some(function (it) {
|
|
@@ -363,17 +388,17 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
363
388
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
364
389
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
365
390
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
366
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
391
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
367
392
|
var itemHeight = item.properties.get('height').get('_length');
|
|
368
393
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
369
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
394
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
370
395
|
itemLines.forEach(function (line) {
|
|
371
396
|
line.push({
|
|
372
397
|
altitude: itemAltitude,
|
|
373
398
|
height: itemHeight
|
|
374
399
|
});
|
|
375
400
|
});
|
|
376
|
-
MGlinesOtherSnapped = [].concat(
|
|
401
|
+
MGlinesOtherSnapped = [].concat((0, _toConsumableArray2["default"])(MGlinesOtherSnapped), (0, _toConsumableArray2["default"])(itemLines));
|
|
377
402
|
return true;
|
|
378
403
|
} else return false;
|
|
379
404
|
});
|
|
@@ -382,10 +407,10 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
382
407
|
items.forEach(function (item) {
|
|
383
408
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
384
409
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
385
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
410
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
386
411
|
var itemHeight = item.properties.get('height').get('_length');
|
|
387
412
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
388
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
413
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
389
414
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
390
415
|
|
|
391
416
|
// remove the edge that overlapped with other snapped items
|
|
@@ -400,17 +425,17 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
400
425
|
for (var j = 0; j < MGlinesOtherSnapped.length; j++) {
|
|
401
426
|
var bCheck = false;
|
|
402
427
|
switch (moldingGroup.location_type) {
|
|
403
|
-
case TOP_MOLDING_LOCATION:
|
|
428
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
404
429
|
bCheck = MGlinesOtherSnapped[j][3].altitude + MGlinesOtherSnapped[j][3].height > itemAltitude + itemHeight;
|
|
405
430
|
break;
|
|
406
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
431
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
407
432
|
bCheck = true;
|
|
408
433
|
break;
|
|
409
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
434
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
410
435
|
bCheck = MGlinesOtherSnapped[j][3].altitude < itemAltitude;
|
|
411
436
|
break;
|
|
412
437
|
}
|
|
413
|
-
if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
|
|
438
|
+
if (item.category !== 'cabinet' || ![_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) bCheck = true;
|
|
414
439
|
if (bCheck) {
|
|
415
440
|
var destLine = {
|
|
416
441
|
x1: MGlinesOtherSnapped[j][0].x,
|
|
@@ -418,8 +443,8 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
418
443
|
x2: MGlinesOtherSnapped[j][1].x,
|
|
419
444
|
y2: MGlinesOtherSnapped[j][1].y
|
|
420
445
|
};
|
|
421
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
422
|
-
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
446
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
447
|
+
if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
|
|
423
448
|
ret = false;
|
|
424
449
|
break;
|
|
425
450
|
}
|
|
@@ -427,7 +452,7 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
427
452
|
}
|
|
428
453
|
return ret;
|
|
429
454
|
});
|
|
430
|
-
MGlines = [].concat(
|
|
455
|
+
MGlines = [].concat((0, _toConsumableArray2["default"])(MGlines), (0, _toConsumableArray2["default"])(itemLines));
|
|
431
456
|
});
|
|
432
457
|
|
|
433
458
|
// Filtering overlapped edges and get contour edges
|
|
@@ -448,16 +473,16 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
448
473
|
x2: MGlines[j][1].x,
|
|
449
474
|
y2: MGlines[j][1].y
|
|
450
475
|
};
|
|
451
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
452
|
-
if (rst.result === OVERLAP_SAME || rst.result === OVERLAP_INCLUDED) {
|
|
476
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
477
|
+
if (rst.result === _constants.OVERLAP_SAME || rst.result === _constants.OVERLAP_INCLUDED) {
|
|
453
478
|
removeLineIds.push(i);
|
|
454
479
|
return 1; // break
|
|
455
|
-
} else if (rst.result === OVERLAP_SOME) {
|
|
480
|
+
} else if (rst.result === _constants.OVERLAP_SOME) {
|
|
456
481
|
removeLineIds.push(i);
|
|
457
482
|
var lineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, MGlines.filter(function (v, idx) {
|
|
458
483
|
return idx !== i && idx !== j;
|
|
459
484
|
}), 0);
|
|
460
|
-
if (lineSegs.length > 0) newLines = [].concat(
|
|
485
|
+
if (lineSegs.length > 0) newLines = [].concat((0, _toConsumableArray2["default"])(newLines), (0, _toConsumableArray2["default"])(lineSegs));
|
|
461
486
|
return 1; // break
|
|
462
487
|
}
|
|
463
488
|
},
|
|
@@ -476,7 +501,7 @@ export function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
476
501
|
return idx === id;
|
|
477
502
|
});
|
|
478
503
|
});
|
|
479
|
-
if (newLines.length > 0) MGlines = [].concat(
|
|
504
|
+
if (newLines.length > 0) MGlines = [].concat((0, _toConsumableArray2["default"])(MGlines), (0, _toConsumableArray2["default"])(newLines));
|
|
480
505
|
|
|
481
506
|
// merge the collinear linked lines to one line
|
|
482
507
|
var newMGlines = [];
|
|
@@ -536,15 +561,15 @@ function getMergedLine(line, MGlines, cnt) {
|
|
|
536
561
|
x2: newMGlines[i][1].x,
|
|
537
562
|
y2: newMGlines[i][1].y
|
|
538
563
|
};
|
|
539
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
540
|
-
if (rst.result === OVERLAP_LINK) {
|
|
564
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
565
|
+
if (rst.result === _constants.OVERLAP_LINK) {
|
|
541
566
|
var mergedLine = [{
|
|
542
567
|
x: rst.linkedLine.x1,
|
|
543
568
|
y: rst.linkedLine.y1
|
|
544
569
|
}, {
|
|
545
570
|
x: rst.linkedLine.x2,
|
|
546
571
|
y: rst.linkedLine.y2
|
|
547
|
-
},
|
|
572
|
+
}, _idBroker["default"].acquireID()];
|
|
548
573
|
mergeResult = getMergedLine(mergedLine, newMGlines.filter(function (v, idx) {
|
|
549
574
|
return idx !== i;
|
|
550
575
|
}), cnt);
|
|
@@ -589,15 +614,15 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
589
614
|
x2: otherLines[j][1].x,
|
|
590
615
|
y2: otherLines[j][1].y
|
|
591
616
|
};
|
|
592
|
-
var rst = GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
593
|
-
if (rst.result == OVERLAP_SAME || rst.result == OVERLAP_INCLUDED) {
|
|
617
|
+
var rst = _export.GeometryUtils.relationshipOfTwoOverlappedLines(srcLine, destLine);
|
|
618
|
+
if (rst.result == _constants.OVERLAP_SAME || rst.result == _constants.OVERLAP_INCLUDED) {
|
|
594
619
|
bContourSeg = false;
|
|
595
620
|
return 0; // break
|
|
596
|
-
} else if (rst.result == OVERLAP_SOME) {
|
|
621
|
+
} else if (rst.result == _constants.OVERLAP_SOME) {
|
|
597
622
|
var tLineSegs = getTrimmedContourLineSegs(rst.trimmedSegs, otherLines.filter(function (v, idx) {
|
|
598
623
|
return idx !== j;
|
|
599
624
|
}), cnt);
|
|
600
|
-
if (tLineSegs.length > 0) returnSegs = [].concat(
|
|
625
|
+
if (tLineSegs.length > 0) returnSegs = [].concat((0, _toConsumableArray2["default"])(returnSegs), (0, _toConsumableArray2["default"])(tLineSegs));
|
|
601
626
|
bContourSeg = false;
|
|
602
627
|
return 0; // break
|
|
603
628
|
}
|
|
@@ -613,7 +638,7 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
613
638
|
}, {
|
|
614
639
|
x: lineSegs[i].x2,
|
|
615
640
|
y: lineSegs[i].y2
|
|
616
|
-
},
|
|
641
|
+
}, _idBroker["default"].acquireID()]);
|
|
617
642
|
}
|
|
618
643
|
return returnSegs;
|
|
619
644
|
} catch (e) {
|
|
@@ -621,9 +646,9 @@ function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
|
621
646
|
return [];
|
|
622
647
|
}
|
|
623
648
|
}
|
|
624
|
-
|
|
625
|
-
var allLineRects = GeometryUtils.buildRectFromLines(layer, GeometryUtils.getAllLines(layer));
|
|
626
|
-
var items =
|
|
649
|
+
function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
650
|
+
var allLineRects = _export.GeometryUtils.buildRectFromLines(layer, _export.GeometryUtils.getAllLines(layer));
|
|
651
|
+
var items = (0, _toConsumableArray2["default"])(moldingGroup.items);
|
|
627
652
|
var MGlines = getLinesOfItem(items[0], allLineRects, catalog);
|
|
628
653
|
items = sortItemsByDistance(items, items[0]);
|
|
629
654
|
var _loop7 = function _loop7() {
|
|
@@ -635,7 +660,7 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
635
660
|
});
|
|
636
661
|
var curItemLine = itemLines[idx];
|
|
637
662
|
if (idx > -1) {
|
|
638
|
-
if (!(GeometryUtils.samePoints(line[0], curItemLine[0]) && GeometryUtils.samePoints(line[1], curItemLine[1]) || GeometryUtils.samePoints(line[0], curItemLine[1]) && GeometryUtils.samePoints(line[1], curItemLine[0]))) {
|
|
663
|
+
if (!(_export.GeometryUtils.samePoints(line[0], curItemLine[0]) && _export.GeometryUtils.samePoints(line[1], curItemLine[1]) || _export.GeometryUtils.samePoints(line[0], curItemLine[1]) && _export.GeometryUtils.samePoints(line[1], curItemLine[0]))) {
|
|
639
664
|
var MGLine = mergeOverlappedLines(line, curItemLine);
|
|
640
665
|
temp_MGLines.push(MGLine);
|
|
641
666
|
}
|
|
@@ -662,29 +687,29 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
662
687
|
snapped_other_items.forEach(function (item) {
|
|
663
688
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
664
689
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
665
|
-
itemAltitude = convert(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
690
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
666
691
|
var itemHeight = item.properties.get('height').get('_length');
|
|
667
692
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
668
|
-
itemHeight = convert(itemHeight).from(itemHeightUnit).to('cm');
|
|
693
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
669
694
|
var mgroupAltitude = items[0].properties.get('altitude').get('_length');
|
|
670
695
|
var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
|
|
671
|
-
mgroupAltitude = convert(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
|
|
696
|
+
mgroupAltitude = (0, _convertUnitsLite.convert)(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
|
|
672
697
|
var mgroupHeight = items[0].properties.get('height').get('_length');
|
|
673
698
|
var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
|
|
674
|
-
mgroupHeight = convert(mgroupHeight).from(mgroupHeightUnit).to('cm');
|
|
699
|
+
mgroupHeight = (0, _convertUnitsLite.convert)(mgroupHeight).from(mgroupHeightUnit).to('cm');
|
|
675
700
|
var flag = false;
|
|
676
701
|
switch (moldingGroup.location_type) {
|
|
677
|
-
case TOP_MOLDING_LOCATION:
|
|
702
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
678
703
|
flag = itemAltitude + itemHeight > mgroupAltitude + mgroupHeight;
|
|
679
704
|
break;
|
|
680
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
705
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
681
706
|
flag = true;
|
|
682
707
|
break;
|
|
683
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
708
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
684
709
|
flag = itemAltitude < mgroupAltitude;
|
|
685
710
|
break;
|
|
686
711
|
}
|
|
687
|
-
if (item.category !== 'cabinet' || ![BASE_CABINET_LAYOUTPOS, WALL_CABINET_LAYOUTPOS, TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
|
|
712
|
+
if (item.category !== 'cabinet' || ![_constants.BASE_CABINET_LAYOUTPOS, _constants.WALL_CABINET_LAYOUTPOS, _constants.TALL_CABINET_LAYOUTPOS].includes(item.layoutpos)) flag = true;
|
|
688
713
|
if (flag) {
|
|
689
714
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
690
715
|
var temp_MGLines = [];
|
|
@@ -694,8 +719,8 @@ export function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
694
719
|
});
|
|
695
720
|
var curITL = itemLines[idx];
|
|
696
721
|
if (idx > -1) {
|
|
697
|
-
if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < EPSILON) {
|
|
698
|
-
if (GeometryUtils.verticesDistance(mgl[0], mgl[1]) > GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
|
|
722
|
+
if (getDelta(mgl[0], mgl[1], curITL[1], curITL[0]) < _constants.EPSILON || getDelta(mgl[0], mgl[1], curITL[0], curITL[1]) < _constants.EPSILON) {
|
|
723
|
+
if (_export.GeometryUtils.verticesDistance(mgl[0], mgl[1]) > _export.GeometryUtils.verticesDistance(curITL[0], curITL[1])) {
|
|
699
724
|
var MGLine = mergeOverlappedLines(mgl, curITL);
|
|
700
725
|
temp_MGLines.push(MGLine);
|
|
701
726
|
}
|
|
@@ -757,7 +782,7 @@ function getMDPoints(newMD) {
|
|
|
757
782
|
});
|
|
758
783
|
|
|
759
784
|
// get vertex points
|
|
760
|
-
var MDlines =
|
|
785
|
+
var MDlines = (0, _toConsumableArray2["default"])(newMD.lines);
|
|
761
786
|
var pointGroups = [[]];
|
|
762
787
|
var flag = 1;
|
|
763
788
|
var i = 0;
|
|
@@ -769,10 +794,10 @@ function getMDPoints(newMD) {
|
|
|
769
794
|
if (flag) {
|
|
770
795
|
var lastPoint = pointGroups[i][pointGroups[i].length - 1];
|
|
771
796
|
var res = MDlines.findIndex(function (a) {
|
|
772
|
-
return GeometryUtils.samePoints({
|
|
797
|
+
return _export.GeometryUtils.samePoints({
|
|
773
798
|
x: a[0].x - cPos.x,
|
|
774
799
|
y: a[0].y - cPos.y
|
|
775
|
-
}, lastPoint) || GeometryUtils.samePoints({
|
|
800
|
+
}, lastPoint) || _export.GeometryUtils.samePoints({
|
|
776
801
|
x: a[1].x - cPos.x,
|
|
777
802
|
y: a[1].y - cPos.y
|
|
778
803
|
}, lastPoint);
|
|
@@ -782,7 +807,7 @@ function getMDPoints(newMD) {
|
|
|
782
807
|
x: MDlines[res][0].x - cPos.x,
|
|
783
808
|
y: MDlines[res][0].y - cPos.y
|
|
784
809
|
};
|
|
785
|
-
if (GeometryUtils.samePoints(newPos, lastPoint)) {
|
|
810
|
+
if (_export.GeometryUtils.samePoints(newPos, lastPoint)) {
|
|
786
811
|
newPos = {
|
|
787
812
|
x: MDlines[res][1].x - cPos.x,
|
|
788
813
|
y: MDlines[res][1].y - cPos.y
|
|
@@ -796,10 +821,10 @@ function getMDPoints(newMD) {
|
|
|
796
821
|
} else {
|
|
797
822
|
var firstPoint = pointGroups[i][0];
|
|
798
823
|
var _res = MDlines.findIndex(function (a) {
|
|
799
|
-
return GeometryUtils.samePoints({
|
|
824
|
+
return _export.GeometryUtils.samePoints({
|
|
800
825
|
x: a[0].x - cPos.x,
|
|
801
826
|
y: a[0].y - cPos.y
|
|
802
|
-
}, firstPoint) || GeometryUtils.samePoints({
|
|
827
|
+
}, firstPoint) || _export.GeometryUtils.samePoints({
|
|
803
828
|
x: a[1].x - cPos.x,
|
|
804
829
|
y: a[1].y - cPos.y
|
|
805
830
|
}, firstPoint);
|
|
@@ -809,13 +834,13 @@ function getMDPoints(newMD) {
|
|
|
809
834
|
x: MDlines[_res][0].x - cPos.x,
|
|
810
835
|
y: MDlines[_res][0].y - cPos.y
|
|
811
836
|
};
|
|
812
|
-
if (GeometryUtils.samePoints(_newPos, firstPoint)) {
|
|
837
|
+
if (_export.GeometryUtils.samePoints(_newPos, firstPoint)) {
|
|
813
838
|
_newPos = {
|
|
814
839
|
x: MDlines[_res][1].x - cPos.x,
|
|
815
840
|
y: MDlines[_res][1].y - cPos.y
|
|
816
841
|
};
|
|
817
842
|
}
|
|
818
|
-
pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat(
|
|
843
|
+
pointGroups[i] = [new Three.Vector2(_newPos.x, _newPos.y)].concat((0, _toConsumableArray2["default"])(pointGroups[i]));
|
|
819
844
|
MDlines.splice(_res, 1);
|
|
820
845
|
} else {
|
|
821
846
|
flag = 1;
|
|
@@ -830,18 +855,18 @@ function getMDPoints(newMD) {
|
|
|
830
855
|
}
|
|
831
856
|
var z = newMD.items[0].properties.get('altitude').get('_length');
|
|
832
857
|
var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
|
|
833
|
-
z = convert(z).from(zUnit).to('cm');
|
|
858
|
+
z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
|
|
834
859
|
var height = newMD.items[0].properties.get('height').get('_length');
|
|
835
860
|
var heightUnit = newMD.items[0].properties.get('height').get('_unit') || 'cm';
|
|
836
|
-
height = convert(height).from(heightUnit).to('cm');
|
|
861
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
837
862
|
switch (newMD.location_type) {
|
|
838
|
-
case TOP_MOLDING_LOCATION:
|
|
863
|
+
case _constants.TOP_MOLDING_LOCATION:
|
|
839
864
|
z += height;
|
|
840
865
|
break;
|
|
841
|
-
case MIDDLE_MOLDING_LOCATION:
|
|
866
|
+
case _constants.MIDDLE_MOLDING_LOCATION:
|
|
842
867
|
z += height / 2;
|
|
843
868
|
break;
|
|
844
|
-
case BOTTOM_MOLDING_LOCATION:
|
|
869
|
+
case _constants.BOTTOM_MOLDING_LOCATION:
|
|
845
870
|
z += 0;
|
|
846
871
|
break;
|
|
847
872
|
default:
|
|
@@ -855,7 +880,7 @@ function getMDPoints(newMD) {
|
|
|
855
880
|
size: newSize
|
|
856
881
|
});
|
|
857
882
|
}
|
|
858
|
-
|
|
883
|
+
function createMonldingGroup(oldMG, layer, molding, catalog) {
|
|
859
884
|
var newMG = _objectSpread({}, oldMG);
|
|
860
885
|
newMG.molding = molding;
|
|
861
886
|
newMG.lines = getLinesFromItems2(oldMG, layer, catalog);
|