hart-estate-widget 0.0.35 → 0.0.38
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.
Binary file
|
@@ -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,18 @@ 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
|
+
let panoramaId = removeExtention(img.substring(panoramaIdIndex));
|
91
|
+
|
92
|
+
if (panoramaId.includes(cameraIdBeginning)) {
|
93
|
+
const cameraIdIndex = panoramaId.indexOf(cameraIdBeginning) - 1;
|
94
|
+
panoramaId = panoramaId.slice(0, cameraIdIndex);
|
95
|
+
}
|
96
|
+
|
97
|
+
return Number(panoramaId) === index;
|
98
|
+
});
|
85
99
|
if (!roomImages.length) return acc;
|
86
100
|
roomImages.forEach(image => {
|
87
101
|
const panorama = createPanorama(image, index, setLoadingState);
|
@@ -325,6 +339,7 @@ const PanoramaTab = _ref5 => {
|
|
325
339
|
src: planImage,
|
326
340
|
className: isMapActive ? 'active' : '',
|
327
341
|
onClick: toggleMap,
|
342
|
+
onLoad: setScale,
|
328
343
|
alt: "plan"
|
329
344
|
}), !isMapDisabled && panoramaRooms.map((room, index) => /*#__PURE__*/_react.default.createElement("div", {
|
330
345
|
key: index,
|