hart-estate-widget 0.0.34 → 0.0.35
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
|
Binary file
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
require("core-js/modules/web.dom-collections.iterator.js");
|
9
9
|
|
10
|
+
require("core-js/modules/es.promise.js");
|
11
|
+
|
10
12
|
var _react = _interopRequireWildcard(require("react"));
|
11
13
|
|
12
14
|
var _mobxReactLite = require("mobx-react-lite");
|
@@ -56,6 +58,19 @@ const Application = (0, _mobxReactLite.observer)(_ref => {
|
|
56
58
|
_store.default.dispatchEvent('enterComponent');
|
57
59
|
};
|
58
60
|
|
61
|
+
const openPanorama = async () => {
|
62
|
+
try {
|
63
|
+
if (DeviceOrientationEvent.requestPermission) {
|
64
|
+
await DeviceOrientationEvent.requestPermission();
|
65
|
+
}
|
66
|
+
} catch (e) {
|
67
|
+
console.error(e);
|
68
|
+
console.log('Device motion not allowed');
|
69
|
+
}
|
70
|
+
|
71
|
+
hideTabPanes();
|
72
|
+
};
|
73
|
+
|
59
74
|
const tabsList = {
|
60
75
|
'planImage': /*#__PURE__*/_react.default.createElement(_ImageTab.default, {
|
61
76
|
image: config.planImage,
|
@@ -85,7 +100,7 @@ const Application = (0, _mobxReactLite.observer)(_ref => {
|
|
85
100
|
image: _store.default.hallRoomImage,
|
86
101
|
title: "Panoramic tour",
|
87
102
|
text: ['Use mouse to rotate', 'To move through the rooms, click on the layout thumbnail'],
|
88
|
-
onStart:
|
103
|
+
onStart: openPanorama
|
89
104
|
}, /*#__PURE__*/_react.default.createElement(_PanoramaTab.default, {
|
90
105
|
json: config.json,
|
91
106
|
planImage: config.planImage,
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
-
require("core-js/modules/es.
|
8
|
+
require("core-js/modules/es.array.reduce.js");
|
9
9
|
|
10
|
-
require("core-js/modules/es.
|
10
|
+
require("core-js/modules/es.regexp.exec.js");
|
11
11
|
|
12
|
-
require("core-js/modules/es.
|
12
|
+
require("core-js/modules/es.string.replace.js");
|
13
13
|
|
14
14
|
require("core-js/modules/es.string.includes.js");
|
15
15
|
|
@@ -46,14 +46,16 @@ const {
|
|
46
46
|
ORBIT
|
47
47
|
} = PANOLENS.CONTROLS;
|
48
48
|
const pathName = 'Panorama_0_0_';
|
49
|
-
(0, _panoramaHelpers.imageToUri)(_spotIcon.default, img => PANOLENS.DataImage.Spot = img);
|
50
|
-
(0, _panoramaHelpers.imageToUri)(_doorIcon.default, img => PANOLENS.DataImage.Door = img);
|
51
49
|
|
52
50
|
const getCameraFromSrc = (json, src) => {
|
53
51
|
var _json$Floors$0$Camera;
|
54
52
|
|
55
|
-
const
|
56
|
-
const
|
53
|
+
const cameraIdIndex = src.indexOf('CameraId');
|
54
|
+
const imgExtentions = ['.png', '.PNG', '.jpg', '.JPG'];
|
55
|
+
if (cameraIdIndex === -1) return null;
|
56
|
+
const cameraId = imgExtentions.reduce((acc, extention) => {
|
57
|
+
return acc.replace(extention, '');
|
58
|
+
}, src.substring(cameraIdIndex));
|
57
59
|
return ((_json$Floors$0$Camera = json.Floors[0].CameraPoints) === null || _json$Floors$0$Camera === void 0 ? void 0 : _json$Floors$0$Camera.find(_ref => {
|
58
60
|
let {
|
59
61
|
ID
|
@@ -109,6 +111,7 @@ const getPanoramaRooms = (json, panoramas) => {
|
|
109
111
|
};
|
110
112
|
const currentRoom = json.Floors[0].Units[0].Rooms.find(room => room.ID === panorama['room_id']);
|
111
113
|
let [left, top] = (0, _geometric.polygonMean)((0, _panoramaHelpers.getRoomCoordinates)(currentRoom, json.Floors[0].Walls, json.Vertices));
|
114
|
+
panorama['roomType'] = currentRoom.Type;
|
112
115
|
|
113
116
|
if (!panorama.linkedSpots.length) {
|
114
117
|
if (panorama.src.includes('_CameraId')) {
|
@@ -173,16 +176,18 @@ const connectPanorama = function connectPanorama(panorama, connectedPanorama, lo
|
|
173
176
|
let isDoorLink = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
174
177
|
const locationX = location.Y - center[1];
|
175
178
|
const locationY = location.X - center[0];
|
176
|
-
const locationZ = isDoorLink ? -10 : -
|
177
|
-
const icon = isDoorLink ?
|
179
|
+
const locationZ = isDoorLink ? -10 : -100;
|
180
|
+
const icon = isDoorLink ? _doorIcon.default : _spotIcon.default;
|
181
|
+
const iconUrl = "".concat(icon, "?id=").concat(panorama['panorama_index'], "-").concat(panorama['panorama_id'], "-").concat(Math.random());
|
178
182
|
const defaultScale = 20;
|
179
183
|
const maxScale = 50;
|
180
184
|
const defaultLength = 120;
|
181
185
|
const length = (0, _geometric.lineLength)([[0, 0], [locationX, locationY]]);
|
182
186
|
const scale = length / defaultLength * defaultScale;
|
183
187
|
const finalScale = scale > maxScale ? maxScale : scale;
|
188
|
+
const resultScale = isDoorLink ? finalScale : finalScale - 15;
|
184
189
|
const position = new THREE.Vector3(locationX, locationZ, locationY);
|
185
|
-
panorama.link(connectedPanorama, position,
|
190
|
+
panorama.link(connectedPanorama, position, resultScale, iconUrl);
|
186
191
|
};
|
187
192
|
|
188
193
|
const initPanorama = () => {
|
@@ -199,11 +204,6 @@ const initPanorama = () => {
|
|
199
204
|
};
|
200
205
|
|
201
206
|
animate();
|
202
|
-
|
203
|
-
if (DeviceOrientationEvent.requestPermission) {
|
204
|
-
DeviceOrientationEvent.requestPermission().catch(() => console.log('Device motion not allowed'));
|
205
|
-
}
|
206
|
-
|
207
207
|
return {
|
208
208
|
camera,
|
209
209
|
controls
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.getScale = exports.getRoomCoordinates = exports.findWallVertices = void 0;
|
7
7
|
|
8
8
|
require("core-js/modules/es.array.reduce.js");
|
9
9
|
|
@@ -49,21 +49,4 @@ const getScale = (image, json) => {
|
|
49
49
|
};
|
50
50
|
};
|
51
51
|
|
52
|
-
exports.getScale = getScale;
|
53
|
-
|
54
|
-
const imageToUri = (url, callback) => {
|
55
|
-
const canvas = document.createElement('canvas');
|
56
|
-
const ctx = canvas.getContext('2d');
|
57
|
-
const image = new Image();
|
58
|
-
image.src = url;
|
59
|
-
|
60
|
-
image.onload = () => {
|
61
|
-
canvas.width = image.width;
|
62
|
-
canvas.height = image.height;
|
63
|
-
ctx.drawImage(image, 0, 0);
|
64
|
-
callback(canvas.toDataURL('image/png'));
|
65
|
-
canvas.remove();
|
66
|
-
};
|
67
|
-
};
|
68
|
-
|
69
|
-
exports.imageToUri = imageToUri;
|
52
|
+
exports.getScale = getScale;
|