hart-estate-widget 0.0.61 → 0.0.64
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/README.md +31 -22
- package/build/assets/css/app.css +1 -1
- package/build/assets/css/app.css.map +1 -1
- package/build/assets/sass/components/instructions.sass +10 -10
- package/build/assets/sass/components/loader.sass +33 -32
- package/build/assets/sass/components/model.sass +1 -1
- package/build/assets/sass/components/panorama.sass +14 -16
- package/build/assets/sass/components/rotation.sass +106 -0
- package/build/assets/sass/components/tabs.sass +6 -112
- package/build/assets/sass/index.sass +13 -40
- package/build/assets/sass/mixin.sass +37 -1
- package/build/assets/sass/vars.sass +4 -5
- package/build/components/Application.js +13 -14
- package/build/components/PanoramaTab.js +34 -60
- package/build/components/RotationTab.js +6 -13
- package/build/components/Widget.js +46 -10
- package/build/config/defaultConfig.js +6 -4
- package/build/enums/deviceWidth.js +12 -3
- package/build/index.js +0 -8
- package/build/store/apiStore.js +51 -19
- package/build/store/fullScreenStore.js +36 -1
- package/build/store/index.js +13 -1
- package/build/store/modelStore.js +10 -5
- package/package.json +1 -1
- package/build/components/ImageTab.js +0 -23
@@ -10,10 +10,10 @@
|
|
10
10
|
display: flex
|
11
11
|
align-items: center
|
12
12
|
justify-content: flex-end
|
13
|
-
@media
|
13
|
+
@include media($tablet)
|
14
14
|
right: 20px
|
15
15
|
bottom: 35px
|
16
|
-
@media
|
16
|
+
@include media($smallMobile)
|
17
17
|
bottom: 30px
|
18
18
|
.widget-tab-button
|
19
19
|
@include customButton
|
@@ -29,17 +29,17 @@
|
|
29
29
|
line-height: 120%
|
30
30
|
font-weight: bold
|
31
31
|
margin-left: 40px
|
32
|
-
@media
|
32
|
+
@include media($tablet)
|
33
33
|
margin-left: 20px
|
34
34
|
width: 60px
|
35
35
|
height: 60px
|
36
36
|
font-size: 22px
|
37
|
-
@media
|
37
|
+
@include media($mobile)
|
38
38
|
margin-left: 10px
|
39
39
|
font-size: 17px
|
40
40
|
width: 44px
|
41
41
|
height: 44px
|
42
|
-
@media
|
42
|
+
@include media($smallMobile)
|
43
43
|
width: 36px
|
44
44
|
height: 36px
|
45
45
|
font-size: 14px
|
@@ -53,114 +53,8 @@
|
|
53
53
|
align-items: center
|
54
54
|
justify-content: center
|
55
55
|
padding: 60px 30px
|
56
|
-
@media
|
56
|
+
@include media($smallMobile)
|
57
57
|
padding: 60px 20px
|
58
|
-
&__image
|
59
|
-
max-width: 100%
|
60
|
-
max-height: 100%
|
61
|
-
object-fit: contain
|
62
|
-
display: block
|
63
|
-
&__threesixty
|
64
|
-
width: 100%
|
65
|
-
height: 100%
|
66
|
-
@include noTouch
|
67
|
-
&-start
|
68
|
-
@include customButton
|
69
|
-
position: absolute
|
70
|
-
left: 50%
|
71
|
-
bottom: 35px
|
72
|
-
transform: translateX(-50%)
|
73
|
-
display: flex
|
74
|
-
align-items: center
|
75
|
-
justify-content: center
|
76
|
-
padding: 0 25px 0 10px
|
77
|
-
background-color: $gray
|
78
|
-
border-radius: 38px
|
79
|
-
height: 72px
|
80
|
-
width: 202px
|
81
|
-
@media #{$tablet}
|
82
|
-
height: 60px
|
83
|
-
width: 166px
|
84
|
-
padding: 0 20px 0 8px
|
85
|
-
bottom: 35px
|
86
|
-
@media #{$mobile}
|
87
|
-
height: 44px
|
88
|
-
width: 115px
|
89
|
-
padding: 0 10px 0 6px
|
90
|
-
@media #{$w-374}
|
91
|
-
height: 36px
|
92
|
-
width: 94px
|
93
|
-
padding: 0 8px 0 6px
|
94
|
-
bottom: 30px
|
95
|
-
&-icon
|
96
|
-
display: flex
|
97
|
-
align-items: center
|
98
|
-
justify-content: center
|
99
|
-
border-radius: 50%
|
100
|
-
background-color: $white
|
101
|
-
margin-right: 18px
|
102
|
-
padding: 10px
|
103
|
-
@media #{$tablet}
|
104
|
-
padding: 7px
|
105
|
-
margin-right: 15px
|
106
|
-
@media #{$mobile}
|
107
|
-
margin-right: 7px
|
108
|
-
@media #{$w-374}
|
109
|
-
padding: 6px
|
110
|
-
margin-right: 5px
|
111
|
-
img
|
112
|
-
display: block
|
113
|
-
position: relative
|
114
|
-
top: 2px
|
115
|
-
width: 34px
|
116
|
-
@media #{$tablet}
|
117
|
-
width: 30px
|
118
|
-
top: 1px
|
119
|
-
@media #{$mobile}
|
120
|
-
width: 19px
|
121
|
-
top: 0
|
122
|
-
@media #{$w-374}
|
123
|
-
width: 15px
|
124
|
-
span
|
125
|
-
font-size: 24px
|
126
|
-
font-weight: bold
|
127
|
-
color: $text-dark
|
128
|
-
text-transform: uppercase
|
129
|
-
width: 100%
|
130
|
-
display: block
|
131
|
-
text-align: center
|
132
|
-
position: relative
|
133
|
-
top: 1px
|
134
|
-
@media #{$tablet}
|
135
|
-
font-size: 20px
|
136
|
-
@media #{$mobile}
|
137
|
-
font-size: 14px
|
138
|
-
@media #{$w-374}
|
139
|
-
font-size: 12px
|
140
|
-
&-container
|
141
|
-
width: 100% !important
|
142
|
-
height: 100% !important
|
143
|
-
position: relative
|
144
|
-
background-image: none !important
|
145
|
-
img
|
146
|
-
position: absolute
|
147
|
-
left: 50%
|
148
|
-
top: 50%
|
149
|
-
transform: translate(-50%, -50%)
|
150
|
-
max-width: 100%
|
151
|
-
max-height: 100%
|
152
|
-
width: 600px
|
153
|
-
height: 600px
|
154
|
-
object-fit: contain
|
155
|
-
opacity: 0
|
156
|
-
pointer-events: none
|
157
|
-
@include noSelect
|
158
|
-
&.active
|
159
|
-
opacity: 1
|
160
|
-
&--active
|
161
|
-
.widget-tab__threesixty-container
|
162
|
-
cursor: move
|
163
|
-
|
164
58
|
&-menu
|
165
59
|
position: absolute
|
166
60
|
z-index: 3
|
@@ -2,10 +2,9 @@
|
|
2
2
|
@import './mixin'
|
3
3
|
|
4
4
|
.widget-application
|
5
|
-
--vh: 100vh
|
6
|
-
|
7
5
|
width: 100%
|
8
|
-
height:
|
6
|
+
height: 100%
|
7
|
+
flex: none
|
9
8
|
overflow: hidden
|
10
9
|
position: relative
|
11
10
|
z-index: 1
|
@@ -30,10 +29,10 @@
|
|
30
29
|
left: 45px
|
31
30
|
top: 30px
|
32
31
|
z-index: 3
|
33
|
-
@media
|
32
|
+
@include media($tablet)
|
34
33
|
left: 20px
|
35
34
|
top: 30px
|
36
|
-
@media
|
35
|
+
@include media($smallMobile)
|
37
36
|
top: 25px
|
38
37
|
img
|
39
38
|
display: block
|
@@ -41,52 +40,26 @@
|
|
41
40
|
height: 82px
|
42
41
|
object-fit: contain
|
43
42
|
object-position: center
|
44
|
-
@media
|
43
|
+
@include media($tablet)
|
45
44
|
width: 65px
|
46
45
|
height: 65px
|
47
|
-
@media
|
46
|
+
@include media($mobile)
|
48
47
|
width: 42px
|
49
48
|
height: 42px
|
50
|
-
@media
|
49
|
+
@include media($smallMobile)
|
51
50
|
width: 36px
|
52
51
|
height: 36px
|
53
52
|
|
54
|
-
.widget-tab__panorama-close-map
|
55
|
-
|
53
|
+
.widget-tab__panorama-close-map
|
54
|
+
@include rightActionButton
|
55
|
+
.widget-enter-fullscreen
|
56
|
+
@include rightActionButton
|
56
57
|
.widget-exit-fullscreen
|
57
|
-
|
58
|
-
right: 45px
|
59
|
-
top: 36px
|
60
|
-
z-index: 3
|
61
|
-
padding: 10px
|
62
|
-
touch-action: none
|
63
|
-
@include customButton
|
64
|
-
@media #{$tablet}
|
65
|
-
right: 17px
|
66
|
-
top: 35px
|
67
|
-
@media #{$mobile}
|
68
|
-
padding: 5px
|
69
|
-
right: 20px
|
70
|
-
@media #{$w-374}
|
71
|
-
top: 25px
|
72
|
-
img
|
73
|
-
display: block
|
74
|
-
width: 50px
|
75
|
-
height: 50px
|
76
|
-
object-fit: contain
|
77
|
-
object-position: center
|
78
|
-
@media #{$tablet}
|
79
|
-
width: 40px
|
80
|
-
height: 40px
|
81
|
-
@media #{$mobile}
|
82
|
-
width: 32px
|
83
|
-
height: 32px
|
84
|
-
@media #{$w-374}
|
85
|
-
width: 26px
|
86
|
-
height: 26px
|
58
|
+
@include rightActionButton
|
87
59
|
|
88
60
|
@import './components/tabs'
|
89
61
|
@import './components/instructions'
|
90
62
|
@import './components/panorama'
|
63
|
+
@import './components/rotation'
|
91
64
|
@import './components/loader'
|
92
65
|
@import './components/model'
|
@@ -9,4 +9,40 @@
|
|
9
9
|
backdrop-filter: blur($blur)
|
10
10
|
-moz-backdrop-filter: blur($blur)
|
11
11
|
-webkit-backdrop-filter: blur($blur)
|
12
|
-
|
12
|
+
|
13
|
+
@mixin media($device)
|
14
|
+
$this: &
|
15
|
+
@at-root .widget-application--#{$device}#{$this}
|
16
|
+
@content
|
17
|
+
|
18
|
+
@mixin rightActionButton
|
19
|
+
position: absolute
|
20
|
+
right: 45px
|
21
|
+
top: 36px
|
22
|
+
z-index: 3
|
23
|
+
padding: 10px
|
24
|
+
touch-action: none
|
25
|
+
@include customButton
|
26
|
+
@include media($tablet)
|
27
|
+
right: 17px
|
28
|
+
top: 35px
|
29
|
+
@include media($mobile)
|
30
|
+
padding: 5px
|
31
|
+
right: 20px
|
32
|
+
@include media($smallMobile)
|
33
|
+
top: 25px
|
34
|
+
img
|
35
|
+
display: block
|
36
|
+
width: 50px
|
37
|
+
height: 50px
|
38
|
+
object-fit: contain
|
39
|
+
object-position: center
|
40
|
+
@include media($tablet)
|
41
|
+
width: 40px
|
42
|
+
height: 40px
|
43
|
+
@include media($mobile)
|
44
|
+
width: 32px
|
45
|
+
height: 32px
|
46
|
+
@include media($smallMobile)
|
47
|
+
width: 26px
|
48
|
+
height: 26px
|
@@ -1,8 +1,7 @@
|
|
1
|
-
$
|
2
|
-
$mobile: "
|
3
|
-
$tablet: "
|
4
|
-
$laptop: "
|
5
|
-
$desktop: "only screen and (min-width: 1441px)"
|
1
|
+
$smallMobile: "smallMobile"
|
2
|
+
$mobile: "mobile"
|
3
|
+
$tablet: "tablet"
|
4
|
+
$laptop: "laptop"
|
6
5
|
|
7
6
|
$white: #FFFFFF
|
8
7
|
$black: #000000
|
@@ -15,6 +15,8 @@ var _store = _interopRequireDefault(require("../store"));
|
|
15
15
|
|
16
16
|
var _fullScreenStore = _interopRequireDefault(require("../store/fullScreenStore"));
|
17
17
|
|
18
|
+
var _deviceWidth = require("../enums/deviceWidth");
|
19
|
+
|
18
20
|
var _RotationTab = _interopRequireDefault(require("./RotationTab"));
|
19
21
|
|
20
22
|
var _PanoramaTab = _interopRequireDefault(require("./PanoramaTab"));
|
@@ -43,13 +45,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
43
45
|
|
44
46
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
45
47
|
|
46
|
-
var Application = (0, _mobxReactLite.observer)(function (
|
47
|
-
var width = _ref.width,
|
48
|
-
height = _ref.height;
|
48
|
+
var Application = (0, _mobxReactLite.observer)(function () {
|
49
49
|
var config = _store.default.config;
|
50
50
|
var appStyle = {
|
51
|
-
width: width,
|
52
|
-
height: height
|
51
|
+
width: config.width,
|
52
|
+
height: config.height
|
53
53
|
};
|
54
54
|
|
55
55
|
var _useState = (0, _react.useState)(config.tabs[0]),
|
@@ -80,16 +80,8 @@ var Application = (0, _mobxReactLite.observer)(function (_ref) {
|
|
80
80
|
tab: 'panorama',
|
81
81
|
text: '3D'
|
82
82
|
}];
|
83
|
-
|
84
|
-
var setWindowHeight = function setWindowHeight() {
|
85
|
-
document.querySelector('.widget-application').style.setProperty('--vh', window.innerHeight / 100 + 'px');
|
86
|
-
};
|
87
|
-
|
88
83
|
(0, _react.useEffect)(function () {
|
89
84
|
_fullScreenStore.default.init();
|
90
|
-
|
91
|
-
window.addEventListener('resize', setWindowHeight);
|
92
|
-
setWindowHeight();
|
93
85
|
}, []);
|
94
86
|
(0, _react.useEffect)(function () {
|
95
87
|
if (config.tabs.some(function (tab) {
|
@@ -111,8 +103,15 @@ var Application = (0, _mobxReactLite.observer)(function (_ref) {
|
|
111
103
|
});
|
112
104
|
};
|
113
105
|
|
106
|
+
var getAppClass = function getAppClass() {
|
107
|
+
var className = (0, _deviceWidth.getDevicesByWidth)(config.width).reduce(function (acc, device) {
|
108
|
+
return acc += " widget-application--".concat(device);
|
109
|
+
}, 'widget-application');
|
110
|
+
return className;
|
111
|
+
};
|
112
|
+
|
114
113
|
return /*#__PURE__*/_react.default.createElement("main", {
|
115
|
-
className:
|
114
|
+
className: getAppClass(),
|
116
115
|
id: "widget-application",
|
117
116
|
style: appStyle
|
118
117
|
}, /*#__PURE__*/_react.default.createElement("section", {
|
@@ -268,63 +268,55 @@ var PanoramaTab = function PanoramaTab(_ref4) {
|
|
268
268
|
setLoadingState = _useState6[1];
|
269
269
|
|
270
270
|
var _useState7 = (0, _react.useState)({
|
271
|
-
width: 0,
|
272
|
-
height: 0
|
273
|
-
}),
|
274
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
275
|
-
windowSize = _useState8[0],
|
276
|
-
setWindowSize = _useState8[1];
|
277
|
-
|
278
|
-
var _useState9 = (0, _react.useState)({
|
279
271
|
width: '200px',
|
280
272
|
height: 'auto'
|
281
273
|
}),
|
282
|
-
|
283
|
-
mapSize =
|
284
|
-
setMapSize =
|
274
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
275
|
+
mapSize = _useState8[0],
|
276
|
+
setMapSize = _useState8[1];
|
285
277
|
|
286
|
-
var
|
287
|
-
|
288
|
-
mapOpen =
|
289
|
-
setMapState =
|
278
|
+
var _useState9 = (0, _react.useState)(false),
|
279
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
280
|
+
mapOpen = _useState10[0],
|
281
|
+
setMapState = _useState10[1];
|
290
282
|
|
291
|
-
var
|
283
|
+
var _useState11 = (0, _react.useState)({
|
292
284
|
X: 1,
|
293
285
|
Y: 1
|
294
286
|
}),
|
287
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
288
|
+
planScale = _useState12[0],
|
289
|
+
setPlanScale = _useState12[1];
|
290
|
+
|
291
|
+
var _useState13 = (0, _react.useState)(true),
|
295
292
|
_useState14 = _slicedToArray(_useState13, 2),
|
296
|
-
|
297
|
-
|
293
|
+
isMapDisabled = _useState14[0],
|
294
|
+
setMapDisabledState = _useState14[1];
|
298
295
|
|
299
|
-
var _useState15 = (0, _react.useState)(
|
296
|
+
var _useState15 = (0, _react.useState)(false),
|
300
297
|
_useState16 = _slicedToArray(_useState15, 2),
|
301
|
-
|
302
|
-
|
298
|
+
autoplayEnabled = _useState16[0],
|
299
|
+
setAutoplayState = _useState16[1];
|
303
300
|
|
304
|
-
var _useState17 = (0, _react.useState)(
|
301
|
+
var _useState17 = (0, _react.useState)(cameraFovValues.x1),
|
305
302
|
_useState18 = _slicedToArray(_useState17, 2),
|
306
|
-
|
307
|
-
|
303
|
+
cameraFov = _useState18[0],
|
304
|
+
setCameraFov = _useState18[1];
|
308
305
|
|
309
|
-
var _useState19 = (0, _react.useState)(
|
306
|
+
var _useState19 = (0, _react.useState)(0),
|
310
307
|
_useState20 = _slicedToArray(_useState19, 2),
|
311
|
-
|
312
|
-
|
308
|
+
currentRoomIndex = _useState20[0],
|
309
|
+
setCurrentRoomIndex = _useState20[1];
|
313
310
|
|
314
|
-
var _useState21 = (0, _react.useState)(
|
311
|
+
var _useState21 = (0, _react.useState)([]),
|
315
312
|
_useState22 = _slicedToArray(_useState21, 2),
|
316
|
-
|
317
|
-
|
313
|
+
panoramas = _useState22[0],
|
314
|
+
setPanoramas = _useState22[1];
|
318
315
|
|
319
|
-
var _useState23 = (0, _react.useState)(
|
316
|
+
var _useState23 = (0, _react.useState)(null),
|
320
317
|
_useState24 = _slicedToArray(_useState23, 2),
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
var _useState25 = (0, _react.useState)(null),
|
325
|
-
_useState26 = _slicedToArray(_useState25, 2),
|
326
|
-
viewer = _useState26[0],
|
327
|
-
setViewer = _useState26[1];
|
318
|
+
viewer = _useState24[0],
|
319
|
+
setViewer = _useState24[1];
|
328
320
|
|
329
321
|
var changePanorama = function changePanorama(panorama) {
|
330
322
|
setCurrentRoomIndex(panorama['panorama_index']);
|
@@ -334,14 +326,11 @@ var PanoramaTab = function PanoramaTab(_ref4) {
|
|
334
326
|
var setScale = function setScale() {
|
335
327
|
if (!viewer) return;
|
336
328
|
var image = document.querySelector('.widget-tab__panorama-map img');
|
337
|
-
var _viewer$container = viewer.container,
|
338
|
-
clientWidth = _viewer$container.clientWidth,
|
339
|
-
clientHeight = _viewer$container.clientHeight;
|
340
329
|
var imageWidth = image.naturalWidth;
|
341
330
|
var imageHeight = image.naturalHeight;
|
342
331
|
var imageDelta = imageWidth / imageHeight;
|
343
332
|
var maxWidth = 200;
|
344
|
-
var maxHeight =
|
333
|
+
var maxHeight = _store.default.config.height - 200;
|
345
334
|
var width = maxWidth;
|
346
335
|
var height = width / imageDelta;
|
347
336
|
|
@@ -358,7 +347,7 @@ var PanoramaTab = function PanoramaTab(_ref4) {
|
|
358
347
|
width: width,
|
359
348
|
height: height
|
360
349
|
}, json));
|
361
|
-
viewer.onWindowResize(
|
350
|
+
viewer.onWindowResize(_store.default.config.width, _store.default.config.height);
|
362
351
|
};
|
363
352
|
|
364
353
|
var onImageLoaded = function onImageLoaded() {
|
@@ -419,21 +408,6 @@ var PanoramaTab = function PanoramaTab(_ref4) {
|
|
419
408
|
viewer.enableAutoRate();
|
420
409
|
};
|
421
410
|
|
422
|
-
(0, _react.useEffect)(function () {
|
423
|
-
var onResize = function onResize() {
|
424
|
-
setWindowSize({
|
425
|
-
width: window.innerWidth,
|
426
|
-
height: window.innerHeight
|
427
|
-
});
|
428
|
-
closeMap();
|
429
|
-
};
|
430
|
-
|
431
|
-
onResize();
|
432
|
-
window.addEventListener('resize', onResize);
|
433
|
-
return function cleanup() {
|
434
|
-
window.removeEventListener('resize', onResize);
|
435
|
-
};
|
436
|
-
}, []);
|
437
411
|
(0, _react.useEffect)(function () {
|
438
412
|
if (!panoramas.length) return;
|
439
413
|
var container = document.querySelector('.widget-tab__panorama-overlay');
|
@@ -479,7 +453,7 @@ var PanoramaTab = function PanoramaTab(_ref4) {
|
|
479
453
|
|
480
454
|
animate();
|
481
455
|
}, [panoramas]);
|
482
|
-
(0, _react.useEffect)(setScale, [json,
|
456
|
+
(0, _react.useEffect)(setScale, [json, viewer, _store.default.config.width, _store.default.config.height]);
|
483
457
|
(0, _react.useEffect)(function () {
|
484
458
|
return setPanoramas(getPanoramas(json, images, setLoadingState));
|
485
459
|
}, [json, images]);
|
@@ -546,7 +520,7 @@ var PanoramaTab = function PanoramaTab(_ref4) {
|
|
546
520
|
var onMapClick = function onMapClick(event) {
|
547
521
|
if (loadingState) return;
|
548
522
|
|
549
|
-
if (
|
523
|
+
if (_store.default.config.width <= _deviceWidth.deviceWidth.tablet) {
|
550
524
|
if (!mapOpen) {
|
551
525
|
openMap();
|
552
526
|
return;
|
@@ -90,9 +90,11 @@ var RotationTab = function RotationTab(_ref) {
|
|
90
90
|
var newRotation = new _threesixty.default(container, {
|
91
91
|
image: _toConsumableArray(images),
|
92
92
|
parentElement: widgetTab,
|
93
|
-
inverted: true
|
93
|
+
inverted: true,
|
94
|
+
speed: 150
|
94
95
|
});
|
95
96
|
newRotation._update = updateRotation;
|
97
|
+
newRotation.play(true);
|
96
98
|
var lastIndex = 0;
|
97
99
|
var controller = (0, _panzoom.default)(container, {
|
98
100
|
maxZoom: 3,
|
@@ -115,15 +117,6 @@ var RotationTab = function RotationTab(_ref) {
|
|
115
117
|
setRotation(newRotation);
|
116
118
|
};
|
117
119
|
|
118
|
-
var onEnd = function onEnd() {
|
119
|
-
rotation.controller.pause();
|
120
|
-
rotation.container.style.transform = 'none';
|
121
|
-
rotation.destroy();
|
122
|
-
setActiveIndex(0);
|
123
|
-
setRotation(null);
|
124
|
-
setInitState(false);
|
125
|
-
};
|
126
|
-
|
127
120
|
var openInstructions = function openInstructions() {
|
128
121
|
return setInstructionsState(true);
|
129
122
|
};
|
@@ -140,15 +133,15 @@ var RotationTab = function RotationTab(_ref) {
|
|
140
133
|
alt: "rotation-view-".concat(index),
|
141
134
|
className: activeIndex === index ? 'active' : ''
|
142
135
|
});
|
143
|
-
}))), !showInstructions && /*#__PURE__*/_react.default.createElement("button", {
|
136
|
+
}))), !initialized && !showInstructions && /*#__PURE__*/_react.default.createElement("button", {
|
144
137
|
className: "widget-tab__threesixty-start",
|
145
|
-
onClick:
|
138
|
+
onClick: openInstructions
|
146
139
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
147
140
|
className: "widget-tab__threesixty-start-icon"
|
148
141
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
149
142
|
src: _rotation.default,
|
150
143
|
alt: "start-icon"
|
151
|
-
})), /*#__PURE__*/_react.default.createElement("span", null, _locale.default.getLocaleText(
|
144
|
+
})), /*#__PURE__*/_react.default.createElement("span", null, _locale.default.getLocaleText('rotate'))), showInstructions && /*#__PURE__*/_react.default.createElement(_Instructions.default, {
|
152
145
|
disabled: disabled,
|
153
146
|
steps: instructionSteps,
|
154
147
|
onClick: onStart
|
@@ -11,9 +11,9 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
11
11
|
|
12
12
|
var _store = _interopRequireDefault(require("../store"));
|
13
13
|
|
14
|
-
var
|
14
|
+
var _fullScreenStore = _interopRequireDefault(require("../store/fullScreenStore"));
|
15
15
|
|
16
|
-
var
|
16
|
+
var _modelStore = _interopRequireDefault(require("../store/modelStore"));
|
17
17
|
|
18
18
|
var _Application = _interopRequireDefault(require("./Application"));
|
19
19
|
|
@@ -35,6 +35,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
35
35
|
|
36
36
|
var Widget = /*#__PURE__*/function () {
|
37
37
|
function Widget(container) {
|
38
|
+
var _this = this;
|
39
|
+
|
38
40
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
39
41
|
|
40
42
|
_classCallCheck(this, Widget);
|
@@ -45,16 +47,28 @@ var Widget = /*#__PURE__*/function () {
|
|
45
47
|
|
46
48
|
var widgetContainer = document.querySelector(container);
|
47
49
|
if (!widgetContainer) throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043D\u0430\u0439\u0442\u0438 \u044D\u043B\u0435\u043C\u0435\u043D\u0442: #".concat(container));
|
50
|
+
|
51
|
+
if (!options.width) {
|
52
|
+
config.width = widgetContainer.offsetWidth;
|
53
|
+
}
|
54
|
+
|
55
|
+
if (!options.height) {
|
56
|
+
config.height = widgetContainer.offsetHeight;
|
57
|
+
}
|
58
|
+
|
48
59
|
config.containerElement = widgetContainer;
|
49
60
|
|
50
61
|
_store.default.setConfig(config);
|
51
62
|
|
52
|
-
|
63
|
+
_fullScreenStore.default.resize(config);
|
64
|
+
|
65
|
+
if (config.resizable) {
|
66
|
+
window.addEventListener('resize', function () {
|
67
|
+
return _this.onResize();
|
68
|
+
});
|
69
|
+
}
|
53
70
|
|
54
|
-
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_Application.default,
|
55
|
-
width: config.width,
|
56
|
-
height: config.height
|
57
|
-
}), widgetContainer);
|
71
|
+
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_Application.default, null), widgetContainer);
|
58
72
|
}
|
59
73
|
|
60
74
|
_createClass(Widget, [{
|
@@ -65,20 +79,42 @@ var Widget = /*#__PURE__*/function () {
|
|
65
79
|
}, {
|
66
80
|
key: "updateOptions",
|
67
81
|
value: function updateOptions(config) {
|
68
|
-
var
|
82
|
+
var _this2 = this;
|
69
83
|
|
70
84
|
var newConfig = _objectSpread({}, config);
|
71
85
|
|
72
86
|
this.requiredParams.forEach(function (param) {
|
73
87
|
if (config[param]) return;
|
74
|
-
newConfig[param] =
|
88
|
+
newConfig[param] = _this2.options[param];
|
75
89
|
});
|
76
90
|
|
77
91
|
_modelStore.default.removeHouse();
|
78
92
|
|
79
93
|
_store.default.setConfig(newConfig);
|
80
94
|
|
81
|
-
|
95
|
+
_fullScreenStore.default.resize(newConfig);
|
96
|
+
}
|
97
|
+
}, {
|
98
|
+
key: "updateSize",
|
99
|
+
value: function updateSize(size) {
|
100
|
+
var newConfig = _objectSpread(_objectSpread({}, this.options), size);
|
101
|
+
|
102
|
+
_modelStore.default.removeHouse();
|
103
|
+
|
104
|
+
_store.default.setConfig(newConfig);
|
105
|
+
|
106
|
+
_fullScreenStore.default.resize(newConfig);
|
107
|
+
}
|
108
|
+
}, {
|
109
|
+
key: "onResize",
|
110
|
+
value: function onResize() {
|
111
|
+
var _this$options$contain = this.options.containerElement,
|
112
|
+
width = _this$options$contain.offsetWidth,
|
113
|
+
height = _this$options$contain.offsetHeight;
|
114
|
+
this.updateSize({
|
115
|
+
width: width,
|
116
|
+
height: height
|
117
|
+
});
|
82
118
|
}
|
83
119
|
}, {
|
84
120
|
key: "on",
|
@@ -11,13 +11,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
11
11
|
|
12
12
|
var defaultConfig = {
|
13
13
|
tabs: ['rotation', 'panorama'],
|
14
|
+
name: null,
|
14
15
|
logo: null,
|
15
16
|
logoUrl: null,
|
16
|
-
|
17
|
-
|
17
|
+
resizable: true,
|
18
|
+
width: 1920,
|
19
|
+
height: 1080,
|
18
20
|
planImage: null,
|
19
|
-
|
20
|
-
|
21
|
+
topViewImage: null,
|
22
|
+
rotationMode: 'default',
|
21
23
|
rotationImages: [],
|
22
24
|
panoramaImages: [],
|
23
25
|
json: null,
|