kitchen-simulator 4.0.6-react-18 → 4.0.7-measurement-unit-payload

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 (204) hide show
  1. package/README.md +3 -0
  2. package/es/AppContext.js +1 -1
  3. package/es/LiteKitchenConfigurator.js +162 -107
  4. package/es/LiteRenderer.js +162 -137
  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/png/helper/video_preview_start.png +0 -0
  9. package/es/assets/img/svg/bottombar/elevation.svg +12 -5
  10. package/es/catalog/catalog.js +21 -5
  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 +38 -34
  28. package/es/class/hole.js +0 -2
  29. package/es/class/item.js +99 -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 +5 -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 -27
  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 -52
  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 +56 -87
  64. package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
  65. package/es/components/viewer3d/scene-creator.js +270 -69
  66. package/es/components/viewer3d/viewer3d-first-person.js +24 -26
  67. package/es/components/viewer3d/viewer3d.js +115 -120
  68. package/es/constants.js +7 -2
  69. package/es/devLiteRenderer.js +491 -150
  70. package/es/index.js +627 -1
  71. package/es/models.js +13 -8
  72. package/es/plugins/SVGLoader.js +1414 -0
  73. package/es/plugins/console-debugger.js +34 -0
  74. package/es/plugins/export.js +7 -0
  75. package/es/plugins/keyboard.js +110 -0
  76. package/es/reducers/project-reducer.js +4 -1
  77. package/es/reducers/viewer2d-reducer.js +3 -1
  78. package/es/reducers/viewer3d-reducer.js +3 -1
  79. package/es/styles/export.js +5 -0
  80. package/es/styles/tabs.css +40 -0
  81. package/es/utils/geometry.js +77 -119
  82. package/es/utils/helper.js +38 -1
  83. package/es/utils/isolate-event-handler.js +829 -609
  84. package/es/utils/molding.js +459 -11
  85. package/es/utils/ruler.js +58 -0
  86. package/lib/AppContext.js +1 -1
  87. package/lib/LiteKitchenConfigurator.js +161 -107
  88. package/lib/LiteRenderer.js +161 -137
  89. package/lib/actions/export.js +35 -39
  90. package/lib/actions/project-actions.js +2 -1
  91. package/lib/assets/gltf/door_sliding.bin +0 -0
  92. package/lib/assets/img/png/helper/video_preview_start.png +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/wall-factory.js +1 -1
  96. package/lib/catalog/holes/window-clear/planner-element.js +2 -2
  97. package/lib/catalog/properties/export.js +81 -0
  98. package/lib/catalog/properties/property-checkbox.js +76 -0
  99. package/lib/catalog/properties/property-color.js +47 -0
  100. package/lib/catalog/properties/property-enum.js +58 -0
  101. package/lib/catalog/properties/property-hidden.js +27 -0
  102. package/lib/catalog/properties/property-lenght-measure.js +108 -0
  103. package/lib/catalog/properties/property-length-measure.js +92 -0
  104. package/lib/catalog/properties/property-length-measure_hole.js +108 -0
  105. package/lib/catalog/properties/property-number.js +56 -0
  106. package/lib/catalog/properties/property-read-only.js +34 -0
  107. package/lib/catalog/properties/property-string.js +56 -0
  108. package/lib/catalog/properties/property-toggle.js +47 -0
  109. package/lib/catalog/properties/shared-property-style.js +21 -0
  110. package/lib/catalog/utils/exporter.js +24 -11
  111. package/lib/catalog/utils/item-loader.js +38 -34
  112. package/lib/class/hole.js +0 -2
  113. package/lib/class/item.js +97 -68
  114. package/lib/class/layer.js +1 -1
  115. package/lib/class/line.js +3 -7
  116. package/lib/class/project.js +96 -81
  117. package/lib/components/content.js +5 -93
  118. package/lib/components/export.js +6 -26
  119. package/lib/components/style/button.js +115 -0
  120. package/lib/components/style/cancel-button.js +29 -0
  121. package/lib/components/style/content-container.js +38 -0
  122. package/lib/components/style/content-title.js +35 -0
  123. package/lib/components/style/delete-button.js +34 -0
  124. package/lib/components/style/export.js +105 -1
  125. package/lib/components/style/form-block.js +28 -0
  126. package/lib/components/style/form-color-input.js +34 -0
  127. package/lib/components/style/form-label.js +30 -0
  128. package/lib/components/style/form-number-input.js +29 -27
  129. package/lib/components/style/form-number-input_2.js +209 -0
  130. package/lib/components/style/form-select.js +29 -0
  131. package/lib/components/style/form-slider.js +68 -0
  132. package/lib/components/style/form-submit-button.js +35 -0
  133. package/lib/components/style/form-text-input.js +78 -0
  134. package/lib/components/viewer2d/grids/grid-streak.js +1 -1
  135. package/lib/components/viewer2d/group.js +5 -4
  136. package/lib/components/viewer2d/item.js +152 -356
  137. package/lib/components/viewer2d/layer.js +1 -1
  138. package/lib/components/viewer2d/line.js +22 -52
  139. package/lib/components/viewer2d/ruler.js +15 -10
  140. package/lib/components/viewer2d/rulerDist.js +38 -51
  141. package/lib/components/viewer2d/rulerX.js +4 -2
  142. package/lib/components/viewer2d/rulerY.js +3 -0
  143. package/lib/components/viewer2d/scene.js +17 -12
  144. package/lib/components/viewer2d/state.js +1 -1
  145. package/lib/components/viewer2d/utils.js +2 -2
  146. package/lib/components/viewer2d/vertex.js +3 -2
  147. package/lib/components/viewer2d/viewer2d.js +54 -84
  148. package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
  149. package/lib/components/viewer3d/scene-creator.js +267 -66
  150. package/lib/components/viewer3d/viewer3d-first-person.js +24 -26
  151. package/lib/components/viewer3d/viewer3d.js +112 -116
  152. package/lib/constants.js +12 -7
  153. package/lib/devLiteRenderer.js +489 -148
  154. package/lib/index.js +630 -6
  155. package/lib/models.js +13 -8
  156. package/lib/plugins/SVGLoader.js +1419 -0
  157. package/lib/plugins/console-debugger.js +42 -0
  158. package/lib/plugins/export.js +25 -0
  159. package/lib/plugins/keyboard.js +117 -0
  160. package/lib/reducers/project-reducer.js +4 -1
  161. package/lib/reducers/viewer2d-reducer.js +3 -1
  162. package/lib/reducers/viewer3d-reducer.js +3 -1
  163. package/lib/styles/export.js +13 -0
  164. package/lib/styles/tabs.css +40 -0
  165. package/lib/utils/geometry.js +77 -119
  166. package/lib/utils/helper.js +40 -1
  167. package/lib/utils/isolate-event-handler.js +829 -608
  168. package/lib/utils/molding.js +460 -9
  169. package/lib/utils/ruler.js +63 -0
  170. package/package.json +21 -20
  171. package/es/mocks/appliancePayload.json +0 -27
  172. package/es/mocks/cabinetPayload.json +0 -1914
  173. package/es/mocks/cabinetPayload2.json +0 -76
  174. package/es/mocks/dataBundle2.json +0 -4
  175. package/es/mocks/distancePayload.json +0 -6
  176. package/es/mocks/doorStylePayload2.json +0 -84
  177. package/es/mocks/furnishingPayload.json +0 -23
  178. package/es/mocks/itemCDSPayload.json +0 -27
  179. package/es/mocks/lightingPayload.json +0 -23
  180. package/es/mocks/mockProps.json +0 -43
  181. package/es/mocks/mockProps2.json +0 -9
  182. package/es/mocks/moldingPayload.json +0 -19
  183. package/es/mocks/projectItemsCatalog.json +0 -133
  184. package/es/mocks/rectangleShape.json +0 -238
  185. package/es/mocks/replaceCabinetPayload.json +0 -81
  186. package/es/mocks/roomShapePayload.json +0 -5
  187. package/es/useAppContext.js +0 -8
  188. package/lib/mocks/appliancePayload.json +0 -27
  189. package/lib/mocks/cabinetPayload.json +0 -1914
  190. package/lib/mocks/cabinetPayload2.json +0 -76
  191. package/lib/mocks/dataBundle2.json +0 -4
  192. package/lib/mocks/distancePayload.json +0 -6
  193. package/lib/mocks/doorStylePayload2.json +0 -84
  194. package/lib/mocks/furnishingPayload.json +0 -23
  195. package/lib/mocks/itemCDSPayload.json +0 -27
  196. package/lib/mocks/lightingPayload.json +0 -23
  197. package/lib/mocks/mockProps.json +0 -43
  198. package/lib/mocks/mockProps2.json +0 -9
  199. package/lib/mocks/moldingPayload.json +0 -19
  200. package/lib/mocks/projectItemsCatalog.json +0 -133
  201. package/lib/mocks/rectangleShape.json +0 -238
  202. package/lib/mocks/replaceCabinetPayload.json +0 -81
  203. package/lib/mocks/roomShapePayload.json +0 -5
  204. package/lib/useAppContext.js +0 -16
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _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; }
5
5
  import React, { useEffect, useRef, useState } from 'react';
6
6
  import PropTypes from 'prop-types';
7
- import { INITIAL_VALUE, POSITION_NONE, ReactSVGPanZoom, TOOL_AUTO, TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT } from 'react-svg-pan-zoom';
7
+ import { ReactSVGPanZoom, TOOL_AUTO, TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT } from 'react-svg-pan-zoom';
8
8
  import * as constants from "../../constants";
9
9
  import { DECIMAL_PLACES_2, LINE_THICKNESS, MIN_ANGLE_DISALLOW_DRAW_WALL, MODE_ELEVATION_VIEW, MODE_IDLE, UNIT_ANGLE, INTERNAL_EVENT_SELECT_ELEMENT, INTERNAL_EVENT_DRAG_ELEMENT, INTERNAL_EVENT_DRAW_ELEMENT, INTERNAL_EVENT_ROTATE_ELEMENT } from "../../constants";
10
10
  import State from "./state";
@@ -15,10 +15,8 @@ import FormNumberInput from "../style/form-number-input";
15
15
  import { convert } from "../../utils/convert-units-lite";
16
16
  import { Map } from 'immutable';
17
17
  import { formatNumber } from "../../utils/math";
18
- import { isEmpty } from "../../utils/helper"; // variables
18
+ import { isEmpty, updatePayloadOfInternalEvent } from "../../utils/helper"; // variables
19
19
  import { isWarningItem } from "./utils";
20
- import { MoldingUtils } from "../../utils/export";
21
- import { useAppContext } from "../../useAppContext";
22
20
  // variables
23
21
  var pinFlag = false;
24
22
  var sFlag = false; //for all object move
@@ -122,22 +120,21 @@ function extractElementData(node) {
122
120
  direct: node.attributes.getNamedItem('data-direct') ? node.attributes.getNamedItem('data-direct').value : 0
123
121
  };
124
122
  }
125
- export default function Viewer2D(_ref) {
123
+ export default function Viewer2D(_ref, _ref2) {
126
124
  var state = _ref.state,
127
125
  width = _ref.width,
128
126
  height = _ref.height,
129
127
  setToolbar = _ref.setToolbar,
130
128
  replaceCabinet = _ref.replaceCabinet,
131
129
  onInternalEvent = _ref.onInternalEvent;
132
- var _useAppContext = useAppContext(),
133
- viewer2DActions = _useAppContext.viewer2DActions,
134
- linesActions = _useAppContext.linesActions,
135
- holesActions = _useAppContext.holesActions,
136
- verticesActions = _useAppContext.verticesActions,
137
- itemsActions = _useAppContext.itemsActions,
138
- areaActions = _useAppContext.areaActions,
139
- projectActions = _useAppContext.projectActions,
140
- catalog = _useAppContext.catalog;
130
+ var viewer2DActions = _ref2.viewer2DActions,
131
+ linesActions = _ref2.linesActions,
132
+ holesActions = _ref2.holesActions,
133
+ verticesActions = _ref2.verticesActions,
134
+ itemsActions = _ref2.itemsActions,
135
+ areaActions = _ref2.areaActions,
136
+ projectActions = _ref2.projectActions,
137
+ catalog = _ref2.catalog;
141
138
  var _useState = useState(null),
142
139
  _useState2 = _slicedToArray(_useState, 2),
143
140
  rulerEdit = _useState2[0],
@@ -160,26 +157,6 @@ export default function Viewer2D(_ref) {
160
157
  _useState8 = _slicedToArray(_useState7, 2),
161
158
  drawStart = _useState8[0],
162
159
  setdrawStart = _useState8[1];
163
- var _useState9 = useState(function () {
164
- return viewer2D && !viewer2D.isEmpty() ? viewer2D.toJS() : INITIAL_VALUE;
165
- }),
166
- _useState0 = _slicedToArray(_useState9, 2),
167
- svgValue = _useState0[0],
168
- setSvgValue = _useState0[1];
169
- var _useState1 = useState(function () {
170
- return mode2Tool(mode);
171
- }),
172
- _useState10 = _slicedToArray(_useState1, 2),
173
- svgTool = _useState10[0],
174
- setSvgTool = _useState10[1];
175
- useEffect(function () {
176
- // keep tool controlled from app mode
177
- setSvgTool(mode2Tool(mode));
178
- }, [mode]);
179
- useEffect(function () {
180
- // keep value controlled from store, but never null
181
- if (viewer2D && !viewer2D.isEmpty()) setSvgValue(viewer2D.toJS());
182
- }, [viewer2D]);
183
160
  useEffect(function () {
184
161
  // move viewer point to center
185
162
  var selectedLayer = state.scene.layers.get(state.scene.selectedLayer);
@@ -204,9 +181,9 @@ export default function Viewer2D(_ref) {
204
181
  var layerID = scene.selectedLayer;
205
182
  var wall_thickness = LINE_THICKNESS / 2;
206
183
  var layer = scene.getIn(['layers', layerID]);
207
- var mapCursorPosition = function mapCursorPosition(_ref2) {
208
- var x = _ref2.x,
209
- y = _ref2.y;
184
+ var mapCursorPosition = function mapCursorPosition(_ref3) {
185
+ var x = _ref3.x,
186
+ y = _ref3.y;
210
187
  return {
211
188
  x: x,
212
189
  y: -y + scene.height
@@ -855,15 +832,21 @@ export default function Viewer2D(_ref) {
855
832
  var onMouseUp = function onMouseUp(viewerEvent) {
856
833
  //set move all flag false
857
834
  sFlag = false;
858
- // //////////////////////
859
- // setRulerEdit(null);
860
835
  var event = viewerEvent.originalEvent;
861
- var bbox = event.target.getBoundingClientRect();
836
+ var parent = document.querySelector('#kitchen-simulator-container');
837
+ var targetRect = event.target.getBoundingClientRect();
838
+ var left = targetRect.left;
839
+ var top = targetRect.top;
840
+ if (!isEmpty(parent)) {
841
+ var parentRect = parent.getBoundingClientRect();
842
+ left = targetRect.left - parentRect.left;
843
+ top = targetRect.top - parentRect.top;
844
+ left = left - (200 - targetRect.width) / 2;
845
+ top = top - (50 - targetRect.height) / 2;
846
+ }
862
847
  if (!mode.includes('ING')) {
863
848
  setToolbar('');
864
849
  }
865
- // bbox.width = event.target.getBBox().width;
866
- // bbox.height = event.target.getBBox().height;
867
850
  if (event.target.tagName === 'rect') {
868
851
  if (event.target.id) {
869
852
  setRulerEditID(event.target.id);
@@ -952,6 +935,7 @@ export default function Viewer2D(_ref) {
952
935
  // handle action when click elevation about selected line
953
936
  var _mode = MODE_ELEVATION_VIEW;
954
937
  projectActions.setMode(_mode);
938
+ internalType = constants.INTERNAL_EVENT_TOGGLE_TO_ELEVATION;
955
939
  break;
956
940
  } else {
957
941
  var tlines = [];
@@ -995,8 +979,8 @@ export default function Viewer2D(_ref) {
995
979
  id: "ruler_numberInput",
996
980
  style: {
997
981
  position: 'absolute',
998
- left: bbox.left - (150 - bbox.width) / 2,
999
- top: bbox.top - (50 - bbox.height) / 2,
982
+ left: left,
983
+ top: top,
1000
984
  zIndex: 1000
1001
985
  }
1002
986
  }, /*#__PURE__*/React.createElement(FormNumberInput, {
@@ -1027,8 +1011,8 @@ export default function Viewer2D(_ref) {
1027
1011
  id: "ruler_numberInput",
1028
1012
  style: {
1029
1013
  position: 'absolute',
1030
- left: bbox.left - (150 - bbox.width) / 2,
1031
- top: bbox.top - (50 - bbox.height) / 2,
1014
+ left: left,
1015
+ top: top,
1032
1016
  zIndex: 1000
1033
1017
  }
1034
1018
  }, /*#__PURE__*/React.createElement(FormNumberInput, {
@@ -1060,8 +1044,8 @@ export default function Viewer2D(_ref) {
1060
1044
  id: "ruler_numberInput",
1061
1045
  style: {
1062
1046
  position: 'absolute',
1063
- left: bbox.left - (150 - bbox.width) / 2,
1064
- top: bbox.top - (50 - bbox.height) / 2,
1047
+ left: left,
1048
+ top: top,
1065
1049
  zIndex: 1000
1066
1050
  }
1067
1051
  }, /*#__PURE__*/React.createElement(FormNumberInput, {
@@ -1093,8 +1077,8 @@ export default function Viewer2D(_ref) {
1093
1077
  id: "ruler_numberInput",
1094
1078
  style: {
1095
1079
  position: 'absolute',
1096
- left: bbox.left - (150 - bbox.width) / 2,
1097
- top: bbox.top - (50 - bbox.height) / 2,
1080
+ left: left,
1081
+ top: top,
1098
1082
  zIndex: 1000
1099
1083
  }
1100
1084
  }, /*#__PURE__*/React.createElement(FormNumberInput, {
@@ -1126,8 +1110,8 @@ export default function Viewer2D(_ref) {
1126
1110
  id: "ruler_numberInput",
1127
1111
  style: {
1128
1112
  position: 'absolute',
1129
- left: bbox.left - (150 - bbox.width) / 2,
1130
- top: bbox.top - (50 - bbox.height) / 2,
1113
+ left: left,
1114
+ top: top,
1131
1115
  zIndex: 1000
1132
1116
  }
1133
1117
  }, /*#__PURE__*/React.createElement(FormNumberInput, {
@@ -1159,8 +1143,8 @@ export default function Viewer2D(_ref) {
1159
1143
  id: "ruler_numberInput",
1160
1144
  style: {
1161
1145
  position: 'absolute',
1162
- left: bbox.left - (150 - bbox.width) / 2,
1163
- top: bbox.top - (50 - bbox.height) / 2,
1146
+ left: left,
1147
+ top: top,
1164
1148
  zIndex: 1000
1165
1149
  }
1166
1150
  }, /*#__PURE__*/React.createElement(FormNumberInput, {
@@ -1191,8 +1175,8 @@ export default function Viewer2D(_ref) {
1191
1175
  id: "ruler_numberInput",
1192
1176
  style: {
1193
1177
  position: 'absolute',
1194
- left: bbox.left - (150 - bbox.width) / 2,
1195
- top: bbox.top - (50 - bbox.height) / 2,
1178
+ left: left,
1179
+ top: top,
1196
1180
  zIndex: 1000
1197
1181
  }
1198
1182
  }, /*#__PURE__*/React.createElement(FormNumberInput, {
@@ -1273,24 +1257,7 @@ export default function Viewer2D(_ref) {
1273
1257
  _currentObject = state.getIn(['scene', 'layers', layerID, elementPrototype, elementID]);
1274
1258
  }
1275
1259
  if (_currentObject) {
1276
- var _currentObject3, _currentObject4, _currentObject5;
1277
- var payload = (_currentObject3 = _currentObject) === null || _currentObject3 === void 0 ? void 0 : _currentObject3.toJS();
1278
- if (((_currentObject4 = _currentObject) === null || _currentObject4 === void 0 ? void 0 : _currentObject4.prototype) === 'lines') {
1279
- // caculating length of selected line//
1280
- var v_a = layer.vertices.get(_currentObject.vertices.get(0));
1281
- var v_b = layer.vertices.get(_currentObject.vertices.get(1));
1282
- var distance = GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
1283
- var _length3 = convert(distance).from('cm').to('in');
1284
- payload.length = _length3;
1285
- //////////////////////////////////////
1286
- } else if (((_currentObject5 = _currentObject) === null || _currentObject5 === void 0 ? void 0 : _currentObject5.prototype) === 'items') {
1287
- // check this cabinet has warning box
1288
- payload.isWarning = isWarningItem(_currentObject);
1289
- // check this item is available molding
1290
- payload.isMoldingAvailable = MoldingUtils.isEnableItemForMolding(layer, _currentObject);
1291
- // check this item is snapped to wall
1292
- payload.isAttachedWall = MoldingUtils.isAttachedWall(layer, _currentObject);
1293
- }
1260
+ var payload = updatePayloadOfInternalEvent(_currentObject, layer, catalog);
1294
1261
 
1295
1262
  // send selection event befor replace event
1296
1263
  if (internalType === constants.INTERNAL_EVENT_REPLACE_CABINET) {
@@ -1309,7 +1276,6 @@ export default function Viewer2D(_ref) {
1309
1276
  };
1310
1277
  var onChangeValue = function onChangeValue(value) {
1311
1278
  if (sFlag) return;
1312
- setSvgValue(value);
1313
1279
  var _zoomValue = parseInt((value.a - 0.5) / constants.ZOOM_VARIABLE);
1314
1280
  if (_zoomValue > constants.MAX_ZOOM_IN_SCALE) return;
1315
1281
  if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
@@ -1322,8 +1288,6 @@ export default function Viewer2D(_ref) {
1322
1288
  var bbox;
1323
1289
  if (_rect && _rulerEdit) {
1324
1290
  bbox = _rect.getBoundingClientRect();
1325
- // bbox.width = _rect.getBBox().width;
1326
- // bbox.height = _rect.getBBox().height;
1327
1291
  _rulerEdit.style.left = "".concat(bbox.left - (150 - bbox.width) / 2, "px");
1328
1292
  _rulerEdit.style.top = "".concat(bbox.top - (50 - bbox.height) / 2, "px");
1329
1293
  }
@@ -1341,7 +1305,6 @@ export default function Viewer2D(_ref) {
1341
1305
  }
1342
1306
  };
1343
1307
  var onChangeTool = function onChangeTool(tool) {
1344
- setSvgTool(tool);
1345
1308
  switch (tool) {
1346
1309
  case TOOL_NONE:
1347
1310
  projectActions.selectToolEdit();
@@ -1440,23 +1403,19 @@ export default function Viewer2D(_ref) {
1440
1403
  },
1441
1404
  width: width - rulerSize,
1442
1405
  height: height - rulerSize,
1443
- value: svgValue,
1444
- tool: svgTool,
1406
+ value: viewer2D.isEmpty() ? null : viewer2D.toJS(),
1445
1407
  onChangeValue: onChangeValue,
1408
+ tool: mode2Tool(mode),
1446
1409
  onChangeTool: onChangeTool,
1447
1410
  detectAutoPan: mode2DetectAutopan(mode),
1448
1411
  onMouseDown: onMouseDown,
1449
1412
  onMouseMove: onMouseMove,
1450
1413
  onMouseUp: onMouseUp,
1414
+ miniaturePosition: "none",
1415
+ toolbarPosition: "none",
1451
1416
  detectPinchGesture: false,
1452
1417
  disableDoubleClickZoomWithToolAuto: true,
1453
- ref: Viewer,
1454
- miniatureProps: {
1455
- position: POSITION_NONE
1456
- },
1457
- toolbarProps: {
1458
- position: POSITION_NONE
1459
- }
1418
+ ref: Viewer
1460
1419
  }, /*#__PURE__*/React.createElement("svg", {
1461
1420
  width: scene.width,
1462
1421
  height: scene.height
@@ -1491,4 +1450,14 @@ Viewer2D.propTypes = {
1491
1450
  state: PropTypes.object.isRequired,
1492
1451
  width: PropTypes.number.isRequired,
1493
1452
  height: PropTypes.number.isRequired
1453
+ };
1454
+ Viewer2D.contextTypes = {
1455
+ viewer2DActions: PropTypes.object.isRequired,
1456
+ linesActions: PropTypes.object.isRequired,
1457
+ holesActions: PropTypes.object.isRequired,
1458
+ verticesActions: PropTypes.object.isRequired,
1459
+ itemsActions: PropTypes.object.isRequired,
1460
+ areaActions: PropTypes.object.isRequired,
1461
+ projectActions: PropTypes.object.isRequired,
1462
+ catalog: PropTypes.object.isRequired
1494
1463
  };
@@ -14,7 +14,7 @@ export default function Scene3D(_ref) {
14
14
  downloadFlag = _ref.downloadFlag;
15
15
  var layers = scene.layers;
16
16
  var selectedLayer = layers.get(scene.selectedLayer);
17
- var ceilHeight = selectedLayer.ceilHeight;
17
+ var ceilHeight = Number(selectedLayer.ceilHeight);
18
18
  var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
19
19
  var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
20
20
  var vertex1 = selectedLayer.vertices.get(selectedLine.vertices.get(1));