hart-estate-widget 0.0.17 → 0.0.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.
@@ -11,6 +11,8 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
11
11
 
12
12
  var _store = _interopRequireDefault(require("../store"));
13
13
 
14
+ var _modelStore = _interopRequireDefault(require("../store/modelStore"));
15
+
14
16
  var _Application = _interopRequireDefault(require("./Application"));
15
17
 
16
18
  var _defaultConfig = _interopRequireDefault(require("../config/defaultConfig"));
@@ -27,6 +29,8 @@ class Widget {
27
29
  constructor(container) {
28
30
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29
31
 
32
+ _defineProperty(this, "requiredParams", ['tabs', 'tabPanes', 'width', 'height', 'env']);
33
+
30
34
  const config = _objectSpread(_objectSpread({}, _defaultConfig.default), options);
31
35
 
32
36
  const widgetContainer = document.querySelector(container);
@@ -46,7 +50,16 @@ class Widget {
46
50
  }
47
51
 
48
52
  updateOptions(config) {
49
- _store.default.setConfig(_objectSpread(_objectSpread({}, this.options), config));
53
+ const newConfig = _objectSpread({}, config);
54
+
55
+ this.requiredParams.forEach(param => {
56
+ if (config[param]) return;
57
+ newConfig[param] = this.options[param];
58
+ });
59
+
60
+ _modelStore.default.removeHouse();
61
+
62
+ _store.default.setConfig(newConfig);
50
63
  }
51
64
 
52
65
  on(event, callback) {
@@ -95,6 +95,7 @@ class HouseStore {
95
95
 
96
96
  (0, _mobx.makeAutoObservable)(this);
97
97
  this.modelStore = modelStore;
98
+ this.houseGroup.name = 'House-Group';
98
99
  this.globalPlane = new THREE.Plane(new THREE.Vector3(0, -this.wallsHeight - 0.5, 0), 1);
99
100
  this.clippingPlanes = [this.globalPlane];
100
101
  this.setCenterPosition().loadTextures().then(() => {
@@ -70,6 +70,12 @@ class ModelStore {
70
70
  this.scene.add(this.houseStore.houseGroup);
71
71
  });
72
72
 
73
+ _defineProperty(this, "removeHouse", () => {
74
+ const selectedObject = this.scene.getObjectByName('House-Group');
75
+ this.scene.remove(selectedObject);
76
+ this.initialized = false;
77
+ });
78
+
73
79
  _defineProperty(this, "setJoystickState", value => {
74
80
  this.isJoystickActive = value;
75
81
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "HART Estate widget",
4
4
  "author": "HART",
5
5
  "keywords": [],
6
- "version": "0.0.17",
6
+ "version": "0.0.18",
7
7
  "private": false,
8
8
  "main": "build/index.js",
9
9
  "module": "build/index.js",