kitchen-simulator 1.1.1-test.64 → 1.1.1-test.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/es/@history.js +10 -2
  2. package/es/AppContext.js +10 -3
  3. package/es/KitchenConfigurator.js +79 -70
  4. package/es/KitchenConfiguratorApp.js +107 -98
  5. package/es/actions/area-actions.js +12 -5
  6. package/es/actions/export.js +29 -12
  7. package/es/actions/groups-actions.js +45 -27
  8. package/es/actions/holes-actions.js +55 -34
  9. package/es/actions/items-actions.js +145 -94
  10. package/es/actions/lines-actions.js +36 -21
  11. package/es/actions/project-actions.js +145 -94
  12. package/es/actions/scene-actions.js +21 -11
  13. package/es/actions/vertices-actions.js +15 -7
  14. package/es/actions/viewer2d-actions.js +36 -21
  15. package/es/actions/viewer3d-actions.js +18 -9
  16. package/es/catalog/areas/area/planner-element.js +9 -2
  17. package/es/catalog/catalog.js +21 -15
  18. package/es/catalog/factories/area-factory-3d.js +31 -22
  19. package/es/catalog/factories/area-factory.js +20 -11
  20. package/es/catalog/factories/export.js +24 -6
  21. package/es/catalog/factories/wall-factory-3d.js +41 -31
  22. package/es/catalog/factories/wall-factory.js +31 -21
  23. package/es/catalog/holes/door-closet/planner-element.js +24 -15
  24. package/es/catalog/holes/door-double/planner-element.js +24 -15
  25. package/es/catalog/holes/door-exterior/planner-element.js +25 -16
  26. package/es/catalog/holes/door-interior/planner-element.js +25 -16
  27. package/es/catalog/holes/door-panic/planner-element.js +16 -7
  28. package/es/catalog/holes/door-panic-double/planner-element.js +24 -15
  29. package/es/catalog/holes/door-sliding/planner-element.js +25 -16
  30. package/es/catalog/holes/doorway-framed/planner-element.js +20 -11
  31. package/es/catalog/holes/doorway-frameless/planner-element.js +16 -7
  32. package/es/catalog/holes/export.js +97 -13
  33. package/es/catalog/holes/window-clear/planner-element.js +19 -10
  34. package/es/catalog/holes/window-cross/planner-element.js +19 -10
  35. package/es/catalog/holes/window-double-hung/planner-element.js +19 -10
  36. package/es/catalog/holes/window-vertical/planner-element.js +19 -10
  37. package/es/catalog/lines/wall/planner-element.js +9 -2
  38. package/es/catalog/molding/molding-dcm/planner-element.js +14 -5
  39. package/es/catalog/molding/molding-fbm/planner-element.js +14 -5
  40. package/es/catalog/molding/molding-lrm/planner-element.js +14 -5
  41. package/es/catalog/properties/export.js +80 -20
  42. package/es/catalog/properties/property-checkbox.js +31 -24
  43. package/es/catalog/properties/property-color.js +23 -16
  44. package/es/catalog/properties/property-enum.js +31 -24
  45. package/es/catalog/properties/property-hidden.js +16 -9
  46. package/es/catalog/properties/property-lenght-measure.js +45 -38
  47. package/es/catalog/properties/property-length-measure.js +43 -36
  48. package/es/catalog/properties/property-length-measure_hole.js +45 -38
  49. package/es/catalog/properties/property-number.js +24 -17
  50. package/es/catalog/properties/property-read-only.js +23 -16
  51. package/es/catalog/properties/property-string.js +23 -16
  52. package/es/catalog/properties/property-toggle.js +23 -16
  53. package/es/catalog/properties/shared-property-style.js +7 -1
  54. package/es/catalog/utils/FuseUtils.js +15 -8
  55. package/es/catalog/utils/exporter.js +15 -8
  56. package/es/catalog/utils/geom-utils.js +29 -13
  57. package/es/catalog/utils/item-loader.js +97 -84
  58. package/es/catalog/utils/load-obj.js +28 -20
  59. package/es/catalog/utils/mtl-loader.js +8 -3
  60. package/es/catalog/utils/obj-loader.js +8 -3
  61. package/es/class/FuseUtils.js +15 -8
  62. package/es/class/area.js +28 -22
  63. package/es/class/export.js +95 -23
  64. package/es/class/group.js +59 -53
  65. package/es/class/guide.js +21 -15
  66. package/es/class/hole.js +89 -83
  67. package/es/class/item.js +147 -141
  68. package/es/class/layer.js +65 -59
  69. package/es/class/line.js +143 -135
  70. package/es/class/project.js +98 -90
  71. package/es/class/vertex.js +35 -29
  72. package/es/components/content.js +28 -19
  73. package/es/components/disclaimer/disclaimer.js +18 -10
  74. package/es/components/export.js +32 -8
  75. package/es/components/style/button.js +31 -23
  76. package/es/components/style/cancel-button.js +14 -7
  77. package/es/components/style/content-container.js +16 -9
  78. package/es/components/style/content-title.js +20 -11
  79. package/es/components/style/delete-button.js +17 -8
  80. package/es/components/style/export.js +120 -30
  81. package/es/components/style/form-block.js +15 -8
  82. package/es/components/style/form-color-input.js +14 -7
  83. package/es/components/style/form-label.js +15 -8
  84. package/es/components/style/form-number-input.js +49 -41
  85. package/es/components/style/form-number-input_2.js +44 -36
  86. package/es/components/style/form-select.js +24 -17
  87. package/es/components/style/form-slider.js +17 -10
  88. package/es/components/style/form-submit-button.js +17 -8
  89. package/es/components/style/form-text-input.js +34 -26
  90. package/es/components/viewer2d/area.js +24 -17
  91. package/es/components/viewer2d/export.js +120 -30
  92. package/es/components/viewer2d/grids/grid-horizontal-streak.js +17 -10
  93. package/es/components/viewer2d/grids/grid-streak.js +17 -10
  94. package/es/components/viewer2d/grids/grid-vertical-streak.js +17 -10
  95. package/es/components/viewer2d/grids/grids.js +19 -10
  96. package/es/components/viewer2d/group.js +24 -15
  97. package/es/components/viewer2d/item.js +70 -61
  98. package/es/components/viewer2d/layer.js +30 -23
  99. package/es/components/viewer2d/line.js +111 -101
  100. package/es/components/viewer2d/ruler.js +29 -22
  101. package/es/components/viewer2d/rulerDist.js +28 -21
  102. package/es/components/viewer2d/rulerX.js +47 -39
  103. package/es/components/viewer2d/rulerY.js +45 -37
  104. package/es/components/viewer2d/scene.js +38 -30
  105. package/es/components/viewer2d/snap.js +22 -13
  106. package/es/components/viewer2d/state.js +27 -18
  107. package/es/components/viewer2d/utils.js +37 -24
  108. package/es/components/viewer2d/vertex.js +17 -8
  109. package/es/components/viewer2d/viewer2d.js +163 -153
  110. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +23 -17
  111. package/es/components/viewer3d/dcm.js +7 -1
  112. package/es/components/viewer3d/fbm.js +7 -1
  113. package/es/components/viewer3d/front3D.js +21 -12
  114. package/es/components/viewer3d/grid-creator.js +17 -8
  115. package/es/components/viewer3d/grids/grid-horizontal-streak.js +14 -6
  116. package/es/components/viewer3d/grids/grid-streak.js +13 -5
  117. package/es/components/viewer3d/grids/grid-vertical-streak.js +14 -6
  118. package/es/components/viewer3d/libs/first-person-controls.js +9 -2
  119. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +7 -1
  120. package/es/components/viewer3d/libs/mtl-loader.js +7 -1
  121. package/es/components/viewer3d/libs/obj-loader.js +7 -1
  122. package/es/components/viewer3d/libs/orbit-controls.js +8 -2
  123. package/es/components/viewer3d/libs/pointer-lock-controls.js +8 -2
  124. package/es/components/viewer3d/lrm.js +7 -1
  125. package/es/components/viewer3d/model.js +7 -1
  126. package/es/components/viewer3d/pointer-lock-navigation.js +10 -3
  127. package/es/components/viewer3d/ruler-utils/itemRect.js +25 -18
  128. package/es/components/viewer3d/ruler-utils/layer3D.js +66 -59
  129. package/es/components/viewer3d/ruler-utils/ruler3D.js +46 -39
  130. package/es/components/viewer3d/ruler-utils/scene3D.js +17 -9
  131. package/es/components/viewer3d/ruler-utils/state3D.js +11 -4
  132. package/es/components/viewer3d/scene-creator.js +226 -191
  133. package/es/components/viewer3d/three-memory-cleaner.js +12 -3
  134. package/es/components/viewer3d/viewer3d-first-person.js +46 -40
  135. package/es/components/viewer3d/viewer3d.js +202 -196
  136. package/es/constants.js +358 -349
  137. package/es/index.js +15 -7
  138. package/es/models.js +184 -177
  139. package/es/plugins/SVGLoader.js +53 -48
  140. package/es/plugins/autosave.js +9 -3
  141. package/es/plugins/console-debugger.js +12 -5
  142. package/es/plugins/export.js +32 -8
  143. package/es/plugins/keyboard.js +35 -29
  144. package/es/reducers/areas-reducer.js +13 -7
  145. package/es/reducers/export.js +96 -24
  146. package/es/reducers/groups-reducer.js +37 -31
  147. package/es/reducers/holes-reducer.js +49 -43
  148. package/es/reducers/items-reducer.js +112 -106
  149. package/es/reducers/lines-reducer.js +34 -28
  150. package/es/reducers/project-reducer.js +111 -105
  151. package/es/reducers/reducer.js +23 -16
  152. package/es/reducers/scene-reducer.js +21 -15
  153. package/es/reducers/user-reducer.js +11 -5
  154. package/es/reducers/vertices-reducer.js +17 -11
  155. package/es/reducers/viewer2d-reducer.js +24 -18
  156. package/es/reducers/viewer3d-reducer.js +22 -16
  157. package/es/shared-style.js +16 -10
  158. package/es/styles/export.js +11 -3
  159. package/es/translator/en.js +7 -1
  160. package/es/translator/it.js +7 -1
  161. package/es/translator/ru.js +7 -1
  162. package/es/translator/translator.js +19 -13
  163. package/es/utils/browser.js +9 -2
  164. package/es/utils/convert-units-lite.js +7 -1
  165. package/es/utils/email-validator.js +7 -1
  166. package/es/utils/export.js +46 -15
  167. package/es/utils/geometry.js +278 -181
  168. package/es/utils/get-edges-of-subgraphs.js +9 -2
  169. package/es/utils/graph-cycles.js +11 -8
  170. package/es/utils/graph-inner-cycles.js +18 -10
  171. package/es/utils/graph.js +17 -9
  172. package/es/utils/helper.js +63 -39
  173. package/es/utils/history.js +15 -8
  174. package/es/utils/id-broker.js +15 -8
  175. package/es/utils/logger.js +7 -1
  176. package/es/utils/math.js +12 -5
  177. package/es/utils/molding.js +144 -119
  178. package/es/utils/name-generator.js +13 -7
  179. package/es/utils/objects-utils.js +19 -7
  180. package/es/utils/phone-validator.js +7 -1
  181. package/es/utils/process-black-list.js +10 -3
  182. package/es/utils/react-if.js +12 -6
  183. package/es/utils/snap-scene.js +34 -27
  184. package/es/utils/snap.js +59 -45
  185. package/es/utils/summarizeCart.js +7 -1
  186. package/es/utils/threeCSG.es6.js +22 -13
  187. package/es/version.js +7 -1
  188. package/package.json +1 -1
@@ -1,81 +1,178 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
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.ContainsPoint = ContainsPoint;
9
+ exports._twoLineSegmentsIntersection = _twoLineSegmentsIntersection;
10
+ exports.absAngleBetweenTwoPoints = absAngleBetweenTwoPoints;
11
+ exports.almostEqual = void 0;
12
+ exports.angleBetweenTwoLines = angleBetweenTwoLines;
13
+ exports.angleBetweenTwoPoints = angleBetweenTwoPoints;
14
+ exports.angleBetweenTwoPointsAndOrigin = angleBetweenTwoPointsAndOrigin;
15
+ exports.buildRectFromLines = buildRectFromLines;
16
+ exports.calcCreateSnap = calcCreateSnap;
17
+ exports.calcSnap = calcSnap;
18
+ exports.calcSnap1 = calcSnap1;
19
+ exports.calcSnap2 = calcSnap2;
20
+ exports.calcSnap3 = calcSnap3;
21
+ exports.clone_point = clone_point;
22
+ exports.closestPointFromLine = closestPointFromLine;
23
+ exports.closestPointFromLineSegment = closestPointFromLineSegment;
24
+ exports.compareVertices = compareVertices;
25
+ exports.containLine = containLine;
26
+ exports.containPointInRect = containPointInRect;
27
+ exports.cosWithThreshold = cosWithThreshold;
28
+ exports.crossprod = crossprod;
29
+ exports.diff = diff;
30
+ exports.distancePointFromLine = distancePointFromLine;
31
+ exports.distancePointFromLineSegment = distancePointFromLineSegment;
32
+ exports.dotprod = dotprod;
33
+ exports.downcrossLine = downcrossLine;
34
+ exports.extendLine = extendLine;
35
+ exports.findCatalogElement = findCatalogElement;
36
+ exports.getAllArea = getAllArea;
37
+ exports.getAllAreaLines = getAllAreaLines;
38
+ exports.getAllCurSnap = getAllCurSnap;
39
+ exports.getAllHoleRect = getAllHoleRect;
40
+ exports.getAllItemSnap = getAllItemSnap;
41
+ exports.getAllItemSpecified = getAllItemSpecified;
42
+ exports.getAllItems = getAllItems;
43
+ exports.getAllLineSnap = getAllLineSnap;
44
+ exports.getAllLines = getAllLines;
45
+ exports.getCalcRectFromItem = getCalcRectFromItem;
46
+ exports.getCalcRectFromItem3D = getCalcRectFromItem3D;
47
+ exports.getCalcRectFromLine = getCalcRectFromLine;
48
+ exports.getCentroidOfPolygon = getCentroidOfPolygon;
49
+ exports.getHoleItems = getHoleItems;
50
+ exports.getInterSect = getInterSect;
51
+ exports.getLineInterSect = getLineInterSect;
52
+ exports.getNormaline = getNormaline;
53
+ exports.getRelatedLines = void 0;
54
+ exports.getRelatedVertices = getRelatedVertices;
55
+ exports.horizontalLine = horizontalLine;
56
+ exports.intersectRect = intersectRect;
57
+ exports.isBackWall = isBackWall;
58
+ exports.isFrontWall = isFrontWall;
59
+ exports.isLeftWall = isLeftWall;
60
+ exports.isPointInArea = isPointInArea;
61
+ exports.isPointInRect = isPointInRect;
62
+ exports.isPointOnLineSegment = isPointOnLineSegment;
63
+ exports.isRightWall = isRightWall;
64
+ exports.isSnappedLine = isSnappedLine;
65
+ exports.isSnappedSideLine = isSnappedSideLine;
66
+ exports.itemInfo = itemInfo;
67
+ exports.linePassingThroughTwoPoints = linePassingThroughTwoPoints;
68
+ exports.mapRange = mapRange;
69
+ exports.maxVertex = maxVertex;
70
+ exports.midPoint = midPoint;
71
+ exports.minVertex = minVertex;
72
+ exports.needSnap = needSnap;
73
+ exports.orderVertices = orderVertices;
74
+ exports.pointPositionOnLineSegment = pointPositionOnLineSegment;
75
+ exports.pointsDistance = pointsDistance;
76
+ exports.relationshipOfTwoOverlappedLines = relationshipOfTwoOverlappedLines;
77
+ exports.relationshipOfTwoOverlappedLines1 = relationshipOfTwoOverlappedLines1;
78
+ exports.relationshipOfTwoOverlappedLines2 = relationshipOfTwoOverlappedLines2;
79
+ exports.rotatePointAroundPoint = rotatePointAroundPoint;
80
+ exports.roundVertex = roundVertex;
81
+ exports.sameDistances = sameDistances;
82
+ exports.sameMDistances = sameMDistances;
83
+ exports.sameMPoints = sameMPoints;
84
+ exports.samePoints = samePoints;
85
+ exports.shrinkRect = shrinkRect;
86
+ exports.sinWithThreshold = sinWithThreshold;
87
+ exports.snapAngleByUnit = snapAngleByUnit;
88
+ exports.twoLineSegmentsIntersection = twoLineSegmentsIntersection;
89
+ exports.twoLinesIntersection = twoLinesIntersection;
90
+ exports.upcrossLine = upcrossLine;
91
+ exports.validInterSect = validInterSect;
92
+ exports.validSnap = validSnap;
93
+ exports.validateLineSnaps = validateLineSnaps;
94
+ exports.validateSnaps = validateSnaps;
95
+ exports.verticalLine = verticalLine;
96
+ exports.verticesDistance = verticesDistance;
97
+ exports.verticesMidPoint = verticesMidPoint;
98
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
99
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
100
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
101
+ var _math = require("./math.js");
102
+ var _constants = require("../constants");
103
+ var _convertUnitsLite = require("./convert-units-lite");
104
+ var Three = _interopRequireWildcard(require("three"));
105
+ var _utils = require("../components/viewer2d/utils.js");
106
+ var _helper = require("./helper.js");
107
+ var _export = require("./export.js");
108
+ 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); }
4
109
  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; }
5
- 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) { _defineProperty(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; }
110
+ 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; }
6
111
  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; } } }; }
7
112
  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; } }
8
- 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; }
9
- /** @description Determines the distance between two points
113
+ 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; } /** @description Determines the distance between two points
10
114
  * @param {number} x0 Vertex 0 x
11
115
  * @param {number} y0 Vertex 0 y
12
116
  * @param {number} x1 Vertex 1 x
13
117
  * @param {number} y1 Vertex 1 y
14
118
  * @return {number}
15
119
  */
16
- import { fAbs, toFixedFloat } from "./math.js";
17
- import { BASE_CABINET_LAYOUTPOS, EPSILON, LINE_THICKNESS, MEPSILON, OVERLAP_INCLUDED, OVERLAP_LINK, OVERLAP_NONE, OVERLAP_SAME, OVERLAP_SOME, UNIT_ANGLE, WALL_CABINET_LAYOUTPOS } from "../constants";
18
- import { convert } from "./convert-units-lite";
19
- import * as Three from 'three';
20
- import { returnReplaceableDeepSearchType } from "../components/viewer2d/utils.js";
21
- import { isEmpty } from "./helper.js";
22
- import { MathUtils } from "./export.js";
23
- export function compareVertices(v0, v1) {
120
+ function compareVertices(v0, v1) {
24
121
  return v0.x === v1.x ? v0.y - v1.y : v0.x - v1.x;
25
122
  }
26
- export function minVertex(v0, v1) {
123
+ function minVertex(v0, v1) {
27
124
  return compareVertices(v0, v1) > 0 ? v1 : v0;
28
125
  }
29
- export function maxVertex(v0, v1) {
126
+ function maxVertex(v0, v1) {
30
127
  return compareVertices(v0, v1) > 0 ? v0 : v1;
31
128
  }
32
- export function orderVertices(vertices) {
129
+ function orderVertices(vertices) {
33
130
  return vertices.sort(compareVertices);
34
131
  }
35
- export function pointsDistance(x0, y0, x1, y1) {
132
+ function pointsDistance(x0, y0, x1, y1) {
36
133
  var diff_x = x0 - x1;
37
134
  var diff_y = y0 - y1;
38
135
  return Math.sqrt(diff_x * diff_x + diff_y * diff_y);
39
136
  }
40
- export function verticesDistance(v1, v2) {
137
+ function verticesDistance(v1, v2) {
41
138
  var x0 = v1.x,
42
139
  y0 = v1.y;
43
140
  var x1 = v2.x,
44
141
  y1 = v2.y;
45
142
  return pointsDistance(x0, y0, x1, y1);
46
143
  }
47
- export function horizontalLine(y) {
144
+ function horizontalLine(y) {
48
145
  return {
49
146
  a: 0,
50
147
  b: 1,
51
148
  c: -y
52
149
  };
53
150
  }
54
- export var almostEqual = function almostEqual(x, y) {
55
- return Math.abs(x - y) < EPSILON;
151
+ var almostEqual = exports.almostEqual = function almostEqual(x, y) {
152
+ return Math.abs(x - y) < _constants.EPSILON;
56
153
  };
57
- export function verticalLine(x) {
154
+ function verticalLine(x) {
58
155
  return {
59
156
  a: 1,
60
157
  b: 0,
61
158
  c: -x
62
159
  };
63
160
  }
64
- export function upcrossLine(x, y) {
161
+ function upcrossLine(x, y) {
65
162
  return {
66
163
  a: 1,
67
164
  b: 1,
68
165
  c: -x - y
69
166
  };
70
167
  }
71
- export function downcrossLine(x, y) {
168
+ function downcrossLine(x, y) {
72
169
  return {
73
170
  a: 1,
74
171
  b: -1,
75
172
  c: -x + y
76
173
  };
77
174
  }
78
- export function linePassingThroughTwoPoints(x1, y1, x2, y2) {
175
+ function linePassingThroughTwoPoints(x1, y1, x2, y2) {
79
176
  if (x1 === x2 && y1 == y2) throw new Error('Geometry error');
80
177
  //if (x1 === x2) return verticalLine(x1);
81
178
  //if (y1 === y2) return horizontalLine(y1);
@@ -86,18 +183,18 @@ export function linePassingThroughTwoPoints(x1, y1, x2, y2) {
86
183
  c: y2 * x1 - x2 * y1
87
184
  };
88
185
  }
89
- export function getNormaline(x1, y1, x2, y2) {
186
+ function getNormaline(x1, y1, x2, y2) {
90
187
  var lineFunction = linePassingThroughTwoPoints(x1, y1, x2, y2);
91
188
  return {
92
189
  x: lineFunction.a / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b),
93
190
  y: lineFunction.b / Math.sqrt(lineFunction.a * lineFunction.a + lineFunction.b * lineFunction.b)
94
191
  };
95
192
  }
96
- export function distancePointFromLine(a, b, c, x, y) {
193
+ function distancePointFromLine(a, b, c, x, y) {
97
194
  //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
98
- return fAbs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
195
+ return (0, _math.fAbs)(a * x + b * y + c) / Math.sqrt(a * a + b * b);
99
196
  }
100
- export function closestPointFromLine(a, b, c, x, y) {
197
+ function closestPointFromLine(a, b, c, x, y) {
101
198
  //https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line
102
199
  var denom = a * a + b * b;
103
200
  return {
@@ -115,7 +212,7 @@ export function closestPointFromLine(a, b, c, x, y) {
115
212
  * @param {number} l costant of second line
116
213
  * @return {object} {x,y} point's coordinates
117
214
  */
118
- export function twoLinesIntersection(a, b, c, j, k, l) {
215
+ function twoLinesIntersection(a, b, c, j, k, l) {
119
216
  var angularCoefficientsDiff = b * j - a * k;
120
217
  if (angularCoefficientsDiff === 0) return undefined; //no intersection
121
218
 
@@ -126,10 +223,10 @@ export function twoLinesIntersection(a, b, c, j, k, l) {
126
223
  y: y
127
224
  };
128
225
  }
129
- export function twoLineSegmentsIntersection(p1, p2, p3, p4) {
226
+ function twoLineSegmentsIntersection(p1, p2, p3, p4) {
130
227
  return _twoLineSegmentsIntersection(p1, p2, p3.toJS(), p4.toJS());
131
228
  }
132
- export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
229
+ function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
133
230
  //https://github.com/psalaets/line-intersect/blob/master/lib/check-intersection.js
134
231
 
135
232
  var x1 = p1.x,
@@ -143,8 +240,8 @@ export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
143
240
  var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
144
241
  var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
145
242
  var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
146
- if (fAbs(denom) <= EPSILON) {
147
- if (fAbs(numA) <= EPSILON && fAbs(numB) <= EPSILON) {
243
+ if ((0, _math.fAbs)(denom) <= _constants.EPSILON) {
244
+ if ((0, _math.fAbs)(numA) <= _constants.EPSILON && (0, _math.fAbs)(numB) <= _constants.EPSILON) {
148
245
  var comparator = function comparator(pa, pb) {
149
246
  return pa.x === pb.x ? pa.y - pb.y : pa.x - pb.x;
150
247
  };
@@ -153,7 +250,7 @@ export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
153
250
  var _sort = [line0, line1].sort(function (lineA, lineB) {
154
251
  return comparator(lineA[0], lineB[0]);
155
252
  }),
156
- _sort2 = _slicedToArray(_sort, 2),
253
+ _sort2 = (0, _slicedToArray2["default"])(_sort, 2),
157
254
  lineSX = _sort2[0],
158
255
  lineDX = _sort2[1];
159
256
  comparator(lineSX[1], lineDX[0]) < 0 ? 'colinear' : 'none';
@@ -173,7 +270,7 @@ export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
173
270
  }
174
271
  var uA = numA / denom;
175
272
  var uB = numB / denom;
176
- if (uA >= 0 - EPSILON && uA <= 1 + EPSILON && uB >= 0 - EPSILON && uB <= 1 + EPSILON) {
273
+ if (uA >= 0 - _constants.EPSILON && uA <= 1 + _constants.EPSILON && uB >= 0 - _constants.EPSILON && uB <= 1 + _constants.EPSILON) {
177
274
  var _point = {
178
275
  x: x1 + uA * (x2 - x1),
179
276
  y: y1 + uA * (y2 - y1)
@@ -187,7 +284,7 @@ export function _twoLineSegmentsIntersection(p1, p2, p3, p4) {
187
284
  type: 'none'
188
285
  };
189
286
  }
190
- export function distancePointFromLineSegment(v1, v2, xp, yp) {
287
+ function distancePointFromLineSegment(v1, v2, xp, yp) {
191
288
  //http://stackoverflow.com/a/6853926/1398836
192
289
  var x1 = v1.x,
193
290
  y1 = v1.y;
@@ -230,8 +327,8 @@ export function distancePointFromLineSegment(v1, v2, xp, yp) {
230
327
  * @param maxDistance {number} the epsilon value used for comparisons
231
328
  * @returns {boolean} true if the point lies on the line segment false otherwise
232
329
  */
233
- export function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
234
- var maxDistance = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : EPSILON;
330
+ function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
331
+ var maxDistance = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : _constants.EPSILON;
235
332
  return distancePointFromLineSegment({
236
333
  x: x1,
237
334
  y: y1
@@ -240,7 +337,7 @@ export function isPointOnLineSegment(x1, y1, x2, y2, xp, yp) {
240
337
  y: y2
241
338
  }, xp, yp) <= maxDistance;
242
339
  }
243
- export function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
340
+ function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
244
341
  if (x1 === x2) return {
245
342
  x: x1,
246
343
  y: yp
@@ -260,7 +357,7 @@ export function closestPointFromLineSegment(x1, y1, x2, y2, xp, yp) {
260
357
  y: y
261
358
  };
262
359
  }
263
- export function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
360
+ function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
264
361
  var length = pointsDistance(x1, y1, x2, y2);
265
362
  var distance = pointsDistance(x1, y1, xp, yp);
266
363
  var offset = distance / length;
@@ -270,16 +367,16 @@ export function pointPositionOnLineSegment(x1, y1, x2, y2, xp, yp) {
270
367
  */
271
368
  return offset;
272
369
  }
273
- export function mapRange(value, low1, high1, low2, high2) {
370
+ function mapRange(value, low1, high1, low2, high2) {
274
371
  return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
275
372
  }
276
- export function angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2) {
373
+ function angleBetweenTwoPointsAndOrigin(x1, y1, x2, y2) {
277
374
  return -Math.atan2(y1 - y2, x2 - x1) * 180 / Math.PI;
278
375
  }
279
- export function angleBetweenTwoPoints(x1, y1, x2, y2) {
376
+ function angleBetweenTwoPoints(x1, y1, x2, y2) {
280
377
  return Math.atan2(y2 - y1, x2 - x1);
281
378
  }
282
- export function angleBetweenTwoLines(line, drawingLine, vertices) {
379
+ function angleBetweenTwoLines(line, drawingLine, vertices) {
283
380
  var points = [];
284
381
 
285
382
  // safety guards
@@ -337,7 +434,7 @@ export function angleBetweenTwoLines(line, drawingLine, vertices) {
337
434
  var v = vertices === null || vertices === void 0 ? void 0 : vertices[idx];
338
435
  return v ? new Three.Vector2(v.x, v.y) : new Three.Vector2(0, 0);
339
436
  }),
340
- _points$slice$map2 = _slicedToArray(_points$slice$map, 3),
437
+ _points$slice$map2 = (0, _slicedToArray2["default"])(_points$slice$map, 3),
341
438
  c = _points$slice$map2[0],
342
439
  p1 = _points$slice$map2[1],
343
440
  p2 = _points$slice$map2[2];
@@ -345,7 +442,7 @@ export function angleBetweenTwoLines(line, drawingLine, vertices) {
345
442
  var vec2 = p2.clone().sub(c).normalize();
346
443
  return Math.floor(vec1.angle() * 180 / Math.PI - vec2.angle() * 180 / Math.PI + 0.5);
347
444
  }
348
- export var getRelatedLines = function getRelatedLines(tlines, drawingLine, vertices, lines) {
445
+ var getRelatedLines = exports.getRelatedLines = function getRelatedLines(tlines, drawingLine, vertices, lines) {
349
446
  var exceptLineId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
350
447
  if (!(drawingLine !== null && drawingLine !== void 0 && drawingLine.vertices) || !Array.isArray(drawingLine.vertices)) return;
351
448
  var seen = new Set();
@@ -361,7 +458,7 @@ export var getRelatedLines = function getRelatedLines(tlines, drawingLine, verti
361
458
  try {
362
459
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
363
460
  var lineId = _step5.value;
364
- if (lineId !== drawingLine.id && lineId !== exceptLineId && !isEmpty(lines === null || lines === void 0 ? void 0 : lines[lineId]) && !seen.has(lineId)) {
461
+ if (lineId !== drawingLine.id && lineId !== exceptLineId && !(0, _helper.isEmpty)(lines === null || lines === void 0 ? void 0 : lines[lineId]) && !seen.has(lineId)) {
365
462
  seen.add(lineId);
366
463
  tlines.push(lines[lineId]);
367
464
  }
@@ -378,12 +475,12 @@ export var getRelatedLines = function getRelatedLines(tlines, drawingLine, verti
378
475
  _iterator4.f();
379
476
  }
380
477
  };
381
- export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVertexId) {
478
+ function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVertexId) {
382
479
  var tx, ty;
383
480
  var absAngle = Math.abs(lineAngle);
384
481
  // angle snapping as a value of UNIT_ANGLE
385
- var rest = absAngle % UNIT_ANGLE;
386
- var missAngle = UNIT_ANGLE - rest;
482
+ var rest = absAngle % _constants.UNIT_ANGLE;
483
+ var missAngle = _constants.UNIT_ANGLE - rest;
387
484
  // the origin point of rotation(snapping)
388
485
  var originVerId = drawingLine.vertices.findIndex(function (vertice) {
389
486
  return vertice !== dragVertexId;
@@ -392,7 +489,7 @@ export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVert
392
489
  var ox = vertices[originVerId].x;
393
490
  var oy = vertices[originVerId].y;
394
491
  // check whether the line is snapped to before point.
395
- if (rest <= UNIT_ANGLE / 2) {
492
+ if (rest <= _constants.UNIT_ANGLE / 2) {
396
493
  // determine the direction of rotation.
397
494
  rest = lineAngle > 0 ? rest : -rest;
398
495
  // rotate the current point to last point around the first point of drawing line.
@@ -400,7 +497,7 @@ export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVert
400
497
  ty = rotatePointAroundPoint(x, y, ox, oy, rest).y;
401
498
  }
402
499
  // check whether the line is snapped to next new point.
403
- else if (rest > UNIT_ANGLE / 2) {
500
+ else if (rest > _constants.UNIT_ANGLE / 2) {
404
501
  // determine the direction of rotation.
405
502
  missAngle = lineAngle > 0 ? -missAngle : missAngle;
406
503
  // rotate the current point to last point around the first point of drawing line.
@@ -413,30 +510,30 @@ export function snapAngleByUnit(lineAngle, vertices, drawingLine, x, y, dragVert
413
510
  };
414
511
  return resPoint;
415
512
  }
416
- export function absAngleBetweenTwoPoints(x1, y1, x2, y2) {
513
+ function absAngleBetweenTwoPoints(x1, y1, x2, y2) {
417
514
  return Math.atan2(y2 - y1, Math.abs(x2 - x1));
418
515
  }
419
- export function samePoints(_ref, _ref2) {
516
+ function samePoints(_ref, _ref2) {
420
517
  var x1 = _ref.x,
421
518
  y1 = _ref.y;
422
519
  var x2 = _ref2.x,
423
520
  y2 = _ref2.y;
424
- return fAbs(x1 - x2) <= EPSILON && fAbs(y1 - y2) <= EPSILON;
521
+ return (0, _math.fAbs)(x1 - x2) <= _constants.EPSILON && (0, _math.fAbs)(y1 - y2) <= _constants.EPSILON;
425
522
  }
426
- export function sameDistances(dis1, dis2) {
427
- return fAbs(dis1 - dis2) <= EPSILON;
523
+ function sameDistances(dis1, dis2) {
524
+ return (0, _math.fAbs)(dis1 - dis2) <= _constants.EPSILON;
428
525
  }
429
- export function sameMPoints(_ref3, _ref4) {
526
+ function sameMPoints(_ref3, _ref4) {
430
527
  var x1 = _ref3.x,
431
528
  y1 = _ref3.y;
432
529
  var x2 = _ref4.x,
433
530
  y2 = _ref4.y;
434
- return fAbs(x1 - x2) <= MEPSILON && fAbs(y1 - y2) <= MEPSILON;
531
+ return (0, _math.fAbs)(x1 - x2) <= _constants.MEPSILON && (0, _math.fAbs)(y1 - y2) <= _constants.MEPSILON;
435
532
  }
436
- export function sameMDistances(dis1, dis2) {
437
- return fAbs(dis1 - dis2) <= MEPSILON;
533
+ function sameMDistances(dis1, dis2) {
534
+ return (0, _math.fAbs)(dis1 - dis2) <= _constants.MEPSILON;
438
535
  }
439
- export function isPointInRect(rect, point) {
536
+ function isPointInRect(rect, point) {
440
537
  var result = true;
441
538
  for (var i = 0; i < rect.length; i++) {
442
539
  var pos1 = rect[i];
@@ -456,23 +553,23 @@ export function isPointInRect(rect, point) {
456
553
  * @param {number} newDistance New line length
457
554
  * @return {object}
458
555
  */
459
- export function extendLine(x1, y1, x2, y2, newDistance) {
556
+ function extendLine(x1, y1, x2, y2, newDistance) {
460
557
  var precision = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 6;
461
558
  var rad = angleBetweenTwoPoints(x1, y1, x2, y2);
462
559
  return {
463
- x: toFixedFloat(x1 + Math.cos(rad) * newDistance, precision),
464
- y: toFixedFloat(y1 + Math.sin(rad) * newDistance, precision)
560
+ x: (0, _math.toFixedFloat)(x1 + Math.cos(rad) * newDistance, precision),
561
+ y: (0, _math.toFixedFloat)(y1 + Math.sin(rad) * newDistance, precision)
465
562
  };
466
563
  }
467
- export function roundVertex(vertex) {
564
+ function roundVertex(vertex) {
468
565
  var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
469
- vertex.set('x', toFixedFloat(vertex.get('x'), precision));
470
- vertex.set('y', toFixedFloat(vertex.get('y'), precision));
566
+ vertex.set('x', (0, _math.toFixedFloat)(vertex.get('x'), precision));
567
+ vertex.set('y', (0, _math.toFixedFloat)(vertex.get('y'), precision));
471
568
  return vertex;
472
569
  }
473
570
 
474
571
  //https://github.com/MartyWallace/PolyK
475
- export function ContainsPoint(polygon, pointX, pointY) {
572
+ function ContainsPoint(polygon, pointX, pointY) {
476
573
  var n = polygon.length >> 1;
477
574
  var ax, lup;
478
575
  var ay = polygon[2 * n - 3] - pointY;
@@ -511,21 +608,21 @@ export function ContainsPoint(polygon, pointX, pointY) {
511
608
  }
512
609
  return (depth & 1) === 1;
513
610
  }
514
- export function cosWithThreshold(alpha, threshold) {
611
+ function cosWithThreshold(alpha, threshold) {
515
612
  var cos = Math.cos(alpha);
516
613
  return cos < threshold ? 0 : cos;
517
614
  }
518
- export function sinWithThreshold(alpha, threshold) {
615
+ function sinWithThreshold(alpha, threshold) {
519
616
  var sin = Math.sin(alpha);
520
617
  return sin < threshold ? 0 : sin;
521
618
  }
522
- export function midPoint(x1, y1, x2, y2) {
619
+ function midPoint(x1, y1, x2, y2) {
523
620
  return {
524
621
  x: (x1 + x2) / 2,
525
622
  y: (y1 + y2) / 2
526
623
  };
527
624
  }
528
- export function verticesMidPoint(verticesArray) {
625
+ function verticesMidPoint(verticesArray) {
529
626
  var res = verticesArray.reduce(function (incr, vertex) {
530
627
  return {
531
628
  x: incr.x + vertex.x,
@@ -540,7 +637,7 @@ export function verticesMidPoint(verticesArray) {
540
637
  y: res.y / verticesArray.length
541
638
  };
542
639
  }
543
- export function rotatePointAroundPoint(px, py, ox, oy, theta) {
640
+ function rotatePointAroundPoint(px, py, ox, oy, theta) {
544
641
  var thetaRad = theta * Math.PI / 180;
545
642
  var cos = Math.cos(thetaRad);
546
643
  var sin = Math.sin(thetaRad);
@@ -574,7 +671,7 @@ function itemrectInfo(x, y, rotRad, size, layoutpos, is_corner) {
574
671
  is_corner: is_corner
575
672
  };
576
673
  }
577
- export function getCalcRectFromItem(item) {
674
+ function getCalcRectFromItem(item) {
578
675
  var itemInfo;
579
676
  if (item === undefined) itemInfo = [];else itemInfo = item.item;
580
677
  var x = item.pos.x;
@@ -602,7 +699,7 @@ export function getCalcRectFromItem(item) {
602
699
  itemInfo: itemInfo
603
700
  };
604
701
  }
605
- export function getCalcRectFromItem3D(item) {
702
+ function getCalcRectFromItem3D(item) {
606
703
  var itemInfo;
607
704
  if (item === undefined) itemInfo = [];else itemInfo = item.item;
608
705
  var x = item.pos.x;
@@ -630,7 +727,7 @@ export function getCalcRectFromItem3D(item) {
630
727
  itemInfo: itemInfo
631
728
  };
632
729
  }
633
- export function getAllItems(scene, catalog, allLineRects) {
730
+ function getAllItems(scene, catalog, allLineRects) {
634
731
  var layerID = scene.selectedLayer;
635
732
  var layer = scene.layers.get(layerID);
636
733
  var curiteminfo;
@@ -642,7 +739,7 @@ export function getAllItems(scene, catalog, allLineRects) {
642
739
  selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
643
740
  var catid = selectedItem.type;
644
741
  var cat = catalog.elements[catid];
645
- if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
742
+ if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
646
743
  currentItem = {
647
744
  selectedItem: selectedItem,
648
745
  cat: cat
@@ -659,7 +756,7 @@ export function getAllItems(scene, catalog, allLineRects) {
659
756
  var catid = item.type;
660
757
  var cat = catalog.elements[catid];
661
758
  if (!cat) {
662
- cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
759
+ cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
663
760
  }
664
761
  var sizeinfo = [];
665
762
  var width, height, depth;
@@ -675,9 +772,9 @@ export function getAllItems(scene, catalog, allLineRects) {
675
772
  layoutpos: cat && cat.info.layoutpos,
676
773
  is_corner: cat && cat.info.is_corner
677
774
  });
678
- width = convert(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
679
- height = convert(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
680
- depth = convert(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
775
+ width = (0, _convertUnitsLite.convert)(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
776
+ height = (0, _convertUnitsLite.convert)(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
777
+ depth = (0, _convertUnitsLite.convert)(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
681
778
  val.size = {
682
779
  width: width,
683
780
  height: height,
@@ -710,7 +807,7 @@ export function getAllItems(scene, catalog, allLineRects) {
710
807
  otherItems: otherItems
711
808
  };
712
809
  }
713
- export function getAllItemSpecified(scene, catalog, filter) {
810
+ function getAllItemSpecified(scene, catalog, filter) {
714
811
  var _scene$layers, _scene$layers$get;
715
812
  var layerID = scene === null || scene === void 0 ? void 0 : scene.selectedLayer;
716
813
  var layer = scene === null || scene === void 0 || (_scene$layers = scene.layers) === null || _scene$layers === void 0 || (_scene$layers$get = _scene$layers.get) === null || _scene$layers$get === void 0 ? void 0 : _scene$layers$get.call(_scene$layers, layerID);
@@ -736,7 +833,7 @@ export function getAllItemSpecified(scene, catalog, filter) {
736
833
  var getSize = function getSize(key) {
737
834
  var _props$getIn;
738
835
  var length = props === null || props === void 0 || (_props$getIn = props.getIn) === null || _props$getIn === void 0 ? void 0 : _props$getIn.call(props, [key, '_length']);
739
- return length != null ? convert(length).from('in').to(scene.unit) : 0;
836
+ return length != null ? (0, _convertUnitsLite.convert)(length).from('in').to(scene.unit) : 0;
740
837
  };
741
838
  val.size = {
742
839
  width: getSize('width'),
@@ -769,13 +866,13 @@ export function getAllItemSpecified(scene, catalog, filter) {
769
866
  others: iteminfo
770
867
  };
771
868
  }
772
- export function findCatalogElement(catalog, elementName) {
869
+ function findCatalogElement(catalog, elementName) {
773
870
  if (!elementName || !catalog) return null;
774
871
  var variants = [elementName, elementName.toLowerCase()];
775
872
  var deepVariants = variants.map(function (v) {
776
- return returnReplaceableDeepSearchType(v);
873
+ return (0, _utils.returnReplaceableDeepSearchType)(v);
777
874
  }).filter(Boolean);
778
- var allCandidates = [].concat(variants, _toConsumableArray(deepVariants));
875
+ var allCandidates = [].concat(variants, (0, _toConsumableArray2["default"])(deepVariants));
779
876
  var getElement = function getElement(catid) {
780
877
  if (!catid) return null;
781
878
 
@@ -805,7 +902,7 @@ export function findCatalogElement(catalog, elementName) {
805
902
  }
806
903
  return null;
807
904
  }
808
- export function isSnappedLine(calcrect, allLineRects) {
905
+ function isSnappedLine(calcrect, allLineRects) {
809
906
  if (allLineRects === undefined) return false;
810
907
  var r2 = calcrect.rect[2];
811
908
  var r3 = calcrect.rect[3];
@@ -813,18 +910,18 @@ export function isSnappedLine(calcrect, allLineRects) {
813
910
  var l2 = linerect.rect[2];
814
911
  var l3 = linerect.rect[3];
815
912
  var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
816
- if (delta < EPSILON) {
913
+ if (delta < _constants.EPSILON) {
817
914
  return true;
818
915
  } else {
819
916
  l2 = linerect.rect[3];
820
917
  l3 = linerect.rect[2];
821
918
  delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
822
- return delta < EPSILON;
919
+ return delta < _constants.EPSILON;
823
920
  }
824
921
  });
825
922
  return result;
826
923
  }
827
- export function isSnappedSideLine(calcrect, allLineRects) {
924
+ function isSnappedSideLine(calcrect, allLineRects) {
828
925
  if (allLineRects === undefined) return 0;
829
926
  var r2 = calcrect.rect[1];
830
927
  var r3 = calcrect.rect[2];
@@ -832,13 +929,13 @@ export function isSnappedSideLine(calcrect, allLineRects) {
832
929
  var l2 = linerect.rect[2];
833
930
  var l3 = linerect.rect[3];
834
931
  var delta = verticesDistance(l2, r3) + verticesDistance(r3, r2) + verticesDistance(r2, l3) - verticesDistance(l3, l2);
835
- return delta < EPSILON;
932
+ return delta < _constants.EPSILON;
836
933
  });
837
934
  return result;
838
935
  }
839
936
 
840
937
  /** Calculate candidate positions */
841
- export function getAllItemSnap(allItemRects) {
938
+ function getAllItemSnap(allItemRects) {
842
939
  var allItemSnap = [];
843
940
  var cur = allItemRects.cur;
844
941
 
@@ -904,7 +1001,7 @@ export function getAllItemSnap(allItemRects) {
904
1001
  });
905
1002
  return allItemSnap;
906
1003
  }
907
- export function getAllArea(layer) {
1004
+ function getAllArea(layer) {
908
1005
  var allAreaLines = [];
909
1006
  var allLines = [];
910
1007
  var verticesArray = [];
@@ -931,11 +1028,11 @@ export function getAllArea(layer) {
931
1028
  }
932
1029
 
933
1030
  /** Get all lines of the scene */
934
- export function getAllLines(layer) {
1031
+ function getAllLines(layer) {
935
1032
  var allAreaLines = getAllAreaLines(layer);
936
1033
  var allLines = [];
937
1034
  //let allNonAreaLines = [];
938
- var thick = LINE_THICKNESS / 2;
1035
+ var thick = _constants.LINE_THICKNESS / 2;
939
1036
  layer.lines.forEach(function (line) {
940
1037
  var i = containLine(allAreaLines, line);
941
1038
  // let thick = line.properties.getIn(['thickness', 'length']);
@@ -989,7 +1086,7 @@ export function getAllLines(layer) {
989
1086
  }
990
1087
 
991
1088
  /** Get lines that wraps the area */
992
- export function getAllAreaLines(layer) {
1089
+ function getAllAreaLines(layer) {
993
1090
  var areainfo = [];
994
1091
  layer.areas.forEach(function (area) {
995
1092
  var sz = area.vertices.size;
@@ -999,7 +1096,7 @@ export function getAllAreaLines(layer) {
999
1096
  });
1000
1097
  return areainfo;
1001
1098
  }
1002
- export function containLine(lines, line) {
1099
+ function containLine(lines, line) {
1003
1100
  // lines: [array]
1004
1101
  var sz = lines.length;
1005
1102
  for (var i = 0; i < sz; i++) {
@@ -1010,7 +1107,7 @@ export function containLine(lines, line) {
1010
1107
  }
1011
1108
  return -1;
1012
1109
  }
1013
- export function buildRectFromLines(layer, lines) {
1110
+ function buildRectFromLines(layer, lines) {
1014
1111
  var rect = [];
1015
1112
  lines.forEach(function (line) {
1016
1113
  var vxys = []; // 0: x0, 1: y0, 2: x1, 3: y1
@@ -1028,7 +1125,7 @@ export function buildRectFromLines(layer, lines) {
1028
1125
  });
1029
1126
  return rect;
1030
1127
  }
1031
- export function getRelatedVertices(x0, y0, x1, y1, layer) {
1128
+ function getRelatedVertices(x0, y0, x1, y1, layer) {
1032
1129
  var verticesArray = [];
1033
1130
  var mapVertIDtoIndex = {};
1034
1131
  layer.vertices.forEach(function (vertex) {
@@ -1048,7 +1145,7 @@ export function getRelatedVertices(x0, y0, x1, y1, layer) {
1048
1145
  x: verticesArray[mapVertIDtoIndex[vertID1]][0],
1049
1146
  y: verticesArray[mapVertIDtoIndex[vertID1]][1]
1050
1147
  };
1051
- if (Math.abs(pt0.x - x0) < EPSILON && Math.abs(pt0.y - y0) < EPSILON && Math.abs(pt1.x - x1) < EPSILON && Math.abs(pt1.y - y1) < EPSILON || Math.abs(pt0.x - x1) < EPSILON && Math.abs(pt0.y - y1) < EPSILON && Math.abs(pt1.x - x0) < EPSILON && Math.abs(pt1.y - y0) < EPSILON) {
1148
+ if (Math.abs(pt0.x - x0) < _constants.EPSILON && Math.abs(pt0.y - y0) < _constants.EPSILON && Math.abs(pt1.x - x1) < _constants.EPSILON && Math.abs(pt1.y - y1) < _constants.EPSILON || Math.abs(pt0.x - x1) < _constants.EPSILON && Math.abs(pt0.y - y1) < _constants.EPSILON && Math.abs(pt1.x - x0) < _constants.EPSILON && Math.abs(pt1.y - y0) < _constants.EPSILON) {
1052
1149
  if (line.relatedVertices.size == 2) {
1053
1150
  var relPt0 = point(x0, y0);
1054
1151
  var relPt1 = point(x1, y1);
@@ -1064,7 +1161,7 @@ export function getRelatedVertices(x0, y0, x1, y1, layer) {
1064
1161
  });
1065
1162
  return relVerts;
1066
1163
  }
1067
- export function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1164
+ function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1068
1165
  // get line from vertex coordinate
1069
1166
  var relVerts = getRelatedVertices(x0, y0, x1, y1, layer);
1070
1167
  var dx = x1 - x0;
@@ -1110,7 +1207,7 @@ export function getCalcRectFromLine(x0, y0, x1, y1, thick, layer) {
1110
1207
  }
1111
1208
  };
1112
1209
  }
1113
- export function getAllLineSnap(allLineRects, curItemRect) {
1210
+ function getAllLineSnap(allLineRects, curItemRect) {
1114
1211
  var allLineSnap = [];
1115
1212
  var cur = curItemRect;
1116
1213
  if (cur === undefined || cur === null) return;else allLineRects.forEach(function (rect) {
@@ -1134,7 +1231,7 @@ export function getAllLineSnap(allLineRects, curItemRect) {
1134
1231
  });
1135
1232
  return allLineSnap;
1136
1233
  }
1137
- export function validateSnaps(allSnaps, allRects) {
1234
+ function validateSnaps(allSnaps, allRects) {
1138
1235
  var validSnaps = [];
1139
1236
  if (allSnaps !== undefined && allSnaps !== null && allSnaps.length > 0) allSnaps.forEach(function (snap) {
1140
1237
  if (validSnap(snap, allRects)) {
@@ -1143,7 +1240,7 @@ export function validateSnaps(allSnaps, allRects) {
1143
1240
  });
1144
1241
  return validSnaps;
1145
1242
  }
1146
- export function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRects, allLineRects, allRects) {
1243
+ function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRects, allLineRects, allRects) {
1147
1244
  var validSnaps = [];
1148
1245
  allSnaps.forEach(function (snap) {
1149
1246
  if (validSnap(snap, allRects)) {
@@ -1159,13 +1256,13 @@ export function validateLineSnaps(allSnaps, allItemSnap, allLineSnap, allItemRec
1159
1256
  });
1160
1257
  return validSnaps;
1161
1258
  }
1162
- export function validSnap(snap, rects) {
1259
+ function validSnap(snap, rects) {
1163
1260
  var snaprect = getCalcRectFromItem(snap);
1164
1261
  return rects.every(function (rect) {
1165
1262
  return !intersectRect(rect.rect, snaprect.rect);
1166
1263
  });
1167
1264
  }
1168
- export function itemInfo(x, y, rotRad, size) {
1265
+ function itemInfo(x, y, rotRad, size) {
1169
1266
  return {
1170
1267
  pos: {
1171
1268
  x: x,
@@ -1175,7 +1272,7 @@ export function itemInfo(x, y, rotRad, size) {
1175
1272
  size: size
1176
1273
  };
1177
1274
  }
1178
- export function intersectRect(rect1, rect2) {
1275
+ function intersectRect(rect1, rect2) {
1179
1276
  var ret = false;
1180
1277
  rect1 = shrinkRect(rect1);
1181
1278
  rect2 = shrinkRect(rect2);
@@ -1188,7 +1285,7 @@ export function intersectRect(rect1, rect2) {
1188
1285
  });
1189
1286
  return ret;
1190
1287
  }
1191
- export function containPointInRect(point, rect) {
1288
+ function containPointInRect(point, rect) {
1192
1289
  // true: contain, false: not contain
1193
1290
  for (var i = 0; i < rect.length; i++) {
1194
1291
  var ni = (i + 1) % rect.length;
@@ -1198,16 +1295,16 @@ export function containPointInRect(point, rect) {
1198
1295
  }
1199
1296
  return true;
1200
1297
  }
1201
- export function diff(v0, v1) {
1298
+ function diff(v0, v1) {
1202
1299
  return {
1203
1300
  x: v0.x - v1.x,
1204
1301
  y: v0.y - v1.y
1205
1302
  };
1206
1303
  }
1207
- export function crossprod(v0, v1) {
1304
+ function crossprod(v0, v1) {
1208
1305
  return v0.x * v1.y - v0.y * v1.x;
1209
1306
  }
1210
- export function shrinkRect(rect) {
1307
+ function shrinkRect(rect) {
1211
1308
  var v02x = rect[2].x - rect[0].x;
1212
1309
  var v02y = rect[2].y - rect[0].y;
1213
1310
  var d02 = Math.sqrt(v02x * v02x + v02y * v02y);
@@ -1220,7 +1317,7 @@ export function shrinkRect(rect) {
1220
1317
  var o13y = v13y / d13 * 0.1;
1221
1318
  return [point(rect[0].x + o02x, rect[0].y + o02y), point(rect[1].x + o13x, rect[1].y + o13y), point(rect[2].x - o02x, rect[2].y - o02y), point(rect[3].x - o13x, rect[3].y - o13y)];
1222
1319
  }
1223
- export function getInterSect(shape1, shape2) {
1320
+ function getInterSect(shape1, shape2) {
1224
1321
  // return result of intersect of two shape
1225
1322
  var count = 0;
1226
1323
  for (var i = 0; i < shape1.length; i++) {
@@ -1250,7 +1347,7 @@ export function getInterSect(shape1, shape2) {
1250
1347
  }
1251
1348
  return false;
1252
1349
  }
1253
- export function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1350
+ function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1254
1351
  var ax = s1x;
1255
1352
  var ay = s1y;
1256
1353
  var bx = e1x - s1x;
@@ -1295,7 +1392,7 @@ export function getLineInterSect(s1x, s1y, e1x, e1y, s2x, s2y, e2x, e2y) {
1295
1392
  return ret;
1296
1393
  }
1297
1394
  }
1298
- export function isPointInArea(allArea, pt) {
1395
+ function isPointInArea(allArea, pt) {
1299
1396
  var x = pt.x;
1300
1397
  var y = pt.y;
1301
1398
  var result = false;
@@ -1315,7 +1412,7 @@ export function isPointInArea(allArea, pt) {
1315
1412
  x: x1 - x,
1316
1413
  y: y1 - y
1317
1414
  };
1318
- if (Math.abs(v0.x) < EPSILON && Math.abs(v0.y) < EPSILON)
1415
+ if (Math.abs(v0.x) < _constants.EPSILON && Math.abs(v0.y) < _constants.EPSILON)
1319
1416
  // check if pt is area point
1320
1417
  return true;
1321
1418
 
@@ -1328,18 +1425,18 @@ export function isPointInArea(allArea, pt) {
1328
1425
  };
1329
1426
  var xE = x0 + vPt.x * lineLen;
1330
1427
  var yE = y0 + vPt.y * lineLen;
1331
- if (v0Len <= lineLen && Math.abs(xE - x1) < EPSILON && Math.abs(yE - y1) < EPSILON) return true;
1428
+ if (v0Len <= lineLen && Math.abs(xE - x1) < _constants.EPSILON && Math.abs(yE - y1) < _constants.EPSILON) return true;
1332
1429
  alpha = Math.atan2(v0.x * v1.y - v1.x * v0.y, v0.x * v1.x + v0.y * v1.y);
1333
1430
  sum += alpha;
1334
1431
  }
1335
- if (Math.abs(Math.abs(sum) - Math.PI * 2) < EPSILON) return true;
1432
+ if (Math.abs(Math.abs(sum) - Math.PI * 2) < _constants.EPSILON) return true;
1336
1433
  });
1337
1434
  return result;
1338
1435
  }
1339
- export function calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines) {
1436
+ function calcSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines) {
1340
1437
  return calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allAreaLines);
1341
1438
  }
1342
- export function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, polygonPoint) {
1439
+ function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, polygonPoint) {
1343
1440
  // Validate required input and guard against missing `.cur`
1344
1441
  if (!allItemRect || !allItemRect.cur) return;
1345
1442
  var cur = allItemRect.cur; // safe alias
@@ -1397,7 +1494,7 @@ export function calcCreateSnap(allItemRect, allItemSnap, allLineRects, allLineSn
1397
1494
  }
1398
1495
 
1399
1496
  ////////////
1400
- export function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1497
+ function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1401
1498
  var cx = allItemRect.cur.pos.x;
1402
1499
  var cy = allItemRect.cur.pos.y;
1403
1500
  var nx = x;
@@ -1441,7 +1538,7 @@ export function calcSnap1(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1441
1538
  }
1442
1539
 
1443
1540
  ////////////
1444
- export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea) {
1541
+ function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y, allArea) {
1445
1542
  var nx = x;
1446
1543
  var ny = y;
1447
1544
  var ndist = 20;
@@ -1585,7 +1682,7 @@ export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1585
1682
  return intersectRect(others.rect, curitem.rect);
1586
1683
  });
1587
1684
  intersects.forEach(function (rect) {
1588
- if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.layoutpos.includes(BASE_CABINET_LAYOUTPOS)) {
1685
+ if (isPointInArea(allArea, rect.itemInfo) || !allArea.length) if (rect.itemInfo.layoutpos.includes(_constants.BASE_CABINET_LAYOUTPOS)) {
1589
1686
  nx = rect.itemInfo.x;
1590
1687
  ny = rect.itemInfo.y;
1591
1688
  rotRad = rect.itemInfo.rotation * Math.PI / 180;
@@ -1612,7 +1709,7 @@ export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1612
1709
  //Check case.
1613
1710
  //If item is 'blind base cabinet', it must be pulled from other 3".
1614
1711
  if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.startsWith('BBC')) {
1615
- var offset3inch = convert(3).from('in').to('cm');
1712
+ var offset3inch = (0, _convertUnitsLite.convert)(3).from('in').to('cm');
1616
1713
  var tx = nx,
1617
1714
  ty = ny;
1618
1715
  if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-L')) {
@@ -1657,7 +1754,7 @@ export function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1657
1754
  }
1658
1755
 
1659
1756
  ////////////
1660
- export function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1757
+ function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect, x, y) {
1661
1758
  // let layer = scene.layers.get(layerID);
1662
1759
  // let cx = allItemRect.cur.pos.x;
1663
1760
  // let cy = allItemRect.cur.pos.y;
@@ -1772,10 +1869,10 @@ export function calcSnap3(allItemRect, allItemSnap, allLineRects, allLineSnap, a
1772
1869
  rotRad: rotRad
1773
1870
  };
1774
1871
  }
1775
- export function getAllCurSnap(allLineRects, x, y, curItemRect) {
1872
+ function getAllCurSnap(allLineRects, x, y, curItemRect) {
1776
1873
  if (!curItemRect) return;
1777
1874
  var allCurSnap = [];
1778
- var thick = LINE_THICKNESS / 2;
1875
+ var thick = _constants.LINE_THICKNESS / 2;
1779
1876
  allLineRects.forEach(function (linerect) {
1780
1877
  //allLineRects:left, right, top, bottom line
1781
1878
  var p0 = clone_point(linerect.rect[2]); //point 2(x, y) inside of line
@@ -1810,15 +1907,15 @@ export function getAllCurSnap(allLineRects, x, y, curItemRect) {
1810
1907
  });
1811
1908
  return allCurSnap;
1812
1909
  }
1813
- export function clone_point(pt) {
1910
+ function clone_point(pt) {
1814
1911
  return point(pt.x, pt.y);
1815
1912
  }
1816
- export function dotprod(v0, v1) {
1913
+ function dotprod(v0, v1) {
1817
1914
  return v0.x * v1.x + v0.y * v1.y;
1818
1915
  }
1819
1916
 
1820
1917
  //////////
1821
- export function validInterSect(rect, val) {
1918
+ function validInterSect(rect, val) {
1822
1919
  var curitem = getCalcRectFromItem(val);
1823
1920
  var datas = [];
1824
1921
  rect.forEach(function (line) {
@@ -1848,7 +1945,7 @@ var lineRect = function lineRect(layer) {
1848
1945
  });
1849
1946
  return rect;
1850
1947
  };
1851
- export function getAllHoleRect(scene, val) {
1948
+ function getAllHoleRect(scene, val) {
1852
1949
  var layerID = scene.selectedLayer;
1853
1950
  var layer = scene.layers.get(layerID);
1854
1951
  var selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
@@ -1892,7 +1989,7 @@ export function getAllHoleRect(scene, val) {
1892
1989
  y: vertice1.y
1893
1990
  };
1894
1991
  var rotation = Math.atan2(point1.y - point0.y, point1.x - point0.x);
1895
- var rectInfo = getCalcRectFromLine(point0.x, point0.y, point1.x, point1.y, LINE_THICKNESS, layer);
1992
+ var rectInfo = getCalcRectFromLine(point0.x, point0.y, point1.x, point1.y, _constants.LINE_THICKNESS, layer);
1896
1993
  var vN = point(rectInfo.rect[0].x - rectInfo.rect[3].x, rectInfo.rect[0].y - rectInfo.rect[3].y);
1897
1994
  var lenN = Math.sqrt(vN.x * vN.x + vN.y * vN.y);
1898
1995
  vN.x /= lenN;
@@ -1914,7 +2011,7 @@ export function getAllHoleRect(scene, val) {
1914
2011
  };
1915
2012
  var hole_rect = getCalcRectFromItem(tval);
1916
2013
  if (intersectRect(itemRect.rect, hole_rect.rect)) {
1917
- if (tdepth > itemRect.size.depth && itemRect.layoutpos !== WALL_CABINET_LAYOUTPOS) {
2014
+ if (tdepth > itemRect.size.depth && itemRect.layoutpos !== _constants.WALL_CABINET_LAYOUTPOS) {
1918
2015
  var dist = itemRect.size.height / 2 + theight / 2;
1919
2016
  var snap = [];
1920
2017
  var p0 = {
@@ -1947,7 +2044,7 @@ export function getAllHoleRect(scene, val) {
1947
2044
  snap: null
1948
2045
  };
1949
2046
  }
1950
- export function getHoleItems(layer) {
2047
+ function getHoleItems(layer) {
1951
2048
  var holeItems = [];
1952
2049
  layer.holes.map(function (hole) {
1953
2050
  var width = hole.properties.getIn(['width', 'length']);
@@ -1961,18 +2058,18 @@ export function getHoleItems(layer) {
1961
2058
  });
1962
2059
  return holeItems;
1963
2060
  }
1964
- export function needSnap(curItem, othItem) {
2061
+ function needSnap(curItem, othItem) {
1965
2062
  var blSnap = false;
1966
2063
  if (curItem == undefined || curItem == null) return false;
1967
2064
  var altitude = curItem.selectedItem.properties.get('altitude');
1968
- var heightFromFloor = convert(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2065
+ var heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
1969
2066
  var height = curItem.cat.info.sizeinfo.height;
1970
2067
  var currentItem = {
1971
2068
  heightFromFloor: heightFromFloor,
1972
2069
  height: height
1973
2070
  };
1974
2071
  altitude = othItem.item.properties.get('altitude');
1975
- heightFromFloor = convert(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2072
+ heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
1976
2073
  height = othItem.cat && othItem.cat.info.sizeinfo.height;
1977
2074
  var otherItem = {
1978
2075
  heightFromFloor: heightFromFloor,
@@ -1990,7 +2087,7 @@ export function needSnap(curItem, othItem) {
1990
2087
  }
1991
2088
  return blSnap;
1992
2089
  }
1993
- export function isFrontWall(v0, v1) {
2090
+ function isFrontWall(v0, v1) {
1994
2091
  var x1 = v0.x,
1995
2092
  y1 = v0.y;
1996
2093
  var x2 = v1.x,
@@ -1998,7 +2095,7 @@ export function isFrontWall(v0, v1) {
1998
2095
  var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
1999
2096
  return almostEqual(y1, y2) && x1 < x2 || -Math.PI / 2 < alpha && alpha < Math.PI / 2;
2000
2097
  }
2001
- export function isBackWall(v0, v1) {
2098
+ function isBackWall(v0, v1) {
2002
2099
  var x1 = v0.x,
2003
2100
  y1 = v0.y;
2004
2101
  var x2 = v1.x,
@@ -2006,7 +2103,7 @@ export function isBackWall(v0, v1) {
2006
2103
  var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2007
2104
  return almostEqual(y1, y2) && x1 > x2 || -Math.PI / 2 > alpha || alpha > Math.PI / 2;
2008
2105
  }
2009
- export function isLeftWall(v0, v1) {
2106
+ function isLeftWall(v0, v1) {
2010
2107
  var x1 = v0.x,
2011
2108
  y1 = v0.y;
2012
2109
  var x2 = v1.x,
@@ -2014,7 +2111,7 @@ export function isLeftWall(v0, v1) {
2014
2111
  var alpha = angleBetweenTwoPoints(x1, y1, x2, y2);
2015
2112
  return almostEqual(x1, x2) && y1 < y2 || Math.PI > alpha && alpha > 0;
2016
2113
  }
2017
- export function isRightWall(v0, v1) {
2114
+ function isRightWall(v0, v1) {
2018
2115
  var x1 = v0.x,
2019
2116
  y1 = v0.y;
2020
2117
  var x2 = v1.x,
@@ -2047,7 +2144,7 @@ export function isRightWall(v0, v1) {
2047
2144
  //////// test - end /////////////
2048
2145
 
2049
2146
  */
2050
- export function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2147
+ function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2051
2148
  // let res1 = relationshipOfTwoOverlappedLines1(srcLine, destLine);
2052
2149
  var res2 = relationshipOfTwoOverlappedLines2(srcLine, destLine);
2053
2150
  // if (res1.result !== 0 || res2.result !== 0) {
@@ -2059,7 +2156,7 @@ export function relationshipOfTwoOverlappedLines(srcLine, destLine) {
2059
2156
  // }
2060
2157
  return res2;
2061
2158
  }
2062
- export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2159
+ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2063
2160
  var p1 = {
2064
2161
  x: srcLine.x1,
2065
2162
  y: srcLine.y1
@@ -2087,10 +2184,10 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2087
2184
  var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
2088
2185
  var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
2089
2186
  var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
2090
- if (fAbs(denom) <= EPSILON) {
2091
- if (fAbs(numA) <= EPSILON && fAbs(numB) <= EPSILON) {
2187
+ if ((0, _math.fAbs)(denom) <= _constants.EPSILON) {
2188
+ if ((0, _math.fAbs)(numA) <= _constants.EPSILON && (0, _math.fAbs)(numB) <= _constants.EPSILON) {
2092
2189
  var comparator = function comparator(pa, pb) {
2093
- return fAbs(pa.x - pb.x) <= EPSILON ? pa.y - pb.y : pa.x - pb.x;
2190
+ return (0, _math.fAbs)(pa.x - pb.x) <= _constants.EPSILON ? pa.y - pb.y : pa.x - pb.x;
2094
2191
  };
2095
2192
  var line0 = [p1, p2].sort(comparator);
2096
2193
  var line1 = [p3, p4].sort(comparator);
@@ -2099,7 +2196,7 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2099
2196
  var _sort3 = [line0, line1].sort(function (lineA, lineB) {
2100
2197
  return comparator(lineA[0], lineB[0]);
2101
2198
  }),
2102
- _sort4 = _slicedToArray(_sort3, 2),
2199
+ _sort4 = (0, _slicedToArray2["default"])(_sort3, 2),
2103
2200
  lineSX = _sort4[0],
2104
2201
  lineDX = _sort4[1];
2105
2202
  var isReversedSrcLineIdx = false;
@@ -2107,17 +2204,17 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2107
2204
  var compare0 = comparator(lineSX[0], lineDX[0]);
2108
2205
  var compare1 = comparator(lineSX[1], lineDX[0]);
2109
2206
  var compare2 = comparator(lineSX[1], lineDX[1]);
2110
- if (MathUtils.fAbs(compare0) < EPSILON && MathUtils.fAbs(compare2) < EPSILON) {
2207
+ if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && _export.MathUtils.fAbs(compare2) < _constants.EPSILON) {
2111
2208
  return {
2112
- result: OVERLAP_SAME
2209
+ result: _constants.OVERLAP_SAME
2113
2210
  };
2114
- } else if (MathUtils.fAbs(compare0) < EPSILON && compare2 < 0) {
2211
+ } else if (_export.MathUtils.fAbs(compare0) < _constants.EPSILON && compare2 < 0) {
2115
2212
  // lineDX includes lineSX
2116
2213
  if (!isReversedSrcLineIdx) {
2117
2214
  // dest === lineDX : dest includes src
2118
2215
  // return OVERLAP_INCLUDED; // lineSX[1] - lineDX[1]
2119
2216
  return {
2120
- result: OVERLAP_INCLUDED
2217
+ result: _constants.OVERLAP_INCLUDED
2121
2218
  };
2122
2219
  }
2123
2220
  // else {
@@ -2134,10 +2231,10 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2134
2231
  // };
2135
2232
  // }
2136
2233
  }
2137
- if (MathUtils.fAbs(compare1) < EPSILON) {
2234
+ if (_export.MathUtils.fAbs(compare1) < _constants.EPSILON) {
2138
2235
  // return OVERLAP_LINK; // lineSX[1]
2139
2236
  return {
2140
- result: OVERLAP_LINK,
2237
+ result: _constants.OVERLAP_LINK,
2141
2238
  linkedLine: {
2142
2239
  x1: isReversedSrcLineDirection ? lineDX[1].x : lineSX[0].x,
2143
2240
  y1: isReversedSrcLineDirection ? lineDX[1].y : lineSX[0].y,
@@ -2147,16 +2244,16 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2147
2244
  };
2148
2245
  } else if (compare1 < 0) {
2149
2246
  return {
2150
- result: OVERLAP_NONE
2247
+ result: _constants.OVERLAP_NONE
2151
2248
  };
2152
2249
  } else {
2153
- if (MathUtils.fAbs(compare2) < EPSILON || compare2 > 0) {
2250
+ if (_export.MathUtils.fAbs(compare2) < _constants.EPSILON || compare2 > 0) {
2154
2251
  // lineSX includes lineDX
2155
2252
  if (isReversedSrcLineIdx) {
2156
2253
  // dest === lineSX : dest includes src
2157
2254
  // return OVERLAP_INCLUDED; // lineDX[0] - lineDX[1]
2158
2255
  return {
2159
- result: OVERLAP_INCLUDED
2256
+ result: _constants.OVERLAP_INCLUDED
2160
2257
  };
2161
2258
  } else {
2162
2259
  // dest === lineDX : src includes dest
@@ -2175,7 +2272,7 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2175
2272
  y2: isReversedSrcLineDirection ? lineDX[1].y : lineSX[1].y
2176
2273
  });
2177
2274
  return {
2178
- result: OVERLAP_SOME,
2275
+ result: _constants.OVERLAP_SOME,
2179
2276
  trimmedSegs: trimmedSegs
2180
2277
  };
2181
2278
  }
@@ -2196,7 +2293,7 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2196
2293
  y2: isReversedSrcLineDirection ? lineSX[1].y : lineDX[1].y
2197
2294
  });
2198
2295
  return {
2199
- result: OVERLAP_SOME,
2296
+ result: _constants.OVERLAP_SOME,
2200
2297
  trimmedSegs: _trimmedSegs
2201
2298
  };
2202
2299
  }
@@ -2204,46 +2301,46 @@ export function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
2204
2301
  }
2205
2302
  }
2206
2303
  return {
2207
- result: OVERLAP_NONE
2304
+ result: _constants.OVERLAP_NONE
2208
2305
  };
2209
2306
  }
2210
- export function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2307
+ function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2211
2308
  var INFINITY = 1000000;
2212
2309
  var ZERO_DELTA = 0.01;
2213
2310
  // geometric equation of srcLine
2214
2311
  var dx1 = srcLine.x2 - srcLine.x1;
2215
- dx1 = MathUtils.fAbs(dx1) < ZERO_DELTA ? 0 : dx1;
2312
+ dx1 = _export.MathUtils.fAbs(dx1) < ZERO_DELTA ? 0 : dx1;
2216
2313
  var dy1 = srcLine.y2 - srcLine.y1;
2217
- dy1 = MathUtils.fAbs(dy1) < ZERO_DELTA ? 0 : dy1;
2314
+ dy1 = _export.MathUtils.fAbs(dy1) < ZERO_DELTA ? 0 : dy1;
2218
2315
  var a1 = dx1 === 0 ? INFINITY : dy1 / dx1;
2219
2316
  var b1 = a1 === INFINITY ? srcLine.x1 : srcLine.y1 - a1 * srcLine.x1;
2220
2317
  // geometric equation of destLine
2221
2318
  var dx2 = destLine.x2 - destLine.x1;
2222
- dx2 = MathUtils.fAbs(dx2) < ZERO_DELTA ? 0 : dx2;
2319
+ dx2 = _export.MathUtils.fAbs(dx2) < ZERO_DELTA ? 0 : dx2;
2223
2320
  var dy2 = destLine.y2 - destLine.y1;
2224
- dy2 = MathUtils.fAbs(dy2) < ZERO_DELTA ? 0 : dy2;
2321
+ dy2 = _export.MathUtils.fAbs(dy2) < ZERO_DELTA ? 0 : dy2;
2225
2322
  var a2 = dx2 === 0 ? INFINITY : dy2 / dx2;
2226
2323
  var b2 = a2 === INFINITY ? destLine.x1 : destLine.y1 - a2 * destLine.x1;
2227
- if (MathUtils.fAbs(MathUtils.fAbs(a1) - MathUtils.fAbs(a2)) > ZERO_DELTA)
2324
+ if (_export.MathUtils.fAbs(_export.MathUtils.fAbs(a1) - _export.MathUtils.fAbs(a2)) > ZERO_DELTA)
2228
2325
  // two lines are not parallel
2229
2326
  return {
2230
- result: OVERLAP_NONE
2327
+ result: _constants.OVERLAP_NONE
2231
2328
  };
2232
- if (MathUtils.fAbs(MathUtils.fAbs(b1) - MathUtils.fAbs(b2)) > ZERO_DELTA)
2329
+ if (_export.MathUtils.fAbs(_export.MathUtils.fAbs(b1) - _export.MathUtils.fAbs(b2)) > ZERO_DELTA)
2233
2330
  // two lines are parallel but not overlap
2234
2331
  return {
2235
- result: OVERLAP_NONE
2332
+ result: _constants.OVERLAP_NONE
2236
2333
  };
2237
2334
 
2238
2335
  // parametric equation of destLine
2239
- var sk1 = dx1 === 0 ? INFINITY : MathUtils.toFixedFloat((destLine.x1 - srcLine.x1) / dx1, 3);
2240
- var sk2 = dy1 === 0 ? INFINITY : MathUtils.toFixedFloat((destLine.y1 - srcLine.y1) / dy1, 3);
2241
- var ek1 = dx1 === 0 ? INFINITY : MathUtils.toFixedFloat((destLine.x2 - srcLine.x1) / dx1, 3);
2242
- var ek2 = dy1 === 0 ? INFINITY : MathUtils.toFixedFloat((destLine.y2 - srcLine.y1) / dy1, 3);
2336
+ var sk1 = dx1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.x1 - srcLine.x1) / dx1, 3);
2337
+ var sk2 = dy1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.y1 - srcLine.y1) / dy1, 3);
2338
+ var ek1 = dx1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.x2 - srcLine.x1) / dx1, 3);
2339
+ var ek2 = dy1 === 0 ? INFINITY : _export.MathUtils.toFixedFloat((destLine.y2 - srcLine.y1) / dy1, 3);
2243
2340
  if (sk1 !== INFINITY && sk2 !== INFINITY && ek1 !== INFINITY && ek2 !== INFINITY && (sk1 !== sk2 || ek1 !== ek2))
2244
2341
  // destLine does not overlap with srcLine
2245
2342
  return {
2246
- result: OVERLAP_NONE
2343
+ result: _constants.OVERLAP_NONE
2247
2344
  };
2248
2345
 
2249
2346
  // parameter of destLine on the start and end points
@@ -2257,17 +2354,17 @@ export function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2257
2354
  if (sk < 0 && ek < 0 || sk > 1 && ek > 1)
2258
2355
  // not overlap
2259
2356
  return {
2260
- result: OVERLAP_NONE
2357
+ result: _constants.OVERLAP_NONE
2261
2358
  };
2262
2359
  if (sk === 0 && ek === 1 || sk === 1 && ek === 0)
2263
2360
  // same lines
2264
2361
  return {
2265
- result: OVERLAP_SAME
2362
+ result: _constants.OVERLAP_SAME
2266
2363
  };
2267
2364
  if (sk <= 0 && ek >= 1 || sk >= 1 && ek <= 0)
2268
2365
  // destLine includes srcLine
2269
2366
  return {
2270
- result: OVERLAP_INCLUDED
2367
+ result: _constants.OVERLAP_INCLUDED
2271
2368
  };
2272
2369
  if (sk === 0 && ek < 0 || sk === 1 && ek > 1 || ek === 0 && sk < 0 || ek === 1 && sk > 1) {
2273
2370
  // linked with one common point
@@ -2310,14 +2407,14 @@ export function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2310
2407
  };
2311
2408
  }
2312
2409
  return {
2313
- result: OVERLAP_LINK,
2410
+ result: _constants.OVERLAP_LINK,
2314
2411
  linkedLine: linkedLine
2315
2412
  };
2316
2413
  }
2317
2414
  var trimmedSegment1 = null;
2318
2415
  var trimmedSegment2 = null;
2319
2416
  var ret = {
2320
- result: OVERLAP_SOME,
2417
+ result: _constants.OVERLAP_SOME,
2321
2418
  trimmedSegs: []
2322
2419
  };
2323
2420
  if (0 <= sk && sk <= 1 && 0 <= ek && ek <= 1) {
@@ -2403,7 +2500,7 @@ export function relationshipOfTwoOverlappedLines1(srcLine, destLine) {
2403
2500
  * @param {Array} points //points of polygon
2404
2501
  * @returns {Array} [centroid.x, centroid.y]
2405
2502
  */
2406
- export function getCentroidOfPolygon(points) {
2503
+ function getCentroidOfPolygon(points) {
2407
2504
  var center = points.reduce(function (x, y) {
2408
2505
  return [x[0] + y[0] / points.length, x[1] + y[1] / points.length];
2409
2506
  }, [0, 0]);