js-cloudimage-360-view 2.7.2-beta.7 → 2.7.5

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 (90) hide show
  1. package/CHANGELOG.md +27 -3
  2. package/LICENSE +13 -1
  3. package/README.md +154 -90
  4. package/dist/ci360.service.js +123 -88
  5. package/dist/ci360.utils.js +3 -4
  6. package/dist/constants/auto-play-behavior.js +13 -0
  7. package/dist/constants/falsy-values.js +8 -0
  8. package/dist/constants/image-src-props.js +8 -0
  9. package/dist/constants/index.js +43 -0
  10. package/dist/constants/orientations.js +12 -0
  11. package/dist/constants/regex.js +10 -0
  12. package/dist/index.js +28 -2
  13. package/dist/utils/auto-play/get-speed-factor.js +14 -0
  14. package/dist/utils/auto-play/is-completed-one-cycle.js +32 -0
  15. package/dist/utils/auto-play/loop.js +67 -0
  16. package/dist/utils/common/add-class.js +18 -0
  17. package/dist/utils/common/remove-class.js +16 -0
  18. package/dist/utils/container-elements/apply-styles-to-container.js +16 -0
  19. package/dist/utils/container-elements/create-360-view-circle-icon.js +16 -0
  20. package/dist/utils/container-elements/create-360-view-icon.js +15 -0
  21. package/dist/utils/container-elements/create-box-shadow.js +16 -0
  22. package/dist/utils/container-elements/create-canvas.js +16 -0
  23. package/dist/utils/container-elements/create-close-fullscreen-icon.js +14 -0
  24. package/dist/utils/container-elements/create-fullscreen-icon.js +14 -0
  25. package/dist/utils/container-elements/create-fullscreen-modal.js +20 -0
  26. package/dist/utils/container-elements/create-icons-container.js +15 -0
  27. package/dist/utils/container-elements/create-inner-box.js +15 -0
  28. package/dist/utils/container-elements/create-loader.js +15 -0
  29. package/dist/utils/container-elements/create-magnifier-icon.js +14 -0
  30. package/dist/utils/container-elements/index.js +101 -0
  31. package/dist/utils/controls/get-item-skipped.js +13 -0
  32. package/dist/utils/controls/init-controls.js +77 -0
  33. package/dist/utils/hotspot/attach-popup-events.js +63 -0
  34. package/dist/utils/hotspot/configs-error-handler.js +30 -0
  35. package/dist/utils/hotspot/create-popper-instace.js +32 -0
  36. package/dist/utils/hotspot/elements/create-carousel-dot.js +26 -0
  37. package/dist/utils/hotspot/elements/create-carousel-image.js +21 -0
  38. package/dist/utils/hotspot/elements/create-hotspot-icon.js +42 -0
  39. package/dist/utils/hotspot/elements/create-hotspot-popup-link.js +23 -0
  40. package/dist/utils/hotspot/elements/create-hotspots.js +20 -0
  41. package/dist/utils/hotspot/elements/create-images-carousel.js +27 -0
  42. package/dist/utils/hotspot/elements/create-modal-description.js +15 -0
  43. package/dist/utils/hotspot/elements/create-modal-title.js +15 -0
  44. package/dist/utils/hotspot/elements/create-model-elements.js +49 -0
  45. package/dist/utils/hotspot/elements/create-popup-arrow.js +16 -0
  46. package/dist/utils/hotspot/elements/create-popup.js +60 -0
  47. package/dist/utils/hotspot/fill-previous-coord-with-previous.js +26 -0
  48. package/dist/utils/hotspot/generate-hotspots-configs.js +41 -0
  49. package/dist/utils/hotspot/generate-popup-config.js +34 -0
  50. package/dist/utils/hotspot/get-hotspot-icon.js +14 -0
  51. package/dist/utils/hotspot/get-hotspot-orientation.js +21 -0
  52. package/dist/utils/hotspot/get-hotspot-popup-node.js +19 -0
  53. package/dist/utils/hotspot/get-hotspot-variant.js +20 -0
  54. package/dist/utils/hotspot/get-popup-node.js +14 -0
  55. package/dist/utils/hotspot/hide-hotspot-icon.js +13 -0
  56. package/dist/utils/hotspot/hide-hotspots-icons.js +18 -0
  57. package/dist/utils/hotspot/is-mouse-on-hotspot.js +14 -0
  58. package/dist/utils/hotspot/prepare-hotspots-positions.js +28 -0
  59. package/dist/utils/hotspot/set-current-slide.js +23 -0
  60. package/dist/utils/hotspot/update-hotspot-icon-position.js +21 -0
  61. package/dist/utils/hotspot/update-hotspots.js +60 -0
  62. package/dist/utils/image-src/generate-images-path.js +40 -0
  63. package/dist/utils/image-src/is-src-props-changed.js +23 -0
  64. package/dist/utils/index.js +237 -0
  65. package/dist/utils/load-images/images-from-folder/prepare-images-from-folder.js +36 -0
  66. package/dist/utils/load-images/images-from-list/prepare-images-from-list.js +37 -0
  67. package/dist/utils/load-images/load-image-as-promise.js +79 -0
  68. package/dist/utils/load-images/load-image.js +26 -0
  69. package/dist/utils/load-images/load-images-relative-to-container-size.js +58 -0
  70. package/dist/utils/load-images/load-original-images.js +58 -0
  71. package/dist/utils/load-images/pad.js +14 -0
  72. package/dist/utils/load-images/preload-images.js +38 -0
  73. package/dist/utils/load-images/preload-original-images.js +38 -0
  74. package/dist/utils/magnify/get-current-original-image.js +29 -0
  75. package/dist/utils/magnify/get-cursor-position.js +24 -0
  76. package/dist/utils/magnify/magnify.js +54 -0
  77. package/dist/utils/magnify/move-magnifier.js +47 -0
  78. package/dist/utils/responsive/contain.js +11 -0
  79. package/dist/utils/responsive/fit.js +33 -0
  80. package/dist/utils/responsive/get-container-responsive-height.js +20 -0
  81. package/dist/utils/responsive/get-container-responsive-width.js +20 -0
  82. package/dist/utils/responsive/get-responsive-width-of-container.js +14 -0
  83. package/dist/utils/responsive/get-size-according-to-pixel-ratio.js +17 -0
  84. package/dist/utils/responsive/get-size-limit.js +14 -0
  85. package/dist/utils/spin-y/get-moving-direction.js +21 -0
  86. package/dist/utils/zoom/generate-zoom-in-steps.js +20 -0
  87. package/dist/utils/zoom/generate-zoom-out-steps.js +20 -0
  88. package/package.json +4 -3
  89. package/.vscode/settings.json +0 -2
  90. package/dist/ci360.constants.js +0 -34
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initControls = void 0;
7
+
8
+ var _addClass = require("../common/add-class");
9
+
10
+ var initControls = function initControls(controlsConfig, controlsTriggers) {
11
+ var container = controlsConfig.container,
12
+ controlReverse = controlsConfig.controlReverse,
13
+ spinReverse = controlsConfig.spinReverse,
14
+ stopAtEdges = controlsConfig.stopAtEdges;
15
+ var onRightStart = controlsTriggers.onRightStart,
16
+ onLeftStart = controlsTriggers.onLeftStart,
17
+ onTopStart = controlsTriggers.onTopStart,
18
+ onBottomStart = controlsTriggers.onBottomStart,
19
+ onEventEnd = controlsTriggers.onEventEnd;
20
+ var controlElements = {};
21
+ var isReverse = controlReverse ? !spinReverse : spinReverse;
22
+ var left = container.querySelectorAll('.cloudimage-360-left, .cloudimage-360-prev')[0];
23
+ var right = container.querySelectorAll('.cloudimage-360-right, .cloudimage-360-next')[0];
24
+ var top = container.querySelector('.cloudimage-360-top');
25
+ var bottom = container.querySelector('.cloudimage-360-bottom');
26
+
27
+ if (left) {
28
+ left.style.display = 'block';
29
+ left.addEventListener('mousedown', isReverse ? onRightStart : onLeftStart);
30
+ left.addEventListener('touchstart', isReverse ? onRightStart : onLeftStart, {
31
+ passive: true
32
+ });
33
+ left.addEventListener('mouseup', isReverse ? onEventEnd : onEventEnd);
34
+ left.addEventListener('touchend', isReverse ? onEventEnd : onEventEnd);
35
+ controlElements.left = left;
36
+ }
37
+
38
+ if (right) {
39
+ right.style.display = 'block';
40
+ right.addEventListener('mousedown', isReverse ? onLeftStart : onRightStart);
41
+ right.addEventListener('touchstart', isReverse ? onLeftStart : onRightStart, {
42
+ passive: true
43
+ });
44
+ right.addEventListener('mouseup', onEventEnd);
45
+ right.addEventListener('touchend', onEventEnd);
46
+ controlElements.right = right;
47
+ }
48
+
49
+ if (top) {
50
+ top.style.display = 'block';
51
+ top.addEventListener('mousedown', isReverse ? onBottomStart : onTopStart);
52
+ top.addEventListener('touchstart', isReverse ? onBottomStart : onTopStart);
53
+ top.addEventListener('mouseup', isReverse ? onEventEnd : onEventEnd);
54
+ top.addEventListener('touchend', isReverse ? onEventEnd : onEventEnd);
55
+ controlElements.top = top;
56
+ }
57
+
58
+ if (bottom) {
59
+ bottom.style.display = 'block';
60
+ bottom.addEventListener('mousedown', isReverse ? onTopStart : onBottomStart);
61
+ bottom.addEventListener('touchstart', isReverse ? onTopStart : onBottomStart);
62
+ bottom.addEventListener('mouseup', isReverse ? onEventEnd : onEventEnd);
63
+ bottom.addEventListener('touchend', isReverse ? onEventEnd : onEventEnd);
64
+ controlElements.bottom = bottom;
65
+ }
66
+
67
+ if (isReverse ? right : left) {
68
+ if (stopAtEdges) {
69
+ (0, _addClass.addClass)(isReverse ? right : left, 'not-active');
70
+ (0, _addClass.addClass)(isReverse ? top : bottom, 'not-active');
71
+ }
72
+ }
73
+
74
+ return controlElements;
75
+ };
76
+
77
+ exports.initControls = initControls;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.attachPopupEvents = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ 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; }
15
+
16
+ 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; }
17
+
18
+ var attachPopupEvents = function attachPopupEvents(reference, popper, popperInstance, open) {
19
+ if (open) return;
20
+ var showEvents = ['mouseenter', 'focus'];
21
+ var hideEvents = ['mouseleave', 'blur'];
22
+ var isVisible;
23
+
24
+ var showPopup = function showPopup() {
25
+ popper.setAttribute('data-show', '');
26
+ popper.setAttribute('data-cloudimage-360-show', '');
27
+ popperInstance.update();
28
+ };
29
+
30
+ var hidePopup = function hidePopup() {
31
+ setTimeout(function () {
32
+ if (!isVisible) {
33
+ popper.removeAttribute('data-show');
34
+ popper.removeAttribute('data-cloudimage-360-show');
35
+ popperInstance.setOptions(function (options) {
36
+ return _objectSpread(_objectSpread({}, options), {}, {
37
+ modifiers: [].concat((0, _toConsumableArray2.default)(options.modifiers), [{
38
+ name: 'eventListeners',
39
+ enabled: false
40
+ }])
41
+ });
42
+ });
43
+ } else {
44
+ isVisible = false;
45
+ }
46
+ }, 160);
47
+ };
48
+
49
+ var keepPopupShown = function keepPopupShown() {
50
+ isVisible = true;
51
+ };
52
+
53
+ showEvents.forEach(function (event) {
54
+ reference.addEventListener(event, showPopup);
55
+ });
56
+ hideEvents.forEach(function (event) {
57
+ reference.addEventListener(event, hidePopup);
58
+ });
59
+ popper.addEventListener('mouseenter', keepPopupShown);
60
+ popper.addEventListener('mouseleave', hidePopup);
61
+ };
62
+
63
+ exports.attachPopupEvents = attachPopupEvents;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configsErrorHandler = void 0;
7
+
8
+ var configsErrorHandler = function configsErrorHandler(hotspotProps) {
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;
14
+ var url = variant.url,
15
+ title = variant.title;
16
+
17
+ if (url && !title) {
18
+ console.error('Cloudimage-360: Hotspot config with variant link must have title for the link');
19
+ }
20
+
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) {
26
+ console.error('Cloudimage-360: Hotspot config with custom variant must provide anchorId');
27
+ }
28
+ };
29
+
30
+ exports.configsErrorHandler = configsErrorHandler;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPopperInstance = void 0;
7
+
8
+ var _core = require("@popperjs/core");
9
+
10
+ var createPopperInstance = function createPopperInstance(popper, popupProps, container) {
11
+ var placement = popupProps.placement,
12
+ offset = popupProps.offset;
13
+ var virtualReference = document.createElement('div');
14
+ var popperInstance = (0, _core.createPopper)(virtualReference, popper);
15
+ popperInstance.setOptions({
16
+ placement: placement,
17
+ modifiers: [{
18
+ name: 'offset',
19
+ options: {
20
+ offset: offset
21
+ }
22
+ }, {
23
+ name: 'preventOverflow',
24
+ options: {
25
+ boundary: container
26
+ }
27
+ }]
28
+ });
29
+ return popperInstance;
30
+ };
31
+
32
+ exports.createPopperInstance = createPopperInstance;
@@ -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;