hart-estate-widget 0.0.29 → 0.0.32
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.
@@ -81,8 +81,8 @@ const Application = (0, _mobxReactLite.observer)(_ref => {
|
|
81
81
|
})),
|
82
82
|
'panorama': /*#__PURE__*/_react.default.createElement(_TabWrapper.default, {
|
83
83
|
isActive: !isTabPanesVisible,
|
84
|
-
disabled: !
|
85
|
-
image:
|
84
|
+
disabled: !_store.default.hallRoomImage,
|
85
|
+
image: _store.default.hallRoomImage,
|
86
86
|
title: "Panoramic tour",
|
87
87
|
text: ['Use mouse to rotate', 'To move through the rooms, click on the layout thumbnail'],
|
88
88
|
onStart: hideTabPanes
|
@@ -13,6 +13,8 @@ require("core-js/modules/web.dom-collections.iterator.js");
|
|
13
13
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
15
15
|
|
16
|
+
var _store = _interopRequireDefault(require("../store"));
|
17
|
+
|
16
18
|
var THREE = _interopRequireWildcard(require("three"));
|
17
19
|
|
18
20
|
var PANOLENS = _interopRequireWildcard(require("panolens"));
|
@@ -58,7 +60,13 @@ const getPanoramas = (json, images, setLoadingState) => {
|
|
58
60
|
if (!image) return acc;
|
59
61
|
const panorama = createPanorama(image, index, setLoadingState);
|
60
62
|
panorama['room_id'] = jsonRoom.ID;
|
61
|
-
|
63
|
+
|
64
|
+
if (panorama['room_id'] === _store.default.hallRoomId) {
|
65
|
+
acc.unshift(panorama);
|
66
|
+
} else {
|
67
|
+
acc.push(panorama);
|
68
|
+
}
|
69
|
+
|
62
70
|
return acc;
|
63
71
|
}, []);
|
64
72
|
};
|
@@ -206,12 +214,30 @@ const PanoramaTab = _ref3 => {
|
|
206
214
|
};
|
207
215
|
|
208
216
|
(0, _react.useEffect)(() => {
|
217
|
+
const container = document.querySelector('.widget-tab__panorama-overlay');
|
209
218
|
const newViewer = new PANOLENS.Viewer({
|
210
|
-
container
|
219
|
+
container,
|
211
220
|
autoHideInfospot: false,
|
212
221
|
controlButtons: [],
|
213
222
|
cameraFov: 90
|
214
223
|
});
|
224
|
+
container.addEventListener('mousewheel', e => {
|
225
|
+
e.preventDefault();
|
226
|
+
e.stopPropagation();
|
227
|
+
const scope = newViewer.getControl();
|
228
|
+
const fovStep = 2;
|
229
|
+
|
230
|
+
if (e.deltaY > 0) {
|
231
|
+
const newFov = scope.object.fov + fovStep;
|
232
|
+
scope.object.fov = newFov < scope.maxFov ? newFov : scope.maxFov;
|
233
|
+
scope.object.updateProjectionMatrix();
|
234
|
+
return;
|
235
|
+
}
|
236
|
+
|
237
|
+
const newFov = scope.object.fov - fovStep;
|
238
|
+
scope.object.fov = newFov > scope.minFov ? newFov : scope.minFov;
|
239
|
+
scope.object.updateProjectionMatrix();
|
240
|
+
});
|
215
241
|
panoramas.forEach(panorama => {
|
216
242
|
if (!panorama.panorama_id) return;
|
217
243
|
panorama.addEventListener('enter', _ref4 => {
|
@@ -28,7 +28,6 @@ const TabPanes = (0, _mobxReactLite.observer)(_ref => {
|
|
28
28
|
planImage,
|
29
29
|
topView,
|
30
30
|
topDownView,
|
31
|
-
panoramaImages,
|
32
31
|
rotationImages,
|
33
32
|
tabs
|
34
33
|
} = _store.default.config;
|
@@ -46,7 +45,7 @@ const TabPanes = (0, _mobxReactLite.observer)(_ref => {
|
|
46
45
|
icon: null
|
47
46
|
},
|
48
47
|
'panorama': {
|
49
|
-
img:
|
48
|
+
img: _store.default.hallRoomImage,
|
50
49
|
icon: null
|
51
50
|
},
|
52
51
|
'rotation': {
|
package/build/store/index.js
CHANGED
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
+
require("core-js/modules/es.string.includes.js");
|
9
|
+
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
9
11
|
|
10
12
|
var _mobx = require("mobx");
|
@@ -29,6 +31,39 @@ class Store {
|
|
29
31
|
(0, _mobx.makeAutoObservable)(this);
|
30
32
|
}
|
31
33
|
|
34
|
+
get hallRoomId() {
|
35
|
+
const {
|
36
|
+
json
|
37
|
+
} = this.config;
|
38
|
+
if (!json) return 0;
|
39
|
+
const exteriorWallWithDoor = json.Floors[0].ExteriorWalls.find(wallId => {
|
40
|
+
return json.Floors[0].Doors.some(door => door.Walls.some(doorWallId => doorWallId === wallId));
|
41
|
+
});
|
42
|
+
const exteriorDoor = json.Floors[0].Doors.find(door => {
|
43
|
+
const isSameDoor = door.Walls.some(doorWallId => doorWallId === exteriorWallWithDoor);
|
44
|
+
const isExterior = door.Walls.some(doorWallId => json.Floors[0].ExteriorWalls.some(exteriorWallId => exteriorWallId === doorWallId));
|
45
|
+
return isSameDoor && isExterior;
|
46
|
+
});
|
47
|
+
const wallWithExteriorDoor = exteriorDoor.Walls.find(wallId => wallId !== exteriorWallWithDoor);
|
48
|
+
const room = json.Floors[0].Units[0].Rooms.find(_ref => {
|
49
|
+
let {
|
50
|
+
Walls
|
51
|
+
} = _ref;
|
52
|
+
return Walls.some(wallId => wallId === wallWithExteriorDoor);
|
53
|
+
});
|
54
|
+
return room.ID;
|
55
|
+
}
|
56
|
+
|
57
|
+
get hallRoomImage() {
|
58
|
+
const {
|
59
|
+
json,
|
60
|
+
panoramaImages
|
61
|
+
} = this.config;
|
62
|
+
const roomIndex = json.Floors[0].Units[0].Rooms.findIndex(room => room.ID === this.hallRoomId);
|
63
|
+
const image = panoramaImages.find(url => url.includes("".concat(roomIndex, ".png")));
|
64
|
+
return image || panoramaImages[0];
|
65
|
+
}
|
66
|
+
|
32
67
|
setConfig(config) {
|
33
68
|
this.config = config;
|
34
69
|
}
|