js-cloudimage-360-view 2.7.5 → 2.7.8
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 +17 -1
- package/README.md +50 -22
- package/dist/ci360.service.js +100 -44
- package/dist/ci360.utils.js +5 -3
- package/dist/index.js +6 -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/index.js +31 -40
- package/dist/utils/responsive/get-image-aspect-ratio.js +39 -0
- package/package.json +1 -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
|
@@ -29,21 +29,22 @@ var updateHotspots = function updateHotspots(container, hotspotsProps) {
|
|
|
29
29
|
var popupProps = hotspotProps.popupProps,
|
|
30
30
|
hotspots = hotspotProps.hotspots,
|
|
31
31
|
initialDimensions = hotspotProps.initialDimensions,
|
|
32
|
-
orientation = hotspotProps.orientation
|
|
32
|
+
orientation = hotspotProps.orientation,
|
|
33
|
+
variant = hotspotProps.variant;
|
|
33
34
|
var hotspotOriantaion = (0, _getHotspotOrientation.getHotspotOriantaion)(movingDirection);
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
var popup = (0, _getHotspotPopupNode.getHotspotPopupNode)(anchorId, open);
|
|
38
|
-
var hotspotIcon = (0, _getHotspotIcon.getHotspotIcon)(anchorId);
|
|
35
|
+
var currentImageIndex = orientation === 'x' ? activeImageX : activeImageY;
|
|
36
|
+
var open = popupProps.open;
|
|
37
|
+
var anchorId = variant.anchorId;
|
|
39
38
|
var hotspotsPositions = (0, _prepareHotspotsPositions.prepareHotspotsPositions)(hotspots);
|
|
39
|
+
var currentPosition = hotspotsPositions.find(function (hotspotPosition) {
|
|
40
|
+
return hotspotPosition.imageIndex === currentImageIndex;
|
|
41
|
+
});
|
|
42
|
+
var popup = (0, _getHotspotPopupNode.getHotspotPopupNode)(anchorId, open, currentPosition);
|
|
43
|
+
var hotspotIcon = (0, _getHotspotIcon.getHotspotIcon)(anchorId);
|
|
40
44
|
var popperInstance = (0, _createPopperInstace.createPopperInstance)(popup, popupProps, container);
|
|
41
45
|
popperInstance.state.elements.reference = hotspotIcon;
|
|
42
46
|
popperInstance.update();
|
|
43
47
|
(0, _attachPopupEvents.attachPopupEvents)(hotspotIcon, popup, popperInstance, open);
|
|
44
|
-
var currentPosition = hotspotsPositions.find(function (hotspotPosition) {
|
|
45
|
-
return hotspotPosition.imageIndex === currentImage;
|
|
46
|
-
});
|
|
47
48
|
|
|
48
49
|
if (currentPosition && hotspotOriantaion === orientation) {
|
|
49
50
|
var _currentPosition$xCoo = currentPosition.xCoord,
|
package/dist/utils/index.js
CHANGED
|
@@ -4,30 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
+
isSrcPropsChanged: true,
|
|
7
8
|
generateImagesPath: true,
|
|
8
9
|
preloadImages: true,
|
|
9
10
|
preloadOriginalImages: true,
|
|
10
11
|
contain: true,
|
|
12
|
+
getImageAspectRatio: true,
|
|
11
13
|
getCurrentOriginalImage: true,
|
|
12
14
|
magnify: true,
|
|
15
|
+
generateZoomInSteps: true,
|
|
16
|
+
generateZoomOutSteps: true,
|
|
17
|
+
loop: true,
|
|
13
18
|
getSpeedFactor: true,
|
|
14
19
|
isCompletedOneCycle: true,
|
|
15
|
-
getContainerResponsiveWidth: true,
|
|
16
|
-
getContainerResponsiveHeight: true,
|
|
17
|
-
getMovingDirection: true,
|
|
18
|
-
initControls: true,
|
|
19
20
|
addClass: true,
|
|
20
21
|
removeClass: true,
|
|
22
|
+
getMovingDirection: true,
|
|
21
23
|
getItemSkipped: true,
|
|
22
|
-
|
|
23
|
-
generateZoomInSteps: true,
|
|
24
|
-
generateZoomOutSteps: true,
|
|
24
|
+
initControls: true,
|
|
25
25
|
updateHotspots: true,
|
|
26
26
|
createHotspots: true,
|
|
27
27
|
generateHotspotsConfigs: true,
|
|
28
28
|
isMouseOnHotspot: true,
|
|
29
|
-
hideHotspotsIcons: true
|
|
30
|
-
isSrcPropsChanged: true
|
|
29
|
+
hideHotspotsIcons: true
|
|
31
30
|
};
|
|
32
31
|
Object.defineProperty(exports, "addClass", {
|
|
33
32
|
enumerable: true,
|
|
@@ -71,22 +70,16 @@ Object.defineProperty(exports, "generateZoomOutSteps", {
|
|
|
71
70
|
return _generateZoomOutSteps.generateZoomOutSteps;
|
|
72
71
|
}
|
|
73
72
|
});
|
|
74
|
-
Object.defineProperty(exports, "
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function get() {
|
|
77
|
-
return _getContainerResponsiveHeight.getContainerResponsiveHeight;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(exports, "getContainerResponsiveWidth", {
|
|
73
|
+
Object.defineProperty(exports, "getCurrentOriginalImage", {
|
|
81
74
|
enumerable: true,
|
|
82
75
|
get: function get() {
|
|
83
|
-
return
|
|
76
|
+
return _getCurrentOriginalImage.getCurrentOriginalImage;
|
|
84
77
|
}
|
|
85
78
|
});
|
|
86
|
-
Object.defineProperty(exports, "
|
|
79
|
+
Object.defineProperty(exports, "getImageAspectRatio", {
|
|
87
80
|
enumerable: true,
|
|
88
81
|
get: function get() {
|
|
89
|
-
return
|
|
82
|
+
return _getImageAspectRatio.getImageAspectRatio;
|
|
90
83
|
}
|
|
91
84
|
});
|
|
92
85
|
Object.defineProperty(exports, "getItemSkipped", {
|
|
@@ -174,6 +167,8 @@ Object.defineProperty(exports, "updateHotspots", {
|
|
|
174
167
|
}
|
|
175
168
|
});
|
|
176
169
|
|
|
170
|
+
var _isSrcPropsChanged = require("./image-src/is-src-props-changed");
|
|
171
|
+
|
|
177
172
|
var _generateImagesPath = require("./image-src/generate-images-path");
|
|
178
173
|
|
|
179
174
|
var _preloadImages = require("./load-images/preload-images");
|
|
@@ -182,28 +177,32 @@ var _preloadOriginalImages = require("./load-images/preload-original-images");
|
|
|
182
177
|
|
|
183
178
|
var _contain = require("./responsive/contain");
|
|
184
179
|
|
|
180
|
+
var _getImageAspectRatio = require("./responsive/get-image-aspect-ratio");
|
|
181
|
+
|
|
185
182
|
var _getCurrentOriginalImage = require("./magnify/get-current-original-image");
|
|
186
183
|
|
|
187
184
|
var _magnify = require("./magnify/magnify");
|
|
188
185
|
|
|
189
|
-
var
|
|
186
|
+
var _generateZoomInSteps = require("./zoom/generate-zoom-in-steps");
|
|
190
187
|
|
|
191
|
-
var
|
|
188
|
+
var _generateZoomOutSteps = require("./zoom/generate-zoom-out-steps");
|
|
192
189
|
|
|
193
|
-
var
|
|
190
|
+
var _loop = require("./auto-play/loop");
|
|
194
191
|
|
|
195
|
-
var
|
|
192
|
+
var _getSpeedFactor = require("./auto-play/get-speed-factor");
|
|
196
193
|
|
|
197
|
-
var
|
|
194
|
+
var _isCompletedOneCycle = require("./auto-play/is-completed-one-cycle");
|
|
198
195
|
|
|
199
|
-
var
|
|
196
|
+
var _addClass = require("./class-names/add-class");
|
|
200
197
|
|
|
201
|
-
var
|
|
198
|
+
var _removeClass = require("./class-names/remove-class");
|
|
202
199
|
|
|
203
|
-
var
|
|
200
|
+
var _getMovingDirection = require("./spin-y/get-moving-direction");
|
|
204
201
|
|
|
205
202
|
var _getItemSkipped = require("./controls/get-item-skipped");
|
|
206
203
|
|
|
204
|
+
var _initControls = require("./controls/init-controls");
|
|
205
|
+
|
|
207
206
|
var _containerElements = require("./container-elements");
|
|
208
207
|
|
|
209
208
|
Object.keys(_containerElements).forEach(function (key) {
|
|
@@ -218,20 +217,12 @@ Object.keys(_containerElements).forEach(function (key) {
|
|
|
218
217
|
});
|
|
219
218
|
});
|
|
220
219
|
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
var _generateZoomInSteps = require("./zoom/generate-zoom-in-steps");
|
|
224
|
-
|
|
225
|
-
var _generateZoomOutSteps = require("./zoom/generate-zoom-out-steps");
|
|
226
|
-
|
|
227
|
-
var _updateHotspots = require("./hotspot/update-hotspots");
|
|
228
|
-
|
|
229
|
-
var _createHotspots = require("./hotspot/elements/create-hotspots");
|
|
220
|
+
var _updateHotspots = require("./hotspots/update-hotspots");
|
|
230
221
|
|
|
231
|
-
var
|
|
222
|
+
var _createHotspots = require("./hotspots/elements/create-hotspots");
|
|
232
223
|
|
|
233
|
-
var
|
|
224
|
+
var _generateHotspotsConfigs = require("./hotspots/generate-hotspots-configs");
|
|
234
225
|
|
|
235
|
-
var
|
|
226
|
+
var _isMouseOnHotspot = require("./hotspots/is-mouse-on-hotspot");
|
|
236
227
|
|
|
237
|
-
var
|
|
228
|
+
var _hideHotspotsIcons = require("./hotspots/hide-hotspots-icons");
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getImageAspectRatio = void 0;
|
|
9
|
+
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var getImageAspectRatio = function getImageAspectRatio(image, providedRatio) {
|
|
13
|
+
try {
|
|
14
|
+
var imageAspectRatio = image.width / image.height;
|
|
15
|
+
|
|
16
|
+
if (typeof providedRatio === 'number') {
|
|
17
|
+
imageAspectRatio = providedRatio;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if ((0, _typeof2.default)(providedRatio) === 'object') {
|
|
21
|
+
var mediaQueries = Object.keys(providedRatio).sort(function (a, b) {
|
|
22
|
+
return a - b;
|
|
23
|
+
});
|
|
24
|
+
var activeMedia = mediaQueries.find(function (mediaQuery) {
|
|
25
|
+
return window.innerWidth <= parseInt(mediaQuery, 10);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (activeMedia) {
|
|
29
|
+
imageAspectRatio = providedRatio[activeMedia];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return imageAspectRatio;
|
|
34
|
+
} catch (_unused) {
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.getImageAspectRatio = getImageAspectRatio;
|
package/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
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 createModalElements = function createModalElements(variant, container, popup) {
|
|
19
|
-
var images = variant.images,
|
|
20
|
-
title = variant.title,
|
|
21
|
-
description = variant.description;
|
|
22
|
-
var imagesCarouselWrapper = document.createElement('div');
|
|
23
|
-
var modalWrapper = document.createElement('div');
|
|
24
|
-
|
|
25
|
-
var _createImagesCarousel = (0, _createImagesCarousel3.createImagesCarousel)(images, popup, container),
|
|
26
|
-
_createImagesCarousel2 = (0, _slicedToArray2.default)(_createImagesCarousel, 2),
|
|
27
|
-
imagesCarousel = _createImagesCarousel2[0],
|
|
28
|
-
carouselDots = _createImagesCarousel2[1];
|
|
29
|
-
|
|
30
|
-
modalWrapper.className = 'cloudimage-360-modal-wrapper';
|
|
31
|
-
imagesCarouselWrapper.className = 'cloudimage-360-images-carousel-wrapper';
|
|
32
|
-
imagesCarouselWrapper.appendChild(imagesCarousel);
|
|
33
|
-
imagesCarouselWrapper.appendChild(carouselDots);
|
|
34
|
-
modalWrapper.appendChild(imagesCarouselWrapper);
|
|
35
|
-
|
|
36
|
-
if (title) {
|
|
37
|
-
var modalTitle = (0, _createModalTitle.createModalTitle)(title);
|
|
38
|
-
modalWrapper.appendChild(modalTitle);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (description) {
|
|
42
|
-
var modalDescription = (0, _createModalDescription.createModalDescription)(description);
|
|
43
|
-
modalWrapper.appendChild(modalDescription);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
popup.appendChild(modalWrapper);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
exports.createModalElements = createModalElements;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateHotspotsConfigs = void 0;
|
|
7
|
-
|
|
8
|
-
var _configsErrorHandler = require("./configs-error-handler");
|
|
9
|
-
|
|
10
|
-
var _generatePopupConfig = require("./generate-popup-config");
|
|
11
|
-
|
|
12
|
-
var generateHotspotsConfigs = function generateHotspotsConfigs(hotspotsProps) {
|
|
13
|
-
var hotspotsConfigs = hotspotsProps.map(function (hotspotProps) {
|
|
14
|
-
var _hotspotProps$variant = hotspotProps.variant,
|
|
15
|
-
variant = _hotspotProps$variant === void 0 ? {} : _hotspotProps$variant,
|
|
16
|
-
_hotspotProps$hotspot = hotspotProps.hotspots,
|
|
17
|
-
hotspots = _hotspotProps$hotspot === void 0 ? [] : _hotspotProps$hotspot,
|
|
18
|
-
_hotspotProps$indicat = hotspotProps.indicatorClass,
|
|
19
|
-
indicatorClass = _hotspotProps$indicat === void 0 ? '' : _hotspotProps$indicat,
|
|
20
|
-
_hotspotProps$popupPr = hotspotProps.popupProps,
|
|
21
|
-
popupProps = _hotspotProps$popupPr === void 0 ? {} : _hotspotProps$popupPr,
|
|
22
|
-
_hotspotProps$orienta = hotspotProps.orientation,
|
|
23
|
-
orientation = _hotspotProps$orienta === void 0 ? 'x' : _hotspotProps$orienta,
|
|
24
|
-
_hotspotProps$initial = hotspotProps.initialDimensions,
|
|
25
|
-
initialDimensions = _hotspotProps$initial === void 0 ? [500, 500] : _hotspotProps$initial;
|
|
26
|
-
(0, _configsErrorHandler.configsErrorHandler)(hotspotProps);
|
|
27
|
-
var popupConfig = (0, _generatePopupConfig.generatePopupConfig)(popupProps);
|
|
28
|
-
var hotspotConfig = {
|
|
29
|
-
variant: variant,
|
|
30
|
-
popupProps: popupConfig,
|
|
31
|
-
hotspots: hotspots,
|
|
32
|
-
indicatorClass: indicatorClass,
|
|
33
|
-
initialDimensions: initialDimensions,
|
|
34
|
-
orientation: orientation.toLowerCase()
|
|
35
|
-
};
|
|
36
|
-
return hotspotConfig;
|
|
37
|
-
});
|
|
38
|
-
return hotspotsConfigs;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
exports.generateHotspotsConfigs = generateHotspotsConfigs;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getHotspotVariant = void 0;
|
|
7
|
-
|
|
8
|
-
var getHotspotVariant = function getHotspotVariant(variant) {
|
|
9
|
-
if (variant.toLowerCase() === 'link') {
|
|
10
|
-
return 'link';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (variant.toLowerCase() === 'custom') {
|
|
14
|
-
return 'custom';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return 'link';
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.getHotspotVariant = getHotspotVariant;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getContainerResponsiveHeight = void 0;
|
|
7
|
-
|
|
8
|
-
var getContainerResponsiveHeight = function getContainerResponsiveHeight(container, width, containerHeight) {
|
|
9
|
-
if (containerHeight) {
|
|
10
|
-
if (width < containerHeight) {
|
|
11
|
-
return width;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return containerHeight;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return container.offsetWidth;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.getContainerResponsiveHeight = getContainerResponsiveHeight;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getContainerResponsiveWidth = void 0;
|
|
7
|
-
|
|
8
|
-
var getContainerResponsiveWidth = function getContainerResponsiveWidth(parentEl, containerWidth) {
|
|
9
|
-
if (containerWidth) {
|
|
10
|
-
if (parentEl.offsetWidth < containerWidth) {
|
|
11
|
-
return parentEl.offsetWidth;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return containerWidth;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return parentEl.offsetWidth;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.getContainerResponsiveWidth = getContainerResponsiveWidth;
|