hart-estate-widget 0.0.30 → 0.0.31

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: !config.panoramaImages[0],
85
- image: config.panoramaImages[0],
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
- acc.push(panorama);
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
  };
@@ -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: panoramaImages[0],
48
+ img: _store.default.hallRoomImage,
50
49
  icon: null
51
50
  },
52
51
  'rotation': {
@@ -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,37 @@ 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
+ return door.Walls.some(doorWallId => json.Floors[0].ExteriorWalls.some(exteriorWallId => exteriorWallId === doorWallId));
44
+ });
45
+ const wallWithExteriorDoor = exteriorDoor.Walls.find(wallId => wallId !== exteriorWallWithDoor);
46
+ const room = json.Floors[0].Units[0].Rooms.find(_ref => {
47
+ let {
48
+ Walls
49
+ } = _ref;
50
+ return Walls.some(wallId => wallId === wallWithExteriorDoor);
51
+ });
52
+ return room.ID;
53
+ }
54
+
55
+ get hallRoomImage() {
56
+ const {
57
+ json,
58
+ panoramaImages
59
+ } = this.config;
60
+ const roomIndex = json.Floors[0].Units[0].Rooms.findIndex(room => room.ID === this.hallRoomId);
61
+ const image = panoramaImages.find(url => url.includes("".concat(roomIndex, ".png")));
62
+ return image || panoramaImages[0];
63
+ }
64
+
32
65
  setConfig(config) {
33
66
  this.config = config;
34
67
  }
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.30",
6
+ "version": "0.0.31",
7
7
  "private": false,
8
8
  "main": "build/index.js",
9
9
  "module": "build/index.js",