kitchen-simulator 1.1.1-test.6 → 1.1.1-test.60

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 (136) hide show
  1. package/es/KitchenConfigurator.js +8 -15
  2. package/es/KitchenConfiguratorApp.js +11 -27
  3. package/es/actions/holes-actions.js +1 -1
  4. package/es/actions/items-actions.js +1 -1
  5. package/es/actions/lines-actions.js +1 -1
  6. package/es/actions/project-actions.js +1 -1
  7. package/es/actions/scene-actions.js +1 -1
  8. package/es/actions/vertices-actions.js +1 -1
  9. package/es/actions/viewer2d-actions.js +1 -1
  10. package/es/actions/viewer3d-actions.js +1 -1
  11. package/es/catalog/areas/area/planner-element.js +10 -7
  12. package/es/catalog/factories/wall-factory-3d.js +1 -1
  13. package/es/catalog/holes/export.js +13 -13
  14. package/es/catalog/lines/wall/planner-element.js +13 -10
  15. package/es/catalog/properties/property-checkbox.js +63 -18
  16. package/es/catalog/properties/property-enum.js +51 -9
  17. package/es/catalog/properties/property-lenght-measure.js +2 -2
  18. package/es/catalog/properties/property-length-measure.js +58 -9
  19. package/es/catalog/properties/property-length-measure_hole.js +2 -2
  20. package/es/catalog/utils/exporter.js +1 -1
  21. package/es/catalog/utils/item-loader.js +1 -1
  22. package/es/catalog/utils/mtl-loader.js +3 -2
  23. package/es/catalog/utils/obj-loader.js +3 -2
  24. package/es/class/area.js +1 -1
  25. package/es/class/group.js +3 -3
  26. package/es/class/hole.js +5 -6
  27. package/es/class/item.js +8 -10
  28. package/es/class/layer.js +2 -2
  29. package/es/class/project.js +4 -4
  30. package/es/components/content.js +1 -0
  31. package/es/components/disclaimer/disclaimer.js +66 -86
  32. package/es/components/style/form-number-input.js +31 -7
  33. package/es/components/style/form-select.js +56 -8
  34. package/es/components/style/form-slider.js +22 -6
  35. package/es/components/style/form-text-input.js +31 -12
  36. package/es/components/viewer2d/area.js +4 -4
  37. package/es/components/viewer2d/grids/grid-horizontal-streak.js +0 -1
  38. package/es/components/viewer2d/grids/grid-streak.js +0 -1
  39. package/es/components/viewer2d/grids/grid-vertical-streak.js +0 -1
  40. package/es/components/viewer2d/item.js +3 -5
  41. package/es/components/viewer2d/line.js +2 -5
  42. package/es/components/viewer2d/ruler.js +2 -3
  43. package/es/components/viewer2d/rulerDist.js +1 -1
  44. package/es/components/viewer2d/scene.js +2 -2
  45. package/es/components/viewer2d/utils.js +37 -1
  46. package/es/components/viewer2d/viewer2d.js +10 -4
  47. package/es/components/viewer3d/libs/mtl-loader.js +2 -2
  48. package/es/components/viewer3d/libs/obj-loader.js +2 -2
  49. package/es/components/viewer3d/libs/orbit-controls.js +6 -5
  50. package/es/components/viewer3d/libs/pointer-lock-controls.js +5 -4
  51. package/es/components/viewer3d/ruler-utils/itemRect.js +1 -1
  52. package/es/components/viewer3d/ruler-utils/layer3D.js +2 -2
  53. package/es/components/viewer3d/ruler-utils/scene3D.js +2 -3
  54. package/es/components/viewer3d/scene-creator.js +1 -1
  55. package/es/components/viewer3d/viewer3d.js +12 -13
  56. package/es/index.js +20 -14
  57. package/es/models.js +4 -3
  58. package/es/plugins/keyboard.js +2 -2
  59. package/es/reducers/holes-reducer.js +1 -1
  60. package/es/reducers/items-reducer.js +2 -5
  61. package/es/reducers/lines-reducer.js +1 -1
  62. package/es/reducers/project-reducer.js +1 -1
  63. package/es/reducers/reducer.js +2 -2
  64. package/es/reducers/scene-reducer.js +1 -1
  65. package/es/reducers/user-reducer.js +1 -2
  66. package/es/reducers/vertices-reducer.js +1 -1
  67. package/es/reducers/viewer2d-reducer.js +2 -2
  68. package/es/reducers/viewer3d-reducer.js +2 -2
  69. package/es/utils/convert-units-lite.js +29 -0
  70. package/es/utils/geometry.js +4 -4
  71. package/es/utils/get-edges-of-subgraphs.js +2 -1
  72. package/es/utils/graph-cycles.js +2 -3
  73. package/es/utils/graph.js +2 -1
  74. package/es/utils/helper.js +1 -69
  75. package/es/utils/id-broker.js +2 -2
  76. package/es/utils/molding.js +34 -34
  77. package/lib/KitchenConfigurator.js +33 -40
  78. package/lib/KitchenConfiguratorApp.js +34 -49
  79. package/lib/catalog/areas/area/planner-element.js +12 -8
  80. package/lib/catalog/factories/wall-factory-3d.js +2 -2
  81. package/lib/catalog/holes/export.js +13 -13
  82. package/lib/catalog/lines/wall/planner-element.js +15 -11
  83. package/lib/catalog/properties/property-checkbox.js +64 -19
  84. package/lib/catalog/properties/property-enum.js +49 -7
  85. package/lib/catalog/properties/property-lenght-measure.js +3 -3
  86. package/lib/catalog/properties/property-length-measure.js +60 -11
  87. package/lib/catalog/properties/property-length-measure_hole.js +3 -3
  88. package/lib/catalog/utils/exporter.js +5 -6
  89. package/lib/catalog/utils/item-loader.js +20 -21
  90. package/lib/catalog/utils/mtl-loader.js +7 -3
  91. package/lib/catalog/utils/obj-loader.js +7 -3
  92. package/lib/class/item.js +13 -16
  93. package/lib/components/content.js +1 -0
  94. package/lib/components/disclaimer/disclaimer.js +66 -86
  95. package/lib/components/style/form-number-input.js +30 -6
  96. package/lib/components/style/form-select.js +54 -8
  97. package/lib/components/style/form-slider.js +22 -6
  98. package/lib/components/style/form-text-input.js +30 -12
  99. package/lib/components/viewer2d/area.js +5 -5
  100. package/lib/components/viewer2d/grids/grid-horizontal-streak.js +0 -1
  101. package/lib/components/viewer2d/grids/grid-streak.js +0 -1
  102. package/lib/components/viewer2d/grids/grid-vertical-streak.js +0 -1
  103. package/lib/components/viewer2d/item.js +7 -8
  104. package/lib/components/viewer2d/line.js +2 -5
  105. package/lib/components/viewer2d/ruler.js +6 -7
  106. package/lib/components/viewer2d/rulerDist.js +4 -4
  107. package/lib/components/viewer2d/scene.js +1 -1
  108. package/lib/components/viewer2d/utils.js +37 -0
  109. package/lib/components/viewer2d/viewer2d.js +25 -17
  110. package/lib/components/viewer3d/libs/mtl-loader.js +6 -2
  111. package/lib/components/viewer3d/libs/obj-loader.js +6 -2
  112. package/lib/components/viewer3d/libs/orbit-controls.js +10 -5
  113. package/lib/components/viewer3d/libs/pointer-lock-controls.js +9 -4
  114. package/lib/components/viewer3d/ruler-utils/itemRect.js +7 -7
  115. package/lib/components/viewer3d/ruler-utils/layer3D.js +32 -32
  116. package/lib/components/viewer3d/ruler-utils/scene3D.js +3 -4
  117. package/lib/components/viewer3d/scene-creator.js +24 -24
  118. package/lib/components/viewer3d/viewer3d.js +17 -17
  119. package/lib/index.js +22 -88
  120. package/lib/models.js +7 -7
  121. package/lib/reducers/user-reducer.js +0 -1
  122. package/lib/reducers/viewer2d-reducer.js +3 -4
  123. package/lib/reducers/viewer3d-reducer.js +3 -4
  124. package/lib/utils/convert-units-lite.js +35 -0
  125. package/lib/utils/geometry.js +9 -10
  126. package/lib/utils/get-edges-of-subgraphs.js +7 -1
  127. package/lib/utils/graph-cycles.js +9 -9
  128. package/lib/utils/graph.js +9 -3
  129. package/lib/utils/helper.js +7 -76
  130. package/lib/utils/id-broker.js +2 -2
  131. package/lib/utils/molding.js +52 -52
  132. package/package.json +34 -70
  133. package/es/analytics/ga4.js +0 -191
  134. package/es/analytics/posthog.js +0 -60
  135. package/lib/analytics/ga4.js +0 -197
  136. package/lib/analytics/posthog.js +0 -68
@@ -7,20 +7,52 @@ exports["default"] = PropertyLengthMeasure;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _constants = require("../../constants");
10
- var _convertUnits = _interopRequireDefault(require("convert-units"));
10
+ var _convertUnitsLite = require("../../utils/convert-units-lite");
11
11
  var _export = require("../../components/style/export");
12
12
  var _immutable = require("immutable");
13
13
  var _math = require("../../utils/math");
14
- var _styledComponents = _interopRequireDefault(require("styled-components"));
15
14
  var _excluded = ["hook", "label"];
16
- var _templateObject, _templateObject2;
17
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
16
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
17
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
18
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
20
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
21
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
22
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19
23
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
20
24
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
21
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
22
- var DistanceFloorWrapper = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin-top: 3px;\n"])));
23
- var DistanceFloorTitle = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: auto;\n width: 110px;\n color: ", ";\n font-family: ", ";\n font-size: 16px;\n\n @media screen and (min-width: 1024) {\n font-size: 11px;\n }\n @media screen and (max-width: 1024) {\n font-size: 11px;\n }\n @media screen and (min-width: 1366) {\n font-size: 13px;\n }\n @media screen and (max-width: 1366) {\n font-size: 13px;\n }\n @media screen and (min-width: 1440) {\n font-size: 16px;\n }\n @media screen and (max-width: 1440) {\n font-size: 16px;\n }\n font-weight: 400;\n line-height: 15px;\n text-align: left;\n"])), _constants.TEXT_COLOR_NEUTRAL_0, _constants.DEFAULT_FONT_FAMILY);
25
+ var styles = {
26
+ distanceFloorWrapper: {
27
+ display: 'flex',
28
+ alignItems: 'center',
29
+ marginTop: 3
30
+ },
31
+ distanceFloorTitle: function distanceFloorTitle(fontSize) {
32
+ return {
33
+ marginRight: 'auto',
34
+ width: 110,
35
+ color: _constants.TEXT_COLOR_NEUTRAL_0,
36
+ fontFamily: _constants.DEFAULT_FONT_FAMILY,
37
+ fontSize: fontSize,
38
+ fontWeight: 400,
39
+ lineHeight: '15px',
40
+ textAlign: 'left'
41
+ };
42
+ }
43
+ };
44
+
45
+ // Responsive font size logic
46
+ function getFontSize() {
47
+ if (typeof window !== 'undefined') {
48
+ var w = window.innerWidth;
49
+ if (w <= 1024) return 11;
50
+ if (w <= 1366) return 13;
51
+ if (w <= 1440) return 16;
52
+ return 16;
53
+ }
54
+ return 13;
55
+ }
24
56
  function PropertyLengthMeasure(_ref, _ref2) {
25
57
  var value = _ref.value,
26
58
  onUpdate = _ref.onUpdate,
@@ -36,7 +68,7 @@ function PropertyLengthMeasure(_ref, _ref2) {
36
68
  var _length = value.get('_length') || length; // in _unit
37
69
  if (!_unit) {
38
70
  _unit = _constants.UNIT_INCH;
39
- _length = (0, _convertUnits["default"])(length).from(_constants.UNIT_CENTIMETER).to(_constants.UNIT_INCH);
71
+ _length = (0, _convertUnitsLite.convert)(length).from(_constants.UNIT_CENTIMETER).to(_constants.UNIT_INCH);
40
72
  }
41
73
  var type = value.get('type') || _constants.BASE_CABINET_LAYOUTPOS;
42
74
  var hook = configs.hook,
@@ -49,11 +81,11 @@ function PropertyLengthMeasure(_ref, _ref2) {
49
81
  merged = value.merge({
50
82
  _length: newLength,
51
83
  _unit: unitInput,
52
- length: (0, _convertUnits["default"])(newLength).from(unitInput).to(_constants.UNIT_CENTIMETER)
84
+ length: (0, _convertUnitsLite.convert)(newLength).from(unitInput).to(_constants.UNIT_CENTIMETER)
53
85
  });
54
86
  } else {
55
87
  merged = value.merge({
56
- _length: (0, _convertUnits["default"])(newLength).from(_constants.UNIT_CENTIMETER).to(unitInput),
88
+ _length: (0, _convertUnitsLite.convert)(newLength).from(_constants.UNIT_CENTIMETER).to(unitInput),
57
89
  _unit: unitInput,
58
90
  length: newLength
59
91
  });
@@ -65,9 +97,26 @@ function PropertyLengthMeasure(_ref, _ref2) {
65
97
  }
66
98
  return onUpdate(merged);
67
99
  };
68
- return /*#__PURE__*/_react["default"].createElement(DistanceFloorWrapper, null, /*#__PURE__*/_react["default"].createElement(DistanceFloorTitle, null, label), /*#__PURE__*/_react["default"].createElement(_export.FormNumberInput, _extends({
100
+ var _React$useState = _react["default"].useState(getFontSize()),
101
+ _React$useState2 = _slicedToArray(_React$useState, 2),
102
+ fontSize = _React$useState2[0],
103
+ setFontSize = _React$useState2[1];
104
+ _react["default"].useEffect(function () {
105
+ function handleResize() {
106
+ setFontSize(getFontSize());
107
+ }
108
+ window.addEventListener('resize', handleResize);
109
+ return function () {
110
+ return window.removeEventListener('resize', handleResize);
111
+ };
112
+ }, []);
113
+ return /*#__PURE__*/_react["default"].createElement("div", {
114
+ style: styles.distanceFloorWrapper
115
+ }, /*#__PURE__*/_react["default"].createElement("span", {
116
+ style: styles.distanceFloorTitle(fontSize)
117
+ }, label), /*#__PURE__*/_react["default"].createElement(_export.FormNumberInput, _extends({
69
118
  disabled: type === _constants.TALL_CABINET_LAYOUTPOS,
70
- value: (0, _convertUnits["default"])(_length).from('in').to(unit),
119
+ value: (0, _convertUnitsLite.convert)(_length).from('in').to(unit),
71
120
  onChange: function onChange(event) {
72
121
  return update(event.target.value, _unit, 0);
73
122
  },
@@ -7,7 +7,7 @@ exports["default"] = PropertyLengthMeasureHole;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _constants = require("../../constants");
10
- var _convertUnits = _interopRequireDefault(require("convert-units"));
10
+ var _convertUnitsLite = require("../../utils/convert-units-lite");
11
11
  var _export = require("../../components/style/export");
12
12
  var _immutable = require("immutable");
13
13
  var _math = require("../../utils/math");
@@ -48,11 +48,11 @@ function PropertyLengthMeasureHole(_ref, _ref2) {
48
48
  if (type === 0) {
49
49
  merged = value.merge({
50
50
  _length: newLength,
51
- length: (0, _convertUnits["default"])(newLength).from(unitInput).to('cm')
51
+ length: (0, _convertUnitsLite.convert)(newLength).from(unitInput).to('cm')
52
52
  });
53
53
  } else {
54
54
  merged = value.merge({
55
- _length: (0, _convertUnits["default"])(newLength).from(_constants.UNIT_INCH).to(unitInput),
55
+ _length: (0, _convertUnitsLite.convert)(newLength).from(_constants.UNIT_INCH).to(unitInput),
56
56
  _unit: unitInput
57
57
  });
58
58
  }
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = _default;
7
- var _convertUnits = _interopRequireDefault(require("convert-units"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
7
+ var _convertUnitsLite = require("../../utils/convert-units-lite");
9
8
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
9
  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; }
11
10
  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; }
@@ -42,7 +41,7 @@ function _default(_ref) {
42
41
  defaultValue: {
43
42
  _length: sizeinfo.width,
44
43
  _unit: 'in',
45
- length: (0, _convertUnits["default"])(sizeinfo.width).from('in').to('cm')
44
+ length: (0, _convertUnitsLite.convert)(sizeinfo.width).from('in').to('cm')
46
45
  }
47
46
  }
48
47
  };
@@ -55,7 +54,7 @@ function _default(_ref) {
55
54
  defaultValue: {
56
55
  _length: sizeinfo.width,
57
56
  _unit: 'in',
58
- length: (0, _convertUnits["default"])(sizeinfo.width).from('in').to('cm')
57
+ length: (0, _convertUnitsLite.convert)(sizeinfo.width).from('in').to('cm')
59
58
  }
60
59
  },
61
60
  depth: {
@@ -64,7 +63,7 @@ function _default(_ref) {
64
63
  defaultValue: {
65
64
  _length: sizeinfo.depth,
66
65
  _unit: 'in',
67
- length: (0, _convertUnits["default"])(sizeinfo.depth).from('in').to('cm')
66
+ length: (0, _convertUnitsLite.convert)(sizeinfo.depth).from('in').to('cm')
68
67
  }
69
68
  },
70
69
  height: {
@@ -73,7 +72,7 @@ function _default(_ref) {
73
72
  defaultValue: {
74
73
  _length: sizeinfo.height,
75
74
  _unit: 'in',
76
- length: (0, _convertUnits["default"])(sizeinfo.height).from('in').to('cm')
75
+ length: (0, _convertUnitsLite.convert)(sizeinfo.height).from('in').to('cm')
77
76
  }
78
77
  }
79
78
  };
@@ -9,7 +9,7 @@ exports.render2DItem = render2DItem;
9
9
  exports.render3DApplianceItem = render3DApplianceItem;
10
10
  exports.render3DItem = render3DItem;
11
11
  exports.render3DLightingItem = render3DLightingItem;
12
- var _convertUnits = _interopRequireDefault(require("convert-units"));
12
+ var _convertUnitsLite = require("../../utils/convert-units-lite");
13
13
  var _immutable = require("immutable");
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
  var Three = _interopRequireWildcard(require("three"));
@@ -20,7 +20,6 @@ var GeomUtils = _interopRequireWildcard(require("./geom-utils"));
20
20
  var _loadObj = require("./load-obj");
21
21
  var _helper = require("../../utils/helper");
22
22
  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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
23
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
24
23
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
25
24
  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; }
26
25
  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; }
@@ -107,11 +106,11 @@ function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corner, sha
107
106
  length: tempDepth.get('_length'),
108
107
  unit: tempDepth.get('_unit')
109
108
  };
110
- var originalWidth = (0, _convertUnits["default"])(sizeinfo.width).from('in').to('cm');
111
- var originalDepth = (0, _convertUnits["default"])(sizeinfo.depth).from('in').to('cm');
112
- var newWidth = (0, _convertUnits["default"])(width.length).from(width.unit).to('cm');
113
- var newDepth = (0, _convertUnits["default"])(depth.length).from(depth.unit).to('cm');
114
- var padding = (0, _convertUnits["default"])(_constants.SHAPE_SVG_PADDING).from(_constants.UNIT_INCH).to(_constants.UNIT_CENTIMETER);
109
+ var originalWidth = (0, _convertUnitsLite.convert)(sizeinfo.width).from('in').to('cm');
110
+ var originalDepth = (0, _convertUnitsLite.convert)(sizeinfo.depth).from('in').to('cm');
111
+ var newWidth = (0, _convertUnitsLite.convert)(width.length).from(width.unit).to('cm');
112
+ var newDepth = (0, _convertUnitsLite.convert)(depth.length).from(depth.unit).to('cm');
113
+ var padding = (0, _convertUnitsLite.convert)(_constants.SHAPE_SVG_PADDING).from(_constants.UNIT_INCH).to(_constants.UNIT_CENTIMETER);
115
114
  var angle = element.rotation + 90;
116
115
  var textRotation = 0;
117
116
  if (Math.sin(angle * Math.PI / 180) < 0) {
@@ -201,8 +200,8 @@ function render2DItem(element, layer, scene, sizeinfo, layoutpos, is_corner, sha
201
200
  // } else {
202
201
  // }
203
202
  svg_url = shape_svg.url;
204
- svg_width = (0, _convertUnits["default"])(_constants.SHAPE_SVG_WIDTH).from(_constants.UNIT_INCH).to(_constants.UNIT_CENTIMETER);
205
- svg_depth = (0, _convertUnits["default"])(_constants.SHAPE_SVG_DEPTH).from(_constants.UNIT_INCH).to(_constants.UNIT_CENTIMETER);
203
+ svg_width = (0, _convertUnitsLite.convert)(_constants.SHAPE_SVG_WIDTH).from(_constants.UNIT_INCH).to(_constants.UNIT_CENTIMETER);
204
+ svg_depth = (0, _convertUnitsLite.convert)(_constants.SHAPE_SVG_DEPTH).from(_constants.UNIT_INCH).to(_constants.UNIT_CENTIMETER);
206
205
  }
207
206
  var padding_width = padding * newWidth / svg_width;
208
207
  var padding_depth = padding * newDepth / svg_depth;
@@ -355,9 +354,9 @@ function render3DItem(element, layer, scene, sizeinfo, structure_json, is_corner
355
354
  length: sizeinfo.height,
356
355
  unit: 'in'
357
356
  };
358
- var newWidth = (0, _convertUnits["default"])(width.length).from(width.unit).to('in');
359
- var newDepth = (0, _convertUnits["default"])(depth.length).from(depth.unit).to('in');
360
- var newHeight = (0, _convertUnits["default"])(height.length).from(height.unit).to('in');
357
+ var newWidth = (0, _convertUnitsLite.convert)(width.length).from(width.unit).to('in');
358
+ var newDepth = (0, _convertUnitsLite.convert)(depth.length).from(depth.unit).to('in');
359
+ var newHeight = (0, _convertUnitsLite.convert)(height.length).from(height.unit).to('in');
361
360
  var mainName = ''; // to get name structure//
362
361
  if (element.properties.get('width')) newWidth = element.getIn(['properties', 'width', '_length']);
363
362
  if (element.properties.get('depth')) newDepth = element.getIn(['properties', 'depth', '_length']);
@@ -418,7 +417,7 @@ function render3DItem(element, layer, scene, sizeinfo, structure_json, is_corner
418
417
  var object1 = object;
419
418
  var newAltitude = element.properties.get('altitude').get('_length');
420
419
  var newUnit = element.properties.get('altitude').get('_unit') || 'in';
421
- newAltitude = (0, _convertUnits["default"])(newAltitude).from(newUnit).to(scene.unit);
420
+ newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(scene.unit);
422
421
  var _element = element.toJS();
423
422
  if (!_element.doorStyle.doorStyles.is_euro_cds) {
424
423
  object1.scale.set(100 * newWidth / sizeinfo.width, 100 * newHeight / sizeinfo.height, 100 * newDepth / sizeinfo.depth);
@@ -1023,16 +1022,16 @@ function render3DApplianceItem(element, layer, scene, sizeinfo, structure_json)
1023
1022
  var onLoadItem = function onLoadItem(object) {
1024
1023
  var newAltitude = element.properties.get('altitude').get('_length');
1025
1024
  var newUnit = element.properties.get('altitude').get('_unit') || 'in';
1026
- newAltitude = (0, _convertUnits["default"])(newAltitude).from(newUnit).to(scene.unit);
1025
+ newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(scene.unit);
1027
1026
  var newWidth = element.properties.get('width').get('_length');
1028
1027
  var newWidthUnit = element.properties.get('width').get('_unit') || 'in';
1029
- newWidth = (0, _convertUnits["default"])(newWidth).from(newWidthUnit).to('in');
1028
+ newWidth = (0, _convertUnitsLite.convert)(newWidth).from(newWidthUnit).to('in');
1030
1029
  var newHeight = element.properties.get('height').get('_length');
1031
1030
  var newHeightUnit = element.properties.get('height').get('_unit') || 'in';
1032
- newHeight = (0, _convertUnits["default"])(newHeight).from(newHeightUnit).to('in');
1031
+ newHeight = (0, _convertUnitsLite.convert)(newHeight).from(newHeightUnit).to('in');
1033
1032
  var newDepth = element.properties.get('depth').get('_length');
1034
1033
  var newDepthUnit = element.properties.get('depth').get('_unit') || 'in';
1035
- newDepth = (0, _convertUnits["default"])(newDepth).from(newDepthUnit).to('in');
1034
+ newDepth = (0, _convertUnitsLite.convert)(newDepth).from(newDepthUnit).to('in');
1036
1035
  object.scale.set(100 * newWidth / sizeinfo.width, 100 * newHeight / sizeinfo.height, 100 * newDepth / sizeinfo.depth);
1037
1036
  // Normalize the origin of the object
1038
1037
  var boundingBox = new Three.Box3().setFromObject(object);
@@ -1302,12 +1301,12 @@ function render3DLightingItem(element, layer, scene, sizeinfo, structure_json) {
1302
1301
  length: sizeinfo.height,
1303
1302
  unit: 'in'
1304
1303
  };
1305
- var newWidth = (0, _convertUnits["default"])(width.length).from(width.unit).to('cm');
1306
- var newDepth = (0, _convertUnits["default"])(depth.length).from(depth.unit).to('cm');
1307
- var newHeight = (0, _convertUnits["default"])(height.length).from(height.unit).to('cm');
1304
+ var newWidth = (0, _convertUnitsLite.convert)(width.length).from(width.unit).to('cm');
1305
+ var newDepth = (0, _convertUnitsLite.convert)(depth.length).from(depth.unit).to('cm');
1306
+ var newHeight = (0, _convertUnitsLite.convert)(height.length).from(height.unit).to('cm');
1308
1307
  var newAltitude = element.properties.get('altitude').get('_length');
1309
1308
  var newUnit = element.properties.get('altitude').get('_unit') || 'in';
1310
- newAltitude = (0, _convertUnits["default"])(newAltitude).from(newUnit).to(scene.unit);
1309
+ newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from(newUnit).to(scene.unit);
1311
1310
 
1312
1311
  //object.scale.set(newWidth, newHeight, newDepth);
1313
1312
  object.scale.set(100, 100, 100);
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.MTLLoader = void 0;
3
7
  /**
4
8
  * Loads a Wavefront .mtl file specifying materials
5
9
  *
6
10
  * @author angelxuanchang
7
11
  */
8
12
 
9
- var THREE = window.THREE || require('three');
13
+ var THREE = window.THREE;
10
14
  var MTLLoader;
11
- MTLLoader = function MTLLoader(manager) {
15
+ exports.MTLLoader = MTLLoader = function MTLLoader(manager) {
12
16
  this.manager = manager !== undefined ? manager : THREE.DefaultLoadingManager;
13
17
  };
14
18
  Object.assign(MTLLoader.prototype, THREE.EventDispatcher.prototype, {
@@ -356,4 +360,4 @@ MTLLoader.MaterialCreator.prototype = {
356
360
  return texture;
357
361
  }
358
362
  };
359
- module.exports = MTLLoader;
363
+ var _default = exports["default"] = MTLLoader;
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.OBJLoader = void 0;
3
7
  /**
4
8
  * @author mrdoob / http://mrdoob.com/
5
9
  */
6
- var THREE = window.THREE || require('three');
10
+ var THREE = window.THREE;
7
11
  var OBJLoader;
8
- OBJLoader = function () {
12
+ exports.OBJLoader = OBJLoader = function () {
9
13
  // o object_name | g group_name
10
14
  var object_pattern = /^[og]\s*(.+)?/;
11
15
  // mtllib file_reference
@@ -475,4 +479,4 @@ OBJLoader = function () {
475
479
  };
476
480
  return OBJLoader;
477
481
  }();
478
- module.exports = OBJLoader;
482
+ var _default = exports["default"] = OBJLoader;
package/lib/class/item.js CHANGED
@@ -4,17 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
- var _convertUnits = _interopRequireDefault(require("convert-units"));
7
+ var _convertUnitsLite = require("../utils/convert-units-lite");
8
8
  var _export = require("./export");
9
9
  var _export2 = require("../utils/export");
10
10
  var _immutable = require("immutable");
11
- var _path = _interopRequireDefault(require("path"));
12
11
  var _constants = require("../constants");
13
12
  var _helper = require("../utils/helper");
14
- var _util = require("util");
15
13
  var _molding = require("../utils/molding");
16
14
  var _utils = require("../components/viewer2d/utils");
17
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
15
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
19
16
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
20
17
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -152,7 +149,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
152
149
  });
153
150
  }
154
151
  newProperties['depth'] = new _immutable.Map({
155
- length: (0, _convertUnits["default"])(euro_cds[0].euro_length).from('in').to('cm'),
152
+ length: (0, _convertUnitsLite.convert)(euro_cds[0].euro_length).from('in').to('cm'),
156
153
  _length: euro_cds[0].euro_length,
157
154
  _unit: 'in'
158
155
  });
@@ -166,7 +163,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
166
163
  });
167
164
  }
168
165
  newProperties['height'] = new _immutable.Map({
169
- length: (0, _convertUnits["default"])(euro_cds[0].euro_height).from('in').to('cm'),
166
+ length: (0, _convertUnitsLite.convert)(euro_cds[0].euro_height).from('in').to('cm'),
170
167
  _length: euro_cds[0].euro_height,
171
168
  _unit: 'in'
172
169
  });
@@ -180,7 +177,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
180
177
  });
181
178
  }
182
179
  newProperties['width'] = new _immutable.Map({
183
- length: (0, _convertUnits["default"])(euro_cds[0].euro_width).from('in').to('cm') - 10,
180
+ length: (0, _convertUnitsLite.convert)(euro_cds[0].euro_width).from('in').to('cm') - 10,
184
181
  _length: euro_cds[0].euro_width,
185
182
  _unit: 'in'
186
183
  });
@@ -222,9 +219,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
222
219
  if (item.type.includes('Light')) {
223
220
  var ceilHeight = state.getIn(['scene', 'layers', layerID, 'ceilHeight']);
224
221
  var ceilUnit = state.getIn(['scene', 'layers', layerID, 'unit']);
225
- ceilHeight = (0, _convertUnits["default"])(ceilHeight).from(ceilUnit).to('cm');
222
+ ceilHeight = (0, _convertUnitsLite.convert)(ceilHeight).from(ceilUnit).to('cm');
226
223
  var newAltitude = ceilHeight - item.properties.getIn(['height', 'length']);
227
- newAltitude = (0, _convertUnits["default"])(newAltitude).from('cm').to(ceilUnit);
224
+ newAltitude = (0, _convertUnitsLite.convert)(newAltitude).from('cm').to(ceilUnit);
228
225
  item = item.setIn(['properties', 'altitude', '_length'], newAltitude);
229
226
  state = state.setIn(['scene', 'layers', layerID, 'items', item.id], item);
230
227
  }
@@ -303,7 +300,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
303
300
  var width = new _immutable.Map({
304
301
  _length: newWidth,
305
302
  _unit: 'in',
306
- length: (0, _convertUnits["default"])(newWidth).from('in').to('cm')
303
+ length: (0, _convertUnitsLite.convert)(newWidth).from('in').to('cm')
307
304
  });
308
305
  properties = properties.set('width', width);
309
306
  state = state.mergeIn(['scene', 'layers', layerID, 'items', itemID, 'properties'], properties);
@@ -733,7 +730,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
733
730
  value: function beginDraggingItem(state, layerID, itemID, x, y) {
734
731
  var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
735
732
  time1 = (0, _helper.debugUtil)();
736
- if ((0, _util.isUndefined)(item)) return;
733
+ if (!item) return;
737
734
  state = state.merge({
738
735
  mode: _constants.MODE_DRAGGING_ITEM,
739
736
  draggingSupport: (0, _immutable.Map)({
@@ -754,7 +751,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
754
751
  value: function beginDraggingItem3D(state, layerID, itemID, x, y) {
755
752
  var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
756
753
  state = state.setIn(['scene', 'isEndDragging'], false);
757
- if ((0, _util.isUndefined)(item)) return {
754
+ if (!item) return {
758
755
  updatedState: state
759
756
  };
760
757
  state = state.merge({
@@ -787,7 +784,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
787
784
  var diffX = startPointX - x;
788
785
  var diffY = startPointY - y;
789
786
  var item = scene.getIn(['layers', layerID, 'items', itemID]);
790
- if ((0, _util.isUndefined)(item)) return {
787
+ if (!item) return {
791
788
  updatedState: state
792
789
  };
793
790
  var tX = originalX - diffX;
@@ -1240,7 +1237,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1240
1237
  });
1241
1238
  }
1242
1239
  newProperties['depth'] = new _immutable.Map({
1243
- length: (0, _convertUnits["default"])(euro_cds[0].euro_length).from('in').to('cm'),
1240
+ length: (0, _convertUnitsLite.convert)(euro_cds[0].euro_length).from('in').to('cm'),
1244
1241
  _length: euro_cds[0].euro_length,
1245
1242
  _unit: 'in'
1246
1243
  });
@@ -1254,7 +1251,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1254
1251
  });
1255
1252
  }
1256
1253
  newProperties['height'] = new _immutable.Map({
1257
- length: (0, _convertUnits["default"])(euro_cds[0].euro_height).from('in').to('cm'),
1254
+ length: (0, _convertUnitsLite.convert)(euro_cds[0].euro_height).from('in').to('cm'),
1258
1255
  _length: euro_cds[0].euro_height,
1259
1256
  _unit: 'in'
1260
1257
  });
@@ -1268,7 +1265,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
1268
1265
  });
1269
1266
  }
1270
1267
  newProperties['width'] = new _immutable.Map({
1271
- length: (0, _convertUnits["default"])(euro_cds[0].euro_width).from('in').to('cm') - 10,
1268
+ length: (0, _convertUnitsLite.convert)(euro_cds[0].euro_width).from('in').to('cm') - 10,
1272
1269
  _length: euro_cds[0].euro_width,
1273
1270
  _unit: 'in'
1274
1271
  });
@@ -26,6 +26,7 @@ function Content(_ref, _ref2) {
26
26
  catalog = _ref.catalog;
27
27
  var projectActions = _ref2.projectActions;
28
28
  var mode = state.get('mode');
29
+ console.log('mode =>', mode);
29
30
  switch (mode) {
30
31
  // this mode is when view elevation
31
32
  case constants.MODE_ELEVATION_VIEW: