kitchen-simulator 1.1.1-test.70 → 1.1.1-test.71

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 +2 -8
  2. package/es/AppContext.js +3 -8
  3. package/es/KitchenConfigurator.js +70 -77
  4. package/es/KitchenConfiguratorApp.js +98 -105
  5. package/es/actions/area-actions.js +5 -10
  6. package/es/actions/export.js +12 -27
  7. package/es/actions/groups-actions.js +27 -43
  8. package/es/actions/holes-actions.js +34 -53
  9. package/es/actions/items-actions.js +94 -143
  10. package/es/actions/lines-actions.js +21 -34
  11. package/es/actions/project-actions.js +94 -143
  12. package/es/actions/scene-actions.js +11 -19
  13. package/es/actions/vertices-actions.js +7 -13
  14. package/es/actions/viewer2d-actions.js +21 -34
  15. package/es/actions/viewer3d-actions.js +9 -16
  16. package/es/catalog/areas/area/planner-element.js +2 -7
  17. package/es/catalog/catalog.js +15 -19
  18. package/es/catalog/factories/area-factory-3d.js +22 -29
  19. package/es/catalog/factories/area-factory.js +11 -18
  20. package/es/catalog/factories/export.js +6 -12
  21. package/es/catalog/factories/wall-factory-3d.js +31 -39
  22. package/es/catalog/factories/wall-factory.js +21 -29
  23. package/es/catalog/holes/door-closet/planner-element.js +15 -22
  24. package/es/catalog/holes/door-double/planner-element.js +15 -22
  25. package/es/catalog/holes/door-exterior/planner-element.js +16 -23
  26. package/es/catalog/holes/door-interior/planner-element.js +16 -23
  27. package/es/catalog/holes/door-panic/planner-element.js +7 -14
  28. package/es/catalog/holes/door-panic-double/planner-element.js +15 -22
  29. package/es/catalog/holes/door-sliding/planner-element.js +16 -23
  30. package/es/catalog/holes/doorway-framed/planner-element.js +11 -18
  31. package/es/catalog/holes/doorway-frameless/planner-element.js +7 -14
  32. package/es/catalog/holes/export.js +13 -31
  33. package/es/catalog/holes/window-clear/planner-element.js +10 -17
  34. package/es/catalog/holes/window-cross/planner-element.js +10 -17
  35. package/es/catalog/holes/window-double-hung/planner-element.js +10 -17
  36. package/es/catalog/holes/window-vertical/planner-element.js +10 -17
  37. package/es/catalog/lines/wall/planner-element.js +2 -7
  38. package/es/catalog/molding/molding-dcm/planner-element.js +5 -12
  39. package/es/catalog/molding/molding-fbm/planner-element.js +5 -12
  40. package/es/catalog/molding/molding-lrm/planner-element.js +5 -12
  41. package/es/catalog/properties/export.js +20 -33
  42. package/es/catalog/properties/property-checkbox.js +24 -29
  43. package/es/catalog/properties/property-color.js +16 -21
  44. package/es/catalog/properties/property-enum.js +24 -29
  45. package/es/catalog/properties/property-hidden.js +9 -14
  46. package/es/catalog/properties/property-lenght-measure.js +38 -43
  47. package/es/catalog/properties/property-length-measure.js +36 -41
  48. package/es/catalog/properties/property-length-measure_hole.js +38 -43
  49. package/es/catalog/properties/property-number.js +17 -22
  50. package/es/catalog/properties/property-read-only.js +16 -21
  51. package/es/catalog/properties/property-string.js +16 -21
  52. package/es/catalog/properties/property-toggle.js +16 -21
  53. package/es/catalog/properties/shared-property-style.js +1 -5
  54. package/es/catalog/utils/FuseUtils.js +8 -13
  55. package/es/catalog/utils/exporter.js +8 -13
  56. package/es/catalog/utils/geom-utils.js +13 -27
  57. package/es/catalog/utils/item-loader.js +84 -95
  58. package/es/catalog/utils/load-obj.js +20 -26
  59. package/es/catalog/utils/mtl-loader.js +3 -6
  60. package/es/catalog/utils/obj-loader.js +3 -6
  61. package/es/class/FuseUtils.js +8 -13
  62. package/es/class/area.js +22 -26
  63. package/es/class/export.js +23 -38
  64. package/es/class/group.js +53 -57
  65. package/es/class/guide.js +15 -19
  66. package/es/class/hole.js +83 -87
  67. package/es/class/item.js +141 -145
  68. package/es/class/layer.js +59 -63
  69. package/es/class/line.js +135 -141
  70. package/es/class/project.js +90 -96
  71. package/es/class/vertex.js +29 -33
  72. package/es/components/content.js +19 -26
  73. package/es/components/disclaimer/disclaimer.js +10 -16
  74. package/es/components/export.js +8 -15
  75. package/es/components/style/button.js +23 -29
  76. package/es/components/style/cancel-button.js +7 -12
  77. package/es/components/style/content-container.js +9 -14
  78. package/es/components/style/content-title.js +11 -18
  79. package/es/components/style/delete-button.js +8 -15
  80. package/es/components/style/export.js +30 -48
  81. package/es/components/style/form-block.js +8 -13
  82. package/es/components/style/form-color-input.js +7 -12
  83. package/es/components/style/form-label.js +8 -13
  84. package/es/components/style/form-number-input.js +41 -47
  85. package/es/components/style/form-number-input_2.js +36 -42
  86. package/es/components/style/form-select.js +17 -22
  87. package/es/components/style/form-slider.js +10 -15
  88. package/es/components/style/form-submit-button.js +8 -15
  89. package/es/components/style/form-text-input.js +26 -32
  90. package/es/components/viewer2d/area.js +17 -22
  91. package/es/components/viewer2d/export.js +30 -48
  92. package/es/components/viewer2d/grids/grid-horizontal-streak.js +10 -15
  93. package/es/components/viewer2d/grids/grid-streak.js +10 -15
  94. package/es/components/viewer2d/grids/grid-vertical-streak.js +10 -15
  95. package/es/components/viewer2d/grids/grids.js +10 -17
  96. package/es/components/viewer2d/group.js +15 -22
  97. package/es/components/viewer2d/item.js +61 -68
  98. package/es/components/viewer2d/layer.js +23 -28
  99. package/es/components/viewer2d/line.js +101 -109
  100. package/es/components/viewer2d/ruler.js +22 -27
  101. package/es/components/viewer2d/rulerDist.js +21 -26
  102. package/es/components/viewer2d/rulerX.js +39 -45
  103. package/es/components/viewer2d/rulerY.js +37 -43
  104. package/es/components/viewer2d/scene.js +30 -36
  105. package/es/components/viewer2d/snap.js +13 -20
  106. package/es/components/viewer2d/state.js +18 -25
  107. package/es/components/viewer2d/utils.js +24 -35
  108. package/es/components/viewer2d/vertex.js +8 -15
  109. package/es/components/viewer2d/viewer2d.js +153 -161
  110. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +17 -21
  111. package/es/components/viewer3d/dcm.js +1 -5
  112. package/es/components/viewer3d/fbm.js +1 -5
  113. package/es/components/viewer3d/front3D.js +12 -19
  114. package/es/components/viewer3d/grid-creator.js +8 -15
  115. package/es/components/viewer3d/grids/grid-horizontal-streak.js +6 -12
  116. package/es/components/viewer3d/grids/grid-streak.js +5 -11
  117. package/es/components/viewer3d/grids/grid-vertical-streak.js +6 -12
  118. package/es/components/viewer3d/libs/first-person-controls.js +2 -7
  119. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1 -5
  120. package/es/components/viewer3d/libs/mtl-loader.js +1 -5
  121. package/es/components/viewer3d/libs/obj-loader.js +1 -5
  122. package/es/components/viewer3d/libs/orbit-controls.js +2 -6
  123. package/es/components/viewer3d/libs/pointer-lock-controls.js +2 -6
  124. package/es/components/viewer3d/lrm.js +1 -5
  125. package/es/components/viewer3d/model.js +1 -5
  126. package/es/components/viewer3d/pointer-lock-navigation.js +3 -8
  127. package/es/components/viewer3d/ruler-utils/itemRect.js +18 -23
  128. package/es/components/viewer3d/ruler-utils/layer3D.js +59 -64
  129. package/es/components/viewer3d/ruler-utils/ruler3D.js +39 -44
  130. package/es/components/viewer3d/ruler-utils/scene3D.js +9 -15
  131. package/es/components/viewer3d/ruler-utils/state3D.js +4 -9
  132. package/es/components/viewer3d/scene-creator.js +191 -224
  133. package/es/components/viewer3d/three-memory-cleaner.js +3 -10
  134. package/es/components/viewer3d/viewer3d-first-person.js +40 -44
  135. package/es/components/viewer3d/viewer3d.js +196 -200
  136. package/es/constants.js +349 -356
  137. package/es/index.js +7 -13
  138. package/es/models.js +177 -182
  139. package/es/plugins/SVGLoader.js +48 -51
  140. package/es/plugins/autosave.js +3 -7
  141. package/es/plugins/console-debugger.js +5 -10
  142. package/es/plugins/export.js +8 -15
  143. package/es/plugins/keyboard.js +29 -33
  144. package/es/reducers/areas-reducer.js +7 -11
  145. package/es/reducers/export.js +24 -39
  146. package/es/reducers/groups-reducer.js +31 -35
  147. package/es/reducers/holes-reducer.js +43 -47
  148. package/es/reducers/items-reducer.js +106 -110
  149. package/es/reducers/lines-reducer.js +28 -32
  150. package/es/reducers/project-reducer.js +105 -109
  151. package/es/reducers/reducer.js +16 -21
  152. package/es/reducers/scene-reducer.js +15 -19
  153. package/es/reducers/user-reducer.js +5 -9
  154. package/es/reducers/vertices-reducer.js +11 -15
  155. package/es/reducers/viewer2d-reducer.js +18 -22
  156. package/es/reducers/viewer3d-reducer.js +16 -20
  157. package/es/shared-style.js +10 -14
  158. package/es/styles/export.js +3 -9
  159. package/es/translator/en.js +1 -5
  160. package/es/translator/it.js +1 -5
  161. package/es/translator/ru.js +1 -5
  162. package/es/translator/translator.js +13 -17
  163. package/es/utils/browser.js +2 -7
  164. package/es/utils/convert-units-lite.js +1 -5
  165. package/es/utils/email-validator.js +1 -5
  166. package/es/utils/export.js +15 -32
  167. package/es/utils/geometry.js +181 -276
  168. package/es/utils/get-edges-of-subgraphs.js +2 -7
  169. package/es/utils/graph-cycles.js +8 -9
  170. package/es/utils/graph-inner-cycles.js +10 -16
  171. package/es/utils/graph.js +9 -15
  172. package/es/utils/helper.js +39 -61
  173. package/es/utils/history.js +8 -13
  174. package/es/utils/id-broker.js +8 -13
  175. package/es/utils/logger.js +1 -5
  176. package/es/utils/math.js +5 -10
  177. package/es/utils/molding.js +119 -142
  178. package/es/utils/name-generator.js +7 -11
  179. package/es/utils/objects-utils.js +7 -17
  180. package/es/utils/phone-validator.js +1 -5
  181. package/es/utils/process-black-list.js +3 -8
  182. package/es/utils/react-if.js +6 -10
  183. package/es/utils/snap-scene.js +27 -32
  184. package/es/utils/snap.js +45 -57
  185. package/es/utils/summarizeCart.js +1 -5
  186. package/es/utils/threeCSG.es6.js +13 -20
  187. package/es/version.js +1 -5
  188. package/package.json +1 -1
@@ -1,28 +1,21 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- exports.__esModule = true;
6
- exports["default"] = void 0;
7
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
10
- var _immutable = require("immutable");
11
- var _constants = _interopRequireWildcard(require("../constants"));
12
- var constants = _constants;
13
- var _models = require("../models");
14
- var _export = require("../utils/export");
15
- var _export2 = require("../class/export");
16
- var viewer2DActions = _interopRequireWildcard(require("../actions/viewer2d-actions"));
17
- var _helper = require("../utils/helper");
18
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
19
4
  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; }
20
- 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; }
21
- var Project = exports["default"] = /*#__PURE__*/function () {
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; }
6
+ import { List, Map } from 'immutable';
7
+ import * as constants from "../constants";
8
+ import { ARRAY_3D_MODES, END_DRAWING_LINE, MODE_CONFIGURING_PROJECT, MODE_DRAWING_HOLE, MODE_DRAWING_ITEM, MODE_DRAWING_ITEM_3D, MODE_DRAWING_LINE, MODE_IDLE, MODE_IDLE_3D, MODE_VIEWING_CATALOG, MODE_WAITING_DRAWING_LINE } from "../constants";
9
+ import { Catalog, Scene, State } from "../models";
10
+ import { GeometryUtils, history } from "../utils/export";
11
+ import { Area, Group, Hole, HorizontalGuide, Item, Layer, Line, VerticalGuide } from "../class/export";
12
+ import * as viewer2DActions from "../actions/viewer2d-actions";
13
+ import { isEmpty } from "../utils/helper";
14
+ var Project = /*#__PURE__*/function () {
22
15
  function Project() {
23
- (0, _classCallCheck2["default"])(this, Project);
16
+ _classCallCheck(this, Project);
24
17
  }
25
- return (0, _createClass2["default"])(Project, null, [{
18
+ return _createClass(Project, null, [{
26
19
  key: "setAlterate",
27
20
  value: function setAlterate(state) {
28
21
  return {
@@ -32,7 +25,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
32
25
  }, {
33
26
  key: "openCatalog",
34
27
  value: function openCatalog(state) {
35
- state = this.setMode(state, _constants.MODE_VIEWING_CATALOG).updatedState;
28
+ state = this.setMode(state, MODE_VIEWING_CATALOG).updatedState;
36
29
  return {
37
30
  updatedState: state
38
31
  };
@@ -52,7 +45,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
52
45
  a: 0.99,
53
46
  d: 0.99
54
47
  });
55
- state = new _models.State({});
48
+ state = new State({});
56
49
  state = state.merge({
57
50
  doorStyle: doorStyle,
58
51
  oStyle: oStyle,
@@ -100,20 +93,20 @@ var Project = exports["default"] = /*#__PURE__*/function () {
100
93
  for (var x in json_items) {
101
94
  _loop(x);
102
95
  }
103
- var newScene = new _models.Scene(sceneJSON);
104
- state = new _models.State({
96
+ var newScene = new Scene(sceneJSON);
97
+ state = new State({
105
98
  scene: newScene.toJS(),
106
99
  catalog: state.catalog.toJS()
107
100
  });
108
101
  state = state.merge({
109
- sceneHistory: _export.history.historyPush(oldSceneHistory, oldScene)
102
+ sceneHistory: history.historyPush(oldSceneHistory, oldScene)
110
103
  });
111
104
  if (state.scene.title === '') {
112
105
  state = state.mergeIn(['scene', 'title'], oldScene.title);
113
106
  }
114
107
 
115
108
  //Validate item positions after loading project.
116
- state = _export2.Item.validateItemPositions(state, layerID).updatedState;
109
+ state = Item.validateItemPositions(state, layerID).updatedState;
117
110
 
118
111
  // get counterTop and floorStyle is after state created from sceneJSON
119
112
  if (state.getIn(['scene', 'layers', layerID, 'counterTop']).uri) {
@@ -171,8 +164,8 @@ var Project = exports["default"] = /*#__PURE__*/function () {
171
164
  oStyle: oStyle,
172
165
  viewer2D: _viewer2D
173
166
  });
174
- state = _export2.Item.setCounterTop(state, counterTop).updatedState;
175
- state = _export2.Area.setFloorStyles(state, floorStyle).updatedState;
167
+ state = Item.setCounterTop(state, counterTop).updatedState;
168
+ state = Area.setFloorStyles(state, floorStyle).updatedState;
176
169
  if (state.getIn(['scene', 'layers', layerID, 'doorStyle']) && !state.getIn(['scene', 'layers', layerID, 'doorStyle', 'install'])) {
177
170
  var layerDoorStyle = state.getIn(['scene', 'layers', layerID, 'doorStyle']);
178
171
  var install = '';
@@ -206,8 +199,8 @@ var Project = exports["default"] = /*#__PURE__*/function () {
206
199
  updatedState: state
207
200
  };
208
201
  }
209
- state = _export2.Layer.setPropertiesOnSelected(state, layerID, properties).updatedState;
210
- state = _export2.Layer.updateMovingState(state, false).updatedState;
202
+ state = Layer.setPropertiesOnSelected(state, layerID, properties).updatedState;
203
+ state = Layer.updateMovingState(state, false).updatedState;
211
204
  return {
212
205
  updatedState: state
213
206
  };
@@ -215,7 +208,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
215
208
  }, {
216
209
  key: "updateProperties",
217
210
  value: function updateProperties(state, layerID, properties) {
218
- state = _export2.Layer.updatePropertiesOnSelected(state, layerID, properties).updatedState;
211
+ state = Layer.updatePropertiesOnSelected(state, layerID, properties).updatedState;
219
212
  return {
220
213
  updatedState: state
221
214
  };
@@ -224,9 +217,9 @@ var Project = exports["default"] = /*#__PURE__*/function () {
224
217
  key: "setItemsAttributes",
225
218
  value: function setItemsAttributes(state, attributes) {
226
219
  //TODO apply only to items
227
- state = _export2.Layer.updateMovingState(state, false).updatedState;
220
+ state = Layer.updateMovingState(state, false).updatedState;
228
221
  state.getIn(['scene', 'layers']).forEach(function (layer) {
229
- state = _export2.Layer.setAttributesOnSelected(state, layer.id, attributes).updatedState;
222
+ state = Layer.setAttributesOnSelected(state, layer.id, attributes).updatedState;
230
223
  });
231
224
  return {
232
225
  updatedState: state
@@ -238,12 +231,12 @@ var Project = exports["default"] = /*#__PURE__*/function () {
238
231
  //TODO apply only to lines
239
232
  if (!isDirect) {
240
233
  state.getIn(['scene', 'layers']).forEach(function (layer) {
241
- state = _export2.Layer.setAttributesOnSelected(state, layer.id, attributes).updatedState;
234
+ state = Layer.setAttributesOnSelected(state, layer.id, attributes).updatedState;
242
235
  });
243
236
  } else if (isDirect && directData !== null) {
244
237
  var layerID = directData.layerID,
245
238
  lineID = directData.lineID;
246
- if (layerID && lineID) state = _export2.Line.setAttributes(state, layerID, lineID, attributes).updatedState;
239
+ if (layerID && lineID) state = Line.setAttributes(state, layerID, lineID, attributes).updatedState;
247
240
  }
248
241
  return {
249
242
  updatedState: state
@@ -254,7 +247,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
254
247
  value: function setHolesAttributes(state, attributes) {
255
248
  //TODO apply only to holes
256
249
  state.getIn(['scene', 'layers']).forEach(function (layer) {
257
- state = _export2.Layer.setAttributesOnSelected(state, layer.id, attributes).updatedState;
250
+ state = Layer.setAttributesOnSelected(state, layer.id, attributes).updatedState;
258
251
  });
259
252
  return {
260
253
  updatedState: state
@@ -265,19 +258,19 @@ var Project = exports["default"] = /*#__PURE__*/function () {
265
258
  value: function unselectAll(state) {
266
259
  state.getIn(['scene', 'layers']).forEach(function (_ref) {
267
260
  var layerID = _ref.id;
268
- state = _export2.Layer.unselectAll(state, layerID).updatedState;
261
+ state = Layer.unselectAll(state, layerID).updatedState;
269
262
  });
270
263
  state.getIn(['scene', 'groups']).forEach(function (group) {
271
- state = _export2.Group.unselect(state, group.get('id')).updatedState;
264
+ state = Group.unselect(state, group.get('id')).updatedState;
272
265
  });
273
266
  var mode = state.getIn(['mode']);
274
267
  if (mode === constants.MODE_DRAGGING_LINE || mode === constants.MODE_DRAGGING_VERTEX) {
275
268
  if (mode.includes('3D')) {
276
- state = state.setIn(['mode'], _constants.MODE_IDLE_3D);
277
- } else state = state.setIn(['mode'], _constants.MODE_IDLE);
269
+ state = state.setIn(['mode'], MODE_IDLE_3D);
270
+ } else state = state.setIn(['mode'], MODE_IDLE);
278
271
  state = state.merge({
279
272
  activeSnapElement: null,
280
- snapElements: new _immutable.List()
273
+ snapElements: new List()
281
274
  });
282
275
  }
283
276
  return {
@@ -290,7 +283,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
290
283
  if (value == null) {
291
284
  state.getIn(['scene', 'layers']).forEach(function (_ref2) {
292
285
  var layerID = _ref2.id;
293
- state = _export2.Layer.selectAll(state, layerID).updatedState;
286
+ state = Layer.selectAll(state, layerID).updatedState;
294
287
  });
295
288
  } else {
296
289
  var layerID = state.getIn(['scene', 'selectedLayer']);
@@ -331,33 +324,33 @@ var Project = exports["default"] = /*#__PURE__*/function () {
331
324
  var allVertices = state.getIn(['scene', 'layers', selectedLayer, 'vertices']).toJS();
332
325
  var selLines = state.getIn(['scene', 'layers', selectedLayer, 'selected', 'lines']).toJS();
333
326
  var lineID = selLines[0];
334
- var delLine = !(0, _helper.isEmpty)(lineID) && state.getIn(['scene', 'layers', selectedLayer, 'lines', lineID]).toJS();
327
+ var delLine = !isEmpty(lineID) && state.getIn(['scene', 'layers', selectedLayer, 'lines', lineID]).toJS();
335
328
  var allLines = state.getIn(['scene', 'layers', selectedLayer, 'lines']).toJS();
336
329
  var relatedLines = [];
337
- delLine && _export.GeometryUtils.getRelatedLines(relatedLines, delLine, allVertices, allLines);
330
+ delLine && GeometryUtils.getRelatedLines(relatedLines, delLine, allVertices, allLines);
338
331
  selectedLines.forEach(function (lineID) {
339
- state = _export2.Line.remove(state, selectedLayer, lineID).updatedState;
332
+ state = Line.remove(state, selectedLayer, lineID).updatedState;
340
333
  });
341
334
  selectedHoles.forEach(function (holeID) {
342
- state = _export2.Hole.remove(state, selectedLayer, holeID).updatedState;
335
+ state = Hole.remove(state, selectedLayer, holeID).updatedState;
343
336
  });
344
337
  selectedItems.forEach(function (itemID) {
345
- state = _export2.Item.remove(state, selectedLayer, itemID).updatedState;
338
+ state = Item.remove(state, selectedLayer, itemID).updatedState;
346
339
  });
347
- if (!(0, _helper.isEmpty)(relatedLines)) {
348
- state = state.setIn(['mode'], _constants.MODE_DRAWING_LINE);
340
+ if (!isEmpty(relatedLines)) {
341
+ state = state.setIn(['mode'], MODE_DRAWING_LINE);
349
342
  relatedLines.forEach(function (relLine, index) {
350
- state = _export2.Line.select(state, selectedLayer, relLine.id).updatedState;
351
- state = _export2.Line.applyWallChanges(state, _constants.END_DRAWING_LINE).updatedState;
343
+ state = Line.select(state, selectedLayer, relLine.id).updatedState;
344
+ state = Line.applyWallChanges(state, END_DRAWING_LINE).updatedState;
352
345
  });
353
346
  }
354
- state = _export2.Layer.unselectAll(state, selectedLayer).updatedState;
347
+ state = Layer.unselectAll(state, selectedLayer).updatedState;
355
348
  var mode = state.getIn(['mode']);
356
349
  if (mode.includes('DRAWING') || mode.includes('DRAGGING') || mode.includes('ROTATING')) {
357
350
  state = state.merge({
358
351
  activeSnapElement: null
359
352
  });
360
- if (mode.endsWith('3D')) state = state.setIn(['mode'], _constants.MODE_IDLE_3D);else state = state.setIn(['mode'], _constants.MODE_IDLE);
353
+ if (mode.endsWith('3D')) state = state.setIn(['mode'], MODE_IDLE_3D);else state = state.setIn(['mode'], MODE_IDLE);
361
354
  }
362
355
  return {
363
356
  updatedState: state
@@ -374,15 +367,15 @@ var Project = exports["default"] = /*#__PURE__*/function () {
374
367
  var forRedo = window.forRedo;
375
368
  window.forRedo = forRedo;
376
369
  if (state.scene === sceneHistory.last && sceneHistory.list.size > 1) {
377
- sceneHistory = _export.history.historyPop(sceneHistory);
370
+ sceneHistory = history.historyPop(sceneHistory);
378
371
  }
379
372
  forRedo.push(state.scene);
380
373
  var mode;
381
- if (_constants.ARRAY_3D_MODES.includes(state.mode)) mode = _constants.MODE_IDLE_3D;else mode = _constants.MODE_IDLE;
374
+ if (ARRAY_3D_MODES.includes(state.mode)) mode = MODE_IDLE_3D;else mode = MODE_IDLE;
382
375
  state = state.merge({
383
376
  mode: mode,
384
377
  scene: sceneHistory.last,
385
- sceneHistory: _export.history.historyPop(sceneHistory)
378
+ sceneHistory: history.historyPop(sceneHistory)
386
379
  });
387
380
  return {
388
381
  updatedState: state
@@ -397,11 +390,11 @@ var Project = exports["default"] = /*#__PURE__*/function () {
397
390
  };
398
391
  var scene = forRedo.pop();
399
392
  var mode;
400
- if (_constants.ARRAY_3D_MODES.includes(state.mode)) mode = _constants.MODE_IDLE_3D;else mode = _constants.MODE_IDLE;
393
+ if (ARRAY_3D_MODES.includes(state.mode)) mode = MODE_IDLE_3D;else mode = MODE_IDLE;
401
394
  state = state.merge({
402
395
  mode: mode,
403
396
  scene: scene,
404
- sceneHistory: _export.history.historyPush(state.sceneHistory, state.scene)
397
+ sceneHistory: history.historyPush(state.sceneHistory, state.scene)
405
398
  });
406
399
  window.forRedo = forRedo;
407
400
  return {
@@ -430,7 +423,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
430
423
  key: "recreate",
431
424
  value: function recreate(state) {
432
425
  if (state.getIn(['drawingSupport', 'type']) !== undefined) state = state.merge({
433
- mode: _constants.MODE_DRAWING_ITEM_3D,
426
+ mode: MODE_DRAWING_ITEM_3D,
434
427
  popup: true
435
428
  });
436
429
  return {
@@ -452,10 +445,10 @@ var Project = exports["default"] = /*#__PURE__*/function () {
452
445
  value: function shift2doff(state) {
453
446
  if (state.getIn(['drawingSupport', 'type']) !== undefined) {
454
447
  if (state.get('selectedElementsHistory')._tail.array[0].prototype === 'holes') state = state.merge({
455
- mode: _constants.MODE_DRAWING_HOLE,
448
+ mode: MODE_DRAWING_HOLE,
456
449
  popup: true
457
450
  });else state = state.merge({
458
- mode: _constants.MODE_DRAWING_ITEM,
451
+ mode: MODE_DRAWING_ITEM,
459
452
  popup: true
460
453
  });
461
454
  }
@@ -477,22 +470,22 @@ var Project = exports["default"] = /*#__PURE__*/function () {
477
470
  }
478
471
 
479
472
  // ESC event doesn't need when mode = MODE_IDLE || MODE_IDLE_3D
480
- if (state.mode == _constants.MODE_IDLE_3D || state.mode == _constants.MODE_IDLE) {
473
+ if (state.mode == MODE_IDLE_3D || state.mode == MODE_IDLE) {
481
474
  return {
482
475
  updatedState: state
483
476
  };
484
477
  }
485
478
  var mode;
486
- if (state.mode == _constants.MODE_DRAWING_ITEM_3D) {
487
- mode = _constants.MODE_IDLE_3D;
488
- if (state.drawingSupport.has('currentID')) state = _export2.Layer.removeElement(state, state.scene.selectedLayer, 'items', state.drawingSupport.get('currentID')).updatedState;
479
+ if (state.mode == MODE_DRAWING_ITEM_3D) {
480
+ mode = MODE_IDLE_3D;
481
+ if (state.drawingSupport.has('currentID')) state = Layer.removeElement(state, state.scene.selectedLayer, 'items', state.drawingSupport.get('currentID')).updatedState;
489
482
  state = state.merge({
490
483
  mode: mode,
491
- snapElements: new _immutable.List(),
484
+ snapElements: new List(),
492
485
  activeSnapElement: null,
493
- drawingSupport: new _immutable.Map(),
494
- draggingSupport: new _immutable.Map(),
495
- rotatingSupport: new _immutable.Map()
486
+ drawingSupport: new Map(),
487
+ draggingSupport: new Map(),
488
+ rotatingSupport: new Map()
496
489
  });
497
490
  return {
498
491
  updatedState: state
@@ -500,30 +493,30 @@ var Project = exports["default"] = /*#__PURE__*/function () {
500
493
  }
501
494
 
502
495
  // when Add Walls button clicked
503
- if (state.mode == _constants.MODE_WAITING_DRAWING_LINE) {
504
- mode = _constants.MODE_IDLE;
496
+ if (state.mode == MODE_WAITING_DRAWING_LINE) {
497
+ mode = MODE_IDLE;
505
498
  state = state.merge({
506
499
  mode: mode,
507
- snapElements: new _immutable.List(),
500
+ snapElements: new List(),
508
501
  activeSnapElement: null,
509
- drawingSupport: new _immutable.Map(),
510
- draggingSupport: new _immutable.Map(),
511
- rotatingSupport: new _immutable.Map()
502
+ drawingSupport: new Map(),
503
+ draggingSupport: new Map(),
504
+ rotatingSupport: new Map()
512
505
  });
513
506
  return {
514
507
  updatedState: state
515
508
  };
516
509
  }
517
- if (_constants.ARRAY_3D_MODES.includes(state.mode)) mode = _constants.MODE_IDLE_3D;else mode = _constants.MODE_IDLE;
510
+ if (ARRAY_3D_MODES.includes(state.mode)) mode = MODE_IDLE_3D;else mode = MODE_IDLE;
518
511
  state = state.merge({
519
512
  mode: mode,
520
513
  scene: sceneHistory.last,
521
- sceneHistory: _export.history.historyPush(sceneHistory, sceneHistory.last),
522
- snapElements: new _immutable.List(),
514
+ sceneHistory: history.historyPush(sceneHistory, sceneHistory.last),
515
+ snapElements: new List(),
523
516
  activeSnapElement: null,
524
- drawingSupport: new _immutable.Map(),
525
- draggingSupport: new _immutable.Map(),
526
- rotatingSupport: new _immutable.Map()
517
+ drawingSupport: new Map(),
518
+ draggingSupport: new Map(),
519
+ rotatingSupport: new Map()
527
520
  });
528
521
  return {
529
522
  updatedState: state
@@ -534,7 +527,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
534
527
  value: function removeDrawingSupport(state) {
535
528
  var sceneHistory = state.sceneHistory;
536
529
  var mode = state.mode;
537
- if (!sceneHistory.last && sceneHistory.list.isEmpty() || mode != _constants.MODE_DRAWING_ITEM_3D) {
530
+ if (!sceneHistory.last && sceneHistory.list.isEmpty() || mode != MODE_DRAWING_ITEM_3D) {
538
531
  return {
539
532
  updatedState: state
540
533
  };
@@ -542,8 +535,8 @@ var Project = exports["default"] = /*#__PURE__*/function () {
542
535
  state = this.unselectAll(state).updatedState;
543
536
  state = state.merge({
544
537
  scene: sceneHistory.last,
545
- sceneHistory: _export.history.historyPush(sceneHistory, sceneHistory.last),
546
- drawingSupport: new _immutable.Map()
538
+ sceneHistory: history.historyPush(sceneHistory, sceneHistory.last),
539
+ drawingSupport: new Map()
547
540
  });
548
541
  return {
549
542
  updatedState: state
@@ -554,7 +547,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
554
547
  value: function setProjectProperties(state, properties) {
555
548
  var scene = state.scene.merge(properties);
556
549
  state = state.merge({
557
- mode: _constants.MODE_IDLE,
550
+ mode: MODE_IDLE,
558
551
  scene: scene
559
552
  });
560
553
  return {
@@ -576,7 +569,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
576
569
  key: "openProjectConfigurator",
577
570
  value: function openProjectConfigurator(state) {
578
571
  state = state.merge({
579
- mode: _constants.MODE_CONFIGURING_PROJECT
572
+ mode: MODE_CONFIGURING_PROJECT
580
573
  });
581
574
  return {
582
575
  updatedState: state
@@ -586,7 +579,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
586
579
  key: "initCatalog",
587
580
  value: function initCatalog(state, catalog) {
588
581
  try {
589
- state = state.set('catalog', new _models.Catalog(catalog));
582
+ state = state.set('catalog', new Catalog(catalog));
590
583
  return {
591
584
  updatedState: state
592
585
  };
@@ -600,7 +593,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
600
593
  }, {
601
594
  key: "updateMouseCoord",
602
595
  value: function updateMouseCoord(state, coords) {
603
- state = state.set('mouse', new _immutable.Map(coords));
596
+ state = state.set('mouse', new Map(coords));
604
597
  return {
605
598
  updatedState: state
606
599
  };
@@ -652,7 +645,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
652
645
  updatedState: state
653
646
  };else {
654
647
  state = state.merge({
655
- mode: _constants.MODE_WAITING_DRAWING_LINE,
648
+ mode: MODE_WAITING_DRAWING_LINE,
656
649
  activeSnapElement: null
657
650
  });
658
651
  return {
@@ -718,7 +711,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
718
711
  }, {
719
712
  key: "addHorizontalGuide",
720
713
  value: function addHorizontalGuide(state, coordinate) {
721
- state = _export2.HorizontalGuide.create(state, coordinate).updatedState;
714
+ state = HorizontalGuide.create(state, coordinate).updatedState;
722
715
  return {
723
716
  updatedState: state
724
717
  };
@@ -726,7 +719,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
726
719
  }, {
727
720
  key: "addVerticalGuide",
728
721
  value: function addVerticalGuide(state, coordinate) {
729
- state = _export2.VerticalGuide.create(state, coordinate).updatedState;
722
+ state = VerticalGuide.create(state, coordinate).updatedState;
730
723
  return {
731
724
  updatedState: state
732
725
  };
@@ -742,7 +735,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
742
735
  }, {
743
736
  key: "removeHorizontalGuide",
744
737
  value: function removeHorizontalGuide(state, guideID) {
745
- state = _export2.HorizontalGuide.remove(state, guideID).updatedState;
738
+ state = HorizontalGuide.remove(state, guideID).updatedState;
746
739
  return {
747
740
  updatedState: state
748
741
  };
@@ -750,7 +743,7 @@ var Project = exports["default"] = /*#__PURE__*/function () {
750
743
  }, {
751
744
  key: "removeVerticalGuide",
752
745
  value: function removeVerticalGuide(state, guideID) {
753
- state = _export2.VerticalGuide.remove(state, guideID).updatedState;
746
+ state = VerticalGuide.remove(state, guideID).updatedState;
754
747
  return {
755
748
  updatedState: state
756
749
  };
@@ -792,4 +785,5 @@ var Project = exports["default"] = /*#__PURE__*/function () {
792
785
  };
793
786
  }
794
787
  }]);
795
- }();
788
+ }();
789
+ export { Project as default };
@@ -1,26 +1,21 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- exports.__esModule = true;
5
- exports["default"] = void 0;
6
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
7
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/classCallCheck"));
8
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createClass"));
9
- var _immutable = require("immutable");
10
- var _models = require("../models");
11
- var _export = require("../utils/export");
12
- var _constants = require("../constants");
13
- var _export2 = require("../class/export");
14
- var _helper = require("../utils/helper");
15
- var Vertex = exports["default"] = /*#__PURE__*/function () {
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import { List, Map } from 'immutable';
5
+ import { Vertex as VertexModel } from "../models";
6
+ import { GeometryUtils, IDBroker, SnapSceneUtils, SnapUtils } from "../utils/export";
7
+ import { END_DRAGGING_VERTEX, MODE_DRAGGING_VERTEX } from "../constants";
8
+ import { Layer, Line } from "../class/export";
9
+ import { isEmpty } from "../utils/helper";
10
+ var Vertex = /*#__PURE__*/function () {
16
11
  function Vertex() {
17
- (0, _classCallCheck2["default"])(this, Vertex);
12
+ _classCallCheck(this, Vertex);
18
13
  }
19
- return (0, _createClass2["default"])(Vertex, null, [{
14
+ return _createClass(Vertex, null, [{
20
15
  key: "add",
21
16
  value: function add(state, layerID, x, y, relatedPrototype, relatedID) {
22
17
  var vertex = state.getIn(['scene', 'layers', layerID, 'vertices']).find(function (vertex) {
23
- return _export.GeometryUtils.samePoints(vertex, {
18
+ return GeometryUtils.samePoints(vertex, {
24
19
  x: x,
25
20
  y: y
26
21
  });
@@ -30,12 +25,12 @@ var Vertex = exports["default"] = /*#__PURE__*/function () {
30
25
  return related.push(relatedID);
31
26
  });
32
27
  } else {
33
- vertex = new _models.Vertex((0, _defineProperty2["default"])({
34
- id: _export.IDBroker.acquireID(),
28
+ vertex = new VertexModel(_defineProperty({
29
+ id: IDBroker.acquireID(),
35
30
  name: 'Vertex',
36
31
  x: x,
37
32
  y: y
38
- }, relatedPrototype, new _immutable.List([relatedID])));
33
+ }, relatedPrototype, new List([relatedID])));
39
34
  }
40
35
  state = state.setIn(['scene', 'layers', layerID, 'vertices', vertex.id], vertex);
41
36
  return {
@@ -125,11 +120,11 @@ var Vertex = exports["default"] = /*#__PURE__*/function () {
125
120
  }, {
126
121
  key: "beginDraggingVertex",
127
122
  value: function beginDraggingVertex(state, layerID, vertexID, x, y) {
128
- var snapElements = _export.SnapSceneUtils.sceneSnapElements(state.scene, new _immutable.List(), state.snapMask);
123
+ var snapElements = SnapSceneUtils.sceneSnapElements(state.scene, new List(), state.snapMask);
129
124
  state = state.merge({
130
- mode: _constants.MODE_DRAGGING_VERTEX,
125
+ mode: MODE_DRAGGING_VERTEX,
131
126
  snapElements: snapElements,
132
- draggingSupport: (0, _immutable.Map)({
127
+ draggingSupport: Map({
133
128
  layerID: layerID,
134
129
  vertexID: vertexID,
135
130
  previousMode: state.get('mode')
@@ -148,7 +143,7 @@ var Vertex = exports["default"] = /*#__PURE__*/function () {
148
143
  scene = _state.scene;
149
144
  var snap = null;
150
145
  if (state.snapMask && !state.snapMask.isEmpty()) {
151
- snap = _export.SnapUtils.nearestSnap(snapElements, x, y, state.snapMask);
146
+ snap = SnapUtils.nearestSnap(snapElements, x, y, state.snapMask);
152
147
  if (snap) {
153
148
  var _snap$point = snap.point;
154
149
  x = _snap$point.x;
@@ -179,12 +174,12 @@ var Vertex = exports["default"] = /*#__PURE__*/function () {
179
174
  if (lines) {
180
175
  state = lines.reduce(function (reducedState, lineID) {
181
176
  var eachLine = reducedState.getIn(['scene', 'layers', layerID, 'lines', lineID]);
182
- if ((0, _helper.isEmpty)(eachLine)) return reducedState;
183
- reducedState = _export2.Layer.removeZeroLengthLines(reducedState, layerID).updatedState;
184
- reducedState = _export2.Layer.mergeEqualsVertices(reducedState, layerID, vertexID).updatedState;
185
- reducedState = _export2.Line.select(reducedState, layerID, eachLine.id).updatedState;
186
- reducedState = reducedState.setIn(['mode'], _constants.MODE_DRAGGING_VERTEX);
187
- reducedState = _export2.Line.applyWallChanges(reducedState, _constants.END_DRAGGING_VERTEX).updatedState;
177
+ if (isEmpty(eachLine)) return reducedState;
178
+ reducedState = Layer.removeZeroLengthLines(reducedState, layerID).updatedState;
179
+ reducedState = Layer.mergeEqualsVertices(reducedState, layerID, vertexID).updatedState;
180
+ reducedState = Line.select(reducedState, layerID, eachLine.id).updatedState;
181
+ reducedState = reducedState.setIn(['mode'], MODE_DRAGGING_VERTEX);
182
+ reducedState = Line.applyWallChanges(reducedState, END_DRAGGING_VERTEX).updatedState;
188
183
  return reducedState;
189
184
  }, state);
190
185
  }
@@ -192,11 +187,12 @@ var Vertex = exports["default"] = /*#__PURE__*/function () {
192
187
  mode: draggingSupport.get('previousMode'),
193
188
  draggingSupport: null,
194
189
  activeSnapElement: null,
195
- snapElements: new _immutable.List()
190
+ snapElements: new List()
196
191
  });
197
192
  return {
198
193
  updatedState: state
199
194
  };
200
195
  }
201
196
  }]);
202
- }();
197
+ }();
198
+ export { Vertex as default };