kitchen-simulator 1.1.1-test.53 → 1.1.1-test.55

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 (61) hide show
  1. package/es/KitchenConfigurator.js +3 -3
  2. package/es/KitchenConfiguratorApp.js +5 -3
  3. package/es/catalog/factories/wall-factory-3d.js +1 -1
  4. package/es/catalog/properties/property-lenght-measure.js +2 -2
  5. package/es/catalog/properties/property-length-measure.js +1 -1
  6. package/es/catalog/properties/property-length-measure_hole.js +2 -2
  7. package/es/catalog/utils/exporter.js +1 -1
  8. package/es/catalog/utils/item-loader.js +1 -1
  9. package/es/class/item.js +1 -1
  10. package/es/components/viewer2d/area.js +1 -1
  11. package/es/components/viewer2d/grids/grid-horizontal-streak.js +0 -1
  12. package/es/components/viewer2d/grids/grid-streak.js +0 -1
  13. package/es/components/viewer2d/grids/grid-vertical-streak.js +0 -1
  14. package/es/components/viewer2d/item.js +3 -5
  15. package/es/components/viewer2d/ruler.js +2 -3
  16. package/es/components/viewer2d/rulerDist.js +1 -1
  17. package/es/components/viewer2d/viewer2d.js +2 -2
  18. package/es/components/viewer3d/ruler-utils/itemRect.js +1 -1
  19. package/es/components/viewer3d/ruler-utils/layer3D.js +2 -2
  20. package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
  21. package/es/components/viewer3d/scene-creator.js +1 -1
  22. package/es/components/viewer3d/viewer3d.js +1 -1
  23. package/es/index.js +1 -5
  24. package/es/models.js +3 -2
  25. package/es/reducers/viewer2d-reducer.js +1 -1
  26. package/es/reducers/viewer3d-reducer.js +1 -1
  27. package/es/utils/convert-units-lite.js +21 -0
  28. package/es/utils/geometry.js +4 -4
  29. package/es/utils/helper.js +1 -1
  30. package/es/utils/molding.js +34 -34
  31. package/lib/KitchenConfigurator.js +11 -11
  32. package/lib/KitchenConfiguratorApp.js +7 -5
  33. package/lib/catalog/factories/wall-factory-3d.js +2 -2
  34. package/lib/catalog/properties/property-lenght-measure.js +3 -3
  35. package/lib/catalog/properties/property-length-measure.js +5 -5
  36. package/lib/catalog/properties/property-length-measure_hole.js +3 -3
  37. package/lib/catalog/utils/exporter.js +5 -6
  38. package/lib/catalog/utils/item-loader.js +20 -21
  39. package/lib/class/item.js +10 -11
  40. package/lib/components/viewer2d/area.js +2 -2
  41. package/lib/components/viewer2d/grids/grid-horizontal-streak.js +0 -1
  42. package/lib/components/viewer2d/grids/grid-streak.js +0 -1
  43. package/lib/components/viewer2d/grids/grid-vertical-streak.js +0 -1
  44. package/lib/components/viewer2d/item.js +7 -8
  45. package/lib/components/viewer2d/ruler.js +6 -7
  46. package/lib/components/viewer2d/rulerDist.js +4 -4
  47. package/lib/components/viewer2d/viewer2d.js +17 -15
  48. package/lib/components/viewer3d/ruler-utils/itemRect.js +7 -7
  49. package/lib/components/viewer3d/ruler-utils/layer3D.js +32 -32
  50. package/lib/components/viewer3d/ruler-utils/scene3D.js +2 -2
  51. package/lib/components/viewer3d/scene-creator.js +24 -24
  52. package/lib/components/viewer3d/viewer3d.js +11 -11
  53. package/lib/index.js +0 -26
  54. package/lib/models.js +7 -7
  55. package/lib/reducers/viewer2d-reducer.js +3 -4
  56. package/lib/reducers/viewer3d-reducer.js +3 -4
  57. package/lib/utils/convert-units-lite.js +27 -0
  58. package/lib/utils/geometry.js +9 -10
  59. package/lib/utils/helper.js +6 -7
  60. package/lib/utils/molding.js +52 -52
  61. package/package.json +1 -3
@@ -15,7 +15,7 @@ var _immutablediff = _interopRequireDefault(require("immutablediff"));
15
15
  var SharedStyle = _interopRequireWildcard(require("../../shared-style"));
16
16
  var _constants = require("../../constants");
17
17
  var _geometry = require("../../utils/geometry");
18
- var _convertUnits = _interopRequireDefault(require("convert-units"));
18
+ var _convertUnitsLite = require("../../utils/convert-units-lite");
19
19
  var _export = require("../../utils/export");
20
20
  var _helper = require("../../utils/helper");
21
21
  var _RGBELoader = require("three/examples/jsm/loaders/RGBELoader");
@@ -288,7 +288,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
288
288
  realVec.push(vec);
289
289
  });
290
290
  if (aVertices.includes(realVec[0]) && aVertices.includes(realVec[1])) {
291
- height = (0, _convertUnits["default"])(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER);
291
+ height = (0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER);
292
292
  // height = data.properties.getIn(['height', 'length']);
293
293
  return 1; // break
294
294
  }
@@ -834,7 +834,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
834
834
  var tRot = layer.getIn(['items', target.userData.itemId]) ? layer.getIn(['items', target.userData.itemId]).rotation : 0;
835
835
  var item = layer.getIn(['items', source.userData.itemId]);
836
836
  var layoutType = item.layoutpos;
837
- var altitudeLength = (0, _convertUnits["default"])(item.properties.getIn(['altitude', '_length'])).from('in').to('cm');
837
+ var altitudeLength = (0, _convertUnitsLite.convert)(item.properties.getIn(['altitude', '_length'])).from('in').to('cm');
838
838
  var sBounding = source.children[0].userData;
839
839
  var tBounding = target.children[0].userData;
840
840
  var tPos = target.position.clone();
@@ -935,7 +935,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
935
935
  return;
936
936
  } else {
937
937
  var _layoutType = _item3.layoutpos;
938
- var _altitudeLength = (0, _convertUnits["default"])(_item3.properties.getIn(['altitude', '_length'])).from('in').to('cm');
938
+ var _altitudeLength = (0, _convertUnitsLite.convert)(_item3.properties.getIn(['altitude', '_length'])).from('in').to('cm');
939
939
  var _sBounding = source.children[0].userData;
940
940
  var _width = _sBounding.max.x - _sBounding.min.x;
941
941
  var _height = _sBounding.max.y - _sBounding.min.y;
@@ -1200,7 +1200,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1200
1200
  var properties = allItemRect.cur.itemInfo.properties;
1201
1201
  altitude = properties.getIn(['altitude', '_length']);
1202
1202
  var unit = properties.getIn(['altitude', '_unit']) || 'in';
1203
- altitude = (0, _convertUnits["default"])(altitude).from(unit).to(_this2.props.state.scene.unit);
1203
+ altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
1204
1204
  }
1205
1205
  getPoint(event, altitude);
1206
1206
  var state = _this2.props.state;
@@ -1292,7 +1292,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1292
1292
  var _properties = allItemRect.cur.itemInfo.properties;
1293
1293
  alti = _properties.getIn(['altitude', '_length']);
1294
1294
  var _unit = _properties.getIn(['altitude', '_unit']) || 'in';
1295
- alti = (0, _convertUnits["default"])(alti).from(_unit).to(_this2.props.state.scene.unit);
1295
+ alti = (0, _convertUnitsLite.convert)(alti).from(_unit).to(_this2.props.state.scene.unit);
1296
1296
  }
1297
1297
  getPoint({
1298
1298
  offsetX: event.offsetX - 50,
@@ -1356,7 +1356,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1356
1356
  var properties = allItemRect.cur.itemInfo.properties;
1357
1357
  altitude = properties.getIn(['altitude', '_length']);
1358
1358
  var unit = properties.getIn(['altitude', '_unit']) || 'in';
1359
- altitude = (0, _convertUnits["default"])(altitude).from(unit).to(_this2.props.state.scene.unit);
1359
+ altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
1360
1360
  }
1361
1361
  scene3D.remove(angleObj);
1362
1362
  scene3D.remove(toolObj);
@@ -1545,7 +1545,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1545
1545
  var _properties2 = allItemRect.cur.itemInfo.properties;
1546
1546
  alti = _properties2.getIn(['altitude', '_length']);
1547
1547
  var _unit2 = _properties2.getIn(['altitude', '_unit']) || 'in';
1548
- alti = (0, _convertUnits["default"])(alti).from(_unit2).to(_this2.props.state.scene.unit);
1548
+ alti = (0, _convertUnitsLite.convert)(alti).from(_unit2).to(_this2.props.state.scene.unit);
1549
1549
  }
1550
1550
  getPoint(event, alti);
1551
1551
  if (bRotate) {
@@ -1618,7 +1618,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
1618
1618
  var properties = allItemRect.cur.itemInfo.properties;
1619
1619
  altitude = properties.getIn(['altitude', '_length']);
1620
1620
  var unit = properties.getIn(['altitude', '_unit']) || 'in';
1621
- altitude = (0, _convertUnits["default"])(altitude).from(unit).to(_this2.props.state.scene.unit);
1621
+ altitude = (0, _convertUnitsLite.convert)(altitude).from(unit).to(_this2.props.state.scene.unit);
1622
1622
  }
1623
1623
  if (_this2.props.state.mode === _constants.MODE_DRAWING_HOLE_3D) {
1624
1624
  gridPlanOrigin = gridPlane.position;
@@ -2078,7 +2078,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
2078
2078
  // In elevation view, set Orthographic camera's position, angle and rotation about selected line
2079
2079
  var layers = scene.layers;
2080
2080
  var selectedLayer = layers.get(scene.selectedLayer);
2081
- var ceilHeight = (0, _convertUnits["default"])(selectedLayer.ceilHeight).from(selectedLayer.unit).to(scene.unit);
2081
+ var ceilHeight = (0, _convertUnitsLite.convert)(selectedLayer.ceilHeight).from(selectedLayer.unit).to(scene.unit);
2082
2082
  var lines = [];
2083
2083
  var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
2084
2084
  var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
@@ -2312,7 +2312,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
2312
2312
  var width = nextProps.width,
2313
2313
  height = nextProps.height;
2314
2314
  var selectedLayer = nextProps.state.getIn(['scene', 'layers', nextProps.state.scene.selectedLayer]);
2315
- var ceilHeight = (0, _convertUnits["default"])(selectedLayer.ceilHeight).from(selectedLayer.unit).to(nextProps.state.scene.unit);
2315
+ var ceilHeight = (0, _convertUnitsLite.convert)(selectedLayer.ceilHeight).from(selectedLayer.unit).to(nextProps.state.scene.unit);
2316
2316
  var actions = {
2317
2317
  areaActions: this.context.areaActions,
2318
2318
  holesActions: this.context.holesActions,
package/lib/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- 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); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -10,32 +9,7 @@ Object.defineProperty(exports, "KitchenConfiguratorApp", {
10
9
  return _KitchenConfiguratorApp["default"];
11
10
  }
12
11
  });
13
- Object.defineProperty(exports, "KitchenConfiguratorReducers", {
14
- enumerable: true,
15
- get: function get() {
16
- return _export2["default"];
17
- }
18
- });
19
- exports.Models = void 0;
20
- Object.defineProperty(exports, "Plugins", {
21
- enumerable: true,
22
- get: function get() {
23
- return _export["default"];
24
- }
25
- });
26
12
  exports["default"] = void 0;
27
- Object.defineProperty(exports, "reducer", {
28
- enumerable: true,
29
- get: function get() {
30
- return _reducer["default"];
31
- }
32
- });
33
- var Models = _interopRequireWildcard(require("./models"));
34
- exports.Models = Models;
35
- var _reducer = _interopRequireDefault(require("./reducers/reducer"));
36
13
  var _KitchenConfiguratorApp = _interopRequireDefault(require("./KitchenConfiguratorApp"));
37
- var _export = _interopRequireDefault(require("./plugins/export"));
38
- var _export2 = _interopRequireDefault(require("./reducers/export"));
39
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
40
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
41
15
  var _default = exports["default"] = _KitchenConfiguratorApp["default"];
package/lib/models.js CHANGED
@@ -4,13 +4,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.Vertex = exports.State = exports.Scene = exports.Line = exports.Layer = exports.Item = exports.Hole = exports.HistoryStructure = exports.Group = exports.Grid = exports.ElementsSet = exports.DefaultLayers = exports.DefaultGrids = exports.CatalogElement = exports.Catalog = exports.Area = void 0;
7
+ exports["default"] = exports.Vertex = exports.State = exports.Scene = exports.Line = exports.Layer = exports.Item = exports.Hole = exports.HistoryStructure = exports.Group = exports.Grid = exports.ElementsSet = exports.DefaultLayers = exports.DefaultGrids = exports.CatalogElement = exports.Catalog = exports.Area = void 0;
8
8
  var _immutable = require("immutable");
9
9
  var _constants = require("./constants");
10
10
  var _snap = require("./utils/snap");
11
11
  var _helper = require("./utils/helper");
12
- var _convertUnits = _interopRequireDefault(require("convert-units"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
+ var _convertUnitsLite = require("./utils/convert-units-lite");
14
13
  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; }
15
14
  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; }
16
15
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -401,17 +400,17 @@ var Catalog = exports.Catalog = /*#__PURE__*/function (_Record10) {
401
400
  width: new _immutable.Map({
402
401
  _length: temp.width,
403
402
  _unit: 'in',
404
- length: (0, _convertUnits["default"])(temp.width).from('in').to('cm')
403
+ length: (0, _convertUnitsLite.convert)(temp.width).from('in').to('cm')
405
404
  }),
406
405
  height: new _immutable.Map({
407
406
  _length: temp.height,
408
407
  _unit: 'in',
409
- length: (0, _convertUnits["default"])(temp.height).from('in').to('cm')
408
+ length: (0, _convertUnitsLite.convert)(temp.height).from('in').to('cm')
410
409
  }),
411
410
  depth: new _immutable.Map({
412
411
  _length: temp.depth,
413
412
  _unit: 'in',
414
- length: (0, _convertUnits["default"])(temp.depth).from('in').to('cm')
413
+ length: (0, _convertUnitsLite.convert)(temp.depth).from('in').to('cm')
415
414
  })
416
415
  };
417
416
  properties = properties.set('width', _sizeinfo.width).set('height', _sizeinfo.height).set('depth', _sizeinfo.depth);
@@ -514,4 +513,5 @@ var State = exports.State = /*#__PURE__*/function (_Record12) {
514
513
  userId: 0,
515
514
  isHelp: false,
516
515
  isCabinetDrawing: false
517
- }, 'State'));
516
+ }, 'State'));
517
+ var _default = exports["default"] = State;
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = _default;
7
7
  var _constants = require("../constants");
8
- var _convertUnits = _interopRequireDefault(require("convert-units"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
8
+ var _convertUnitsLite = require("../utils/convert-units-lite");
10
9
  function _default(state, action) {
11
10
  var _state = state,
12
11
  scene = _state.scene;
@@ -36,8 +35,8 @@ function _default(state, action) {
36
35
  if (item.type.includes('Light')) {
37
36
  var height = item.properties.getIn(['height', '_length']);
38
37
  var heightUnit = item.properties.getIn(['height', '_unit']);
39
- var newAltitude = action.value - (0, _convertUnits["default"])(height).from(heightUnit).to('in');
40
- item = item.setIn(['properties', 'altitude', '_length'], (0, _convertUnits["default"])(newAltitude).from('in').to(_layer.unit));
38
+ var newAltitude = action.value - (0, _convertUnitsLite.convert)(height).from(heightUnit).to('in');
39
+ item = item.setIn(['properties', 'altitude', '_length'], (0, _convertUnitsLite.convert)(newAltitude).from('in').to(_layer.unit));
41
40
  }
42
41
  return item;
43
42
  });
@@ -7,8 +7,7 @@ exports["default"] = _default;
7
7
  var _constants = require("../constants");
8
8
  var _export = require("../class/export");
9
9
  var _export2 = require("../utils/export");
10
- var _convertUnits = _interopRequireDefault(require("convert-units"));
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ var _convertUnitsLite = require("../utils/convert-units-lite");
12
11
  function _default(state, action) {
13
12
  state = state.merge({
14
13
  sceneHistory: _export2.history.historyPush(state.sceneHistory, state.scene)
@@ -41,8 +40,8 @@ function _default(state, action) {
41
40
  if (item.type.includes('Light')) {
42
41
  var height = item.properties.getIn(['height', '_length']);
43
42
  var heightUnit = item.properties.getIn(['height', '_unit']);
44
- var newAltitude = action.value - (0, _convertUnits["default"])(height).from(heightUnit).to('in');
45
- item = item.setIn(['properties', 'altitude', '_length'], (0, _convertUnits["default"])(newAltitude).from('in').to(_layer.unit));
43
+ var newAltitude = action.value - (0, _convertUnitsLite.convert)(height).from(heightUnit).to('in');
44
+ item = item.setIn(['properties', 'altitude', '_length'], (0, _convertUnitsLite.convert)(newAltitude).from('in').to(_layer.unit));
46
45
  }
47
46
  return item;
48
47
  });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.convert = convert;
7
+ var lengthFactors = {
8
+ m: 1,
9
+ cm: 100,
10
+ mm: 1000,
11
+ "in": 39.3701,
12
+ ft: 3.28084
13
+ };
14
+ function convert(value) {
15
+ return {
16
+ from: function from(fromUnit) {
17
+ return {
18
+ to: function to(toUnit) {
19
+ if (!(fromUnit in lengthFactors) || !(toUnit in lengthFactors)) {
20
+ throw new Error("Unsupported unit conversion: ".concat(fromUnit, " \u2192 ").concat(toUnit));
21
+ }
22
+ return value / lengthFactors[fromUnit] * lengthFactors[toUnit];
23
+ }
24
+ };
25
+ }
26
+ };
27
+ }
@@ -96,13 +96,12 @@ exports.verticesDistance = verticesDistance;
96
96
  exports.verticesMidPoint = verticesMidPoint;
97
97
  var _math = require("./math.js");
98
98
  var _constants = require("../constants");
99
- var _convertUnits = _interopRequireDefault(require("convert-units"));
99
+ var _convertUnitsLite = require("./convert-units-lite");
100
100
  var Three = _interopRequireWildcard(require("three"));
101
101
  var _utils = require("../components/viewer2d/utils.js");
102
102
  var _helper = require("./helper.js");
103
103
  var _export = require("./export.js");
104
104
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
105
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
106
105
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
107
106
  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."); }
108
107
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
@@ -780,9 +779,9 @@ function getAllItems(scene, catalog, allLineRects) {
780
779
  layoutpos: cat && cat.info.layoutpos,
781
780
  is_corner: cat && cat.info.is_corner
782
781
  });
783
- width = (0, _convertUnits["default"])(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
784
- height = (0, _convertUnits["default"])(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
785
- depth = (0, _convertUnits["default"])(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
782
+ width = (0, _convertUnitsLite.convert)(sizeinfo.width).from(sizeinfo.widthUnit).to(scene.unit);
783
+ height = (0, _convertUnitsLite.convert)(sizeinfo.depth).from(sizeinfo.depthUnit).to(scene.unit);
784
+ depth = (0, _convertUnitsLite.convert)(sizeinfo.height).from(sizeinfo.heightUnit).to(scene.unit);
786
785
  val.size = {
787
786
  width: width,
788
787
  height: height,
@@ -841,7 +840,7 @@ function getAllItemSpecified(scene, catalog, filter) {
841
840
  var getSize = function getSize(key) {
842
841
  var _props$getIn;
843
842
  var length = props === null || props === void 0 || (_props$getIn = props.getIn) === null || _props$getIn === void 0 ? void 0 : _props$getIn.call(props, [key, '_length']);
844
- return length != null ? (0, _convertUnits["default"])(length).from('in').to(scene.unit) : 0;
843
+ return length != null ? (0, _convertUnitsLite.convert)(length).from('in').to(scene.unit) : 0;
845
844
  };
846
845
  val.size = {
847
846
  width: getSize('width'),
@@ -1717,7 +1716,7 @@ function calcSnap2(allItemRect, allItemSnap, allLineRects, allLineSnap, allRect,
1717
1716
  //Check case.
1718
1717
  //If item is 'blind base cabinet', it must be pulled from other 3".
1719
1718
  if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.startsWith('BBC')) {
1720
- var offset3inch = (0, _convertUnits["default"])(3).from('in').to('cm');
1719
+ var offset3inch = (0, _convertUnitsLite.convert)(3).from('in').to('cm');
1721
1720
  var tx = nx,
1722
1721
  ty = ny;
1723
1722
  if (allItemRect.cur && allItemRect.cur.itemInfo.sku_number.endsWith('-L')) {
@@ -2070,14 +2069,14 @@ function needSnap(curItem, othItem) {
2070
2069
  var blSnap = false;
2071
2070
  if (curItem == undefined || curItem == null) return false;
2072
2071
  var altitude = curItem.selectedItem.properties.get('altitude');
2073
- var heightFromFloor = (0, _convertUnits["default"])(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2072
+ var heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2074
2073
  var height = curItem.cat.info.sizeinfo.height;
2075
2074
  var currentItem = {
2076
2075
  heightFromFloor: heightFromFloor,
2077
2076
  height: height
2078
2077
  };
2079
2078
  altitude = othItem.item.properties.get('altitude');
2080
- heightFromFloor = (0, _convertUnits["default"])(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2079
+ heightFromFloor = (0, _convertUnitsLite.convert)(altitude.get('_length')).from(altitude.get('_unit')).to('in');
2081
2080
  height = othItem.cat && othItem.cat.info.sizeinfo.height;
2082
2081
  var otherItem = {
2083
2082
  heightFromFloor: heightFromFloor,
@@ -2138,7 +2137,7 @@ function isRightWall(v0, v1) {
2138
2137
  * OVERLAP_LINK: two lines are linked at the common point, so they can be merged to one line
2139
2138
  * OVERLAP_INCLUDED: destLine includes srcLine
2140
2139
  * OVERLAP_SOME: two lines are overlapped with some common range, then returns the trimmed segments of srcLine
2141
- *
2140
+ *
2142
2141
  * //////// test - start /////////////
2143
2142
  const p1 = { x1: 1413.1313131313132, y1: 1044.949494949495 };
2144
2143
  const p2 = { x1: 1476.2626262626263, y1: 1108.0808080808079 };
@@ -23,9 +23,8 @@ var _HDRCubeTextureLoader = require("three/examples/jsm/loaders/HDRCubeTextureLo
23
23
  var _constants = require("../constants");
24
24
  var Three = _interopRequireWildcard(require("three"));
25
25
  var _utils = require("./../components/viewer2d/utils");
26
- var _convertUnits = _interopRequireDefault(require("convert-units"));
26
+ var _convertUnitsLite = require("./convert-units-lite");
27
27
  var _math = require("./math");
28
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
29
28
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
30
29
  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); }
31
30
  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; }
@@ -89,9 +88,9 @@ var refineProductForSummaryPdf = exports.refineProductForSummaryPdf = function r
89
88
  thumbnail: review.img,
90
89
  sku: itemSKU,
91
90
  sizeInfo: {
92
- width: Math.round((0, _convertUnits["default"])(review.info.sizeinfo.width).from('in').to(measurementUnit._unit) * 100) / 100,
93
- depth: Math.round((0, _convertUnits["default"])(review.info.sizeinfo.depth).from('in').to(measurementUnit._unit) * 100) / 100,
94
- height: Math.round((0, _convertUnits["default"])(review.info.sizeinfo.height).from('in').to(measurementUnit._unit) * 100) / 100,
91
+ width: Math.round((0, _convertUnitsLite.convert)(review.info.sizeinfo.width).from('in').to(measurementUnit._unit) * 100) / 100,
92
+ depth: Math.round((0, _convertUnitsLite.convert)(review.info.sizeinfo.depth).from('in').to(measurementUnit._unit) * 100) / 100,
93
+ height: Math.round((0, _convertUnitsLite.convert)(review.info.sizeinfo.height).from('in').to(measurementUnit._unit) * 100) / 100,
95
94
  _unit: measurementUnit._unit
96
95
  },
97
96
  doorstyle: doorStyleName,
@@ -207,7 +206,7 @@ var animateDoor = exports.animateDoor = function animateDoor(offsetData, doorObj
207
206
 
208
207
  // Opening or Closing the drawer action
209
208
  var translateDrawer = exports.translateDrawer = function translateDrawer(item, drawerObj, open_doors, mode) {
210
- var animate_translate_unit = (0, _convertUnits["default"])(item.properties.depth._length).from(item.properties.depth._unit).to('cm') * (1 / 2) / _constants.ANIMATE_STEP_MAX * 0.01;
209
+ var animate_translate_unit = (0, _convertUnitsLite.convert)(item.properties.depth._length).from(item.properties.depth._unit).to('cm') * (1 / 2) / _constants.ANIMATE_STEP_MAX * 0.01;
211
210
  // Check whether the object's drawer is opened in 2D.
212
211
  if (mode === 'Opened2D') animate_translate_unit *= _constants.ANIMATE_STEP_MAX;
213
212
  drawerObj.translateZ(open_doors ? -animate_translate_unit : animate_translate_unit);
@@ -270,7 +269,7 @@ function isCeilLimitation(layer, ceilHeight, ceilUnit) {
270
269
  var heightUnit = item.properties.getIn(['height', '_unit']);
271
270
  var altitude = item.properties.getIn(['altitude', '_length']);
272
271
  var altitudeUnit = item.properties.getIn(['altitude', '_unit']);
273
- var totalHeight = (0, _convertUnits["default"])(height).from(heightUnit).to(ceilUnit._unit) + (0, _convertUnits["default"])(altitude).from(altitudeUnit).to(ceilUnit._unit);
272
+ var totalHeight = (0, _convertUnitsLite.convert)(height).from(heightUnit).to(ceilUnit._unit) + (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to(ceilUnit._unit);
274
273
  return totalHeight > ceilHeight;
275
274
  });
276
275
  }
@@ -23,7 +23,7 @@ exports.sortItemsByDistance = sortItemsByDistance;
23
23
  exports.tryMergeMDItem = tryMergeMDItem;
24
24
  var _constants = require("../constants");
25
25
  var Three = _interopRequireWildcard(require("three"));
26
- var _convertUnits = _interopRequireDefault(require("convert-units"));
26
+ var _convertUnitsLite = require("./convert-units-lite");
27
27
  var _idBroker = _interopRequireDefault(require("./id-broker"));
28
28
  var _utils = require("../components/viewer2d/utils");
29
29
  var _export = require("./export");
@@ -48,10 +48,10 @@ function getItemRect(item) {
48
48
  var rotRad = item.rotation / 180 * Math.PI;
49
49
  var itemWidth = item.properties.get('width').get('_length');
50
50
  var itemWidthUnit = item.properties.get('width').get('_unit') || 'cm';
51
- itemWidth = (0, _convertUnits["default"])(itemWidth / 2).from(itemWidthUnit).to('cm');
51
+ itemWidth = (0, _convertUnitsLite.convert)(itemWidth / 2).from(itemWidthUnit).to('cm');
52
52
  var itemDepth = item.properties.get('depth').get('_length');
53
53
  var itemDepthUnit = item.properties.get('depth').get('_unit') || 'cm';
54
- itemDepth = (0, _convertUnits["default"])(itemDepth / 2).from(itemDepthUnit).to('cm');
54
+ itemDepth = (0, _convertUnitsLite.convert)(itemDepth / 2).from(itemDepthUnit).to('cm');
55
55
  var mx = x - itemWidth * Math.cos(rotRad);
56
56
  var my = y - itemWidth * Math.sin(rotRad);
57
57
  var x0 = mx + itemDepth * Math.sin(rotRad);
@@ -93,16 +93,16 @@ function isEnableItemForMolding(layer, selItem) {
93
93
  else return result && hasMoldingLayout(molding, selItem.layoutpos);
94
94
  }
95
95
 
96
- /**
97
- * Check two line segments are overlap. The direction of the two line segments must be opposite.
98
- * s1 c2 s2 c1
99
- * |--------|------|-----------|
100
- * Decision Formular: L(s1,c1) + L(s2, c2) = L(s1, s2) + L(c1, c2)
101
- * @param {*} selRectPos1
102
- * @param {*} selRectPos2
103
- * @param {*} curRectPos1
104
- * @param {*} curRectPos2
105
- * @returns L(s1,c1) + L(s2, c2) - L(s1, s2) - L(c1, c2)
96
+ /**
97
+ * Check two line segments are overlap. The direction of the two line segments must be opposite.
98
+ * s1 c2 s2 c1
99
+ * |--------|------|-----------|
100
+ * Decision Formular: L(s1,c1) + L(s2, c2) = L(s1, s2) + L(c1, c2)
101
+ * @param {*} selRectPos1
102
+ * @param {*} selRectPos2
103
+ * @param {*} curRectPos1
104
+ * @param {*} curRectPos2
105
+ * @returns L(s1,c1) + L(s2, c2) - L(s1, s2) - L(c1, c2)
106
106
  */
107
107
  function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
108
108
  return (
@@ -142,16 +142,16 @@ function isSameMoldingLayoutpos(curItem, item) {
142
142
  function isItemSameItemByLocation(item1, item2, location) {
143
143
  var item1Altitude = item1.properties.get('altitude').get('_length');
144
144
  var item1AltitudeUnit = item1.properties.get('altitude').get('_unit');
145
- item1Altitude = (0, _convertUnits["default"])(item1Altitude).from(item1AltitudeUnit).to('cm');
145
+ item1Altitude = (0, _convertUnitsLite.convert)(item1Altitude).from(item1AltitudeUnit).to('cm');
146
146
  var item1Height = item1.properties.get('height').get('_length');
147
147
  var item1HeightUnit = item1.properties.get('height').get('_unit');
148
- item1Height = (0, _convertUnits["default"])(item1Height).from(item1HeightUnit).to('cm');
148
+ item1Height = (0, _convertUnitsLite.convert)(item1Height).from(item1HeightUnit).to('cm');
149
149
  var item2Altitude = item2.properties.get('altitude').get('_length');
150
150
  var item2AltitudeUnit = item2.properties.get('altitude').get('_unit');
151
- item2Altitude = (0, _convertUnits["default"])(item2Altitude).from(item2AltitudeUnit).to('cm');
151
+ item2Altitude = (0, _convertUnitsLite.convert)(item2Altitude).from(item2AltitudeUnit).to('cm');
152
152
  var item2Height = item2.properties.get('height').get('_length');
153
153
  var item2HeightUnit = item2.properties.get('height').get('_unit');
154
- item2Height = (0, _convertUnits["default"])(item2Height).from(item2HeightUnit).to('cm');
154
+ item2Height = (0, _convertUnitsLite.convert)(item2Height).from(item2HeightUnit).to('cm');
155
155
  var flag = false;
156
156
  switch (location) {
157
157
  case _constants.TOP_MOLDING_LOCATION:
@@ -192,11 +192,11 @@ function tryMergeItemWithLocation(curItem, itemGroup, location) {
192
192
  });
193
193
  }
194
194
 
195
- /**
196
- * Make the molding group array with [items].
197
- * @param {*} layer
198
- * @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
199
- * @returns MG array
195
+ /**
196
+ * Make the molding group array with [items].
197
+ * @param {*} layer
198
+ * @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
199
+ * @returns MG array
200
200
  */
201
201
  function getAllMoldingGroups(layer) {
202
202
  var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
@@ -268,10 +268,10 @@ function getLinesOfItem(item, allLineRects, catalog) {
268
268
  // get edge lines
269
269
  var newWidth = item.properties.get('width').get('_length');
270
270
  var wUnit = item.properties.get('width').get('_unit') || 'cm';
271
- newWidth = (0, _convertUnits["default"])(newWidth).from(wUnit).to('cm');
271
+ newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
272
272
  var newDepth = item.properties.get('depth').get('_length');
273
273
  var hUnit = item.properties.get('depth').get('_unit') || 'cm';
274
- newDepth = (0, _convertUnits["default"])(newDepth).from(hUnit).to('cm');
274
+ newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
275
275
  if (item) {
276
276
  // Get Outline Data of Selected Item
277
277
  outline = element.info.outline;
@@ -371,12 +371,12 @@ function mergeOverlappedLines(line1, line2) {
371
371
  }
372
372
  }
373
373
 
374
- /**
375
- * Get the contour line array of moldingGroup items
376
- * @param {*} moldingGroup
377
- * @param {*} layer
378
- * @param {*} catalog
379
- * @returns contour line array of moldingGroup items
374
+ /**
375
+ * Get the contour line array of moldingGroup items
376
+ * @param {*} moldingGroup
377
+ * @param {*} layer
378
+ * @param {*} catalog
379
+ * @returns contour line array of moldingGroup items
380
380
  */
381
381
  function getLinesFromItems2(moldingGroup, layer, catalog) {
382
382
  // wall lines
@@ -393,10 +393,10 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
393
393
  var itemLines = getLinesOfItem(item, allLineRects, catalog);
394
394
  var itemAltitude = item.properties.get('altitude').get('_length');
395
395
  var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
396
- itemAltitude = (0, _convertUnits["default"])(itemAltitude).from(itemAltitudeUnit).to('cm');
396
+ itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
397
397
  var itemHeight = item.properties.get('height').get('_length');
398
398
  var itemHeightUnit = item.properties.get('height').get('_unit');
399
- itemHeight = (0, _convertUnits["default"])(itemHeight).from(itemHeightUnit).to('cm');
399
+ itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
400
400
  itemLines.forEach(function (line) {
401
401
  line.push({
402
402
  altitude: itemAltitude,
@@ -412,10 +412,10 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
412
412
  items.forEach(function (item) {
413
413
  var itemAltitude = item.properties.get('altitude').get('_length');
414
414
  var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
415
- itemAltitude = (0, _convertUnits["default"])(itemAltitude).from(itemAltitudeUnit).to('cm');
415
+ itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
416
416
  var itemHeight = item.properties.get('height').get('_length');
417
417
  var itemHeightUnit = item.properties.get('height').get('_unit');
418
- itemHeight = (0, _convertUnits["default"])(itemHeight).from(itemHeightUnit).to('cm');
418
+ itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
419
419
  var itemLines = getLinesOfItem(item, allLineRects, catalog);
420
420
 
421
421
  // remove the edge that overlapped with other snapped items
@@ -531,13 +531,13 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
531
531
  return newMGlines;
532
532
  }
533
533
 
534
- /**
535
- * Get the line that colinear linked with [line], and merge them to a new line
536
- * @param {*} line
537
- * @param {*} MGlines
538
- * @returns
539
- * - returns merged new line
540
- * - returns filtered new line group (remove linked line from [MGlines])
534
+ /**
535
+ * Get the line that colinear linked with [line], and merge them to a new line
536
+ * @param {*} line
537
+ * @param {*} MGlines
538
+ * @returns
539
+ * - returns merged new line
540
+ * - returns filtered new line group (remove linked line from [MGlines])
541
541
  */
542
542
  function getMergedLine(line, MGlines, cnt) {
543
543
  try {
@@ -590,11 +590,11 @@ function getMergedLine(line, MGlines, cnt) {
590
590
  }
591
591
  }
592
592
 
593
- /**
594
- * Get the contour line segments from [lineSegs]
595
- * @param {*} lineSegs
596
- * @param {*} otherLines
597
- * @returns
593
+ /**
594
+ * Get the contour line segments from [lineSegs]
595
+ * @param {*} lineSegs
596
+ * @param {*} otherLines
597
+ * @returns
598
598
  */
599
599
  function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
600
600
  try {
@@ -692,16 +692,16 @@ function getLinesFromItems(moldingGroup, layer, catalog) {
692
692
  snapped_other_items.forEach(function (item) {
693
693
  var itemAltitude = item.properties.get('altitude').get('_length');
694
694
  var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
695
- itemAltitude = (0, _convertUnits["default"])(itemAltitude).from(itemAltitudeUnit).to('cm');
695
+ itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
696
696
  var itemHeight = item.properties.get('height').get('_length');
697
697
  var itemHeightUnit = item.properties.get('height').get('_unit');
698
- itemHeight = (0, _convertUnits["default"])(itemHeight).from(itemHeightUnit).to('cm');
698
+ itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
699
699
  var mgroupAltitude = items[0].properties.get('altitude').get('_length');
700
700
  var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
701
- mgroupAltitude = (0, _convertUnits["default"])(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
701
+ mgroupAltitude = (0, _convertUnitsLite.convert)(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
702
702
  var mgroupHeight = items[0].properties.get('height').get('_length');
703
703
  var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
704
- mgroupHeight = (0, _convertUnits["default"])(mgroupHeight).from(mgroupHeightUnit).to('cm');
704
+ mgroupHeight = (0, _convertUnitsLite.convert)(mgroupHeight).from(mgroupHeightUnit).to('cm');
705
705
  var flag = false;
706
706
  switch (moldingGroup.location_type) {
707
707
  case _constants.TOP_MOLDING_LOCATION:
@@ -860,10 +860,10 @@ function getMDPoints(newMD) {
860
860
  }
861
861
  var z = newMD.items[0].properties.get('altitude').get('_length');
862
862
  var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
863
- z = (0, _convertUnits["default"])(z).from(zUnit).to('cm');
863
+ z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
864
864
  var height = newMD.items[0].properties.get('height').get('_length');
865
865
  var heightUnit = newMD.items[0].properties.get('height').get('_unit') || 'cm';
866
- height = (0, _convertUnits["default"])(height).from(heightUnit).to('cm');
866
+ height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
867
867
  switch (newMD.location_type) {
868
868
  case _constants.TOP_MOLDING_LOCATION:
869
869
  z += height;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "1.1.1-test.53",
3
+ "version": "1.1.1-test.55",
4
4
  "description": "It is a kitchen simulator.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -58,7 +58,6 @@
58
58
  "redux"
59
59
  ],
60
60
  "peerDependencies": {
61
- "convert-units": "2.3.4",
62
61
  "hoist-non-react-statics": "2.5.5",
63
62
  "immutable": "3.8.2",
64
63
  "immutablediff": "0.4.4",
@@ -99,7 +98,6 @@
99
98
  "babel-plugin-transform-object-rest-spread": "^6.26.0",
100
99
  "babel-plugin-transform-rename-import": "^2.3.0",
101
100
  "const-version": "2.0.0",
102
- "convert-units": "2.3.4",
103
101
  "cross-env": "^5.2.0",
104
102
  "css-loader": "*",
105
103
  "file-loader": "6.2.0",