js-cloudimage-360-view 2.7.4 → 2.7.7
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/CHANGELOG.md +18 -0
- package/README.md +78 -19
- package/dist/ci360.service.js +141 -51
- package/dist/ci360.utils.js +6 -5
- package/dist/constants/image-src-props.js +8 -0
- package/dist/index.js +28 -1
- package/dist/static/css/hotspots.css +222 -0
- package/dist/utils/{common → class-names}/add-class.js +0 -0
- package/dist/utils/{common → class-names}/remove-class.js +0 -0
- package/dist/utils/container-elements/index.js +9 -1
- package/dist/utils/container-elements/remove-child-from-parent.js +16 -0
- package/dist/utils/controls/init-controls.js +1 -1
- package/dist/utils/{hotspot → hotspots}/attach-popup-events.js +1 -1
- package/dist/utils/{hotspot → hotspots}/configs-error-handler.js +7 -10
- package/dist/utils/{hotspot → hotspots}/create-popper-instace.js +0 -0
- package/dist/utils/{hotspot → hotspots}/elements/create-carousel-dot.js +1 -1
- package/dist/utils/{hotspot → hotspots}/elements/create-carousel-image.js +0 -0
- package/dist/utils/{hotspot → hotspots}/elements/create-hotspot-icon.js +4 -5
- package/dist/utils/{hotspot → hotspots}/elements/create-hotspot-popup-link.js +0 -0
- package/dist/utils/{hotspot → hotspots}/elements/create-hotspots.js +0 -0
- package/dist/utils/{hotspot → hotspots}/elements/create-images-carousel.js +0 -0
- package/dist/utils/{hotspot → hotspots}/elements/create-modal-description.js +0 -0
- package/dist/utils/{hotspot → hotspots}/elements/create-modal-title.js +0 -0
- package/dist/utils/hotspots/elements/create-model-elements.js +66 -0
- package/dist/utils/{hotspot → hotspots}/elements/create-popup-arrow.js +0 -0
- package/dist/utils/{hotspot → hotspots}/elements/create-popup.js +10 -7
- package/dist/utils/hotspots/elements/create-read-more-btn.js +17 -0
- package/dist/utils/{hotspot/fill-previous-coord-with-previous.js → hotspots/fill-empty-coord-with-previous.js} +3 -3
- package/dist/utils/hotspots/generate-hotspots-configs.js +58 -0
- package/dist/utils/{hotspot → hotspots}/generate-popup-config.js +3 -8
- package/dist/utils/{hotspot → hotspots}/get-hotspot-icon.js +0 -0
- package/dist/utils/{hotspot → hotspots}/get-hotspot-orientation.js +0 -0
- package/dist/utils/{hotspot → hotspots}/get-hotspot-popup-node.js +4 -2
- package/dist/utils/{hotspot → hotspots}/get-popup-node.js +1 -1
- package/dist/utils/{hotspot → hotspots}/hide-hotspot-icon.js +0 -0
- package/dist/utils/{hotspot → hotspots}/hide-hotspots-icons.js +0 -0
- package/dist/utils/{hotspot → hotspots}/is-mouse-on-hotspot.js +0 -0
- package/dist/utils/{hotspot → hotspots}/prepare-hotspots-positions.js +3 -3
- package/dist/utils/{hotspot → hotspots}/set-current-slide.js +0 -0
- package/dist/utils/{hotspot → hotspots}/update-hotspot-icon-position.js +0 -0
- package/dist/utils/{hotspot → hotspots}/update-hotspots.js +10 -9
- package/dist/utils/image-src/is-src-props-changed.js +23 -0
- package/dist/utils/index.js +36 -36
- package/dist/utils/responsive/get-image-aspect-ratio.js +39 -0
- package/dist/utils/spin-y/get-moving-direction.js +1 -1
- package/package.json +2 -1
- package/dist/utils/hotspot/elements/create-model-elements.js +0 -49
- package/dist/utils/hotspot/generate-hotspots-configs.js +0 -41
- package/dist/utils/hotspot/get-hotspot-variant.js +0 -20
- package/dist/utils/responsive/get-container-responsive-height.js +0 -20
- package/dist/utils/responsive/get-container-responsive-width.js +0 -20
package/dist/index.js
CHANGED
|
@@ -10,11 +10,16 @@ require("core-js/features/array/includes");
|
|
|
10
10
|
|
|
11
11
|
var _ci = _interopRequireDefault(require("./ci360.service"));
|
|
12
12
|
|
|
13
|
+
var _ci2 = require("./ci360.utils");
|
|
14
|
+
|
|
13
15
|
function init() {
|
|
14
16
|
var viewers = [];
|
|
15
17
|
var view360Array = document.querySelectorAll('.cloudimage-360:not(.initialized)');
|
|
18
|
+
var hotspotsConfigs = window.CI360.hotspots || {};
|
|
16
19
|
[].slice.call(view360Array).forEach(function (container) {
|
|
17
|
-
|
|
20
|
+
var hotspotInstanceName = (0, _ci2.attr)(container, 'hotspot-instance') || (0, _ci2.attr)(container, 'data-hotspot-instance');
|
|
21
|
+
var hotspotConfig = hotspotsConfigs[hotspotInstanceName] ? hotspotsConfigs[hotspotInstanceName] : null;
|
|
22
|
+
viewers.push(new _ci.default(container, false, hotspotConfig));
|
|
18
23
|
});
|
|
19
24
|
window.CI360._viewers = viewers;
|
|
20
25
|
}
|
|
@@ -43,6 +48,27 @@ function getActiveIndexByID(id, oriantation) {
|
|
|
43
48
|
return currentViewer && currentViewer.activeImageX - 1;
|
|
44
49
|
}
|
|
45
50
|
|
|
51
|
+
function update() {
|
|
52
|
+
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
53
|
+
var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
54
|
+
|
|
55
|
+
if (id) {
|
|
56
|
+
try {
|
|
57
|
+
var view = window.CI360._viewers.filter(function (viewer) {
|
|
58
|
+
return viewer.id === id;
|
|
59
|
+
})[0];
|
|
60
|
+
|
|
61
|
+
return view.updatePlugin(forceUpdate);
|
|
62
|
+
} catch (_unused) {
|
|
63
|
+
console.error("Cloudimage-360: there is no view with such id '".concat(id, "'"));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return window.CI360._viewers.forEach(function (viewer) {
|
|
68
|
+
viewer.updatePlugin(forceUpdate);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
46
72
|
function isNoViewers() {
|
|
47
73
|
return !(window.CI360._viewers && window.CI360._viewers.length > 0);
|
|
48
74
|
}
|
|
@@ -51,6 +77,7 @@ window.CI360 = window.CI360 || {};
|
|
|
51
77
|
window.CI360.init = init;
|
|
52
78
|
window.CI360.destroy = destroy;
|
|
53
79
|
window.CI360.getActiveIndexByID = getActiveIndexByID;
|
|
80
|
+
window.CI360.update = update;
|
|
54
81
|
|
|
55
82
|
if (!window.CI360.notInitOnLoad) {
|
|
56
83
|
init();
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
.cloudimage-360-hotspot-link-icon {
|
|
2
|
+
width: 42px;
|
|
3
|
+
height: 42px;
|
|
4
|
+
background: rgba(12, 109, 199, 0.2);
|
|
5
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
6
|
+
border-radius: 50%;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
transition: opacity 600ms ease-in-out;
|
|
9
|
+
cursor: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.cloudimage-360-hotspot-link-icon::before {
|
|
13
|
+
content: '';
|
|
14
|
+
position: absolute;
|
|
15
|
+
width: 18px;
|
|
16
|
+
height: 18px;
|
|
17
|
+
background-image: url('https://scaleflex.cloudimg.io/v7/plugins/js-cloudimage-360-view/assets/img/link-hotspot.svg');
|
|
18
|
+
background-color: #0C6DC7;
|
|
19
|
+
background-repeat: no-repeat;
|
|
20
|
+
background-size: 8px;
|
|
21
|
+
background-position: center;
|
|
22
|
+
left: 50%;
|
|
23
|
+
top: 50%;
|
|
24
|
+
transform: translate(-50%, -50%);
|
|
25
|
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.25);
|
|
26
|
+
border-radius: 50%;
|
|
27
|
+
animation: pulse 2s infinite;
|
|
28
|
+
cursor: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cloudimage-360-hotspot-custom-icon {
|
|
32
|
+
width: 42px;
|
|
33
|
+
height: 42px;
|
|
34
|
+
background: #76AD0133;
|
|
35
|
+
border: 1px solid #FFFFFF33;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
transition: opacity 800ms ease-in-out;
|
|
39
|
+
cursor: auto;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.cloudimage-360-hotspot-custom-icon::before {
|
|
43
|
+
content: '';
|
|
44
|
+
position: absolute;
|
|
45
|
+
width: 18px;
|
|
46
|
+
height: 18px;
|
|
47
|
+
left: 50%;
|
|
48
|
+
top: 50%;
|
|
49
|
+
transform: translate(-50%, -50%);
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
background-color: #76AD01;
|
|
52
|
+
background-repeat: no-repeat;
|
|
53
|
+
background-size: 8px;
|
|
54
|
+
background-position: center;
|
|
55
|
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.25);
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
animation: pulse 2s infinite;
|
|
58
|
+
cursor: auto;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.cloudimage-360-hotspot-custom-icon::after {
|
|
62
|
+
content: '+';
|
|
63
|
+
position: absolute;
|
|
64
|
+
width: 8px;
|
|
65
|
+
left: 50%;
|
|
66
|
+
top: 100%;
|
|
67
|
+
color: #FFF;
|
|
68
|
+
font-weight: 400;
|
|
69
|
+
transform: translate(-50%, -150%);
|
|
70
|
+
cursor: auto;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.cloudimage-360-hotspot-popup {
|
|
74
|
+
visibility: hidden;
|
|
75
|
+
opacity: 0;
|
|
76
|
+
background-color: #FFFFFF;
|
|
77
|
+
padding: 6px;
|
|
78
|
+
border-radius: 2px;
|
|
79
|
+
box-shadow: 0px 4px 4px 0px #00000040;
|
|
80
|
+
z-index: 999;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.cloudimage-360-hotspot-popup[data-show] {
|
|
84
|
+
visibility: visible;
|
|
85
|
+
opacity: 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.cloudimage-360-popup-arrow,
|
|
89
|
+
.cloudimage-360-popup-arrow::before {
|
|
90
|
+
position: absolute;
|
|
91
|
+
width: 8px;
|
|
92
|
+
height: 8px;
|
|
93
|
+
background: inherit;
|
|
94
|
+
cursor: 'auto';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.cloudimage-360-popup-arrow {
|
|
98
|
+
visibility: hidden;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.cloudimage-360-popup-arrow::before {
|
|
102
|
+
visibility: visible;
|
|
103
|
+
content: '';
|
|
104
|
+
transform: rotate(45deg);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.cloudimage-360-hotspot-popup[data-popper-placement^='top'] > .cloudimage-360-popup-arrow {
|
|
108
|
+
bottom: -4px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.cloudimage-360-hotspot-popup[data-popper-placement^='bottom'] > .cloudimage-360-popup-arrow {
|
|
112
|
+
top: -4px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.cloudimage-360-hotspot-popup[data-popper-placement^='left'] > .cloudimage-360-popup-arrow {
|
|
116
|
+
right: -4px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.cloudimage-360-hotspot-popup[data-popper-placement^='right'] > .cloudimage-360-popup-arrow {
|
|
120
|
+
left: -4px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.cloudimage-360-modal-wrapper {
|
|
124
|
+
max-width: 222px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.cloudimage-360-images-carousel-wrapper {
|
|
128
|
+
margin: 0 auto;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.cloudimage-360-images-carousel .cloudimage-360-carousel-image {
|
|
132
|
+
display: none;
|
|
133
|
+
min-height: 187px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.cloudimage-360-images-carousel .cloudimage-360-carousel-image.active-image {
|
|
137
|
+
display: block;
|
|
138
|
+
animation-name: fade-active-image;
|
|
139
|
+
animation-duration: 1.5s;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.cloudimage-360-carousel-dots {
|
|
143
|
+
display: flex;
|
|
144
|
+
column-gap: 3px;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
flex-wrap: wrap;
|
|
147
|
+
margin: 5px auto;
|
|
148
|
+
row-gap: 3px;
|
|
149
|
+
padding: 0 6px;
|
|
150
|
+
width: 50%;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.cloudimage-360-carousel-dot {
|
|
154
|
+
width: 5px;
|
|
155
|
+
height: 5px;
|
|
156
|
+
background-color: #C9D0DE;
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
transition: background-color 0.6s ease;
|
|
160
|
+
border: 0;
|
|
161
|
+
padding: 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.cloudimage-360-carousel-dot.active-dot {
|
|
165
|
+
background-color: #76AD01;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.cloudimage-360-carousel-dot:focus,
|
|
169
|
+
.cloudimage-360-carousel-dot:focus-visible {
|
|
170
|
+
border: 0;
|
|
171
|
+
outline: 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.cloudimage-360-modal-title {
|
|
175
|
+
font-size: 12px;
|
|
176
|
+
font-weight: 700;
|
|
177
|
+
line-height: 16px;
|
|
178
|
+
margin: 4px 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.cloudimage-360-modal-description {
|
|
182
|
+
font-size: 10px;
|
|
183
|
+
font-weight: 400;
|
|
184
|
+
line-height: 16px;
|
|
185
|
+
margin: 4px 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.cloudimage-360-modal-more-details {
|
|
189
|
+
color: #76AD01;
|
|
190
|
+
background-color: #ECFAE6;
|
|
191
|
+
font-size: 10px;
|
|
192
|
+
line-height: 16px;
|
|
193
|
+
font-weight: 400;
|
|
194
|
+
padding: 4px 8px;
|
|
195
|
+
transition: background-color 200ms ease-in-out;
|
|
196
|
+
border-radius: 2px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.cloudimage-360-modal-more-details:hover {
|
|
200
|
+
text-decoration: none;
|
|
201
|
+
color: #76AD01;
|
|
202
|
+
background-color: #e1f5d8;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@keyframes pulse {
|
|
206
|
+
0% {
|
|
207
|
+
box-shadow: 0 0 0 0 rgba(99, 99, 99, 0.7);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
70% {
|
|
211
|
+
box-shadow: 0 0 0 10px rgba(99, 99, 99, 0);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
100% {
|
|
215
|
+
box-shadow: 0 0 0 0 rgba(99, 99, 99, 0);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@keyframes fade-active-image {
|
|
220
|
+
from { opacity: 0.7 }
|
|
221
|
+
to { opacity: 1 }
|
|
222
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -75,6 +75,12 @@ Object.defineProperty(exports, "createMagnifierIcon", {
|
|
|
75
75
|
return _createMagnifierIcon.createMagnifierIcon;
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
+
Object.defineProperty(exports, "removeChildFromParent", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function get() {
|
|
81
|
+
return _removeChildFromParent.removeChildFromParent;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
78
84
|
|
|
79
85
|
var _create360ViewCircleIcon = require("./create-360-view-circle-icon");
|
|
80
86
|
|
|
@@ -98,4 +104,6 @@ var _createLoader = require("./create-loader");
|
|
|
98
104
|
|
|
99
105
|
var _applyStylesToContainer = require("./apply-styles-to-container");
|
|
100
106
|
|
|
101
|
-
var _createFullscreenModal = require("./create-fullscreen-modal");
|
|
107
|
+
var _createFullscreenModal = require("./create-fullscreen-modal");
|
|
108
|
+
|
|
109
|
+
var _removeChildFromParent = require("./remove-child-from-parent");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeChildFromParent = void 0;
|
|
7
|
+
|
|
8
|
+
var removeChildFromParent = function removeChildFromParent(parent, child) {
|
|
9
|
+
if (parent && child) {
|
|
10
|
+
try {
|
|
11
|
+
parent.removeChild(child);
|
|
12
|
+
} catch (_unused) {}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.removeChildFromParent = removeChildFromParent;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.initControls = void 0;
|
|
7
7
|
|
|
8
|
-
var _addClass = require("../
|
|
8
|
+
var _addClass = require("../class-names/add-class");
|
|
9
9
|
|
|
10
10
|
var initControls = function initControls(controlsConfig, controlsTriggers) {
|
|
11
11
|
var container = controlsConfig.container,
|
|
@@ -17,7 +17,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
17
|
|
|
18
18
|
var attachPopupEvents = function attachPopupEvents(reference, popper, popperInstance, open) {
|
|
19
19
|
if (open) return;
|
|
20
|
-
var showEvents = ['mouseenter', 'focus'];
|
|
20
|
+
var showEvents = ['mouseenter', 'touchstart', 'focus'];
|
|
21
21
|
var hideEvents = ['mouseleave', 'blur'];
|
|
22
22
|
var isVisible;
|
|
23
23
|
|
|
@@ -7,22 +7,19 @@ exports.configsErrorHandler = void 0;
|
|
|
7
7
|
|
|
8
8
|
var configsErrorHandler = function configsErrorHandler(hotspotProps) {
|
|
9
9
|
var _hotspotProps$variant = hotspotProps.variant,
|
|
10
|
-
variant = _hotspotProps$variant === void 0 ? {} : _hotspotProps$variant
|
|
11
|
-
_hotspotProps$popupPr = hotspotProps.popupProps,
|
|
12
|
-
popupProps = _hotspotProps$popupPr === void 0 ? {} : _hotspotProps$popupPr;
|
|
13
|
-
var anchorId = popupProps.anchorId;
|
|
10
|
+
variant = _hotspotProps$variant === void 0 ? {} : _hotspotProps$variant;
|
|
14
11
|
var url = variant.url,
|
|
15
|
-
title = variant.title
|
|
12
|
+
title = variant.title,
|
|
13
|
+
anchorId = variant.anchorId,
|
|
14
|
+
images = variant.images,
|
|
15
|
+
description = variant.description,
|
|
16
|
+
moreDetailsUrl = variant.moreDetailsUrl;
|
|
16
17
|
|
|
17
18
|
if (url && !title) {
|
|
18
19
|
console.error('Cloudimage-360: Hotspot config with variant link must have title for the link');
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
if (title && !url) {
|
|
22
|
-
console.error('Cloudimage-360: Hotspot config with variant link must have url for the link');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!title && !url && !anchorId) {
|
|
22
|
+
if (!title && !url && !anchorId && !images && !description && !moreDetailsUrl) {
|
|
26
23
|
console.error('Cloudimage-360: Hotspot config with custom variant must provide anchorId');
|
|
27
24
|
}
|
|
28
25
|
};
|
|
File without changes
|
|
@@ -8,7 +8,7 @@ exports.createCarouselDot = void 0;
|
|
|
8
8
|
var _setCurrentSlide = require("../set-current-slide");
|
|
9
9
|
|
|
10
10
|
var createCarouselDot = function createCarouselDot(image, imageIndex, popup) {
|
|
11
|
-
var imageDot = document.createElement('
|
|
11
|
+
var imageDot = document.createElement('button');
|
|
12
12
|
imageDot.className = 'cloudimage-360-carousel-dot';
|
|
13
13
|
|
|
14
14
|
imageDot.onclick = function () {
|
|
File without changes
|
|
@@ -8,11 +8,10 @@ exports.createHotspotIcon = void 0;
|
|
|
8
8
|
var _hideHotspotIcon = require("../hide-hotspot-icon");
|
|
9
9
|
|
|
10
10
|
var createHotspotIcon = function createHotspotIcon(container, hotspotConfig) {
|
|
11
|
-
var
|
|
12
|
-
popupProps = hotspotConfig.popupProps,
|
|
11
|
+
var indicatorSelector = hotspotConfig.indicatorSelector,
|
|
13
12
|
variant = hotspotConfig.variant;
|
|
14
|
-
var
|
|
15
|
-
|
|
13
|
+
var url = variant.url,
|
|
14
|
+
anchorId = variant.anchorId;
|
|
16
15
|
var hotspotIcon = document.createElement('div');
|
|
17
16
|
|
|
18
17
|
var mouseEnterHotspot = function mouseEnterHotspot() {
|
|
@@ -24,7 +23,7 @@ var createHotspotIcon = function createHotspotIcon(container, hotspotConfig) {
|
|
|
24
23
|
};
|
|
25
24
|
|
|
26
25
|
hotspotIcon.style.position = 'absolute';
|
|
27
|
-
hotspotIcon.className = "cloudimage-360-hotspot-".concat(url ? 'link' : 'custom', "-icon ").concat(
|
|
26
|
+
hotspotIcon.className = "cloudimage-360-hotspot-".concat(url ? 'link' : 'custom', "-icon ").concat(indicatorSelector);
|
|
28
27
|
hotspotIcon.setAttribute('data-hotspot-icon-id', anchorId);
|
|
29
28
|
hotspotIcon.setAttribute('data-cloudimage-360-hotspot', '');
|
|
30
29
|
hotspotIcon.addEventListener('mouseenter', mouseEnterHotspot);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createModalElements = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _createImagesCarousel3 = require("./create-images-carousel");
|
|
13
|
+
|
|
14
|
+
var _createModalDescription = require("./create-modal-description");
|
|
15
|
+
|
|
16
|
+
var _createModalTitle = require("./create-modal-title");
|
|
17
|
+
|
|
18
|
+
var _createReadMoreBtn = require("./create-read-more-btn");
|
|
19
|
+
|
|
20
|
+
var createModalElements = function createModalElements(variant, container, popup) {
|
|
21
|
+
var images = variant.images,
|
|
22
|
+
title = variant.title,
|
|
23
|
+
description = variant.description,
|
|
24
|
+
moreDetailsUrl = variant.moreDetailsUrl,
|
|
25
|
+
_variant$moreDetailsT = variant.moreDetailsTitle,
|
|
26
|
+
moreDetailsTitle = _variant$moreDetailsT === void 0 ? 'Read more' : _variant$moreDetailsT;
|
|
27
|
+
var modalWrapper = document.createElement('div');
|
|
28
|
+
modalWrapper.className = 'cloudimage-360-modal-wrapper';
|
|
29
|
+
|
|
30
|
+
if (images) {
|
|
31
|
+
var imagesCarouselWrapper = document.createElement('div');
|
|
32
|
+
|
|
33
|
+
var _createImagesCarousel = (0, _createImagesCarousel3.createImagesCarousel)(images, popup, container),
|
|
34
|
+
_createImagesCarousel2 = (0, _slicedToArray2.default)(_createImagesCarousel, 2),
|
|
35
|
+
imagesCarousel = _createImagesCarousel2[0],
|
|
36
|
+
carouselDots = _createImagesCarousel2[1];
|
|
37
|
+
|
|
38
|
+
imagesCarouselWrapper.appendChild(imagesCarousel);
|
|
39
|
+
|
|
40
|
+
if (images.length > 1) {
|
|
41
|
+
imagesCarouselWrapper.appendChild(carouselDots);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
modalWrapper.appendChild(imagesCarouselWrapper);
|
|
45
|
+
imagesCarouselWrapper.className = 'cloudimage-360-images-carousel-wrapper';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (title) {
|
|
49
|
+
var modalTitle = (0, _createModalTitle.createModalTitle)(title);
|
|
50
|
+
modalWrapper.appendChild(modalTitle);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (description) {
|
|
54
|
+
var modalDescription = (0, _createModalDescription.createModalDescription)(description);
|
|
55
|
+
modalWrapper.appendChild(modalDescription);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (moreDetailsUrl) {
|
|
59
|
+
var readMoreBtn = (0, _createReadMoreBtn.createReadMoreBtn)(moreDetailsUrl, moreDetailsTitle);
|
|
60
|
+
modalWrapper.appendChild(readMoreBtn);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
popup.appendChild(modalWrapper);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.createModalElements = createModalElements;
|
|
File without changes
|
|
@@ -15,24 +15,27 @@ var _createModelElements = require("./create-model-elements");
|
|
|
15
15
|
|
|
16
16
|
var createPopup = function createPopup(container, hotspotConfig, popupProps) {
|
|
17
17
|
var variant = hotspotConfig.variant;
|
|
18
|
-
var
|
|
19
|
-
arrow = popupProps.arrow
|
|
20
|
-
anchorId = popupProps.anchorId;
|
|
18
|
+
var popupSelector = popupProps.popupSelector,
|
|
19
|
+
arrow = popupProps.arrow;
|
|
21
20
|
var url = variant.url,
|
|
22
|
-
images = variant.images
|
|
21
|
+
images = variant.images,
|
|
22
|
+
title = variant.title,
|
|
23
|
+
anchorId = variant.anchorId,
|
|
24
|
+
description = variant.description,
|
|
25
|
+
moreDetailsUrl = variant.moreDetailsUrl;
|
|
23
26
|
var popup = document.createElement('div');
|
|
24
|
-
popup.className = "cloudimage-360-hotspot-popup ".concat(
|
|
27
|
+
popup.className = "cloudimage-360-hotspot-popup ".concat(popupSelector);
|
|
25
28
|
popup.setAttribute('data-hotspot-popup-id', anchorId);
|
|
26
29
|
popup.setAttribute('data-cloudimage-360-hotspot', '');
|
|
27
30
|
popup.style.minHeight = 16;
|
|
28
31
|
popup.style.minWidth = 16;
|
|
29
|
-
popup.style.cursor = '
|
|
32
|
+
popup.style.cursor = 'default';
|
|
30
33
|
|
|
31
34
|
popup.onclick = function (e) {
|
|
32
35
|
return e.stopPropagation();
|
|
33
36
|
};
|
|
34
37
|
|
|
35
|
-
if (images) {
|
|
38
|
+
if (images || description || moreDetailsUrl || title && !url) {
|
|
36
39
|
(0, _createModelElements.createModalElements)(variant, container, popup);
|
|
37
40
|
} else if (url) {
|
|
38
41
|
var hotspotPopupLink = (0, _createHotspotPopupLink.createHotspotPopupLink)(variant);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createReadMoreBtn = void 0;
|
|
7
|
+
|
|
8
|
+
var createReadMoreBtn = function createReadMoreBtn(moreDetailsUrl, moreDetailsTitle) {
|
|
9
|
+
var readMoreBtn = document.createElement('a');
|
|
10
|
+
readMoreBtn.href = moreDetailsUrl;
|
|
11
|
+
readMoreBtn.innerText = moreDetailsTitle;
|
|
12
|
+
readMoreBtn.className = 'cloudimage-360-modal-more-details';
|
|
13
|
+
readMoreBtn.target = '_blank';
|
|
14
|
+
return readMoreBtn;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.createReadMoreBtn = createReadMoreBtn;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.fillEmptyCoordWithPrevious = void 0;
|
|
7
7
|
|
|
8
8
|
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
|
9
|
-
var
|
|
9
|
+
var fillEmptyCoordWithPrevious = function fillEmptyCoordWithPrevious(hotspots, hotspotIndex, coord) {
|
|
10
10
|
var coordIndexes = new Array(hotspotIndex);
|
|
11
11
|
var intialValue = '0%';
|
|
12
12
|
|
|
@@ -23,4 +23,4 @@ var fillPreviousCoordWithPrevious = function fillPreviousCoordWithPrevious(hotsp
|
|
|
23
23
|
return intialValue;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
exports.
|
|
26
|
+
exports.fillEmptyCoordWithPrevious = fillEmptyCoordWithPrevious;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.generateHotspotsConfigs = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _configsErrorHandler = require("./configs-error-handler");
|
|
13
|
+
|
|
14
|
+
var _generatePopupConfig = require("./generate-popup-config");
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
|
+
|
|
20
|
+
var generateHotspotsConfigs = function generateHotspotsConfigs(hotspotsProps) {
|
|
21
|
+
var hotspotsConfigs = hotspotsProps.map(function (hotspotProps) {
|
|
22
|
+
var _hotspotProps$variant = hotspotProps.variant,
|
|
23
|
+
variant = _hotspotProps$variant === void 0 ? {} : _hotspotProps$variant,
|
|
24
|
+
_hotspotProps$hotspot = hotspotProps.hotspots,
|
|
25
|
+
hotspots = _hotspotProps$hotspot === void 0 ? [] : _hotspotProps$hotspot,
|
|
26
|
+
_hotspotProps$indicat = hotspotProps.indicatorSelector,
|
|
27
|
+
indicatorSelector = _hotspotProps$indicat === void 0 ? '' : _hotspotProps$indicat,
|
|
28
|
+
_hotspotProps$popupPr = hotspotProps.popupProps,
|
|
29
|
+
popupProps = _hotspotProps$popupPr === void 0 ? {} : _hotspotProps$popupPr,
|
|
30
|
+
_hotspotProps$orienta = hotspotProps.orientation,
|
|
31
|
+
orientation = _hotspotProps$orienta === void 0 ? 'x' : _hotspotProps$orienta,
|
|
32
|
+
_hotspotProps$initial = hotspotProps.initialDimensions,
|
|
33
|
+
initialDimensions = _hotspotProps$initial === void 0 ? [500, 500] : _hotspotProps$initial;
|
|
34
|
+
(0, _configsErrorHandler.configsErrorHandler)(hotspotProps);
|
|
35
|
+
var popupConfig = (0, _generatePopupConfig.generatePopupConfig)(popupProps);
|
|
36
|
+
var anchorId = variant === null || variant === void 0 ? void 0 : variant.anchorId;
|
|
37
|
+
|
|
38
|
+
if (!anchorId) {
|
|
39
|
+
var uniqueID = Math.floor(Math.random() * 10000);
|
|
40
|
+
anchorId = "cloudimage-360-".concat(uniqueID);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var hotspotConfig = {
|
|
44
|
+
variant: _objectSpread(_objectSpread({}, variant), {}, {
|
|
45
|
+
anchorId: anchorId
|
|
46
|
+
}),
|
|
47
|
+
popupProps: popupConfig,
|
|
48
|
+
hotspots: hotspots,
|
|
49
|
+
indicatorSelector: indicatorSelector,
|
|
50
|
+
initialDimensions: initialDimensions,
|
|
51
|
+
orientation: orientation.toLowerCase()
|
|
52
|
+
};
|
|
53
|
+
return hotspotConfig;
|
|
54
|
+
});
|
|
55
|
+
return hotspotsConfigs;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.generateHotspotsConfigs = generateHotspotsConfigs;
|
|
@@ -6,26 +6,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.generatePopupConfig = void 0;
|
|
7
7
|
|
|
8
8
|
var generatePopupConfig = function generatePopupConfig(popupProps) {
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var _popupProps$popupClas = popupProps.popupClass,
|
|
12
|
-
popupClass = _popupProps$popupClas === void 0 ? '' : _popupProps$popupClas,
|
|
9
|
+
var _popupProps$popupSele = popupProps.popupSelector,
|
|
10
|
+
popupSelector = _popupProps$popupSele === void 0 ? '' : _popupProps$popupSele,
|
|
13
11
|
_popupProps$arrow = popupProps.arrow,
|
|
14
12
|
arrow = _popupProps$arrow === void 0 ? false : _popupProps$arrow,
|
|
15
13
|
_popupProps$offset = popupProps.offset,
|
|
16
14
|
offset = _popupProps$offset === void 0 ? [0, 10] : _popupProps$offset,
|
|
17
15
|
_popupProps$placement = popupProps.placement,
|
|
18
16
|
placement = _popupProps$placement === void 0 ? 'auto' : _popupProps$placement,
|
|
19
|
-
_popupProps$anchorId = popupProps.anchorId,
|
|
20
|
-
anchorId = _popupProps$anchorId === void 0 ? defaultAnchorId : _popupProps$anchorId,
|
|
21
17
|
_popupProps$open = popupProps.open,
|
|
22
18
|
open = _popupProps$open === void 0 ? false : _popupProps$open;
|
|
23
19
|
var popupConfig = {
|
|
24
|
-
|
|
20
|
+
popupSelector: popupSelector,
|
|
25
21
|
arrow: arrow,
|
|
26
22
|
offset: offset,
|
|
27
23
|
placement: placement,
|
|
28
|
-
anchorId: anchorId,
|
|
29
24
|
open: open
|
|
30
25
|
};
|
|
31
26
|
return popupConfig;
|
|
File without changes
|
|
File without changes
|
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getHotspotPopupNode = void 0;
|
|
7
7
|
|
|
8
|
-
var getHotspotPopupNode = function getHotspotPopupNode(anchorId, open) {
|
|
8
|
+
var getHotspotPopupNode = function getHotspotPopupNode(anchorId, open, currentPosition) {
|
|
9
9
|
var hotspotPopupSelector = "[data-hotspot-popup-id=".concat(anchorId, "]");
|
|
10
10
|
var hotspotPopup = document.querySelector(hotspotPopupSelector);
|
|
11
11
|
|
|
12
|
-
if (open) {
|
|
12
|
+
if (open && currentPosition) {
|
|
13
13
|
hotspotPopup.setAttribute('data-show', '');
|
|
14
|
+
} else {
|
|
15
|
+
hotspotPopup.removeAttribute('data-show');
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
return hotspotPopup;
|