hart-estate-widget 0.0.15 → 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.
@@ -44,9 +44,17 @@ const Application = (0, _mobxReactLite.observer)(_ref => {
|
|
44
44
|
const [currentTab, setCurrentTab] = (0, _react.useState)(config.tabs[0]);
|
45
45
|
const [isTabPanesVisible, setTabPanesState] = (0, _react.useState)(true);
|
46
46
|
|
47
|
-
const showTabPanes = () =>
|
47
|
+
const showTabPanes = () => {
|
48
|
+
setTabPanesState(true);
|
48
49
|
|
49
|
-
|
50
|
+
_store.default.dispatchEvent('exitComponent');
|
51
|
+
};
|
52
|
+
|
53
|
+
const hideTabPanes = () => {
|
54
|
+
setTabPanesState(false);
|
55
|
+
|
56
|
+
_store.default.dispatchEvent('enterComponent');
|
57
|
+
};
|
50
58
|
|
51
59
|
const tabsList = {
|
52
60
|
'planImage': /*#__PURE__*/_react.default.createElement(_ImageTab.default, {
|
@@ -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,20 @@ class Widget {
|
|
46
50
|
}
|
47
51
|
|
48
52
|
updateOptions(config) {
|
49
|
-
|
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);
|
63
|
+
}
|
64
|
+
|
65
|
+
on(event, callback) {
|
66
|
+
_store.default.addEventListener(event, callback);
|
50
67
|
}
|
51
68
|
|
52
69
|
}
|
package/build/store/apiStore.js
CHANGED
@@ -44,6 +44,12 @@ class ApiStore {
|
|
44
44
|
return await response.json();
|
45
45
|
});
|
46
46
|
|
47
|
+
_defineProperty(this, "loadEditorData", async (planId, token) => {
|
48
|
+
const path = "".concat(this.API_URL, "/api/plans/").concat(planId, "/editor?token=").concat(token);
|
49
|
+
const response = await fetch(path);
|
50
|
+
return await response.json();
|
51
|
+
});
|
52
|
+
|
47
53
|
_defineProperty(this, "loadPanoramaData", async planId => {
|
48
54
|
const path = "".concat(this.API_URL, "/api/plans/").concat(planId, "/panorama");
|
49
55
|
const response = await fetch(path);
|
@@ -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(() => {
|
package/build/store/index.js
CHANGED
@@ -21,6 +21,11 @@ class Store {
|
|
21
21
|
constructor() {
|
22
22
|
_defineProperty(this, "config", null);
|
23
23
|
|
24
|
+
_defineProperty(this, "listeners", {
|
25
|
+
'enterComponent': [],
|
26
|
+
'exitComponent': []
|
27
|
+
});
|
28
|
+
|
24
29
|
(0, _mobx.makeAutoObservable)(this);
|
25
30
|
}
|
26
31
|
|
@@ -28,6 +33,16 @@ class Store {
|
|
28
33
|
this.config = config;
|
29
34
|
}
|
30
35
|
|
36
|
+
addEventListener(event, callback) {
|
37
|
+
if (!this.listeners[event]) return;
|
38
|
+
this.listeners[event].push(callback);
|
39
|
+
}
|
40
|
+
|
41
|
+
dispatchEvent(event) {
|
42
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
43
|
+
this.listeners[event].forEach(callback => callback(value));
|
44
|
+
}
|
45
|
+
|
31
46
|
}
|
32
47
|
|
33
48
|
var _default = new Store();
|
@@ -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
|
});
|