hart-estate-widget 0.0.36 → 0.0.37

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,13 +45,13 @@ 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_';
49
50
 
50
51
  const getCameraFromSrc = (json, src) => {
51
52
  var _json$Floors$0$Camera;
52
53
 
53
54
  const cameraIdIndex = src.indexOf('CameraId');
54
- const imgExtentions = ['.png', '.PNG', '.jpg', '.JPG'];
55
55
  if (cameraIdIndex === -1) return null;
56
56
  const cameraId = imgExtentions.reduce((acc, extention) => {
57
57
  return acc.replace(extention, '');
@@ -81,7 +81,14 @@ const createPanorama = (image, index, setLoadingState) => {
81
81
  const getPanoramas = (json, images, setLoadingState) => {
82
82
  if (!json) return images.map((image, index) => createPanorama(image, index, setLoadingState));
83
83
  return json.Floors[0].Units[0].Rooms.reduce((acc, jsonRoom, index) => {
84
- const roomImages = images.filter(img => img.includes(pathName + index));
84
+ const roomImages = images.filter(img => {
85
+ const panoramaIdIndex = img.indexOf(pathName);
86
+ if (panoramaIdIndex === -1) return false;
87
+ const panoramaId = imgExtentions.reduce((acc, extention) => {
88
+ return acc.replace(extention, '');
89
+ }, img.substring(panoramaIdIndex + pathName.length));
90
+ return Number(panoramaId) === index;
91
+ });
85
92
  if (!roomImages.length) return acc;
86
93
  roomImages.forEach(image => {
87
94
  const panorama = createPanorama(image, index, setLoadingState);
@@ -325,6 +332,7 @@ const PanoramaTab = _ref5 => {
325
332
  src: planImage,
326
333
  className: isMapActive ? 'active' : '',
327
334
  onClick: toggleMap,
335
+ onLoad: setScale,
328
336
  alt: "plan"
329
337
  }), !isMapDisabled && panoramaRooms.map((room, index) => /*#__PURE__*/_react.default.createElement("div", {
330
338
  key: index,
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.36",
6
+ "version": "0.0.37",
7
7
  "private": false,
8
8
  "main": "build/index.js",
9
9
  "module": "build/index.js",