hart-estate-widget 0.0.64 → 0.0.67

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.
Files changed (96) hide show
  1. package/README.md +7 -3
  2. package/package.json +17 -5
  3. package/build/assets/css/app.css +0 -1
  4. package/build/assets/css/app.css.map +0 -1
  5. package/build/assets/fonts/RobotoMono/RobotoMono-Bold.ttf +0 -0
  6. package/build/assets/fonts/RobotoMono/RobotoMono-Bold.woff +0 -0
  7. package/build/assets/fonts/RobotoMono/RobotoMono-Bold.woff2 +0 -0
  8. package/build/assets/fonts/RobotoMono/RobotoMono-BoldItalic.ttf +0 -0
  9. package/build/assets/fonts/RobotoMono/RobotoMono-BoldItalic.woff +0 -0
  10. package/build/assets/fonts/RobotoMono/RobotoMono-BoldItalic.woff2 +0 -0
  11. package/build/assets/fonts/RobotoMono/RobotoMono-Italic.ttf +0 -0
  12. package/build/assets/fonts/RobotoMono/RobotoMono-Italic.woff +0 -0
  13. package/build/assets/fonts/RobotoMono/RobotoMono-Italic.woff2 +0 -0
  14. package/build/assets/fonts/RobotoMono/RobotoMono-Light.ttf +0 -0
  15. package/build/assets/fonts/RobotoMono/RobotoMono-Light.woff +0 -0
  16. package/build/assets/fonts/RobotoMono/RobotoMono-Light.woff2 +0 -0
  17. package/build/assets/fonts/RobotoMono/RobotoMono-LightItalic.ttf +0 -0
  18. package/build/assets/fonts/RobotoMono/RobotoMono-LightItalic.woff +0 -0
  19. package/build/assets/fonts/RobotoMono/RobotoMono-LightItalic.woff2 +0 -0
  20. package/build/assets/fonts/RobotoMono/RobotoMono-Medium.ttf +0 -0
  21. package/build/assets/fonts/RobotoMono/RobotoMono-Medium.woff +0 -0
  22. package/build/assets/fonts/RobotoMono/RobotoMono-Medium.woff2 +0 -0
  23. package/build/assets/fonts/RobotoMono/RobotoMono-MediumItalic.ttf +0 -0
  24. package/build/assets/fonts/RobotoMono/RobotoMono-MediumItalic.woff +0 -0
  25. package/build/assets/fonts/RobotoMono/RobotoMono-MediumItalic.woff2 +0 -0
  26. package/build/assets/fonts/RobotoMono/RobotoMono-Regular.ttf +0 -0
  27. package/build/assets/fonts/RobotoMono/RobotoMono-Regular.woff +0 -0
  28. package/build/assets/fonts/RobotoMono/RobotoMono-Regular.woff2 +0 -0
  29. package/build/assets/fonts/RobotoMono/RobotoMono-Thin.ttf +0 -0
  30. package/build/assets/fonts/RobotoMono/RobotoMono-Thin.woff +0 -0
  31. package/build/assets/fonts/RobotoMono/RobotoMono-Thin.woff2 +0 -0
  32. package/build/assets/fonts/RobotoMono/RobotoMono.css +0 -98
  33. package/build/assets/icons/1x.svg +0 -4
  34. package/build/assets/icons/2x.svg +0 -4
  35. package/build/assets/icons/bullet.png +0 -0
  36. package/build/assets/icons/close.svg +0 -4
  37. package/build/assets/icons/enter-fullscreen.svg +0 -6
  38. package/build/assets/icons/hand-move.svg +0 -15
  39. package/build/assets/icons/hand-research.svg +0 -12
  40. package/build/assets/icons/rotation-close.svg +0 -6
  41. package/build/assets/icons/rotation.svg +0 -4
  42. package/build/assets/img/3D.jpg +0 -0
  43. package/build/assets/img/door-icon.png +0 -0
  44. package/build/assets/img/door-texture.jpeg +0 -0
  45. package/build/assets/img/exterior-wall-texture-roughness.jpg +0 -0
  46. package/build/assets/img/exterior-wall-texture.jpeg +0 -0
  47. package/build/assets/img/floor-bathroom.jpg +0 -0
  48. package/build/assets/img/floor-dark.png +0 -0
  49. package/build/assets/img/floor-white.png +0 -0
  50. package/build/assets/img/floor.jpg +0 -0
  51. package/build/assets/img/grass.png +0 -0
  52. package/build/assets/img/logo.svg +0 -11
  53. package/build/assets/img/refresh-icon.svg +0 -6
  54. package/build/assets/img/spot-icon.png +0 -0
  55. package/build/assets/img/wall-texture.jpg +0 -0
  56. package/build/assets/sass/components/instructions.sass +0 -94
  57. package/build/assets/sass/components/loader.sass +0 -54
  58. package/build/assets/sass/components/model.sass +0 -27
  59. package/build/assets/sass/components/panorama.sass +0 -174
  60. package/build/assets/sass/components/rotation.sass +0 -106
  61. package/build/assets/sass/components/tabs.sass +0 -121
  62. package/build/assets/sass/index.sass +0 -65
  63. package/build/assets/sass/mixin.sass +0 -48
  64. package/build/assets/sass/vars.sass +0 -28
  65. package/build/components/Application.js +0 -132
  66. package/build/components/Buttons/FullScreenButton.js +0 -50
  67. package/build/components/Buttons/TabButton.js +0 -24
  68. package/build/components/Instructions.js +0 -54
  69. package/build/components/Loader.js +0 -22
  70. package/build/components/ModelTab.js +0 -213
  71. package/build/components/PanoramaTab.js +0 -620
  72. package/build/components/RotationTab.js +0 -152
  73. package/build/components/Widget.js +0 -130
  74. package/build/config/defaultConfig.js +0 -30
  75. package/build/enums/deviceOrientationStatuses.js +0 -11
  76. package/build/enums/deviceWidth.js +0 -21
  77. package/build/enums/imageExtentions.js +0 -16
  78. package/build/index.css +0 -2
  79. package/build/index.js +0 -67
  80. package/build/locale/en/data.json +0 -25
  81. package/build/locale/index.js +0 -71
  82. package/build/locale/ru/data.json +0 -25
  83. package/build/store/apiStore.js +0 -231
  84. package/build/store/deviceStore.js +0 -60
  85. package/build/store/fullScreenStore.js +0 -159
  86. package/build/store/houseStore.js +0 -952
  87. package/build/store/index.js +0 -124
  88. package/build/store/modelStore.js +0 -338
  89. package/build/threesixty/events.js +0 -220
  90. package/build/threesixty/index.js +0 -264
  91. package/build/utils/csg/csg-lib.js +0 -472
  92. package/build/utils/csg/csg-worker.js +0 -84
  93. package/build/utils/csg/three-csg.js +0 -277
  94. package/build/utils/helpers.js +0 -12
  95. package/build/utils/modelHelpers.js +0 -161
  96. package/build/utils/panoramaHelpers.js +0 -117
@@ -1,277 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var THREE = _interopRequireWildcard(require("three"));
13
-
14
- var _csgLib = require("./csg-lib.js");
15
-
16
- require("./csg-worker.js");
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- var Geometry = THREE.Geometry,
25
- BufferGeometry = THREE.BufferGeometry,
26
- Vector3 = THREE.Vector3,
27
- Vector2 = THREE.Vector2;
28
-
29
- _csgLib.CSG.fromGeometry = function (geom, objectIndex) {
30
- var polys = [];
31
-
32
- if (geom.isGeometry) {
33
- var fs = geom.faces;
34
- var vs = geom.vertices;
35
- var fm = ['a', 'b', 'c'];
36
-
37
- for (var i = 0; i < fs.length; i++) {
38
- var f = fs[i];
39
- var vertices = [];
40
-
41
- for (var j = 0; j < 3; j++) {
42
- vertices.push(new _csgLib.Vertex(vs[f[fm[j]]], f.vertexNormals[j], geom.faceVertexUvs[0][i][j]));
43
- }
44
-
45
- polys.push(new _csgLib.Polygon(vertices, objectIndex));
46
- }
47
- } else if (geom.isBufferGeometry) {
48
- var _vertices, normals, uvs;
49
-
50
- var posattr = geom.attributes.position;
51
- var normalattr = geom.attributes.normal;
52
- var uvattr = geom.attributes.uv;
53
- var colorattr = geom.attributes.color;
54
- var index;
55
- if (geom.index) index = geom.index.array;else {
56
- index = new Array(posattr.array.length / posattr.itemSize | 0);
57
-
58
- for (var _i = 0; _i < index.length; _i++) {
59
- index[_i] = _i;
60
- }
61
- }
62
- var triCount = index.length / 3 | 0;
63
- polys = new Array(triCount);
64
-
65
- for (var _i2 = 0, pli = 0, l = index.length; _i2 < l; _i2 += 3, pli++) {
66
- var _vertices2 = new Array(3);
67
-
68
- for (var _j = 0; _j < 3; _j++) {
69
- var vi = index[_i2 + _j];
70
- var vp = vi * 3;
71
- var vt = vi * 2;
72
- var x = posattr.array[vp];
73
- var y = posattr.array[vp + 1];
74
- var z = posattr.array[vp + 2];
75
- var nx = normalattr.array[vp];
76
- var ny = normalattr.array[vp + 1];
77
- var nz = normalattr.array[vp + 2]; //let u = uvattr.array[vt]
78
- //let v = uvattr.array[vt + 1]
79
-
80
- _vertices2[_j] = new _csgLib.Vertex({
81
- x: x,
82
- y: y,
83
- z: z
84
- }, {
85
- x: nx,
86
- y: ny,
87
- z: nz
88
- }, uvattr && {
89
- x: uvattr.array[vt],
90
- y: uvattr.array[vt + 1],
91
- z: 0
92
- }, colorattr && {
93
- x: colorattr.array[vt],
94
- y: colorattr.array[vt + 1],
95
- z: colorattr.array[vt + 2]
96
- });
97
- }
98
-
99
- polys[pli] = new _csgLib.Polygon(_vertices2, objectIndex);
100
- }
101
- } else console.error("Unsupported CSG input type:" + geom.type);
102
-
103
- return _csgLib.CSG.fromPolygons(polys);
104
- };
105
-
106
- var ttvv0 = new THREE.Vector3();
107
- var tmpm3 = new THREE.Matrix3();
108
-
109
- _csgLib.CSG.fromMesh = function (mesh, objectIndex) {
110
- var csg = _csgLib.CSG.fromGeometry(mesh.geometry, objectIndex);
111
-
112
- tmpm3.getNormalMatrix(mesh.matrix);
113
-
114
- for (var i = 0; i < csg.polygons.length; i++) {
115
- var p = csg.polygons[i];
116
-
117
- for (var j = 0; j < p.vertices.length; j++) {
118
- var v = p.vertices[j];
119
- v.pos.copy(ttvv0.copy(v.pos).applyMatrix4(mesh.matrix));
120
- v.normal.copy(ttvv0.copy(v.normal).applyMatrix3(tmpm3));
121
- }
122
- }
123
-
124
- return csg;
125
- };
126
-
127
- var nbuf3 = function nbuf3(ct) {
128
- return {
129
- top: 0,
130
- array: new Float32Array(ct),
131
- write: function write(v) {
132
- this.array[this.top++] = v.x;
133
- this.array[this.top++] = v.y;
134
- this.array[this.top++] = v.z;
135
- }
136
- };
137
- };
138
-
139
- var nbuf2 = function nbuf2(ct) {
140
- return {
141
- top: 0,
142
- array: new Float32Array(ct),
143
- write: function write(v) {
144
- this.array[this.top++] = v.x;
145
- this.array[this.top++] = v.y;
146
- }
147
- };
148
- };
149
-
150
- _csgLib.CSG.toGeometry = function (csg) {
151
- var buffered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
152
- var ps = csg.polygons;
153
- var geom;
154
- var g2;
155
-
156
- if (!buffered) //Old geometry path...
157
- {
158
- geom = new Geometry();
159
- var vs = geom.vertices;
160
- var fvuv = geom.faceVertexUvs[0];
161
-
162
- for (var i = 0; i < ps.length; i++) {
163
- var p = ps[i];
164
- var pvs = p.vertices;
165
- var v0 = vs.length;
166
- var pvlen = pvs.length;
167
-
168
- for (var j = 0; j < pvlen; j++) {
169
- vs.push(new THREE.Vector3().copy(pvs[j].pos));
170
- }
171
-
172
- for (var _j2 = 3; _j2 <= pvlen; _j2++) {
173
- var fc = new THREE.Face3();
174
- var fuv = [];
175
- fvuv.push(fuv);
176
- var fnml = fc.vertexNormals;
177
- fc.a = v0;
178
- fc.b = v0 + _j2 - 2;
179
- fc.c = v0 + _j2 - 1;
180
- fnml.push(new THREE.Vector3().copy(pvs[0].normal));
181
- fnml.push(new THREE.Vector3().copy(pvs[_j2 - 2].normal));
182
- fnml.push(new THREE.Vector3().copy(pvs[_j2 - 1].normal));
183
- fuv.push(new THREE.Vector3().copy(pvs[0].uv));
184
- fuv.push(new THREE.Vector3().copy(pvs[_j2 - 2].uv));
185
- fuv.push(new THREE.Vector3().copy(pvs[_j2 - 1].uv));
186
- fc.normal = new THREE.Vector3().copy(p.plane.normal);
187
- geom.faces.push(fc);
188
- }
189
- }
190
-
191
- geom = new THREE.BufferGeometry().fromGeometry(geom);
192
- geom.verticesNeedUpdate = geom.elementsNeedUpdate = geom.normalsNeedUpdate = true;
193
- } else {
194
- //BufferGeometry path
195
- var triCount = 0;
196
- ps.forEach(function (p) {
197
- return triCount += p.vertices.length - 2;
198
- });
199
- geom = new THREE.BufferGeometry();
200
- var vertices = nbuf3(triCount * 3 * 3);
201
- var normals = nbuf3(triCount * 3 * 3);
202
- var uvs; // = nbuf2(triCount * 2 * 3)
203
-
204
- var colors;
205
- var grps = [];
206
- ps.forEach(function (p) {
207
- var pvs = p.vertices;
208
- var pvlen = pvs.length;
209
-
210
- if (p.shared !== undefined) {
211
- if (!grps[p.shared]) grps[p.shared] = [];
212
- }
213
-
214
- if (pvlen) {
215
- if (pvs[0].color !== undefined) {
216
- if (!colors) colors = nbuf3(triCount * 3 * 3);
217
- }
218
-
219
- if (pvs[0].uv !== undefined) {
220
- if (!uvs) uvs = nbuf2(triCount * 2 * 3);
221
- }
222
- }
223
-
224
- for (var _j3 = 3; _j3 <= pvlen; _j3++) {
225
- p.shared !== undefined && grps[p.shared].push(vertices.top / 3, vertices.top / 3 + 1, vertices.top / 3 + 2);
226
- vertices.write(pvs[0].pos);
227
- vertices.write(pvs[_j3 - 2].pos);
228
- vertices.write(pvs[_j3 - 1].pos);
229
- normals.write(pvs[0].normal);
230
- normals.write(pvs[_j3 - 2].normal);
231
- normals.write(pvs[_j3 - 1].normal);
232
- uvs && pvs[0].uv && (uvs.write(pvs[0].uv) || uvs.write(pvs[_j3 - 2].uv) || uvs.write(pvs[_j3 - 1].uv));
233
- colors && (colors.write(pvs[0].color) || colors.write(pvs[_j3 - 2].color) || colors.write(pvs[_j3 - 1].color));
234
- }
235
- });
236
- geom.setAttribute('position', new THREE.BufferAttribute(vertices.array, 3));
237
- geom.setAttribute('normal', new THREE.BufferAttribute(normals.array, 3));
238
- uvs && geom.setAttribute('uv', new THREE.BufferAttribute(uvs.array, 2));
239
- colors && geom.setAttribute('color', new THREE.BufferAttribute(colors.array, 3));
240
-
241
- if (grps.length) {
242
- var index = [];
243
- var gbase = 0;
244
-
245
- for (var gi = 0; gi < grps.length; gi++) {
246
- geom.addGroup(gbase, grps[gi].length, gi);
247
- gbase += grps[gi].length;
248
- index = index.concat(grps[gi]);
249
- }
250
-
251
- geom.setIndex(index);
252
- }
253
-
254
- g2 = geom;
255
- }
256
-
257
- return geom;
258
- };
259
-
260
- _csgLib.CSG.toMesh = function (csg, toMatrix, toMaterial) {
261
- var geom = _csgLib.CSG.toGeometry(csg);
262
-
263
- var inv = new THREE.Matrix4().copy(toMatrix).invert();
264
- geom.applyMatrix4(inv);
265
- geom.computeBoundingSphere();
266
- geom.computeBoundingBox();
267
- var m = new THREE.Mesh(geom, toMaterial);
268
- m.matrix.copy(toMatrix);
269
- m.matrix.decompose(m.position, m.quaternion, m.scale);
270
- m.rotation.setFromQuaternion(m.quaternion);
271
- m.updateMatrixWorld();
272
- m.castShadow = m.receiveShadow = true;
273
- return m;
274
- };
275
-
276
- var _default = _csgLib.CSG;
277
- exports.default = _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.preventRightClick = void 0;
7
-
8
- var preventRightClick = function preventRightClick(event) {
9
- event.preventDefault();
10
- };
11
-
12
- exports.preventRightClick = preventRightClick;
@@ -1,161 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.getMinMaxCoordinates = exports.getKeyEvents = exports.getFloorParams = exports.getDirectionsFromDegrees = void 0;
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var holdEvent = _interopRequireWildcard(require("hold-event"));
13
-
14
- var _floor = _interopRequireDefault(require("../assets/img/floor.jpg"));
15
-
16
- var _floorDark = _interopRequireDefault(require("../assets/img/floor-dark.png"));
17
-
18
- var _floorWhite = _interopRequireDefault(require("../assets/img/floor-white.png"));
19
-
20
- var _floorBathroom = _interopRequireDefault(require("../assets/img/floor-bathroom.jpg"));
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
- var FloorParams = {
29
- 'default': {
30
- texture: _floorDark.default,
31
- roughnessMap: null,
32
- color: '#FFFFFF'
33
- },
34
- 'Kitchen': {
35
- texture: _floorWhite.default,
36
- roughnessMap: null,
37
- color: '#FFFFFF'
38
- },
39
- 'Balcony': {
40
- texture: _floor.default,
41
- roughnessMap: null,
42
- color: '#DADADA'
43
- },
44
- 'Bathroom': {
45
- texture: _floorBathroom.default,
46
- roughnessMap: null,
47
- color: '#FFFFFF'
48
- }
49
- };
50
-
51
- var getKeyEvents = function getKeyEvents(controls) {
52
- var KEYCODE = {
53
- W: 87,
54
- A: 65,
55
- S: 83,
56
- D: 68,
57
- ARROW_LEFT: 37,
58
- ARROW_UP: 38,
59
- ARROW_RIGHT: 39,
60
- ARROW_DOWN: 40
61
- };
62
- var wKey = new holdEvent.KeyboardKeyHold(KEYCODE.W, 100);
63
- var upKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_UP, 100);
64
- var upArr = [wKey, upKey];
65
- var aKey = new holdEvent.KeyboardKeyHold(KEYCODE.A, 100);
66
- var leftKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_LEFT, 100);
67
- var leftArr = [aKey, leftKey];
68
- var sKey = new holdEvent.KeyboardKeyHold(KEYCODE.S, 100);
69
- var downKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_DOWN, 100);
70
- var downArr = [sKey, downKey];
71
- var dKey = new holdEvent.KeyboardKeyHold(KEYCODE.D, 100);
72
- var rightKey = new holdEvent.KeyboardKeyHold(KEYCODE.ARROW_RIGHT, 100);
73
- var rightArr = [dKey, rightKey];
74
- var keyEvents = [{
75
- keys: upArr,
76
- callback: function callback() {
77
- return controls.forward(1, true);
78
- }
79
- }, {
80
- keys: leftArr,
81
- callback: function callback() {
82
- return controls.truck(-1, 0, true);
83
- }
84
- }, {
85
- keys: downArr,
86
- callback: function callback() {
87
- return controls.forward(-1, true);
88
- }
89
- }, {
90
- keys: rightArr,
91
- callback: function callback() {
92
- return controls.truck(1, 0, true);
93
- }
94
- }];
95
- return keyEvents;
96
- };
97
-
98
- exports.getKeyEvents = getKeyEvents;
99
-
100
- var getFloorParams = function getFloorParams(type) {
101
- var params = FloorParams[type];
102
- if (!params) return FloorParams['default'];
103
- return params;
104
- };
105
-
106
- exports.getFloorParams = getFloorParams;
107
-
108
- var getMinMaxCoordinates = function getMinMaxCoordinates(walls) {
109
- var maxX = 0;
110
- var minX = Infinity;
111
- var maxY = 0;
112
- var minY = Infinity;
113
- walls.forEach(function (_ref) {
114
- var start = _ref.start,
115
- end = _ref.end;
116
- // CALCULATE MAX COORDS
117
- if (start.x > maxX) maxX = start.x;
118
- if (start.x > maxX) maxX = start.x;
119
- if (end.y > maxY) maxY = end.y;
120
- if (end.y > maxY) maxY = end.y; // CALCULATE MIN COORDS
121
-
122
- if (start.x < minX) minX = start.x;
123
- if (start.x < minX) minX = start.x;
124
- if (end.y < minY) minY = end.y;
125
- if (end.y < minY) minY = end.y;
126
- });
127
- return {
128
- maxX: maxX,
129
- minX: minX,
130
- maxY: maxY,
131
- minY: minY
132
- };
133
- };
134
-
135
- exports.getMinMaxCoordinates = getMinMaxCoordinates;
136
-
137
- var getDirectionsFromDegrees = function getDirectionsFromDegrees(deg) {
138
- var directions = [];
139
-
140
- if (deg > 80 && deg < 100) {
141
- directions = ['forward'];
142
- } else if (deg > 10 && deg < 80) {
143
- directions = ['forward', 'right'];
144
- } else if (deg > 100 && deg < 170) {
145
- directions = ['forward', 'left'];
146
- } else if (deg > 260 && deg < 280) {
147
- directions = ['backward'];
148
- } else if (deg > 190 && deg < 260) {
149
- directions = ['backward', 'left'];
150
- } else if (deg > 280 && deg < 350) {
151
- directions = ['backward', 'right'];
152
- } else if (deg > 350 || deg < 10) {
153
- directions = ['right'];
154
- } else if (deg > 170 && deg < 190) {
155
- directions = ['left'];
156
- }
157
-
158
- return directions;
159
- };
160
-
161
- exports.getDirectionsFromDegrees = getDirectionsFromDegrees;
@@ -1,117 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getScale = exports.getRoomCoordinates = exports.getClosestPanorama = exports.getCameraFromSrc = exports.getArrayFromNumber = exports.findWallVertices = exports.cameraIdBeginning = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _geometric = require("geometric");
11
-
12
- var _imageExtentions = require("../enums/imageExtentions");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
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';
29
- exports.cameraIdBeginning = cameraIdBeginning;
30
-
31
- var getArrayFromNumber = function getArrayFromNumber(num) {
32
- return _toConsumableArray(Array(num).keys());
33
- };
34
-
35
- exports.getArrayFromNumber = getArrayFromNumber;
36
-
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
- });
45
- return [vertex.Location.X, vertex.Location.Y];
46
- });
47
- };
48
-
49
- exports.findWallVertices = findWallVertices;
50
-
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
- });
59
- return acc;
60
- }, []);
61
- return points;
62
- };
63
-
64
- exports.getRoomCoordinates = getRoomCoordinates;
65
-
66
- var getScale = function getScale(_ref, json) {
67
- var width = _ref.width,
68
- height = _ref.height;
69
- if (!json) return {
70
- X: 1,
71
- Y: 1
72
- };
73
- var baseImageWidth = 1024;
74
- var baseImageHeight = height * (baseImageWidth / width);
75
- var deltaX = width / baseImageWidth / json.Scale.X;
76
- var deltaY = height / baseImageHeight / json.Scale.X;
77
- return {
78
- X: deltaX,
79
- Y: deltaY
80
- };
81
- };
82
-
83
- exports.getScale = getScale;
84
-
85
- var getCameraFromSrc = function getCameraFromSrc(json, src) {
86
- var _json$Floors$0$Camera;
87
-
88
- var cameraIdIndex = src.toLowerCase().indexOf(cameraIdBeginning);
89
- if (cameraIdIndex === -1) return null;
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 (_ref2) {
92
- var ID = _ref2.ID;
93
- return ID === cameraId;
94
- })) || null;
95
- };
96
-
97
- exports.getCameraFromSrc = getCameraFromSrc;
98
-
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]]);
102
-
103
- if (length < closest.length) {
104
- return {
105
- panorama: current,
106
- length: length
107
- };
108
- }
109
-
110
- return closest;
111
- }, {
112
- length: Infinity,
113
- panorama: null
114
- });
115
- };
116
-
117
- exports.getClosestPanorama = getClosestPanorama;