hart-estate-widget 0.0.36 → 0.0.39
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,10 +11,10 @@ require("core-js/modules/es.regexp.exec.js");
|
|
11
11
|
|
12
12
|
require("core-js/modules/es.string.replace.js");
|
13
13
|
|
14
|
-
require("core-js/modules/es.string.includes.js");
|
15
|
-
|
16
14
|
require("core-js/modules/web.dom-collections.iterator.js");
|
17
15
|
|
16
|
+
require("core-js/modules/es.string.includes.js");
|
17
|
+
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
19
19
|
|
20
20
|
var _store = _interopRequireDefault(require("../store"));
|
@@ -45,17 +45,20 @@ const {
|
|
45
45
|
DEVICEORIENTATION,
|
46
46
|
ORBIT
|
47
47
|
} = PANOLENS.CONTROLS;
|
48
|
+
const imgExtentions = ['.png', '.PNG', '.jpg', '.JPG'];
|
48
49
|
const pathName = 'Panorama_0_0_';
|
50
|
+
const cameraIdBeginning = 'CameraId';
|
51
|
+
|
52
|
+
const removeExtention = str => imgExtentions.reduce((acc, extention) => {
|
53
|
+
return acc.replace(extention, '');
|
54
|
+
}, str);
|
49
55
|
|
50
56
|
const getCameraFromSrc = (json, src) => {
|
51
57
|
var _json$Floors$0$Camera;
|
52
58
|
|
53
|
-
const cameraIdIndex = src.indexOf(
|
54
|
-
const imgExtentions = ['.png', '.PNG', '.jpg', '.JPG'];
|
59
|
+
const cameraIdIndex = src.indexOf(cameraIdBeginning);
|
55
60
|
if (cameraIdIndex === -1) return null;
|
56
|
-
const cameraId =
|
57
|
-
return acc.replace(extention, '');
|
58
|
-
}, src.substring(cameraIdIndex));
|
61
|
+
const cameraId = removeExtention(src.substring(cameraIdIndex));
|
59
62
|
return ((_json$Floors$0$Camera = json.Floors[0].CameraPoints) === null || _json$Floors$0$Camera === void 0 ? void 0 : _json$Floors$0$Camera.find(_ref => {
|
60
63
|
let {
|
61
64
|
ID
|
@@ -81,7 +84,17 @@ const createPanorama = (image, index, setLoadingState) => {
|
|
81
84
|
const getPanoramas = (json, images, setLoadingState) => {
|
82
85
|
if (!json) return images.map((image, index) => createPanorama(image, index, setLoadingState));
|
83
86
|
return json.Floors[0].Units[0].Rooms.reduce((acc, jsonRoom, index) => {
|
84
|
-
const roomImages = images.filter(img =>
|
87
|
+
const roomImages = images.filter(img => {
|
88
|
+
const panoramaIdIndex = img.indexOf(pathName) + pathName.length;
|
89
|
+
if (panoramaIdIndex < pathName.length) return false;
|
90
|
+
const indexAsString = String(index);
|
91
|
+
const panoramaId = String(removeExtention(img.substring(panoramaIdIndex)));
|
92
|
+
const maxIndexLength = Math.max(indexAsString.length, panoramaId.length);
|
93
|
+
const imageInRoom = (0, _panoramaHelpers.getArrayFromNumber)(maxIndexLength).every(i => {
|
94
|
+
return panoramaId[i] === indexAsString[i];
|
95
|
+
});
|
96
|
+
return imageInRoom;
|
97
|
+
});
|
85
98
|
if (!roomImages.length) return acc;
|
86
99
|
roomImages.forEach(image => {
|
87
100
|
const panorama = createPanorama(image, index, setLoadingState);
|
@@ -325,6 +338,7 @@ const PanoramaTab = _ref5 => {
|
|
325
338
|
src: planImage,
|
326
339
|
className: isMapActive ? 'active' : '',
|
327
340
|
onClick: toggleMap,
|
341
|
+
onLoad: setScale,
|
328
342
|
alt: "plan"
|
329
343
|
}), !isMapDisabled && panoramaRooms.map((room, index) => /*#__PURE__*/_react.default.createElement("div", {
|
330
344
|
key: index,
|
package/build/store/index.js
CHANGED
@@ -59,9 +59,10 @@ class Store {
|
|
59
59
|
json,
|
60
60
|
panoramaImages
|
61
61
|
} = this.config;
|
62
|
+
if (!json) return panoramaImages[0] || null;
|
62
63
|
const roomIndex = json.Floors[0].Units[0].Rooms.findIndex(room => room.ID === this.hallRoomId);
|
63
64
|
const image = panoramaImages.find(url => url.includes("".concat(roomIndex, ".png")));
|
64
|
-
return image || panoramaImages[0];
|
65
|
+
return image || panoramaImages[0] || null;
|
65
66
|
}
|
66
67
|
|
67
68
|
setConfig(config) {
|
@@ -3,7 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.getScale = exports.getRoomCoordinates = exports.findWallVertices = void 0;
|
6
|
+
exports.getScale = exports.getRoomCoordinates = exports.getArrayFromNumber = exports.findWallVertices = void 0;
|
7
|
+
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
7
9
|
|
8
10
|
require("core-js/modules/es.array.reduce.js");
|
9
11
|
|
@@ -11,6 +13,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
15
|
|
16
|
+
const getArrayFromNumber = num => [...Array(num).keys()];
|
17
|
+
|
18
|
+
exports.getArrayFromNumber = getArrayFromNumber;
|
19
|
+
|
14
20
|
const findWallVertices = (walls, wall, vertices) => {
|
15
21
|
const currentWall = walls.find(el => el.ID === wall);
|
16
22
|
return currentWall.Vertices.map(vertexId => {
|