hart-estate-widget 0.0.47 → 0.0.50
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.
- package/build/assets/css/app.css +1 -1
- package/build/assets/css/app.css.map +1 -1
- package/build/components/Application.js +41 -24
- package/build/components/Buttons/FullScreenButton.js +7 -3
- package/build/components/Buttons/TabButton.js +4 -6
- package/build/components/ImageTab.js +3 -5
- package/build/components/Instructions.js +15 -13
- package/build/components/Loader.js +4 -5
- package/build/components/ModelTab.js +89 -54
- package/build/components/PanoramaTab.js +234 -176
- package/build/components/RotationTab.js +71 -32
- package/build/components/Widget.js +43 -27
- package/build/config/defaultConfig.js +1 -1
- package/build/enums/deviceOrientationStatus.js +1 -1
- package/build/enums/imageExtentions.js +6 -11
- package/build/index.js +6 -6
- package/build/store/apiStore.js +177 -40
- package/build/store/fullScreenStore.js +90 -20
- package/build/store/houseStore.js +792 -693
- package/build/store/index.js +70 -44
- package/build/store/modelStore.js +194 -141
- package/build/threesixty/events.js +92 -71
- package/build/threesixty/index.js +138 -112
- package/build/utils/csg/csg-lib.js +383 -298
- package/build/utils/csg/csg-worker.js +23 -33
- package/build/utils/csg/three-csg.js +103 -106
- package/build/utils/modelHelpers.js +46 -40
- package/build/utils/panoramaHelpers.js +48 -32
- package/package.json +6 -14
@@ -5,10 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.getScale = exports.getRoomCoordinates = exports.getClosestPanorama = exports.getCameraFromSrc = exports.getArrayFromNumber = exports.findWallVertices = exports.cameraIdBeginning = void 0;
|
7
7
|
|
8
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
9
|
-
|
10
|
-
require("core-js/modules/es.array.reduce.js");
|
11
|
-
|
12
8
|
var _react = _interopRequireDefault(require("react"));
|
13
9
|
|
14
10
|
var _geometric = require("geometric");
|
@@ -17,27 +13,49 @@ var _imageExtentions = require("../enums/imageExtentions");
|
|
17
13
|
|
18
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
15
|
|
20
|
-
|
16
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
17
|
+
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
19
|
+
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
21
|
+
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
23
|
+
|
24
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
25
|
+
|
26
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
27
|
+
|
28
|
+
var cameraIdBeginning = 'CameraId';
|
21
29
|
exports.cameraIdBeginning = cameraIdBeginning;
|
22
30
|
|
23
|
-
|
31
|
+
var getArrayFromNumber = function getArrayFromNumber(num) {
|
32
|
+
return _toConsumableArray(Array(num).keys());
|
33
|
+
};
|
24
34
|
|
25
35
|
exports.getArrayFromNumber = getArrayFromNumber;
|
26
36
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
37
|
+
var findWallVertices = function findWallVertices(walls, wall, vertices) {
|
38
|
+
var currentWall = walls.find(function (el) {
|
39
|
+
return el.ID === wall;
|
40
|
+
});
|
41
|
+
return currentWall.Vertices.map(function (vertexId) {
|
42
|
+
var vertex = vertices.find(function (el) {
|
43
|
+
return el.ID === vertexId;
|
44
|
+
});
|
31
45
|
return [vertex.Location.X, vertex.Location.Y];
|
32
46
|
});
|
33
47
|
};
|
34
48
|
|
35
49
|
exports.findWallVertices = findWallVertices;
|
36
50
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
51
|
+
var getRoomCoordinates = function getRoomCoordinates(room, walls, vertices) {
|
52
|
+
var points = room.Walls.reduce(function (acc, wallId) {
|
53
|
+
var wall = walls.find(function (wallObject) {
|
54
|
+
return wallObject.ID === wallId;
|
55
|
+
});
|
56
|
+
findWallVertices(walls, wall.ID, vertices).forEach(function (vertex) {
|
57
|
+
return acc.push(vertex);
|
58
|
+
});
|
41
59
|
return acc;
|
42
60
|
}, []);
|
43
61
|
return points;
|
@@ -45,17 +63,17 @@ const getRoomCoordinates = (room, walls, vertices) => {
|
|
45
63
|
|
46
64
|
exports.getRoomCoordinates = getRoomCoordinates;
|
47
65
|
|
48
|
-
|
66
|
+
var getScale = function getScale(image, json) {
|
49
67
|
if (!json) return {
|
50
68
|
X: 1,
|
51
69
|
Y: 1
|
52
70
|
};
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
71
|
+
var imageWidth = image.width;
|
72
|
+
var imageHeight = image.height;
|
73
|
+
var baseImageWidth = 1024;
|
74
|
+
var baseImageHeight = imageHeight * (baseImageWidth / imageWidth);
|
75
|
+
var deltaX = imageWidth / baseImageWidth / json.Scale.X;
|
76
|
+
var deltaY = imageHeight / baseImageHeight / json.Scale.X;
|
59
77
|
return {
|
60
78
|
X: deltaX,
|
61
79
|
Y: deltaY
|
@@ -64,30 +82,28 @@ const getScale = (image, json) => {
|
|
64
82
|
|
65
83
|
exports.getScale = getScale;
|
66
84
|
|
67
|
-
|
85
|
+
var getCameraFromSrc = function getCameraFromSrc(json, src) {
|
68
86
|
var _json$Floors$0$Camera;
|
69
87
|
|
70
|
-
|
88
|
+
var cameraIdIndex = src.indexOf(cameraIdBeginning);
|
71
89
|
if (cameraIdIndex === -1) return null;
|
72
|
-
|
73
|
-
return ((_json$Floors$0$Camera = json.Floors[0].CameraPoints) === null || _json$Floors$0$Camera === void 0 ? void 0 : _json$Floors$0$Camera.find(_ref
|
74
|
-
|
75
|
-
ID
|
76
|
-
} = _ref;
|
90
|
+
var cameraId = (0, _imageExtentions.removeExtention)(src.substring(cameraIdIndex));
|
91
|
+
return ((_json$Floors$0$Camera = json.Floors[0].CameraPoints) === null || _json$Floors$0$Camera === void 0 ? void 0 : _json$Floors$0$Camera.find(function (_ref) {
|
92
|
+
var ID = _ref.ID;
|
77
93
|
return ID === cameraId;
|
78
94
|
})) || null;
|
79
95
|
};
|
80
96
|
|
81
97
|
exports.getCameraFromSrc = getCameraFromSrc;
|
82
98
|
|
83
|
-
|
84
|
-
return panoramas.reduce((closest, current)
|
85
|
-
|
99
|
+
var getClosestPanorama = function getClosestPanorama(point, panoramas) {
|
100
|
+
return panoramas.reduce(function (closest, current) {
|
101
|
+
var length = (0, _geometric.lineLength)([point, [current.userData.left, current.userData.top]]);
|
86
102
|
|
87
103
|
if (length < closest.length) {
|
88
104
|
return {
|
89
105
|
panorama: current,
|
90
|
-
length
|
106
|
+
length: length
|
91
107
|
};
|
92
108
|
}
|
93
109
|
|
package/package.json
CHANGED
@@ -3,19 +3,18 @@
|
|
3
3
|
"description": "HART Estate widget",
|
4
4
|
"author": "HART",
|
5
5
|
"keywords": [],
|
6
|
-
"version": "0.0.
|
6
|
+
"version": "0.0.50",
|
7
7
|
"private": false,
|
8
|
-
"
|
9
|
-
|
8
|
+
"main": "build/index.js",
|
9
|
+
"module": "build/index.js",
|
10
10
|
"files": [
|
11
11
|
"build",
|
12
12
|
"README.md"
|
13
13
|
],
|
14
14
|
"scripts": {
|
15
|
-
"
|
16
|
-
"start": "npm run build:sass && npm run babel -- --watch",
|
15
|
+
"start": "npm run build:sass && babel src --watch -d build --copy-files",
|
17
16
|
"start-example": "cd ./example && npm run start",
|
18
|
-
"build": "rm -rf build && NODE_ENV=production
|
17
|
+
"build": "rm -rf build && NODE_ENV=production babel src -d build --copy-files && npm run build:sass",
|
19
18
|
"build:sass": "sass src/assets/sass/index.sass:build/assets/css/app.css --style compressed",
|
20
19
|
"local-tunnel": "Lt --port 9000 --subdomain estate-widget --local-host localhost"
|
21
20
|
},
|
@@ -40,18 +39,11 @@
|
|
40
39
|
"@babel/core": "^7.17.0",
|
41
40
|
"@babel/eslint-parser": "^7.16.3",
|
42
41
|
"@babel/preset-env": "^7.16.11",
|
43
|
-
"babel-loader": "^8.2.3",
|
44
|
-
"css-loader": "^6.6.0",
|
45
42
|
"eslint": "^8.0.0",
|
46
43
|
"eslint-config-react-app": "^7.0.0",
|
47
44
|
"eslint-plugin-react": "^7.28.0",
|
48
45
|
"path": "^0.12.7",
|
49
|
-
"sass": "^1.46.0"
|
50
|
-
"sass-loader": "^12.4.0",
|
51
|
-
"style-loader": "^3.3.1",
|
52
|
-
"webpack": "^5.68.0",
|
53
|
-
"webpack-cli": "^4.9.2",
|
54
|
-
"webpack-dev-server": "^4.7.4"
|
46
|
+
"sass": "^1.46.0"
|
55
47
|
},
|
56
48
|
"browserslist": [
|
57
49
|
">0.2%",
|