kitchen-simulator 10.3.0 → 11.0.0-react-18

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 (41) hide show
  1. package/es/LiteKitchenConfigurator.js +11 -42
  2. package/es/LiteRenderer.js +24 -2
  3. package/es/actions/export.js +12 -25
  4. package/es/components/content.js +0 -3
  5. package/es/components/export.js +4 -6
  6. package/es/components/style/form-number-input.js +5 -7
  7. package/es/components/viewer2d/group.js +5 -6
  8. package/es/components/viewer2d/item.js +5 -6
  9. package/es/components/viewer2d/line.js +47 -18
  10. package/es/components/viewer2d/rulerX.js +8 -9
  11. package/es/components/viewer2d/rulerY.js +8 -9
  12. package/es/components/viewer2d/scene.js +9 -9
  13. package/es/components/viewer2d/state.js +1 -1
  14. package/es/components/viewer2d/viewer2d.js +28 -32
  15. package/es/components/viewer3d/viewer3d-first-person.js +8 -13
  16. package/es/components/viewer3d/viewer3d.js +8 -15
  17. package/es/utils/helper.js +0 -68
  18. package/lib/LiteKitchenConfigurator.js +11 -42
  19. package/lib/LiteRenderer.js +25 -3
  20. package/lib/actions/export.js +39 -35
  21. package/lib/components/content.js +0 -3
  22. package/lib/components/export.js +16 -6
  23. package/lib/components/style/form-number-input.js +5 -7
  24. package/lib/components/viewer2d/group.js +5 -6
  25. package/lib/components/viewer2d/item.js +4 -5
  26. package/lib/components/viewer2d/line.js +47 -18
  27. package/lib/components/viewer2d/rulerX.js +8 -9
  28. package/lib/components/viewer2d/rulerY.js +8 -9
  29. package/lib/components/viewer2d/scene.js +9 -9
  30. package/lib/components/viewer2d/state.js +1 -1
  31. package/lib/components/viewer2d/viewer2d.js +26 -30
  32. package/lib/components/viewer3d/viewer3d-first-person.js +8 -13
  33. package/lib/components/viewer3d/viewer3d.js +8 -15
  34. package/lib/utils/helper.js +1 -69
  35. package/package.json +6 -21
  36. package/es/analytics/ga4.js +0 -188
  37. package/es/components/style/form-submit-button.js +0 -25
  38. package/es/devLiteRenderer.js +0 -926
  39. package/lib/analytics/ga4.js +0 -194
  40. package/lib/components/style/form-submit-button.js +0 -35
  41. package/lib/devLiteRenderer.js +0 -930
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
6
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
7
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
@@ -314,41 +313,20 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
314
313
  var el = document.getElementById('add_appliances_inactive');
315
314
  if (el !== null && el !== void 0 && (_el$parentElement0 = el.parentElement) !== null && _el$parentElement0 !== void 0 && _el$parentElement0.parentElement) el.parentElement.parentElement.style.zIndex = 6;
316
315
  }
317
- }, {
318
- key: "getChildContext",
319
- value: function getChildContext() {
320
- var _this2 = this;
321
- return _objectSpread(_objectSpread({}, objectsMap(actions, function (actionNamespace) {
322
- return _this2.props[actionNamespace];
323
- })), {}, {
324
- translator: this.props.translator,
325
- catalog: this.props.catalog
326
- });
327
- }
328
316
  }, {
329
317
  key: "componentDidMount",
330
318
  value: function componentDidMount() {
331
319
  window.forRedo = [];
332
- var store = this.context.store;
333
- var _this$props = this.props,
334
- stateExtractor = _this$props.stateExtractor,
335
- plugins = _this$props.plugins;
336
-
337
- // keep old behavior: run plugins once on mount
338
- var newplugins = _toConsumableArray(plugins);
339
- newplugins.forEach(function (newplugin) {
340
- return newplugin(store, stateExtractor);
341
- });
342
320
  }
343
321
  }, {
344
322
  key: "componentDidUpdate",
345
323
  value: function componentDidUpdate(prevProps) {
346
324
  var _extractedState$getIn;
347
- var _this$props2 = this.props,
348
- externalEvent = _this$props2.externalEvent,
349
- extractedState = _this$props2.extractedState,
350
- projectActions = _this$props2.projectActions,
351
- catalog = _this$props2.catalog;
325
+ var _this$props = this.props,
326
+ externalEvent = _this$props.externalEvent,
327
+ extractedState = _this$props.extractedState,
328
+ projectActions = _this$props.projectActions,
329
+ catalog = _this$props.catalog;
352
330
 
353
331
  // same behavior: handle external event when it changes
354
332
  if (prevProps.externalEvent !== externalEvent) {
@@ -407,11 +385,11 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
407
385
  }, {
408
386
  key: "render",
409
387
  value: function render() {
410
- var _this$props3 = this.props,
411
- width = _this$props3.width,
412
- height = _this$props3.height,
413
- extractedState = _this$props3.extractedState,
414
- props = _objectWithoutProperties(_this$props3, _excluded);
388
+ var _this$props2 = this.props,
389
+ width = _this$props2.width,
390
+ height = _this$props2.height,
391
+ extractedState = _this$props2.extractedState,
392
+ props = _objectWithoutProperties(_this$props2, _excluded);
415
393
  var _this$state = this.state,
416
394
  savePopupVisible = _this$state.savePopupVisible,
417
395
  quotePopupVisible = _this$state.quotePopupVisible,
@@ -477,15 +455,6 @@ LiteKitchenConfigurator.propTypes = {
477
455
  // ✅ injected by connect
478
456
  externalEvent: PropTypes.object
479
457
  };
480
- LiteKitchenConfigurator.contextTypes = {
481
- store: PropTypes.object.isRequired
482
- };
483
- LiteKitchenConfigurator.childContextTypes = _objectSpread(_objectSpread({}, objectsMap(actions, function () {
484
- return PropTypes.object;
485
- })), {}, {
486
- translator: PropTypes.object,
487
- catalog: PropTypes.object
488
- });
489
458
  LiteKitchenConfigurator.defaultProps = {
490
459
  translator: new Translator(),
491
460
  catalog: new Catalog(),
@@ -11,7 +11,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
11
11
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
12
12
  import PropTypes from 'prop-types';
13
13
  import { Provider } from 'react-redux';
14
- import { createStore } from 'redux';
14
+ import { createStore, bindActionCreators } from 'redux';
15
15
  import { Map } from 'immutable';
16
16
  import * as Sentry from '@sentry/react';
17
17
  import * as THREE from 'three';
@@ -20,11 +20,14 @@ import { State } from "./models";
20
20
  import PlannerReducer from "./reducers/reducer";
21
21
  import AppContext from "./AppContext";
22
22
  import Catalog from "./catalog/catalog";
23
+ import actions from "./actions/export";
24
+ import Translator from "./translator/translator";
23
25
  import * as Areas from "./catalog/areas/area/planner-element";
24
26
  import * as Lines from "./catalog/lines/wall/planner-element";
25
27
  import { buildHoleElements, registerDynamicHoles } from "./mappings/holesToCatalog";
26
28
  import { ConsoleDebugger, Keyboard } from "./plugins/export";
27
29
  import LiteKitchenConfigurator from "./LiteKitchenConfigurator";
30
+ import { objectsMap } from "./utils/objects-utils";
28
31
  var isBrowser = typeof window !== 'undefined';
29
32
  if (isBrowser) window.THREE = THREE;
30
33
 
@@ -274,7 +277,26 @@ export default function LiteRenderer(props) {
274
277
  var _ref = configData || {},
275
278
  logoImg = _ref.logoImg,
276
279
  companyUrl = _ref.companyUrl;
277
- return /*#__PURE__*/React.createElement(AppContext.Provider, null, /*#__PURE__*/React.createElement(Provider, {
280
+
281
+ // Build the context value with bound action creators + translator + catalog
282
+ var translatorRef = useRef(null);
283
+ if (!translatorRef.current) translatorRef.current = new Translator();
284
+ var contextValue = useMemo(function () {
285
+ var store = storeRef.current;
286
+ var boundActions = objectsMap(actions, function (actionNamespace) {
287
+ return bindActionCreators(actions[actionNamespace], store.dispatch);
288
+ });
289
+ return _objectSpread(_objectSpread({}, boundActions), {}, {
290
+ translator: translatorRef.current,
291
+ catalog: catalogRef.current
292
+ });
293
+ }, []);
294
+
295
+ // Update catalog in context when it changes
296
+ contextValue.catalog = catalogRef.current;
297
+ return /*#__PURE__*/React.createElement(AppContext.Provider, {
298
+ value: contextValue
299
+ }, /*#__PURE__*/React.createElement(Provider, {
278
300
  store: storeRef.current
279
301
  }, /*#__PURE__*/React.createElement(LiteKitchenConfigurator, _extends({
280
302
  catalog: catalogRef.current,
@@ -8,29 +8,16 @@ import * as verticesActions from "./vertices-actions";
8
8
  import * as itemsActions from "./items-actions";
9
9
  import * as areaActions from "./area-actions";
10
10
  import * as groupsActions from "./groups-actions";
11
-
12
- export {
13
- projectActions,
14
- viewer2DActions,
15
- viewer3DActions,
16
- linesActions,
17
- holesActions,
18
- sceneActions,
19
- verticesActions,
20
- itemsActions,
21
- areaActions,
22
- groupsActions
23
- };
24
-
11
+ export { projectActions, viewer2DActions, viewer3DActions, linesActions, holesActions, sceneActions, verticesActions, itemsActions, areaActions, groupsActions };
25
12
  export default {
26
- projectActions,
27
- viewer2DActions,
28
- viewer3DActions,
29
- linesActions,
30
- holesActions,
31
- sceneActions,
32
- verticesActions,
33
- itemsActions,
34
- areaActions,
35
- groupsActions
36
- };
13
+ projectActions: projectActions,
14
+ viewer2DActions: viewer2DActions,
15
+ viewer3DActions: viewer3DActions,
16
+ linesActions: linesActions,
17
+ holesActions: holesActions,
18
+ sceneActions: sceneActions,
19
+ verticesActions: verticesActions,
20
+ itemsActions: itemsActions,
21
+ areaActions: areaActions,
22
+ groupsActions: groupsActions
23
+ };
@@ -131,7 +131,4 @@ Content.propTypes = {
131
131
  height: PropTypes.number.isRequired,
132
132
  replaceCabinet: PropTypes.func.isRequired,
133
133
  onInternalEvent: PropTypes.func.isRequired
134
- };
135
- Content.contextTypes = {
136
- projectActions: PropTypes.object.isRequired
137
134
  };
@@ -1,7 +1,5 @@
1
1
  import Content from "./content";
2
- import Viewer2DComponents from "./viewer2d/export";
3
- import StyleComponents from "./style/export";
4
-
5
- export { Content, Viewer2DComponents, StyleComponents };
6
-
7
- export default { Content, Viewer2DComponents, StyleComponents };
2
+ export { Content };
3
+ export default {
4
+ Content: Content
5
+ };
@@ -3,12 +3,14 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
4
4
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
5
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
7
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
7
8
  var _templateObject;
8
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
11
  import React, { Component } from 'react';
11
12
  import PropTypes from 'prop-types';
13
+ import AppContext from "../../AppContext";
12
14
  import { KEYBOARD_BUTTON_CODE, TEXT_COLOR_NEUTRAL_0, SECONDARY_PURPLE_COLOR, DEFAULT_FONT_FAMILY } from "../../constants";
13
15
  import styled from 'styled-components';
14
16
  import { isValidNumber } from "../../utils/helper";
@@ -38,8 +40,8 @@ var FormNumberInput = /*#__PURE__*/function (_Component) {
38
40
  }
39
41
  }
40
42
  }, {
41
- key: "componentWillReceiveProps",
42
- value: function componentWillReceiveProps(nextProps) {
43
+ key: "UNSAFE_componentWillReceiveProps",
44
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
43
45
  if (this.props.value !== nextProps.value || this.props.focus !== nextProps.focus) {
44
46
  this.setState({
45
47
  showedValue: nextProps.value,
@@ -153,6 +155,7 @@ var FormNumberInput = /*#__PURE__*/function (_Component) {
153
155
  }
154
156
  }]);
155
157
  }(Component);
158
+ _defineProperty(FormNumberInput, "contextType", AppContext);
156
159
  export { FormNumberInput as default };
157
160
  FormNumberInput.propTypes = {
158
161
  value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -167,11 +170,6 @@ FormNumberInput.propTypes = {
167
170
  labelName: PropTypes.string,
168
171
  isCeiling: PropTypes.string
169
172
  };
170
- FormNumberInput.contextTypes = {
171
- translator: PropTypes.object.isRequired,
172
- projectActions: PropTypes.object.isRequired,
173
- linesActions: PropTypes.object.isRequired
174
- };
175
173
  FormNumberInput.defaultProps = {
176
174
  value: 0,
177
175
  style: {},
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import React, { useContext } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import AppContext from "../../AppContext";
3
4
  import If from "../../utils/react-if";
4
5
  import * as sharedStyles from "../../shared-style";
5
6
  var cx = 0;
@@ -10,12 +11,13 @@ var STYLE_CIRCLE = {
10
11
  stroke: sharedStyles.MATERIAL_COLORS[500].orange,
11
12
  cursor: 'default'
12
13
  };
13
- export default function Group(_ref, _ref2) {
14
+ export default function Group(_ref) {
14
15
  var layer = _ref.layer,
15
16
  group = _ref.group,
16
17
  scene = _ref.scene,
17
18
  catalog = _ref.catalog;
18
- var translator = _ref2.translator;
19
+ var _useContext = useContext(AppContext),
20
+ translator = _useContext.translator;
19
21
  return /*#__PURE__*/React.createElement("g", {
20
22
  "data-element-root": true,
21
23
  "data-prototype": group.prototype,
@@ -47,7 +49,4 @@ Group.propTypes = {
47
49
  layer: PropTypes.object.isRequired,
48
50
  scene: PropTypes.object.isRequired,
49
51
  catalog: PropTypes.object.isRequired
50
- };
51
- Group.contextTypes = {
52
- translator: PropTypes.object.isRequired
53
52
  };
@@ -1,6 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React, { useState } from 'react';
2
+ import React, { useContext, useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import AppContext from "../../AppContext";
4
5
  import RulerDist from "./rulerDist";
5
6
  import { convert } from "../../utils/convert-units-lite";
6
7
  import { GeometryUtils } from "../../utils/export";
@@ -21,14 +22,15 @@ var STYLE_CIRCLE2 = {
21
22
  stroke: '#0096fd',
22
23
  cursor: 'ew-resize'
23
24
  };
24
- export default function Item(_ref, _ref2) {
25
+ export default function Item(_ref) {
25
26
  var _element$render2D;
26
27
  var layer = _ref.layer,
27
28
  item = _ref.item,
28
29
  scene = _ref.scene,
29
30
  catalog = _ref.catalog,
30
31
  mode = _ref.mode;
31
- var itemsActions = _ref2.itemsActions;
32
+ var _useContext = useContext(AppContext),
33
+ itemsActions = _useContext.itemsActions;
32
34
  var _useState = useState(false),
33
35
  _useState2 = _slicedToArray(_useState, 2),
34
36
  clockRotateState = _useState2[0],
@@ -229,7 +231,4 @@ Item.propTypes = {
229
231
  layer: PropTypes.object.isRequired,
230
232
  scene: PropTypes.object.isRequired,
231
233
  catalog: PropTypes.object.isRequired
232
- };
233
- Item.contextTypes = {
234
- itemsActions: PropTypes.object.isRequired
235
234
  };
@@ -247,11 +247,13 @@ export default function Line(_ref) {
247
247
  if (!showWallCabinetMeasure || wall_posArray.length <= 2) {
248
248
  wallSpace = 0;
249
249
  }
250
- wallRuler = wall_posAndwidth.map(function (pAw) {
250
+ wallRuler = wall_posAndwidth.map(function (pAw, pAwIdx) {
251
251
  if (pAw.length > 1) {
252
252
  if (Math.sin(angle) === 0 || GeometryUtils.almostEqual(y1, y2)) {
253
253
  if (x1 - x2 > 0) {
254
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
254
+ return /*#__PURE__*/React.createElement("g", {
255
+ key: "wall_".concat(pAwIdx)
256
+ }, /*#__PURE__*/React.createElement("line", {
255
257
  x1: pAw.pos.x + pAw.length,
256
258
  y1: pAw.pos.y,
257
259
  x2: pAw.pos.x + pAw.length,
@@ -273,7 +275,9 @@ export default function Line(_ref) {
273
275
  style: STYLE_DASH
274
276
  }));
275
277
  } else {
276
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
278
+ return /*#__PURE__*/React.createElement("g", {
279
+ key: "wall_".concat(pAwIdx)
280
+ }, /*#__PURE__*/React.createElement("line", {
277
281
  x1: pAw.pos.x + pAw.length,
278
282
  y1: pAw.pos.y,
279
283
  x2: pAw.pos.x + pAw.length,
@@ -298,7 +302,9 @@ export default function Line(_ref) {
298
302
  } else {
299
303
  if (y1 - y2 > 0) {
300
304
  if (x1 - x2 < 0 || GeometryUtils.almostEqual(x1, x2)) {
301
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
305
+ return /*#__PURE__*/React.createElement("g", {
306
+ key: "wall_".concat(pAwIdx)
307
+ }, /*#__PURE__*/React.createElement("line", {
302
308
  x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
303
309
  y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
304
310
  x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
@@ -320,7 +326,9 @@ export default function Line(_ref) {
320
326
  style: STYLE_DASH
321
327
  }));
322
328
  } else {
323
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
329
+ return /*#__PURE__*/React.createElement("g", {
330
+ key: "wall_".concat(pAwIdx)
331
+ }, /*#__PURE__*/React.createElement("line", {
324
332
  x1: pAw.pos.x,
325
333
  y1: pAw.pos.y,
326
334
  x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
@@ -344,7 +352,9 @@ export default function Line(_ref) {
344
352
  }
345
353
  } else {
346
354
  if (x1 - x2 < 0 || GeometryUtils.almostEqual(x1, x2)) {
347
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
355
+ return /*#__PURE__*/React.createElement("g", {
356
+ key: "wall_".concat(pAwIdx)
357
+ }, /*#__PURE__*/React.createElement("line", {
348
358
  x1: pAw.pos.x,
349
359
  y1: pAw.pos.y,
350
360
  x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
@@ -366,7 +376,9 @@ export default function Line(_ref) {
366
376
  style: STYLE_DASH
367
377
  }));
368
378
  } else {
369
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
379
+ return /*#__PURE__*/React.createElement("g", {
380
+ key: "wall_".concat(pAwIdx)
381
+ }, /*#__PURE__*/React.createElement("line", {
370
382
  x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
371
383
  y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
372
384
  x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
@@ -459,11 +471,13 @@ export default function Line(_ref) {
459
471
  if (!showBaseCabinetMeasure || base_posArray.length <= 2) {
460
472
  baseSpace -= STEP;
461
473
  }
462
- baseRuler = base_posAndwidth.map(function (pAw) {
474
+ baseRuler = base_posAndwidth.map(function (pAw, pAwIdx) {
463
475
  if (pAw.length > 1) {
464
476
  if (Math.sin(angle) === 0 || GeometryUtils.almostEqual(y1, y2)) {
465
477
  if (x1 - x2 > 0) {
466
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
478
+ return /*#__PURE__*/React.createElement("g", {
479
+ key: "base_".concat(pAwIdx)
480
+ }, /*#__PURE__*/React.createElement("line", {
467
481
  x1: pAw.pos.x + pAw.length,
468
482
  y1: pAw.pos.y,
469
483
  x2: pAw.pos.x + pAw.length,
@@ -485,7 +499,9 @@ export default function Line(_ref) {
485
499
  style: STYLE_DASH
486
500
  }));
487
501
  } else {
488
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
502
+ return /*#__PURE__*/React.createElement("g", {
503
+ key: "base_".concat(pAwIdx)
504
+ }, /*#__PURE__*/React.createElement("line", {
489
505
  x1: pAw.pos.x + pAw.length,
490
506
  y1: pAw.pos.y,
491
507
  x2: pAw.pos.x + pAw.length,
@@ -510,7 +526,9 @@ export default function Line(_ref) {
510
526
  } else {
511
527
  if (y1 - y2 > 0) {
512
528
  if (x1 - x2 < 0 || GeometryUtils.almostEqual(x1, x2)) {
513
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
529
+ return /*#__PURE__*/React.createElement("g", {
530
+ key: "base_".concat(pAwIdx)
531
+ }, /*#__PURE__*/React.createElement("line", {
514
532
  x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
515
533
  y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
516
534
  x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
@@ -532,7 +550,9 @@ export default function Line(_ref) {
532
550
  style: STYLE_DASH
533
551
  }));
534
552
  } else {
535
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
553
+ return /*#__PURE__*/React.createElement("g", {
554
+ key: "base_".concat(pAwIdx)
555
+ }, /*#__PURE__*/React.createElement("line", {
536
556
  x1: pAw.pos.x,
537
557
  y1: pAw.pos.y,
538
558
  x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
@@ -556,7 +576,9 @@ export default function Line(_ref) {
556
576
  }
557
577
  } else {
558
578
  if (x1 - x2 < 0 || GeometryUtils.almostEqual(x1, x2)) {
559
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
579
+ return /*#__PURE__*/React.createElement("g", {
580
+ key: "base_".concat(pAwIdx)
581
+ }, /*#__PURE__*/React.createElement("line", {
560
582
  x1: pAw.pos.x,
561
583
  y1: pAw.pos.y,
562
584
  x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
@@ -578,7 +600,9 @@ export default function Line(_ref) {
578
600
  style: STYLE_DASH
579
601
  }));
580
602
  } else {
581
- return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
603
+ return /*#__PURE__*/React.createElement("g", {
604
+ key: "base_".concat(pAwIdx)
605
+ }, /*#__PURE__*/React.createElement("line", {
582
606
  x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
583
607
  y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
584
608
  x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
@@ -652,14 +676,15 @@ export default function Line(_ref) {
652
676
  //the space from the dimensioning line to the bottom
653
677
  var lineSpacedimension2 = 14;
654
678
  if (compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
655
- renderedRuler.push(/*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
679
+ renderedRuler.push(/*#__PURE__*/React.createElement("g", {
680
+ key: "ruler-a"
681
+ }, /*#__PURE__*/React.createElement("line", {
656
682
  x1: length,
657
683
  y1: lineSpace + lineSpacedimension1,
658
684
  x2: length,
659
685
  y2: lineSpace + lineSpacedimension2,
660
686
  style: STYLE_ROOM_SHAPE
661
687
  }), /*#__PURE__*/React.createElement(Ruler, {
662
- key: 0,
663
688
  layer: layer,
664
689
  unit: scene.unit,
665
690
  rulerUnit: scene.rulerUnit,
@@ -674,14 +699,15 @@ export default function Line(_ref) {
674
699
  style: STYLE_ROOM_SHAPE
675
700
  })));
676
701
  } else {
677
- renderedRuler.push(/*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("line", {
702
+ renderedRuler.push(/*#__PURE__*/React.createElement("g", {
703
+ key: "ruler-b"
704
+ }, /*#__PURE__*/React.createElement("line", {
678
705
  x1: 0,
679
706
  y1: lineSpace + lineSpacedimension1,
680
707
  x2: 0,
681
708
  y2: lineSpace + lineSpacedimension2,
682
709
  style: STYLE_ROOM_SHAPE
683
710
  }), /*#__PURE__*/React.createElement(Ruler, {
684
- key: 0,
685
711
  layer: layer,
686
712
  unit: scene.unit,
687
713
  rulerUnit: scene.rulerUnit,
@@ -723,6 +749,7 @@ export default function Line(_ref) {
723
749
  }
724
750
  if (compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
725
751
  renderedAllRuler.push(/*#__PURE__*/React.createElement("g", {
752
+ key: "allRuler_a_".concat(index),
726
753
  transform: "translate(".concat(x1, ", ").concat(y1, ") rotate(").concat(angle, ", 0, 0)")
727
754
  }, /*#__PURE__*/React.createElement("line", {
728
755
  x1: allRuler[index],
@@ -747,6 +774,7 @@ export default function Line(_ref) {
747
774
  })));
748
775
  } else {
749
776
  renderedAllRuler.push(/*#__PURE__*/React.createElement("g", {
777
+ key: "allRuler_b_".concat(index),
750
778
  transform: "translate(".concat(x1, ", ").concat(y1, ") rotate(").concat(angle, ", 0, 0)")
751
779
  }, /*#__PURE__*/React.createElement("line", {
752
780
  x1: allRuler[index],
@@ -846,6 +874,7 @@ export default function Line(_ref) {
846
874
 
847
875
  // Angle SVG Path
848
876
  lines.push(/*#__PURE__*/React.createElement("path", {
877
+ key: "angle-path-".concat(index),
849
878
  style: STYLE_ANGLE,
850
879
  d: "\n M ".concat(vertex[0].x, ",").concat(vertex[0].y, " L ").concat(pos1.x, ",").concat(pos1.y, " A ").concat(minLineLength, " ").concat(minLineLength, " ").concat(angle, " 0 ").concat(t > 0 ? 1 : 0, " ").concat(pos2.x, ",").concat(pos2.y, " z\n ")
851
880
  }));
@@ -1,15 +1,16 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
4
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
7
  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; }
8
8
  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; }
9
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  import React, { Component } from 'react';
12
12
  import PropTypes from 'prop-types';
13
+ import AppContext from "../../AppContext";
13
14
  import * as SharedStyle from "../../shared-style";
14
15
  var RulerX = /*#__PURE__*/function (_Component) {
15
16
  function RulerX(props, context) {
@@ -45,7 +46,7 @@ var RulerX = /*#__PURE__*/function (_Component) {
45
46
  };
46
47
  var markerStyle = {
47
48
  position: 'absolute',
48
- left: this.props.zeroLeftPosition + this.props.mouseX * this.props.zoom - 6.5,
49
+ left: (this.props.zeroLeftPosition || 0) + (this.props.mouseX || 0) * (this.props.zoom || 1) - 6.5,
49
50
  top: 8,
50
51
  width: 0,
51
52
  height: 0,
@@ -65,12 +66,12 @@ var RulerX = /*#__PURE__*/function (_Component) {
65
66
  grdAutoColumns: "".concat(elementW, "px")
66
67
  };
67
68
  var positiveRulerContainer = _objectSpread(_objectSpread({}, rulerContainer), {}, {
68
- width: this.props.positiveUnitsNumber * elementW,
69
- left: this.props.zeroLeftPosition
69
+ width: (this.props.positiveUnitsNumber || 0) * elementW,
70
+ left: this.props.zeroLeftPosition || 0
70
71
  });
71
72
  var negativeRulerContainer = _objectSpread(_objectSpread({}, rulerContainer), {}, {
72
- width: this.props.negativeUnitsNumber * elementW,
73
- left: this.props.zeroLeftPosition - this.props.negativeUnitsNumber * elementW
73
+ width: (this.props.negativeUnitsNumber || 0) * elementW,
74
+ left: (this.props.zeroLeftPosition || 0) - (this.props.negativeUnitsNumber || 0) * elementW
74
75
  });
75
76
  var positiveDomElements = [];
76
77
  if (elementW <= 200) {
@@ -120,6 +121,7 @@ var RulerX = /*#__PURE__*/function (_Component) {
120
121
  }
121
122
  }]);
122
123
  }(Component);
124
+ _defineProperty(RulerX, "contextType", AppContext);
123
125
  export { RulerX as default };
124
126
  RulerX.propTypes = {
125
127
  unitPixelSize: PropTypes.number.isRequired,
@@ -139,7 +141,4 @@ RulerX.defaultProps = {
139
141
  backgroundColor: SharedStyle.PRIMARY_COLOR.main,
140
142
  fontColor: SharedStyle.COLORS.white,
141
143
  markerColor: SharedStyle.SECONDARY_COLOR.main
142
- };
143
- RulerX.contextTypes = {
144
- translator: PropTypes.object.isRequired
145
144
  };
@@ -1,15 +1,16 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
3
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
4
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
5
  import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
7
  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; }
8
8
  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; }
9
9
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  import React, { Component } from 'react';
12
12
  import PropTypes from 'prop-types';
13
+ import AppContext from "../../AppContext";
13
14
  import * as SharedStyle from "../../shared-style";
14
15
  var RulerY = /*#__PURE__*/function (_Component) {
15
16
  function RulerY(props, context) {
@@ -49,7 +50,7 @@ var RulerY = /*#__PURE__*/function (_Component) {
49
50
  };
50
51
  var markerStyle = {
51
52
  position: 'absolute',
52
- top: this.props.zeroTopPosition - this.props.mouseY * this.props.zoom - 6.5,
53
+ top: (this.props.zeroTopPosition || 0) - (this.props.mouseY || 0) * (this.props.zoom || 1) - 6.5,
53
54
  left: 8,
54
55
  width: 0,
55
56
  height: 0,
@@ -69,12 +70,12 @@ var RulerY = /*#__PURE__*/function (_Component) {
69
70
  paddingLeft: '5px'
70
71
  };
71
72
  var positiveRulerContainer = _objectSpread(_objectSpread({}, rulerContainer), {}, {
72
- top: this.props.zeroTopPosition - this.props.positiveUnitsNumber * elementH,
73
- height: this.props.positiveUnitsNumber * elementH
73
+ top: (this.props.zeroTopPosition || 0) - (this.props.positiveUnitsNumber || 0) * elementH,
74
+ height: (this.props.positiveUnitsNumber || 0) * elementH
74
75
  });
75
76
  var negativeRulerContainer = _objectSpread(_objectSpread({}, rulerContainer), {}, {
76
- top: this.props.zeroTopPosition + this.props.negativeUnitsNumber * elementH,
77
- height: this.props.negativeUnitsNumber * elementH
77
+ top: (this.props.zeroTopPosition || 0) + (this.props.negativeUnitsNumber || 0) * elementH,
78
+ height: (this.props.negativeUnitsNumber || 0) * elementH
78
79
  });
79
80
  var positiveDomElements = [];
80
81
  if (elementH <= 200) {
@@ -124,6 +125,7 @@ var RulerY = /*#__PURE__*/function (_Component) {
124
125
  }
125
126
  }]);
126
127
  }(Component);
128
+ _defineProperty(RulerY, "contextType", AppContext);
127
129
  export { RulerY as default };
128
130
  RulerY.propTypes = {
129
131
  unitPixelSize: PropTypes.number.isRequired,
@@ -141,7 +143,4 @@ RulerY.defaultProps = {
141
143
  backgroundColor: SharedStyle.PRIMARY_COLOR.main,
142
144
  fontColor: SharedStyle.COLORS.white,
143
145
  markerColor: SharedStyle.SECONDARY_COLOR.main
144
- };
145
- RulerY.contextTypes = {
146
- translator: PropTypes.object.isRequired
147
146
  };