js-cloudimage-360-view 2.7.2-beta.8 → 2.7.3

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 (88) hide show
  1. package/CHANGELOG.md +16 -3
  2. package/LICENSE +13 -1
  3. package/README.md +117 -90
  4. package/dist/ci360.service.js +81 -80
  5. package/dist/ci360.utils.js +2 -2
  6. package/dist/constants/auto-play-behavior.js +13 -0
  7. package/dist/constants/falsy-values.js +8 -0
  8. package/dist/constants/index.js +43 -0
  9. package/dist/constants/orientations.js +12 -0
  10. package/dist/constants/regex.js +10 -0
  11. package/dist/index.js +6 -2
  12. package/dist/utils/auto-play/get-speed-factor.js +14 -0
  13. package/dist/utils/auto-play/is-completed-one-cycle.js +32 -0
  14. package/dist/utils/auto-play/loop.js +67 -0
  15. package/dist/utils/common/add-class.js +18 -0
  16. package/dist/utils/common/remove-class.js +16 -0
  17. package/dist/utils/container-elements/apply-styles-to-container.js +16 -0
  18. package/dist/utils/container-elements/create-360-view-circle-icon.js +16 -0
  19. package/dist/utils/container-elements/create-360-view-icon.js +15 -0
  20. package/dist/utils/container-elements/create-box-shadow.js +16 -0
  21. package/dist/utils/container-elements/create-canvas.js +16 -0
  22. package/dist/utils/container-elements/create-close-fullscreen-icon.js +14 -0
  23. package/dist/utils/container-elements/create-fullscreen-icon.js +14 -0
  24. package/dist/utils/container-elements/create-fullscreen-modal.js +20 -0
  25. package/dist/utils/container-elements/create-icons-container.js +15 -0
  26. package/dist/utils/container-elements/create-inner-box.js +15 -0
  27. package/dist/utils/container-elements/create-loader.js +15 -0
  28. package/dist/utils/container-elements/create-magnifier-icon.js +14 -0
  29. package/dist/utils/container-elements/index.js +101 -0
  30. package/dist/utils/controls/get-item-skipped.js +13 -0
  31. package/dist/utils/controls/init-controls.js +77 -0
  32. package/dist/utils/hotspot/attach-popup-events.js +63 -0
  33. package/dist/utils/hotspot/configs-error-handler.js +30 -0
  34. package/dist/utils/hotspot/create-popper-instace.js +32 -0
  35. package/dist/utils/hotspot/elements/create-carousel-dot.js +26 -0
  36. package/dist/utils/hotspot/elements/create-carousel-image.js +21 -0
  37. package/dist/utils/hotspot/elements/create-hotspot-icon.js +42 -0
  38. package/dist/utils/hotspot/elements/create-hotspot-popup-link.js +23 -0
  39. package/dist/utils/hotspot/elements/create-hotspots.js +20 -0
  40. package/dist/utils/hotspot/elements/create-images-carousel.js +27 -0
  41. package/dist/utils/hotspot/elements/create-modal-description.js +15 -0
  42. package/dist/utils/hotspot/elements/create-modal-title.js +15 -0
  43. package/dist/utils/hotspot/elements/create-model-elements.js +49 -0
  44. package/dist/utils/hotspot/elements/create-popup-arrow.js +16 -0
  45. package/dist/utils/hotspot/elements/create-popup.js +60 -0
  46. package/dist/utils/hotspot/fill-previous-coord-with-previous.js +26 -0
  47. package/dist/utils/hotspot/generate-hotspots-configs.js +41 -0
  48. package/dist/utils/hotspot/generate-popup-config.js +34 -0
  49. package/dist/utils/hotspot/get-hotspot-icon.js +14 -0
  50. package/dist/utils/hotspot/get-hotspot-orientation.js +21 -0
  51. package/dist/utils/hotspot/get-hotspot-popup-node.js +19 -0
  52. package/dist/utils/hotspot/get-hotspot-variant.js +20 -0
  53. package/dist/utils/hotspot/get-popup-node.js +14 -0
  54. package/dist/utils/hotspot/hide-hotspot-icon.js +13 -0
  55. package/dist/utils/hotspot/hide-hotspots-icons.js +18 -0
  56. package/dist/utils/hotspot/is-mouse-on-hotspot.js +14 -0
  57. package/dist/utils/hotspot/prepare-hotspots-positions.js +28 -0
  58. package/dist/utils/hotspot/set-current-slide.js +23 -0
  59. package/dist/utils/hotspot/update-hotspot-icon-position.js +21 -0
  60. package/dist/utils/hotspot/update-hotspots.js +60 -0
  61. package/dist/utils/image-src/generate-images-path.js +40 -0
  62. package/dist/utils/index.js +228 -0
  63. package/dist/utils/load-images/images-from-folder/prepare-images-from-folder.js +36 -0
  64. package/dist/utils/load-images/images-from-list/prepare-images-from-list.js +37 -0
  65. package/dist/utils/load-images/load-image-as-promise.js +79 -0
  66. package/dist/utils/load-images/load-image.js +26 -0
  67. package/dist/utils/load-images/load-images-relative-to-container-size.js +58 -0
  68. package/dist/utils/load-images/load-original-images.js +58 -0
  69. package/dist/utils/load-images/pad.js +14 -0
  70. package/dist/utils/load-images/preload-images.js +38 -0
  71. package/dist/utils/load-images/preload-original-images.js +38 -0
  72. package/dist/utils/magnify/get-current-original-image.js +29 -0
  73. package/dist/utils/magnify/get-cursor-position.js +24 -0
  74. package/dist/utils/magnify/magnify.js +54 -0
  75. package/dist/utils/magnify/move-magnifier.js +47 -0
  76. package/dist/utils/responsive/contain.js +11 -0
  77. package/dist/utils/responsive/fit.js +33 -0
  78. package/dist/utils/responsive/get-container-responsive-height.js +20 -0
  79. package/dist/utils/responsive/get-container-responsive-width.js +20 -0
  80. package/dist/utils/responsive/get-responsive-width-of-container.js +14 -0
  81. package/dist/utils/responsive/get-size-according-to-pixel-ratio.js +17 -0
  82. package/dist/utils/responsive/get-size-limit.js +14 -0
  83. package/dist/utils/spin-y/get-moving-direction.js +21 -0
  84. package/dist/utils/zoom/generate-zoom-in-steps.js +20 -0
  85. package/dist/utils/zoom/generate-zoom-out-steps.js +20 -0
  86. package/package.json +3 -3
  87. package/.vscode/settings.json +0 -2
  88. package/dist/ci360.constants.js +0 -34
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCarouselDot = void 0;
7
+
8
+ var _setCurrentSlide = require("../set-current-slide");
9
+
10
+ var createCarouselDot = function createCarouselDot(image, imageIndex, popup) {
11
+ var imageDot = document.createElement('div');
12
+ imageDot.className = 'cloudimage-360-carousel-dot';
13
+
14
+ imageDot.onclick = function () {
15
+ return (0, _setCurrentSlide.setCurrentSlide)(image, imageDot, popup);
16
+ };
17
+
18
+ if (!imageIndex) {
19
+ imageDot.className += ' active-dot';
20
+ imageDot.setAttribute('data-active-dot', '');
21
+ }
22
+
23
+ return imageDot;
24
+ };
25
+
26
+ exports.createCarouselDot = createCarouselDot;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCarouselImage = void 0;
7
+
8
+ var createCarouselImage = function createCarouselImage(imageSrc, imageIndex) {
9
+ var carouselImage = document.createElement('img');
10
+ carouselImage.className = 'cloudimage-360-carousel-image';
11
+ carouselImage.setAttribute('src', imageSrc);
12
+
13
+ if (!imageIndex) {
14
+ carouselImage.setAttribute('data-active-image', '');
15
+ carouselImage.className += ' active-image';
16
+ }
17
+
18
+ return carouselImage;
19
+ };
20
+
21
+ exports.createCarouselImage = createCarouselImage;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createHotspotIcon = void 0;
7
+
8
+ var _hideHotspotIcon = require("../hide-hotspot-icon");
9
+
10
+ var createHotspotIcon = function createHotspotIcon(container, hotspotConfig) {
11
+ var indicatorClass = hotspotConfig.indicatorClass,
12
+ popupProps = hotspotConfig.popupProps,
13
+ variant = hotspotConfig.variant;
14
+ var anchorId = popupProps.anchorId;
15
+ var url = variant.url;
16
+ var hotspotIcon = document.createElement('div');
17
+
18
+ var mouseEnterHotspot = function mouseEnterHotspot() {
19
+ hotspotIcon.setAttribute('data-cloudimage-360-show', '');
20
+ };
21
+
22
+ var mouseLeaveHotspot = function mouseLeaveHotspot() {
23
+ hotspotIcon.removeAttribute('data-cloudimage-360-show');
24
+ };
25
+
26
+ hotspotIcon.style.position = 'absolute';
27
+ hotspotIcon.className = "cloudimage-360-hotspot-".concat(url ? 'link' : 'custom', "-icon ").concat(indicatorClass);
28
+ hotspotIcon.setAttribute('data-hotspot-icon-id', anchorId);
29
+ hotspotIcon.setAttribute('data-cloudimage-360-hotspot', '');
30
+ hotspotIcon.addEventListener('mouseenter', mouseEnterHotspot);
31
+ hotspotIcon.addEventListener('mouseleave', mouseLeaveHotspot);
32
+
33
+ hotspotIcon.onclick = function (e) {
34
+ return e.stopPropagation();
35
+ };
36
+
37
+ (0, _hideHotspotIcon.hideHotspotIcon)(hotspotIcon);
38
+ container.appendChild(hotspotIcon);
39
+ return hotspotIcon;
40
+ };
41
+
42
+ exports.createHotspotIcon = createHotspotIcon;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createHotspotPopupLink = void 0;
7
+
8
+ var createHotspotPopupLink = function createHotspotPopupLink(variant) {
9
+ var url = variant.url,
10
+ title = variant.title,
11
+ newTab = variant.newTab;
12
+ var hyperLink = document.createElement('a');
13
+ hyperLink.href = url;
14
+ hyperLink.innerText = title;
15
+
16
+ if (newTab) {
17
+ hyperLink.target = '_blank';
18
+ }
19
+
20
+ return hyperLink;
21
+ };
22
+
23
+ exports.createHotspotPopupLink = createHotspotPopupLink;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createHotspots = void 0;
7
+
8
+ var _createHotspotIcon = require("./create-hotspot-icon");
9
+
10
+ var _createPopup = require("./create-popup");
11
+
12
+ var createHotspots = function createHotspots(container, hotspotsProps) {
13
+ hotspotsProps.forEach(function (hotspotProps) {
14
+ var popupProps = hotspotProps.popupProps;
15
+ (0, _createPopup.createPopup)(container, hotspotProps, popupProps);
16
+ (0, _createHotspotIcon.createHotspotIcon)(container, hotspotProps);
17
+ });
18
+ };
19
+
20
+ exports.createHotspots = createHotspots;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createImagesCarousel = void 0;
7
+
8
+ var _createCarouselDot = require("./create-carousel-dot");
9
+
10
+ var _createCarouselImage = require("./create-carousel-image");
11
+
12
+ var createImagesCarousel = function createImagesCarousel(imagesSrcs, popup, container) {
13
+ var imagesCarousel = document.createElement('div');
14
+ var carouselDots = document.createElement('div');
15
+ imagesCarousel.className = 'cloudimage-360-images-carousel';
16
+ imagesCarousel.style.maxWidth = "".concat(container.offsetWidth, "px");
17
+ carouselDots.className = 'cloudimage-360-carousel-dots';
18
+ imagesSrcs.forEach(function (imageSrc, imageIndex) {
19
+ var carouselImage = (0, _createCarouselImage.createCarouselImage)(imageSrc, imageIndex);
20
+ var carouselDot = (0, _createCarouselDot.createCarouselDot)(carouselImage, imageIndex, popup);
21
+ carouselDots.appendChild(carouselDot);
22
+ imagesCarousel.appendChild(carouselImage);
23
+ });
24
+ return [imagesCarousel, carouselDots];
25
+ };
26
+
27
+ exports.createImagesCarousel = createImagesCarousel;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createModalDescription = void 0;
7
+
8
+ var createModalDescription = function createModalDescription(description) {
9
+ var modalDescription = document.createElement('p');
10
+ modalDescription.innerText = description;
11
+ modalDescription.className = 'cloudimage-360-modal-description';
12
+ return modalDescription;
13
+ };
14
+
15
+ exports.createModalDescription = createModalDescription;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createModalTitle = void 0;
7
+
8
+ var createModalTitle = function createModalTitle(title) {
9
+ var modalTitle = document.createElement('h4');
10
+ modalTitle.innerText = title;
11
+ modalTitle.className = 'cloudimage-360-modal-title';
12
+ return modalTitle;
13
+ };
14
+
15
+ exports.createModalTitle = createModalTitle;
@@ -0,0 +1,49 @@
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;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPopupArrow = void 0;
7
+
8
+ var createPopupArrow = function createPopupArrow() {
9
+ var popupArrow = document.createElement('div');
10
+ popupArrow.setAttribute('data-popper-arrow', '');
11
+ popupArrow.setAttribute('data-cloudimage-360-hotspot', '');
12
+ popupArrow.className = 'cloudimage-360-popup-arrow';
13
+ return popupArrow;
14
+ };
15
+
16
+ exports.createPopupArrow = createPopupArrow;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPopup = void 0;
7
+
8
+ var _createHotspotPopupLink = require("./create-hotspot-popup-link");
9
+
10
+ var _getPopupNode = require("../get-popup-node");
11
+
12
+ var _createPopupArrow = require("./create-popup-arrow");
13
+
14
+ var _createModelElements = require("./create-model-elements");
15
+
16
+ var createPopup = function createPopup(container, hotspotConfig, popupProps) {
17
+ var variant = hotspotConfig.variant;
18
+ var popupClass = popupProps.popupClass,
19
+ arrow = popupProps.arrow,
20
+ anchorId = popupProps.anchorId;
21
+ var url = variant.url,
22
+ images = variant.images;
23
+ var popup = document.createElement('div');
24
+ popup.className = "cloudimage-360-hotspot-popup ".concat(popupClass);
25
+ popup.setAttribute('data-hotspot-popup-id', anchorId);
26
+ popup.setAttribute('data-cloudimage-360-hotspot', '');
27
+ popup.style.minHeight = 16;
28
+ popup.style.minWidth = 16;
29
+ popup.style.cursor = 'initial';
30
+
31
+ popup.onclick = function (e) {
32
+ return e.stopPropagation();
33
+ };
34
+
35
+ if (images) {
36
+ (0, _createModelElements.createModalElements)(variant, container, popup);
37
+ } else if (url) {
38
+ var hotspotPopupLink = (0, _createHotspotPopupLink.createHotspotPopupLink)(variant);
39
+ popup.appendChild(hotspotPopupLink);
40
+ } else {
41
+ try {
42
+ var popupNode = (0, _getPopupNode.getPopupNode)(anchorId);
43
+ var userPopup = popupNode.cloneNode(true);
44
+ popup.appendChild(userPopup);
45
+ popupNode.parentNode.removeChild(popupNode);
46
+ } catch (_unused) {
47
+ console.error("Cloudimage-360: Element with anchorId '".concat(anchorId, "' not exist in the DOM"));
48
+ }
49
+ }
50
+
51
+ if (arrow) {
52
+ var popupArrow = (0, _createPopupArrow.createPopupArrow)();
53
+ popup.appendChild(popupArrow);
54
+ }
55
+
56
+ container.appendChild(popup);
57
+ return popup;
58
+ };
59
+
60
+ exports.createPopup = createPopup;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fillPreviousCoordWithPrevious = void 0;
7
+
8
+ /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
9
+ var fillPreviousCoordWithPrevious = function fillPreviousCoordWithPrevious(hotspots, hotspotIndex, coord) {
10
+ var coordIndexes = new Array(hotspotIndex);
11
+ var intialValue = '0%';
12
+
13
+ for (var i = coordIndexes.length - 1; i > -1; i--) {
14
+ var _hotspots$i;
15
+
16
+ var previousXCoord = (_hotspots$i = hotspots[i]) === null || _hotspots$i === void 0 ? void 0 : _hotspots$i[coord];
17
+
18
+ if (previousXCoord) {
19
+ return previousXCoord;
20
+ }
21
+ }
22
+
23
+ return intialValue;
24
+ };
25
+
26
+ exports.fillPreviousCoordWithPrevious = fillPreviousCoordWithPrevious;
@@ -0,0 +1,41 @@
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;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generatePopupConfig = void 0;
7
+
8
+ var generatePopupConfig = function generatePopupConfig(popupProps) {
9
+ var uniqueID = Math.floor(Math.random() * 10000);
10
+ var defaultAnchorId = "cloudimage-".concat(uniqueID);
11
+ var _popupProps$popupClas = popupProps.popupClass,
12
+ popupClass = _popupProps$popupClas === void 0 ? '' : _popupProps$popupClas,
13
+ _popupProps$arrow = popupProps.arrow,
14
+ arrow = _popupProps$arrow === void 0 ? false : _popupProps$arrow,
15
+ _popupProps$offset = popupProps.offset,
16
+ offset = _popupProps$offset === void 0 ? [0, 10] : _popupProps$offset,
17
+ _popupProps$placement = popupProps.placement,
18
+ placement = _popupProps$placement === void 0 ? 'auto' : _popupProps$placement,
19
+ _popupProps$anchorId = popupProps.anchorId,
20
+ anchorId = _popupProps$anchorId === void 0 ? defaultAnchorId : _popupProps$anchorId,
21
+ _popupProps$open = popupProps.open,
22
+ open = _popupProps$open === void 0 ? false : _popupProps$open;
23
+ var popupConfig = {
24
+ popupClass: popupClass,
25
+ arrow: arrow,
26
+ offset: offset,
27
+ placement: placement,
28
+ anchorId: anchorId,
29
+ open: open
30
+ };
31
+ return popupConfig;
32
+ };
33
+
34
+ exports.generatePopupConfig = generatePopupConfig;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getHotspotIcon = void 0;
7
+
8
+ var getHotspotIcon = function getHotspotIcon(anchorId) {
9
+ var hotspotIconSelector = "[data-hotspot-icon-id=".concat(anchorId, "]");
10
+ var hotspotIcon = document.querySelector(hotspotIconSelector);
11
+ return hotspotIcon;
12
+ };
13
+
14
+ exports.getHotspotIcon = getHotspotIcon;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getHotspotOriantaion = void 0;
7
+
8
+ var getHotspotOriantaion = function getHotspotOriantaion(orientation) {
9
+ switch (orientation.toLowerCase()) {
10
+ case 'x-axis':
11
+ return 'x';
12
+
13
+ case 'y-axis':
14
+ return 'y';
15
+
16
+ default:
17
+ return 'x';
18
+ }
19
+ };
20
+
21
+ exports.getHotspotOriantaion = getHotspotOriantaion;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getHotspotPopupNode = void 0;
7
+
8
+ var getHotspotPopupNode = function getHotspotPopupNode(anchorId, open) {
9
+ var hotspotPopupSelector = "[data-hotspot-popup-id=".concat(anchorId, "]");
10
+ var hotspotPopup = document.querySelector(hotspotPopupSelector);
11
+
12
+ if (open) {
13
+ hotspotPopup.setAttribute('data-show', '');
14
+ }
15
+
16
+ return hotspotPopup;
17
+ };
18
+
19
+ exports.getHotspotPopupNode = getHotspotPopupNode;
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPopupNode = void 0;
7
+
8
+ var getPopupNode = function getPopupNode(popupId) {
9
+ var popupSelector = 'data-CI-360-anchor';
10
+ var popupNode = document.querySelector("[".concat(popupSelector, "=").concat(popupId, "]"));
11
+ return popupNode;
12
+ };
13
+
14
+ exports.getPopupNode = getPopupNode;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hideHotspotIcon = void 0;
7
+
8
+ var hideHotspotIcon = function hideHotspotIcon(icon) {
9
+ icon.style.visibility = 'hidden';
10
+ icon.style.opacity = 0;
11
+ };
12
+
13
+ exports.hideHotspotIcon = hideHotspotIcon;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hideHotspotsIcons = void 0;
7
+
8
+ var _hideHotspotIcon = require("./hide-hotspot-icon");
9
+
10
+ var hideHotspotsIcons = function hideHotspotsIcons() {
11
+ var hotspotIconSelector = '[data-hotspot-icon-id]';
12
+ var hotspotIcons = document.querySelectorAll(hotspotIconSelector) || [];
13
+ hotspotIcons.forEach(function (hotspotIcon) {
14
+ (0, _hideHotspotIcon.hideHotspotIcon)(hotspotIcon);
15
+ });
16
+ };
17
+
18
+ exports.hideHotspotsIcons = hideHotspotsIcons;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isMouseOnHotspot = void 0;
7
+
8
+ var isMouseOnHotspot = function isMouseOnHotspot() {
9
+ var hotspotElementsSelector = '[data-cloudimage-360-show]';
10
+ var hostpotElements = document.querySelectorAll(hotspotElementsSelector);
11
+ return !!hostpotElements.length;
12
+ };
13
+
14
+ exports.isMouseOnHotspot = isMouseOnHotspot;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.prepareHotspotsPositions = void 0;
7
+
8
+ var _fillPreviousCoordWithPrevious = require("./fill-previous-coord-with-previous");
9
+
10
+ var prepareHotspotsPositions = function prepareHotspotsPositions(hotspots) {
11
+ return hotspots.reduce(function (accumulate, current, currentIndex) {
12
+ var isIncludesXcoord = !!(current !== null && current !== void 0 && current.xCoord);
13
+ var isIncludesYcoord = !!(current !== null && current !== void 0 && current.yCoord);
14
+
15
+ if (!isIncludesXcoord) {
16
+ current.xCoord = (0, _fillPreviousCoordWithPrevious.fillPreviousCoordWithPrevious)(hotspots, currentIndex, 'xCoord');
17
+ }
18
+
19
+ if (!isIncludesYcoord) {
20
+ current.yCoord = (0, _fillPreviousCoordWithPrevious.fillPreviousCoordWithPrevious)(hotspots, currentIndex, 'yCoord');
21
+ }
22
+
23
+ accumulate.push(current);
24
+ return accumulate;
25
+ }, []);
26
+ };
27
+
28
+ exports.prepareHotspotsPositions = prepareHotspotsPositions;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setCurrentSlide = void 0;
7
+
8
+ var setCurrentSlide = function setCurrentSlide(image, imageDot, popup) {
9
+ var activeDotSelector = '[data-active-dot]';
10
+ var activeImageSelector = '[data-active-image]';
11
+ var previousActiveDot = popup.querySelector(activeDotSelector);
12
+ var previousActiveImage = popup.querySelector(activeImageSelector);
13
+ previousActiveDot.classList.remove('active-dot');
14
+ previousActiveDot.removeAttribute('data-active-dot');
15
+ previousActiveImage.classList.remove('active-image');
16
+ previousActiveImage.removeAttribute('data-active-image');
17
+ image.className += ' active-image';
18
+ image.setAttribute('data-active-image', '');
19
+ imageDot.className += ' active-dot';
20
+ imageDot.setAttribute('data-active-dot', '');
21
+ };
22
+
23
+ exports.setCurrentSlide = setCurrentSlide;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.updateHotspotIconPosition = void 0;
7
+
8
+ var updateHotspotIconPosition = function updateHotspotIconPosition(container, initialDimensions, icon, xCoord, yCoord) {
9
+ icon.style.visibility = 'visible';
10
+ icon.style.opacity = 1;
11
+ icon.style.zIndex = 100;
12
+ icon.style.left = "".concat(-icon.offsetWidth / 2, "px");
13
+ icon.style.top = "".concat(-icon.offsetHeight / 2, "px");
14
+ var positionXRatio = container.offsetWidth / initialDimensions[0];
15
+ var positionYRatio = container.offsetHeight / initialDimensions[1];
16
+ var translateX = "".concat(positionXRatio * xCoord, "px");
17
+ var translateY = "".concat(positionYRatio * yCoord, "px");
18
+ icon.style.transform = "translate3d(".concat(translateX, ", ").concat(translateY, ", 0)");
19
+ };
20
+
21
+ exports.updateHotspotIconPosition = updateHotspotIconPosition;