kitchen-simulator 4.1.7-react-18 → 4.2.1

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 (206) hide show
  1. package/README.md +3 -0
  2. package/es/AppContext.js +1 -1
  3. package/es/LiteKitchenConfigurator.js +171 -111
  4. package/es/LiteRenderer.js +161 -129
  5. package/es/actions/export.js +25 -12
  6. package/es/actions/project-actions.js +2 -1
  7. package/es/assets/gltf/door_sliding.bin +0 -0
  8. package/es/assets/img/svg/bottombar/elevation.svg +12 -5
  9. package/es/catalog/catalog.js +21 -5
  10. package/es/catalog/factories/area-factory-3d.js +17 -17
  11. package/es/catalog/factories/wall-factory.js +1 -1
  12. package/es/catalog/holes/window-clear/planner-element.js +2 -2
  13. package/es/catalog/properties/export.js +21 -0
  14. package/es/catalog/properties/property-checkbox.js +68 -0
  15. package/es/catalog/properties/property-color.js +39 -0
  16. package/es/catalog/properties/property-enum.js +50 -0
  17. package/es/catalog/properties/property-hidden.js +19 -0
  18. package/es/catalog/properties/property-lenght-measure.js +100 -0
  19. package/es/catalog/properties/property-length-measure.js +84 -0
  20. package/es/catalog/properties/property-length-measure_hole.js +100 -0
  21. package/es/catalog/properties/property-number.js +48 -0
  22. package/es/catalog/properties/property-read-only.js +26 -0
  23. package/es/catalog/properties/property-string.js +48 -0
  24. package/es/catalog/properties/property-toggle.js +39 -0
  25. package/es/catalog/properties/shared-property-style.js +14 -0
  26. package/es/catalog/utils/exporter.js +24 -11
  27. package/es/catalog/utils/item-loader.js +224 -220
  28. package/es/class/hole.js +0 -2
  29. package/es/class/item.js +92 -70
  30. package/es/class/layer.js +1 -1
  31. package/es/class/line.js +4 -8
  32. package/es/class/project.js +96 -81
  33. package/es/components/content.js +10 -93
  34. package/es/components/export.js +4 -6
  35. package/es/components/style/button.js +106 -0
  36. package/es/components/style/cancel-button.js +21 -0
  37. package/es/components/style/content-container.js +30 -0
  38. package/es/components/style/content-title.js +25 -0
  39. package/es/components/style/delete-button.js +24 -0
  40. package/es/components/style/export.js +28 -2
  41. package/es/components/style/form-block.js +20 -0
  42. package/es/components/style/form-color-input.js +26 -0
  43. package/es/components/style/form-label.js +22 -0
  44. package/es/components/style/form-number-input.js +29 -29
  45. package/es/components/style/form-number-input_2.js +200 -0
  46. package/es/components/style/form-select.js +19 -0
  47. package/es/components/style/form-slider.js +60 -0
  48. package/es/components/style/form-submit-button.js +25 -0
  49. package/es/components/style/form-text-input.js +69 -0
  50. package/es/components/viewer2d/grids/grid-streak.js +1 -1
  51. package/es/components/viewer2d/group.js +5 -4
  52. package/es/components/viewer2d/item.js +155 -359
  53. package/es/components/viewer2d/layer.js +1 -1
  54. package/es/components/viewer2d/line.js +22 -54
  55. package/es/components/viewer2d/ruler.js +16 -11
  56. package/es/components/viewer2d/rulerDist.js +38 -51
  57. package/es/components/viewer2d/rulerX.js +4 -2
  58. package/es/components/viewer2d/rulerY.js +3 -0
  59. package/es/components/viewer2d/scene.js +17 -12
  60. package/es/components/viewer2d/state.js +1 -1
  61. package/es/components/viewer2d/utils.js +2 -2
  62. package/es/components/viewer2d/vertex.js +3 -2
  63. package/es/components/viewer2d/viewer2d.js +81 -118
  64. package/es/components/viewer3d/front3D.js +13 -1
  65. package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
  66. package/es/components/viewer3d/scene-creator.js +270 -69
  67. package/es/components/viewer3d/viewer3d-first-person.js +26 -32
  68. package/es/components/viewer3d/viewer3d.js +110 -130
  69. package/es/constants.js +7 -2
  70. package/es/devLiteRenderer.js +491 -150
  71. package/es/index.js +589 -62
  72. package/es/models.js +13 -8
  73. package/es/plugins/SVGLoader.js +1414 -0
  74. package/es/plugins/console-debugger.js +34 -0
  75. package/es/plugins/export.js +7 -0
  76. package/es/plugins/keyboard.js +110 -0
  77. package/es/reducers/project-reducer.js +4 -1
  78. package/es/reducers/viewer2d-reducer.js +3 -1
  79. package/es/reducers/viewer3d-reducer.js +3 -1
  80. package/es/styles/export.js +5 -0
  81. package/es/styles/tabs.css +40 -0
  82. package/es/utils/geometry.js +77 -119
  83. package/es/utils/helper.js +38 -1
  84. package/es/utils/isolate-event-handler.js +829 -609
  85. package/es/utils/molding.js +459 -11
  86. package/es/utils/ruler.js +58 -0
  87. package/lib/AppContext.js +1 -1
  88. package/lib/LiteKitchenConfigurator.js +170 -111
  89. package/lib/LiteRenderer.js +160 -129
  90. package/lib/actions/export.js +35 -39
  91. package/lib/actions/project-actions.js +2 -1
  92. package/lib/assets/gltf/door_sliding.bin +0 -0
  93. package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
  94. package/lib/catalog/catalog.js +20 -4
  95. package/lib/catalog/factories/area-factory-3d.js +14 -14
  96. package/lib/catalog/factories/wall-factory.js +1 -1
  97. package/lib/catalog/holes/window-clear/planner-element.js +2 -2
  98. package/lib/catalog/properties/export.js +81 -0
  99. package/lib/catalog/properties/property-checkbox.js +76 -0
  100. package/lib/catalog/properties/property-color.js +47 -0
  101. package/lib/catalog/properties/property-enum.js +58 -0
  102. package/lib/catalog/properties/property-hidden.js +27 -0
  103. package/lib/catalog/properties/property-lenght-measure.js +108 -0
  104. package/lib/catalog/properties/property-length-measure.js +92 -0
  105. package/lib/catalog/properties/property-length-measure_hole.js +108 -0
  106. package/lib/catalog/properties/property-number.js +56 -0
  107. package/lib/catalog/properties/property-read-only.js +34 -0
  108. package/lib/catalog/properties/property-string.js +56 -0
  109. package/lib/catalog/properties/property-toggle.js +47 -0
  110. package/lib/catalog/properties/shared-property-style.js +21 -0
  111. package/lib/catalog/utils/exporter.js +24 -11
  112. package/lib/catalog/utils/item-loader.js +221 -217
  113. package/lib/class/hole.js +0 -2
  114. package/lib/class/item.js +90 -68
  115. package/lib/class/layer.js +1 -1
  116. package/lib/class/line.js +3 -7
  117. package/lib/class/project.js +96 -81
  118. package/lib/components/content.js +10 -93
  119. package/lib/components/export.js +6 -26
  120. package/lib/components/style/button.js +115 -0
  121. package/lib/components/style/cancel-button.js +29 -0
  122. package/lib/components/style/content-container.js +38 -0
  123. package/lib/components/style/content-title.js +35 -0
  124. package/lib/components/style/delete-button.js +34 -0
  125. package/lib/components/style/export.js +105 -1
  126. package/lib/components/style/form-block.js +28 -0
  127. package/lib/components/style/form-color-input.js +34 -0
  128. package/lib/components/style/form-label.js +30 -0
  129. package/lib/components/style/form-number-input.js +29 -29
  130. package/lib/components/style/form-number-input_2.js +209 -0
  131. package/lib/components/style/form-select.js +29 -0
  132. package/lib/components/style/form-slider.js +68 -0
  133. package/lib/components/style/form-submit-button.js +35 -0
  134. package/lib/components/style/form-text-input.js +78 -0
  135. package/lib/components/viewer2d/grids/grid-streak.js +1 -1
  136. package/lib/components/viewer2d/group.js +5 -4
  137. package/lib/components/viewer2d/item.js +152 -356
  138. package/lib/components/viewer2d/layer.js +1 -1
  139. package/lib/components/viewer2d/line.js +22 -54
  140. package/lib/components/viewer2d/ruler.js +15 -10
  141. package/lib/components/viewer2d/rulerDist.js +38 -51
  142. package/lib/components/viewer2d/rulerX.js +4 -2
  143. package/lib/components/viewer2d/rulerY.js +3 -0
  144. package/lib/components/viewer2d/scene.js +17 -12
  145. package/lib/components/viewer2d/state.js +1 -1
  146. package/lib/components/viewer2d/utils.js +2 -2
  147. package/lib/components/viewer2d/vertex.js +3 -2
  148. package/lib/components/viewer2d/viewer2d.js +79 -115
  149. package/lib/components/viewer3d/front3D.js +13 -1
  150. package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
  151. package/lib/components/viewer3d/scene-creator.js +267 -66
  152. package/lib/components/viewer3d/viewer3d-first-person.js +26 -32
  153. package/lib/components/viewer3d/viewer3d.js +107 -126
  154. package/lib/constants.js +12 -7
  155. package/lib/devLiteRenderer.js +489 -148
  156. package/lib/index.js +591 -62
  157. package/lib/models.js +13 -8
  158. package/lib/plugins/SVGLoader.js +1419 -0
  159. package/lib/plugins/console-debugger.js +42 -0
  160. package/lib/plugins/export.js +25 -0
  161. package/lib/plugins/keyboard.js +117 -0
  162. package/lib/reducers/project-reducer.js +4 -1
  163. package/lib/reducers/viewer2d-reducer.js +3 -1
  164. package/lib/reducers/viewer3d-reducer.js +3 -1
  165. package/lib/styles/export.js +13 -0
  166. package/lib/styles/tabs.css +40 -0
  167. package/lib/utils/geometry.js +77 -119
  168. package/lib/utils/helper.js +40 -1
  169. package/lib/utils/isolate-event-handler.js +829 -608
  170. package/lib/utils/molding.js +460 -9
  171. package/lib/utils/ruler.js +63 -0
  172. package/package.json +21 -20
  173. package/es/mocks/appliancePayload.json +0 -27
  174. package/es/mocks/cabinetPayload.json +0 -1914
  175. package/es/mocks/cabinetPayload2.json +0 -76
  176. package/es/mocks/dataBundle2.json +0 -4
  177. package/es/mocks/distancePayload.json +0 -6
  178. package/es/mocks/doorStylePayload2.json +0 -84
  179. package/es/mocks/furnishingPayload.json +0 -23
  180. package/es/mocks/itemCDSPayload.json +0 -27
  181. package/es/mocks/lightingPayload.json +0 -23
  182. package/es/mocks/mockProps.json +0 -43
  183. package/es/mocks/mockProps2.json +0 -9
  184. package/es/mocks/moldingPayload.json +0 -19
  185. package/es/mocks/projectItemsCatalog.json +0 -133
  186. package/es/mocks/rectangleShape.json +0 -238
  187. package/es/mocks/replaceCabinetPayload.json +0 -81
  188. package/es/mocks/roomShapePayload.json +0 -5
  189. package/es/useAppContext.js +0 -8
  190. package/lib/mocks/appliancePayload.json +0 -27
  191. package/lib/mocks/cabinetPayload.json +0 -1914
  192. package/lib/mocks/cabinetPayload2.json +0 -76
  193. package/lib/mocks/dataBundle2.json +0 -4
  194. package/lib/mocks/distancePayload.json +0 -6
  195. package/lib/mocks/doorStylePayload2.json +0 -84
  196. package/lib/mocks/furnishingPayload.json +0 -23
  197. package/lib/mocks/itemCDSPayload.json +0 -27
  198. package/lib/mocks/lightingPayload.json +0 -23
  199. package/lib/mocks/mockProps.json +0 -43
  200. package/lib/mocks/mockProps2.json +0 -9
  201. package/lib/mocks/moldingPayload.json +0 -19
  202. package/lib/mocks/projectItemsCatalog.json +0 -133
  203. package/lib/mocks/rectangleShape.json +0 -238
  204. package/lib/mocks/replaceCabinetPayload.json +0 -81
  205. package/lib/mocks/roomShapePayload.json +0 -5
  206. package/lib/useAppContext.js +0 -16
@@ -23,7 +23,6 @@ var _immutable = require("immutable");
23
23
  var _math = require("../../utils/math");
24
24
  var _helper = require("../../utils/helper");
25
25
  var _utils = require("./utils");
26
- var _useAppContext2 = require("../../useAppContext");
27
26
  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); }
28
27
  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; }
29
28
  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; } // variables
@@ -130,22 +129,21 @@ function extractElementData(node) {
130
129
  direct: node.attributes.getNamedItem('data-direct') ? node.attributes.getNamedItem('data-direct').value : 0
131
130
  };
132
131
  }
133
- function Viewer2D(_ref) {
134
- var _state$get;
132
+ function Viewer2D(_ref, _ref2) {
135
133
  var state = _ref.state,
136
134
  width = _ref.width,
137
135
  height = _ref.height,
136
+ setToolbar = _ref.setToolbar,
138
137
  replaceCabinet = _ref.replaceCabinet,
139
138
  onInternalEvent = _ref.onInternalEvent;
140
- var _useAppContext = (0, _useAppContext2.useAppContext)(),
141
- viewer2DActions = _useAppContext.viewer2DActions,
142
- linesActions = _useAppContext.linesActions,
143
- holesActions = _useAppContext.holesActions,
144
- verticesActions = _useAppContext.verticesActions,
145
- itemsActions = _useAppContext.itemsActions,
146
- areaActions = _useAppContext.areaActions,
147
- projectActions = _useAppContext.projectActions,
148
- catalog = _useAppContext.catalog;
139
+ var viewer2DActions = _ref2.viewer2DActions,
140
+ linesActions = _ref2.linesActions,
141
+ holesActions = _ref2.holesActions,
142
+ verticesActions = _ref2.verticesActions,
143
+ itemsActions = _ref2.itemsActions,
144
+ areaActions = _ref2.areaActions,
145
+ projectActions = _ref2.projectActions,
146
+ catalog = _ref2.catalog;
149
147
  var _useState = (0, _react.useState)(null),
150
148
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
151
149
  rulerEdit = _useState2[0],
@@ -168,26 +166,6 @@ function Viewer2D(_ref) {
168
166
  _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
169
167
  drawStart = _useState8[0],
170
168
  setdrawStart = _useState8[1];
171
- var _useState9 = (0, _react.useState)(function () {
172
- return viewer2D && !viewer2D.isEmpty() ? viewer2D.toJS() : _reactSvgPanZoom.INITIAL_VALUE;
173
- }),
174
- _useState0 = (0, _slicedToArray2["default"])(_useState9, 2),
175
- svgValue = _useState0[0],
176
- setSvgValue = _useState0[1];
177
- var _useState1 = (0, _react.useState)(function () {
178
- return mode2Tool(mode);
179
- }),
180
- _useState10 = (0, _slicedToArray2["default"])(_useState1, 2),
181
- svgTool = _useState10[0],
182
- setSvgTool = _useState10[1];
183
- (0, _react.useEffect)(function () {
184
- // keep tool controlled from app mode
185
- setSvgTool(mode2Tool(mode));
186
- }, [mode]);
187
- (0, _react.useEffect)(function () {
188
- // keep value controlled from store, but never null
189
- if (viewer2D && !viewer2D.isEmpty()) setSvgValue(viewer2D.toJS());
190
- }, [viewer2D]);
191
169
  (0, _react.useEffect)(function () {
192
170
  // move viewer point to center
193
171
  var selectedLayer = state.scene.layers.get(state.scene.selectedLayer);
@@ -212,9 +190,9 @@ function Viewer2D(_ref) {
212
190
  var layerID = scene.selectedLayer;
213
191
  var wall_thickness = _constants.LINE_THICKNESS / 2;
214
192
  var layer = scene.getIn(['layers', layerID]);
215
- var mapCursorPosition = function mapCursorPosition(_ref2) {
216
- var x = _ref2.x,
217
- y = _ref2.y;
193
+ var mapCursorPosition = function mapCursorPosition(_ref3) {
194
+ var x = _ref3.x,
195
+ y = _ref3.y;
218
196
  return {
219
197
  x: x,
220
198
  y: -y + scene.height
@@ -238,11 +216,10 @@ function Viewer2D(_ref) {
238
216
  allArea = _export2.GeometryUtils.getAllArea(layer);
239
217
  };
240
218
  var updateRulerDistAttribute = function updateRulerDistAttribute(elementData, value) {
241
- var _scene$getIn;
242
219
  var newVal = value.get('length');
243
220
  var oldVal = elementData.length;
244
221
  var direct = elementData.direct;
245
- var thisItem = (_scene$getIn = scene.getIn(['layers', elementData.layer, 'items', elementData.id])) === null || _scene$getIn === void 0 ? void 0 : _scene$getIn.toJS();
222
+ var thisItem = scene.getIn(['layers', elementData.layer, 'items', elementData.id]).toJS();
246
223
  var oldX = thisItem.x;
247
224
  var oldY = thisItem.y;
248
225
  var oldRotRad = thisItem.rotation / 180 * Math.PI;
@@ -276,8 +253,7 @@ function Viewer2D(_ref) {
276
253
  verticesActions.endDraggingVertex(x, y, state.snapMask);
277
254
  };
278
255
  var updateRulerAttribute = function updateRulerAttribute(elementData, value) {
279
- var _scene$getIn2;
280
- var selectedLine = (_scene$getIn2 = scene.getIn(['layers', elementData.layer, 'lines', elementData.id])) === null || _scene$getIn2 === void 0 ? void 0 : _scene$getIn2.toJS();
256
+ var selectedLine = scene.getIn(['layers', elementData.layer, 'lines', elementData.id]).toJS();
281
257
  var v_0 = scene.getIn(['layers', elementData.layer, 'vertices', selectedLine.vertices[0]]);
282
258
  var v_1 = scene.getIn(['layers', elementData.layer, 'vertices', selectedLine.vertices[1]]);
283
259
  var _GeometryUtils$orderV = _export2.GeometryUtils.orderVertices([v_0, v_1]),
@@ -337,10 +313,9 @@ function Viewer2D(_ref) {
337
313
  updateRightHoleRulerAttribute(elementData, value);
338
314
  };
339
315
  var updateLeftHoleRulerAttribute = function updateLeftHoleRulerAttribute(elementData, value) {
340
- var _scene$getIn3;
341
316
  var newVal = value.get('length');
342
317
  var oldVal = elementData.length;
343
- var thisItem = (_scene$getIn3 = scene.getIn(['layers', elementData.layer, 'holes', elementData.id])) === null || _scene$getIn3 === void 0 ? void 0 : _scene$getIn3.toJS();
318
+ var thisItem = scene.getIn(['layers', elementData.layer, 'holes', elementData.id]).toJS();
344
319
  var oldX = thisItem.x;
345
320
  var oldY = thisItem.y;
346
321
  var oldRotRad = thisItem.rotation;
@@ -353,9 +328,8 @@ function Viewer2D(_ref) {
353
328
  setRulerEdit(null);
354
329
  };
355
330
  var updateHoleRulerAttribute = function updateHoleRulerAttribute(elementData, value) {
356
- var _scene$getIn4;
357
331
  var newVal = value.get('length');
358
- var thisItem = (_scene$getIn4 = scene.getIn(['layers', elementData.layer, 'holes', elementData.id])) === null || _scene$getIn4 === void 0 ? void 0 : _scene$getIn4.toJS();
332
+ var thisItem = scene.getIn(['layers', elementData.layer, 'holes', elementData.id]).toJS();
359
333
  var oldX = thisItem.x;
360
334
  var oldY = thisItem.y;
361
335
  holesActions.beginDraggingHole(elementData.layer, elementData.id, oldX, oldY);
@@ -364,10 +338,9 @@ function Viewer2D(_ref) {
364
338
  setRulerEdit(null);
365
339
  };
366
340
  var updateRightHoleRulerAttribute = function updateRightHoleRulerAttribute(elementData, value) {
367
- var _scene$getIn5;
368
341
  var newVal = value.get('length');
369
342
  var oldVal = elementData.length;
370
- var thisItem = (_scene$getIn5 = scene.getIn(['layers', elementData.layer, 'holes', elementData.id])) === null || _scene$getIn5 === void 0 ? void 0 : _scene$getIn5.toJS();
343
+ var thisItem = scene.getIn(['layers', elementData.layer, 'holes', elementData.id]).toJS();
371
344
  var oldX = thisItem.x;
372
345
  var oldY = thisItem.y;
373
346
  var oldRotRad = thisItem.rotation;
@@ -402,7 +375,6 @@ function Viewer2D(_ref) {
402
375
  // }
403
376
  };
404
377
  var getEndPoint = function getEndPoint(vertices, x, y, mode) {
405
- var _state$getIn, _state$getIn2;
406
378
  var selLineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
407
379
  if ((0, _helper.isEmpty)(selLineID)) {
408
380
  return {
@@ -411,8 +383,8 @@ function Viewer2D(_ref) {
411
383
  y: y
412
384
  };
413
385
  }
414
- var draggingLine = (_state$getIn = state.getIn(['scene', 'layers', layerID, 'lines', selLineID])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.toJS();
415
- var allLines = (_state$getIn2 = state.getIn(['scene', 'layers', layerID, 'lines'])) === null || _state$getIn2 === void 0 ? void 0 : _state$getIn2.toJS();
386
+ var draggingLine = state.getIn(['scene', 'layers', layerID, 'lines', selLineID]).toJS();
387
+ var allLines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
416
388
  var dragVertexId = state.getIn(['draggingSupport', 'vertexID']);
417
389
  dragVertexId = !(0, _helper.isEmpty)(dragVertexId) ? dragVertexId : draggingLine.vertices[1];
418
390
  var vtx, vty;
@@ -587,11 +559,11 @@ function Viewer2D(_ref) {
587
559
  };
588
560
  };
589
561
  var getConnectedLines = function getConnectedLines() {
590
- var _state$getIn3, _state$getIn4, _state$getIn5;
591
- var vertices = (_state$getIn3 = state.getIn(['scene', 'layers', layerID, 'vertices'])) === null || _state$getIn3 === void 0 ? void 0 : _state$getIn3.toJS();
592
- var lines = (_state$getIn4 = state.getIn(['scene', 'layers', layerID, 'lines'])) === null || _state$getIn4 === void 0 ? void 0 : _state$getIn4.toJS();
562
+ var _state$getIn;
563
+ var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
564
+ var lines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
593
565
  var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
594
- var drawingLine = (_state$getIn5 = state.getIn(['scene', 'layers', layerID, 'lines', lineID])) === null || _state$getIn5 === void 0 ? void 0 : _state$getIn5.toJS();
566
+ var drawingLine = (_state$getIn = state.getIn(['scene', 'layers', layerID, 'lines', lineID])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.toJS();
595
567
  // get the lines that have same points with drawing line.
596
568
  if (!(0, _helper.isEmpty)(drawingLine)) {
597
569
  var tlines = [];
@@ -600,7 +572,6 @@ function Viewer2D(_ref) {
600
572
  }
601
573
  };
602
574
  var onMouseMove = function onMouseMove(viewerEvent) {
603
- var _state$getIn6, _state$getIn7, _state$getIn9;
604
575
  //workaround that allow imageful component to work
605
576
 
606
577
  // let evt = new Event('mousemove-planner-event');
@@ -624,12 +595,11 @@ function Viewer2D(_ref) {
624
595
  case constants.MODE_DRAWING_LINE:
625
596
  // check whether the drawing line is started.
626
597
  var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
627
- var lines = (_state$getIn6 = state.getIn(['scene', 'layers', layerID, 'lines'])) === null || _state$getIn6 === void 0 ? void 0 : _state$getIn6.toJS();
628
- var drawingLine = (_state$getIn7 = state.getIn(['scene', 'layers', layerID, 'lines', lineID])) === null || _state$getIn7 === void 0 ? void 0 : _state$getIn7.toJS();
598
+ var lines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
599
+ var drawingLine = state.getIn(['scene', 'layers', layerID, 'lines', lineID]).toJS();
629
600
  var tlines = [];
630
601
  if (drawStart || state.getIn(['scene', 'setLineAttributes'])) {
631
- var _state$getIn8;
632
- var _vertices = (_state$getIn8 = state.getIn(['scene', 'layers', layerID, 'vertices'])) === null || _state$getIn8 === void 0 ? void 0 : _state$getIn8.toJS();
602
+ var _vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
633
603
  setdrawStart(false);
634
604
  // get the lines that have same points with drawing line.
635
605
  getRelatedLines(tlines, drawingLine, _vertices, lines);
@@ -735,7 +705,7 @@ function Viewer2D(_ref) {
735
705
  linesActions.updateDraggingLine(x, y, relatedLines, state.snapMask);
736
706
  break;
737
707
  case constants.MODE_DRAGGING_VERTEX:
738
- var vertices = (_state$getIn9 = state.getIn(['scene', 'layers', layerID, 'vertices'])) === null || _state$getIn9 === void 0 ? void 0 : _state$getIn9.toJS();
708
+ var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
739
709
  getConnectedLines();
740
710
  var result = getEndPoint(vertices, x, y, 'DRAGGING_VERTEX');
741
711
  verticesActions.updateDraggingVertex(result.x, result.y, state.snapMask);
@@ -841,6 +811,7 @@ function Viewer2D(_ref) {
841
811
  verticesActions.beginDraggingVertex(elementData.layer, elementData.id, x, y, state.snapMask);
842
812
  break;
843
813
  case 'items':
814
+ setToolbar('');
844
815
  current_sel_obj_id = elementData.id;
845
816
  if (elementData.part === 'rotation-anchor') itemsActions.beginRotatingItem(elementData.layer, elementData.id, x, y);else if (elementData.part === 'remove') break;else if (elementData.part === 'duplicate') break;else if (elementData.part === 'warning_edit') break;else {
846
817
  // closes the setting dialog
@@ -868,15 +839,23 @@ function Viewer2D(_ref) {
868
839
  event.stopPropagation();
869
840
  };
870
841
  var onMouseUp = function onMouseUp(viewerEvent) {
871
- var _state$getIn0, _state$getIn1;
872
842
  //set move all flag false
873
843
  sFlag = false;
874
- // //////////////////////
875
- // setRulerEdit(null);
876
844
  var event = viewerEvent.originalEvent;
877
- var bbox = event.target.getBoundingClientRect();
878
- // bbox.width = event.target.getBBox().width;
879
- // bbox.height = event.target.getBBox().height;
845
+ var parent = document.querySelector('#kitchen-simulator-container');
846
+ var targetRect = event.target.getBoundingClientRect();
847
+ var left = targetRect.left;
848
+ var top = targetRect.top;
849
+ if (!(0, _helper.isEmpty)(parent)) {
850
+ var parentRect = parent.getBoundingClientRect();
851
+ left = targetRect.left - parentRect.left;
852
+ top = targetRect.top - parentRect.top;
853
+ left = left - (200 - targetRect.width) / 2;
854
+ top = top - (50 - targetRect.height) / 2;
855
+ }
856
+ if (!mode.includes('ING')) {
857
+ setToolbar('');
858
+ }
880
859
  if (event.target.tagName === 'rect') {
881
860
  if (event.target.id) {
882
861
  setRulerEditID(event.target.id);
@@ -891,8 +870,8 @@ function Viewer2D(_ref) {
891
870
  x = _mapCursorPosition3.x,
892
871
  y = _mapCursorPosition3.y;
893
872
  var draggingDistance = Math.sqrt((x - mouseDownPoint.x) * (x - mouseDownPoint.x) + (y - mouseDownPoint.y) * (y - mouseDownPoint.y));
894
- var vertices = (_state$getIn0 = state.getIn(['scene', 'layers', layerID, 'vertices'])) === null || _state$getIn0 === void 0 ? void 0 : _state$getIn0.toJS();
895
- var lines = (_state$getIn1 = state.getIn(['scene', 'layers', layerID, 'lines'])) === null || _state$getIn1 === void 0 ? void 0 : _state$getIn1.toJS();
873
+ var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
874
+ var lines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
896
875
  var elementData = extractElementData(event.target);
897
876
  var selectedLayer = scene.getIn(['layers', layerID]);
898
877
  var elementPrototype = null;
@@ -965,11 +944,11 @@ function Viewer2D(_ref) {
965
944
  // handle action when click elevation about selected line
966
945
  var _mode = _constants.MODE_ELEVATION_VIEW;
967
946
  projectActions.setMode(_mode);
947
+ internalType = constants.INTERNAL_EVENT_TOGGLE_TO_ELEVATION;
968
948
  break;
969
949
  } else {
970
- var _state$getIn10;
971
950
  var tlines = [];
972
- var drawingLine = (_state$getIn10 = state.getIn(['scene', 'layers', layerID, 'lines', elementData.id])) === null || _state$getIn10 === void 0 ? void 0 : _state$getIn10.toJS();
951
+ var drawingLine = state.getIn(['scene', 'layers', layerID, 'lines', elementData.id]).toJS();
973
952
  getRelatedLines(tlines, drawingLine, vertices, lines);
974
953
  setRelatedLines(tlines);
975
954
  linesActions.selectLine(elementData.layer, elementData.id);
@@ -1009,8 +988,8 @@ function Viewer2D(_ref) {
1009
988
  id: "ruler_numberInput",
1010
989
  style: {
1011
990
  position: 'absolute',
1012
- left: bbox.left - (150 - bbox.width) / 2,
1013
- top: bbox.top - (50 - bbox.height) / 2,
991
+ left: left,
992
+ top: top,
1014
993
  zIndex: 1000
1015
994
  }
1016
995
  }, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
@@ -1041,8 +1020,8 @@ function Viewer2D(_ref) {
1041
1020
  id: "ruler_numberInput",
1042
1021
  style: {
1043
1022
  position: 'absolute',
1044
- left: bbox.left - (150 - bbox.width) / 2,
1045
- top: bbox.top - (50 - bbox.height) / 2,
1023
+ left: left,
1024
+ top: top,
1046
1025
  zIndex: 1000
1047
1026
  }
1048
1027
  }, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
@@ -1074,8 +1053,8 @@ function Viewer2D(_ref) {
1074
1053
  id: "ruler_numberInput",
1075
1054
  style: {
1076
1055
  position: 'absolute',
1077
- left: bbox.left - (150 - bbox.width) / 2,
1078
- top: bbox.top - (50 - bbox.height) / 2,
1056
+ left: left,
1057
+ top: top,
1079
1058
  zIndex: 1000
1080
1059
  }
1081
1060
  }, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
@@ -1107,8 +1086,8 @@ function Viewer2D(_ref) {
1107
1086
  id: "ruler_numberInput",
1108
1087
  style: {
1109
1088
  position: 'absolute',
1110
- left: bbox.left - (150 - bbox.width) / 2,
1111
- top: bbox.top - (50 - bbox.height) / 2,
1089
+ left: left,
1090
+ top: top,
1112
1091
  zIndex: 1000
1113
1092
  }
1114
1093
  }, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
@@ -1140,8 +1119,8 @@ function Viewer2D(_ref) {
1140
1119
  id: "ruler_numberInput",
1141
1120
  style: {
1142
1121
  position: 'absolute',
1143
- left: bbox.left - (150 - bbox.width) / 2,
1144
- top: bbox.top - (50 - bbox.height) / 2,
1122
+ left: left,
1123
+ top: top,
1145
1124
  zIndex: 1000
1146
1125
  }
1147
1126
  }, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
@@ -1173,8 +1152,8 @@ function Viewer2D(_ref) {
1173
1152
  id: "ruler_numberInput",
1174
1153
  style: {
1175
1154
  position: 'absolute',
1176
- left: bbox.left - (150 - bbox.width) / 2,
1177
- top: bbox.top - (50 - bbox.height) / 2,
1155
+ left: left,
1156
+ top: top,
1178
1157
  zIndex: 1000
1179
1158
  }
1180
1159
  }, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
@@ -1205,8 +1184,8 @@ function Viewer2D(_ref) {
1205
1184
  id: "ruler_numberInput",
1206
1185
  style: {
1207
1186
  position: 'absolute',
1208
- left: bbox.left - (150 - bbox.width) / 2,
1209
- top: bbox.top - (50 - bbox.height) / 2,
1187
+ left: left,
1188
+ top: top,
1210
1189
  zIndex: 1000
1211
1190
  }
1212
1191
  }, /*#__PURE__*/_react["default"].createElement(_formNumberInput["default"], {
@@ -1287,24 +1266,7 @@ function Viewer2D(_ref) {
1287
1266
  _currentObject = state.getIn(['scene', 'layers', layerID, elementPrototype, elementID]);
1288
1267
  }
1289
1268
  if (_currentObject) {
1290
- var _currentObject3, _currentObject4, _currentObject5;
1291
- var payload = (_currentObject3 = _currentObject) === null || _currentObject3 === void 0 ? void 0 : _currentObject3.toJS();
1292
- if (((_currentObject4 = _currentObject) === null || _currentObject4 === void 0 ? void 0 : _currentObject4.prototype) === 'lines') {
1293
- // caculating length of selected line//
1294
- var v_a = layer.vertices.get(_currentObject.vertices.get(0));
1295
- var v_b = layer.vertices.get(_currentObject.vertices.get(1));
1296
- var distance = _export2.GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
1297
- var _length3 = (0, _convertUnitsLite.convert)(distance).from('cm').to('in');
1298
- payload.length = _length3;
1299
- //////////////////////////////////////
1300
- } else if (((_currentObject5 = _currentObject) === null || _currentObject5 === void 0 ? void 0 : _currentObject5.prototype) === 'items') {
1301
- // check this cabinet has warning box
1302
- payload.isWarning = (0, _utils.isWarningItem)(_currentObject);
1303
- // check this item is available molding
1304
- payload.isMoldingAvailable = _export2.MoldingUtils.isEnableItemForMolding(layer, _currentObject);
1305
- // check this item is snapped to wall
1306
- payload.isAttachedWall = _export2.MoldingUtils.isAttachedWall(layer, _currentObject);
1307
- }
1269
+ var payload = (0, _helper.updatePayloadOfInternalEvent)(_currentObject, layer, catalog);
1308
1270
 
1309
1271
  // send selection event befor replace event
1310
1272
  if (internalType === constants.INTERNAL_EVENT_REPLACE_CABINET) {
@@ -1323,7 +1285,6 @@ function Viewer2D(_ref) {
1323
1285
  };
1324
1286
  var onChangeValue = function onChangeValue(value) {
1325
1287
  if (sFlag) return;
1326
- setSvgValue(value);
1327
1288
  var _zoomValue = parseInt((value.a - 0.5) / constants.ZOOM_VARIABLE);
1328
1289
  if (_zoomValue > constants.MAX_ZOOM_IN_SCALE) return;
1329
1290
  if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
@@ -1336,8 +1297,6 @@ function Viewer2D(_ref) {
1336
1297
  var bbox;
1337
1298
  if (_rect && _rulerEdit) {
1338
1299
  bbox = _rect.getBoundingClientRect();
1339
- // bbox.width = _rect.getBBox().width;
1340
- // bbox.height = _rect.getBBox().height;
1341
1300
  _rulerEdit.style.left = "".concat(bbox.left - (150 - bbox.width) / 2, "px");
1342
1301
  _rulerEdit.style.top = "".concat(bbox.top - (50 - bbox.height) / 2, "px");
1343
1302
  }
@@ -1355,7 +1314,6 @@ function Viewer2D(_ref) {
1355
1314
  }
1356
1315
  };
1357
1316
  var onChangeTool = function onChangeTool(tool) {
1358
- setSvgTool(tool);
1359
1317
  switch (tool) {
1360
1318
  case _reactSvgPanZoom.TOOL_NONE:
1361
1319
  projectActions.selectToolEdit();
@@ -1372,12 +1330,12 @@ function Viewer2D(_ref) {
1372
1330
  }
1373
1331
  };
1374
1332
  var onZoom = function onZoom(value) {
1375
- // var nextValue = viewer2D?.toJS();
1333
+ // var nextValue = viewer2D.toJS();
1376
1334
  // nextValue = zoom(nextValue, 0, 0, value.a / nextValue.a)
1377
1335
  // projectActions.updateZoomScale(nextValue.a);
1378
1336
  // return viewer2DActions.updateCameraView(nextValue)
1379
1337
  };
1380
- var _state$get$toJS = (_state$get = state.get('viewer2D')) === null || _state$get === void 0 ? void 0 : _state$get.toJS(),
1338
+ var _state$get$toJS = state.get('viewer2D').toJS(),
1381
1339
  e = _state$get$toJS.e,
1382
1340
  f = _state$get$toJS.f,
1383
1341
  SVGWidth = _state$get$toJS.SVGWidth,
@@ -1454,23 +1412,19 @@ function Viewer2D(_ref) {
1454
1412
  },
1455
1413
  width: width - rulerSize,
1456
1414
  height: height - rulerSize,
1457
- value: svgValue,
1458
- tool: svgTool,
1415
+ value: viewer2D.isEmpty() ? null : viewer2D.toJS(),
1459
1416
  onChangeValue: onChangeValue,
1417
+ tool: mode2Tool(mode),
1460
1418
  onChangeTool: onChangeTool,
1461
1419
  detectAutoPan: mode2DetectAutopan(mode),
1462
1420
  onMouseDown: onMouseDown,
1463
1421
  onMouseMove: onMouseMove,
1464
1422
  onMouseUp: onMouseUp,
1423
+ miniaturePosition: "none",
1424
+ toolbarPosition: "none",
1465
1425
  detectPinchGesture: false,
1466
1426
  disableDoubleClickZoomWithToolAuto: true,
1467
- ref: Viewer,
1468
- miniatureProps: {
1469
- position: _reactSvgPanZoom.POSITION_NONE
1470
- },
1471
- toolbarProps: {
1472
- position: _reactSvgPanZoom.POSITION_NONE
1473
- }
1427
+ ref: Viewer
1474
1428
  }, /*#__PURE__*/_react["default"].createElement("svg", {
1475
1429
  width: scene.width,
1476
1430
  height: scene.height
@@ -1506,4 +1460,14 @@ Viewer2D.propTypes = {
1506
1460
  width: _propTypes["default"].number.isRequired,
1507
1461
  height: _propTypes["default"].number.isRequired
1508
1462
  };
1463
+ Viewer2D.contextTypes = {
1464
+ viewer2DActions: _propTypes["default"].object.isRequired,
1465
+ linesActions: _propTypes["default"].object.isRequired,
1466
+ holesActions: _propTypes["default"].object.isRequired,
1467
+ verticesActions: _propTypes["default"].object.isRequired,
1468
+ itemsActions: _propTypes["default"].object.isRequired,
1469
+ areaActions: _propTypes["default"].object.isRequired,
1470
+ projectActions: _propTypes["default"].object.isRequired,
1471
+ catalog: _propTypes["default"].object.isRequired
1472
+ };
1509
1473
  module.exports = exports.default;
@@ -13,13 +13,15 @@ var _state3D = _interopRequireDefault(require("./ruler-utils/state3D"));
13
13
  var _utils = require("../viewer2d/utils");
14
14
  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); }
15
15
  var k = 0;
16
- function Front3D(_ref) {
16
+ function Front3D(_ref, _ref2) {
17
17
  var width = _ref.width,
18
18
  height = _ref.height,
19
19
  state = _ref.state,
20
+ setToolbar = _ref.setToolbar,
20
21
  replaceCabinet = _ref.replaceCabinet,
21
22
  keyDownEnable = _ref.keyDownEnable,
22
23
  catalog = _ref.catalog;
24
+ var viewer2DActions = _ref2.viewer2DActions;
23
25
  var _useState = (0, _react.useState)(''),
24
26
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
25
27
  mode = _useState2[0],
@@ -30,6 +32,15 @@ function Front3D(_ref) {
30
32
  k++;
31
33
  setMode(state.get('mode'));
32
34
  }
35
+ var mouseUpEvent = function mouseUpEvent(event) {
36
+ setToolbar('');
37
+ };
38
+ (0, _react.useEffect)(function () {
39
+ if (!(0, _utils.isEmpty)(document.getElementById('front'))) document.getElementById('front').addEventListener('mouseup', mouseUpEvent);
40
+ return function () {
41
+ if (!(0, _utils.isEmpty)(document.getElementById('front'))) document.getElementById('front').removeEventListener('mouseup', mouseUpEvent);
42
+ };
43
+ }, []);
33
44
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("svg", {
34
45
  width: sceneWidth,
35
46
  height: sceneHeight,
@@ -52,6 +63,7 @@ function Front3D(_ref) {
52
63
  state: state,
53
64
  width: width,
54
65
  height: height,
66
+ setToolbar: setToolbar,
55
67
  replaceCabinet: replaceCabinet,
56
68
  keyDownEnable: keyDownEnable,
57
69
  downloadFlag: false
@@ -22,7 +22,7 @@ function Scene3D(_ref) {
22
22
  downloadFlag = _ref.downloadFlag;
23
23
  var layers = scene.layers;
24
24
  var selectedLayer = layers.get(scene.selectedLayer);
25
- var ceilHeight = selectedLayer.ceilHeight;
25
+ var ceilHeight = Number(selectedLayer.ceilHeight);
26
26
  var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
27
27
  var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
28
28
  var vertex1 = selectedLayer.vertices.get(selectedLine.vertices.get(1));