js-cloudimage-360-view 2.7.6 → 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.
Files changed (45) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +4 -4
  3. package/dist/ci360.service.js +89 -9
  4. package/dist/ci360.utils.js +5 -2
  5. package/dist/index.js +6 -1
  6. package/dist/static/css/hotspots.css +222 -0
  7. package/dist/utils/{common → class-names}/add-class.js +0 -0
  8. package/dist/utils/{common → class-names}/remove-class.js +0 -0
  9. package/dist/utils/container-elements/index.js +9 -1
  10. package/dist/utils/container-elements/remove-child-from-parent.js +16 -0
  11. package/dist/utils/controls/init-controls.js +1 -1
  12. package/dist/utils/{hotspot → hotspots}/attach-popup-events.js +1 -1
  13. package/dist/utils/{hotspot → hotspots}/configs-error-handler.js +7 -10
  14. package/dist/utils/{hotspot → hotspots}/create-popper-instace.js +0 -0
  15. package/dist/utils/{hotspot → hotspots}/elements/create-carousel-dot.js +1 -1
  16. package/dist/utils/{hotspot → hotspots}/elements/create-carousel-image.js +0 -0
  17. package/dist/utils/{hotspot → hotspots}/elements/create-hotspot-icon.js +4 -5
  18. package/dist/utils/{hotspot → hotspots}/elements/create-hotspot-popup-link.js +0 -0
  19. package/dist/utils/{hotspot → hotspots}/elements/create-hotspots.js +0 -0
  20. package/dist/utils/{hotspot → hotspots}/elements/create-images-carousel.js +0 -0
  21. package/dist/utils/{hotspot → hotspots}/elements/create-modal-description.js +0 -0
  22. package/dist/utils/{hotspot → hotspots}/elements/create-modal-title.js +0 -0
  23. package/dist/utils/hotspots/elements/create-model-elements.js +66 -0
  24. package/dist/utils/{hotspot → hotspots}/elements/create-popup-arrow.js +0 -0
  25. package/dist/utils/{hotspot → hotspots}/elements/create-popup.js +10 -7
  26. package/dist/utils/hotspots/elements/create-read-more-btn.js +17 -0
  27. package/dist/utils/{hotspot/fill-previous-coord-with-previous.js → hotspots/fill-empty-coord-with-previous.js} +3 -3
  28. package/dist/utils/hotspots/generate-hotspots-configs.js +58 -0
  29. package/dist/utils/{hotspot → hotspots}/generate-popup-config.js +3 -8
  30. package/dist/utils/{hotspot → hotspots}/get-hotspot-icon.js +0 -0
  31. package/dist/utils/{hotspot → hotspots}/get-hotspot-orientation.js +0 -0
  32. package/dist/utils/{hotspot → hotspots}/get-hotspot-popup-node.js +4 -2
  33. package/dist/utils/{hotspot → hotspots}/get-popup-node.js +1 -1
  34. package/dist/utils/{hotspot → hotspots}/hide-hotspot-icon.js +0 -0
  35. package/dist/utils/{hotspot → hotspots}/hide-hotspots-icons.js +0 -0
  36. package/dist/utils/{hotspot → hotspots}/is-mouse-on-hotspot.js +0 -0
  37. package/dist/utils/{hotspot → hotspots}/prepare-hotspots-positions.js +3 -3
  38. package/dist/utils/{hotspot → hotspots}/set-current-slide.js +0 -0
  39. package/dist/utils/{hotspot → hotspots}/update-hotspot-icon-position.js +0 -0
  40. package/dist/utils/{hotspot → hotspots}/update-hotspots.js +10 -9
  41. package/dist/utils/index.js +7 -7
  42. package/package.json +1 -1
  43. package/dist/utils/hotspot/elements/create-model-elements.js +0 -49
  44. package/dist/utils/hotspot/generate-hotspots-configs.js +0 -41
  45. package/dist/utils/hotspot/get-hotspot-variant.js +0 -20
package/CHANGELOG.md CHANGED
@@ -25,6 +25,11 @@ Types of changes:
25
25
  - ...
26
26
 
27
27
  -------------
28
+ ## 2.7.7 - 2022-02-24
29
+ ### Fixed
30
+ - container width on mobile
31
+ - re-render method
32
+
28
33
  ## 2.7.6 - 2022-02-20
29
34
  ### Fixed
30
35
  - drag speed
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Release](https://img.shields.io/badge/release-v2.7.6-blue.svg)](https://github.com/scaleflex/js-cloudimage-360-view/releases)
1
+ [![Release](https://img.shields.io/badge/release-v2.7.7-blue.svg)](https://github.com/scaleflex/js-cloudimage-360-view/releases)
2
2
  [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)](#contributing)
3
3
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4
4
  [![Scaleflex team](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg)](https://www.scaleflex.it/en/home)
@@ -6,9 +6,9 @@
6
6
  [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Engage%20your%20customers%20with%20a%20stunning%20360%20viewvof%20your%20products&url=https://scaleflex.github.io/js-cloudimage-360-view/&via=cloudimage&hashtags=images,cloudimage)
7
7
 
8
8
  <p align="center">
9
- <img
10
- alt="The Lounge"
11
- src="https://scaleflex.cloudimg.io/v7/cloudimage.io/LOGO+WITH+SCALEFLEX-01.png?vh=f6080d&w=350">
9
+ <img
10
+ alt="The Lounge"
11
+ src="https://scaleflex.cloudimg.io/v7/cloudimage.io/LOGO+WITH+SCALEFLEX-01.png?vh=f6080d&w=350">
12
12
  </p>
13
13
 
14
14
  <h1 align="center">
@@ -19,6 +19,8 @@ var _constants = require("./constants/");
19
19
 
20
20
  require("./static/css/style.css");
21
21
 
22
+ require("./static/css/hotspots.css");
23
+
22
24
  var _utils = require("./utils");
23
25
 
24
26
  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; }
@@ -26,7 +28,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
26
28
  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; }
27
29
 
28
30
  var CI360Viewer = /*#__PURE__*/function () {
29
- function CI360Viewer(container, fullscreen) {
31
+ function CI360Viewer(container, fullscreen, hotspotConfig) {
30
32
  (0, _classCallCheck2.default)(this, CI360Viewer);
31
33
  this.container = container;
32
34
  this.movementStart = {
@@ -50,7 +52,7 @@ var CI360Viewer = /*#__PURE__*/function () {
50
52
  this.devicePixelRatio = Math.round(window.devicePixelRatio || 1);
51
53
  this.isMobile = !!('ontouchstart' in window || navigator.msMaxTouchPoints);
52
54
  this.id = container.id;
53
- this.init(container);
55
+ this.hotspotConfig = hotspotConfig && (0, _utils.generateHotspotsConfigs)(hotspotConfig);
54
56
  this.isMagnifyOpen = false;
55
57
  this.isDragged = false;
56
58
  this.startPointerZoom = false;
@@ -65,13 +67,14 @@ var CI360Viewer = /*#__PURE__*/function () {
65
67
  y: 0
66
68
  };
67
69
  this.isStartedLoadOriginalImages = false;
70
+ this.init(container);
68
71
  }
69
72
 
70
73
  (0, _createClass2.default)(CI360Viewer, [{
71
74
  key: "mouseDown",
72
75
  value: function mouseDown(event) {
73
76
  if (!this.imagesLoaded) return;
74
- event.preventDefault();
77
+ var isMouseOnHotspotElement = (0, _utils.isMouseOnHotspot)();
75
78
  var pageX = event.pageX,
76
79
  pageY = event.pageY;
77
80
  this.hideInitialIcons();
@@ -92,6 +95,10 @@ var CI360Viewer = /*#__PURE__*/function () {
92
95
  };
93
96
  this.isClicked = true;
94
97
  this.isDragged = false;
98
+
99
+ if (isMouseOnHotspotElement) {
100
+ this.isClicked = false;
101
+ }
95
102
  }
96
103
  }, {
97
104
  key: "mouseUp",
@@ -215,6 +222,10 @@ var CI360Viewer = /*#__PURE__*/function () {
215
222
 
216
223
  var _zoomSteps = (0, _utils.generateZoomInSteps)(this.pointerZoom);
217
224
 
225
+ if (this.hotspotConfig) {
226
+ (0, _utils.hideHotspotsIcons)();
227
+ }
228
+
218
229
  _zoomSteps.forEach(function (step) {
219
230
  setTimeout(function () {
220
231
  _this2.zoomIntensity = step;
@@ -273,6 +284,7 @@ var CI360Viewer = /*#__PURE__*/function () {
273
284
  key: "touchStart",
274
285
  value: function touchStart(event) {
275
286
  if (!this.imagesLoaded) return;
287
+ var isMouseOnHotspotElement = (0, _utils.isMouseOnHotspot)();
276
288
  this.hideInitialIcons();
277
289
 
278
290
  if (this.autoplay || this.loopTimeoutId) {
@@ -289,6 +301,10 @@ var CI360Viewer = /*#__PURE__*/function () {
289
301
  y: event.touches[0].clientY
290
302
  };
291
303
  this.isClicked = true;
304
+
305
+ if (isMouseOnHotspotElement) {
306
+ this.isClicked = false;
307
+ }
292
308
  }
293
309
  }, {
294
310
  key: "touchEnd",
@@ -680,12 +696,23 @@ var CI360Viewer = /*#__PURE__*/function () {
680
696
  this.update();
681
697
  }
682
698
  }
699
+ }, {
700
+ key: "showImageInfo",
701
+ value: function showImageInfo(ctx) {
702
+ ctx.font = "".concat(this.fullscreenView ? 28 : 14, "px serif");
703
+ ctx.fillStyle = this.info === 'white' ? '#FFF' : '#000';
704
+ var imageDimension = "image-dimension: ".concat(this.container.offsetWidth, "x").concat(this.container.offsetHeight, "px");
705
+ var currentXImage = 'active-index-x: ' + this.activeImageX;
706
+ var currentYImage = 'active-index-y: ' + this.activeImageY;
707
+ var imageIndex = [currentXImage, currentYImage].join(' | ');
708
+ ctx.fillText(imageDimension, 20, this.container.offsetHeight - 35);
709
+ ctx.fillText(imageIndex, 20, this.container.offsetHeight - 10);
710
+ }
683
711
  }, {
684
712
  key: "requestResizedImages",
685
713
  value: function requestResizedImages() {
686
714
  var responsive = this.ciParams.ciToken;
687
715
  var firstImage = this.imagesX[0];
688
- this.updateContainerAndCanvasSize(firstImage);
689
716
  this.update();
690
717
  this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
691
718
  var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
@@ -708,6 +735,7 @@ var CI360Viewer = /*#__PURE__*/function () {
708
735
 
709
736
  var ctx = this.canvas.getContext("2d");
710
737
  ctx.scale(this.devicePixelRatio, this.devicePixelRatio);
738
+ this.updateContainerAndCanvasSize(image);
711
739
 
712
740
  if (this.fullscreenView) {
713
741
  var _contain = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
@@ -721,9 +749,17 @@ var CI360Viewer = /*#__PURE__*/function () {
721
749
  if (this.mouseTracked) {
722
750
  this.updateImageScale(ctx);
723
751
  } else {
752
+ if (this.hotspotConfig && !this.autoplay) {
753
+ (0, _utils.updateHotspots)(this.container, this.hotspotConfig, this.activeImageX, this.activeImageY, this.movingDirection);
754
+ }
755
+
724
756
  ctx.drawImage(image, 0, 0, this.canvas.width, this.canvas.height);
725
757
  }
726
758
  }
759
+
760
+ if (this.info) {
761
+ this.showImageInfo(ctx);
762
+ }
727
763
  }
728
764
  }, {
729
765
  key: "updateImageScale",
@@ -776,6 +812,7 @@ var CI360Viewer = /*#__PURE__*/function () {
776
812
  x: offsetX,
777
813
  y: offsetY
778
814
  };
815
+ this.addCloseFullscreenView();
779
816
  ctx.drawImage(image, offsetX, offsetY, width, height);
780
817
  } else {
781
818
  this.canvas.width = this.container.offsetWidth * this.devicePixelRatio;
@@ -785,8 +822,8 @@ var CI360Viewer = /*#__PURE__*/function () {
785
822
  ctx.drawImage(image, 0, 0, this.canvas.width, this.canvas.height);
786
823
  }
787
824
 
788
- if (this.fullscreenView) {
789
- this.addCloseFullscreenView();
825
+ if (this.info) {
826
+ this.showImageInfo(ctx);
790
827
  }
791
828
 
792
829
  if (this.magnifier) {
@@ -794,7 +831,7 @@ var CI360Viewer = /*#__PURE__*/function () {
794
831
  }
795
832
 
796
833
  if (this.boxShadow && !this.fullscreenView) {
797
- (0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
834
+ this.boxShadowEl = (0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
798
835
  }
799
836
 
800
837
  if (this.bottomCircle && !this.fullscreenView) {
@@ -804,6 +841,10 @@ var CI360Viewer = /*#__PURE__*/function () {
804
841
  if (this.fullscreen && !this.fullscreenView) {
805
842
  this.addFullscreenIcon();
806
843
  }
844
+
845
+ if (this.hotspotConfig && !this.autoplay) {
846
+ (0, _utils.updateHotspots)(this.container, this.hotspotConfig, this.activeImageX, this.activeImageY, this.movingDirection);
847
+ }
807
848
  }
808
849
  }, {
809
850
  key: "onAllImagesLoaded",
@@ -870,7 +911,7 @@ var CI360Viewer = /*#__PURE__*/function () {
870
911
  event.stopPropagation();
871
912
  if (this.mouseTracked) this.togglePointerZoom();
872
913
  var fullscreenContainer = (0, _utils.createFullscreenModal)(this.container);
873
- new CI360Viewer(fullscreenContainer, true);
914
+ new CI360Viewer(fullscreenContainer, true, this.hotspotConfig);
874
915
  }
875
916
  }, {
876
917
  key: "setFullscreenEvents",
@@ -1193,7 +1234,9 @@ var CI360Viewer = /*#__PURE__*/function () {
1193
1234
  hide360Logo = _get360ViewProps.hide360Logo,
1194
1235
  logoSrc = _get360ViewProps.logoSrc,
1195
1236
  pointerZoom = _get360ViewProps.pointerZoom,
1196
- ratio = _get360ViewProps.ratio;
1237
+ ratio = _get360ViewProps.ratio,
1238
+ _get360ViewProps$imag = _get360ViewProps.imageInfo,
1239
+ imageInfo = _get360ViewProps$imag === void 0 ? 'black' : _get360ViewProps$imag;
1197
1240
 
1198
1241
  var ciParams = {
1199
1242
  ciToken: ciToken,
@@ -1238,6 +1281,7 @@ var CI360Viewer = /*#__PURE__*/function () {
1238
1281
  this.apiVersion = apiVersion;
1239
1282
  this.pointerZoom = pointerZoom > 1 ? Math.min(pointerZoom, 3) : 0;
1240
1283
  this.keysReverse = keysReverse;
1284
+ this.info = imageInfo;
1241
1285
  this.ratio = ratio && JSON.parse(ratio);
1242
1286
 
1243
1287
  if (reload) {
@@ -1246,6 +1290,37 @@ var CI360Viewer = /*#__PURE__*/function () {
1246
1290
  }
1247
1291
 
1248
1292
  if (update) {
1293
+ (0, _utils.removeChildFromParent)(this.innerBox, this.iconsContainer);
1294
+ (0, _utils.removeChildFromParent)(this.innerBox, this.boxShadowEl);
1295
+ (0, _utils.removeChildFromParent)(this.innerBox, this.view360Icon);
1296
+ this.remove360ViewCircleIcon();
1297
+ this.iconsContainer = (0, _utils.createIconsContainer)(this.innerBox);
1298
+
1299
+ if (!this.hide360Logo && !this.lazyload && this.logoSrc) {
1300
+ this.add360ViewIcon();
1301
+ (0, _ci.setView360Icon)(this.view360Icon, this.logoSrc);
1302
+ }
1303
+
1304
+ if (this.magnifier) {
1305
+ this.addMagnifier();
1306
+ }
1307
+
1308
+ if (this.info) {
1309
+ this.showImageInfo(ctx);
1310
+ }
1311
+
1312
+ if (this.bottomCircle && !this.fullscreenView) {
1313
+ this.add360ViewCircleIcon();
1314
+ }
1315
+
1316
+ if (this.fullscreen && !this.fullscreenView) {
1317
+ this.addFullscreenIcon();
1318
+ }
1319
+
1320
+ if (this.boxShadow && !this.fullscreenView) {
1321
+ this.boxShadowEl = (0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
1322
+ }
1323
+
1249
1324
  this.onAllImagesLoaded();
1250
1325
  return;
1251
1326
  }
@@ -1254,6 +1329,11 @@ var CI360Viewer = /*#__PURE__*/function () {
1254
1329
  this.iconsContainer = (0, _utils.createIconsContainer)(this.innerBox);
1255
1330
  this.canvas = (0, _utils.createCanvas)(this.innerBox);
1256
1331
  this.loader = (0, _utils.createLoader)(this.innerBox);
1332
+
1333
+ if (this.hotspotConfig && !this.fullscreenView) {
1334
+ (0, _utils.createHotspots)(container, this.hotspotConfig);
1335
+ }
1336
+
1257
1337
  (0, _utils.applyStylesToContainer)(this.container);
1258
1338
  this.srcXConfig = {
1259
1339
  folder: folder,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setView360Icon = exports.get360ViewProps = exports.debounce = void 0;
6
+ exports.setView360Icon = exports.get360ViewProps = exports.debounce = exports.attr = void 0;
7
7
 
8
8
  var _constants = require("./constants");
9
9
 
@@ -46,7 +46,8 @@ var get360ViewProps = function get360ViewProps(image) {
46
46
  stopAtEdges: isTrue(image, 'stop-at-edges'),
47
47
  hide360Logo: isTrue(image, 'hide-360-logo'),
48
48
  logoSrc: attr(image, 'logo-src') || 'https://scaleflex.ultrafast.io/https://scaleflex.airstore.io/filerobot/js-cloudimage-360-view/360_view.svg',
49
- ratio: attr(image, 'ratio') || attr(image, 'data-ratio') || null
49
+ ratio: attr(image, 'ratio') || attr(image, 'data-ratio') || null,
50
+ imageInfo: attr(image, 'info') || attr(image, 'data-info') || isTrue(image, 'info')
50
51
  };
51
52
  };
52
53
 
@@ -62,6 +63,8 @@ var attr = function attr(element, attribute) {
62
63
  return element.getAttribute(attribute);
63
64
  };
64
65
 
66
+ exports.attr = attr;
67
+
65
68
  var setView360Icon = function setView360Icon(view360Icon, logoSrc) {
66
69
  view360Icon.style.background = "rgba(255,255,255,0.8) url('".concat(logoSrc, "') 50% 50% / contain no-repeat");
67
70
  };
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
- viewers.push(new _ci.default(container));
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
  }
@@ -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
@@ -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("../common/add-class");
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
  };
@@ -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('div');
11
+ var imageDot = document.createElement('button');
12
12
  imageDot.className = 'cloudimage-360-carousel-dot';
13
13
 
14
14
  imageDot.onclick = function () {
@@ -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 indicatorClass = hotspotConfig.indicatorClass,
12
- popupProps = hotspotConfig.popupProps,
11
+ var indicatorSelector = hotspotConfig.indicatorSelector,
13
12
  variant = hotspotConfig.variant;
14
- var anchorId = popupProps.anchorId;
15
- var url = variant.url;
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(indicatorClass);
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);
@@ -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;
@@ -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 popupClass = popupProps.popupClass,
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(popupClass);
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 = 'initial';
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.fillPreviousCoordWithPrevious = void 0;
6
+ exports.fillEmptyCoordWithPrevious = void 0;
7
7
 
8
8
  /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
9
- var fillPreviousCoordWithPrevious = function fillPreviousCoordWithPrevious(hotspots, hotspotIndex, coord) {
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.fillPreviousCoordWithPrevious = fillPreviousCoordWithPrevious;
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 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,
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
- popupClass: popupClass,
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;
@@ -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;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getPopupNode = void 0;
7
7
 
8
8
  var getPopupNode = function getPopupNode(popupId) {
9
- var popupSelector = 'data-CI-360-anchor';
9
+ var popupSelector = 'data-cloudimage-360-hotspots';
10
10
  var popupNode = document.querySelector("[".concat(popupSelector, "=").concat(popupId, "]"));
11
11
  return popupNode;
12
12
  };
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.prepareHotspotsPositions = void 0;
7
7
 
8
- var _fillPreviousCoordWithPrevious = require("./fill-previous-coord-with-previous");
8
+ var _fillEmptyCoordWithPrevious = require("./fill-empty-coord-with-previous");
9
9
 
10
10
  var prepareHotspotsPositions = function prepareHotspotsPositions(hotspots) {
11
11
  return hotspots.reduce(function (accumulate, current, currentIndex) {
@@ -13,11 +13,11 @@ var prepareHotspotsPositions = function prepareHotspotsPositions(hotspots) {
13
13
  var isIncludesYcoord = !!(current !== null && current !== void 0 && current.yCoord);
14
14
 
15
15
  if (!isIncludesXcoord) {
16
- current.xCoord = (0, _fillPreviousCoordWithPrevious.fillPreviousCoordWithPrevious)(hotspots, currentIndex, 'xCoord');
16
+ current.xCoord = (0, _fillEmptyCoordWithPrevious.fillEmptyCoordWithPrevious)(hotspots, currentIndex, 'xCoord');
17
17
  }
18
18
 
19
19
  if (!isIncludesYcoord) {
20
- current.yCoord = (0, _fillPreviousCoordWithPrevious.fillPreviousCoordWithPrevious)(hotspots, currentIndex, 'yCoord');
20
+ current.yCoord = (0, _fillEmptyCoordWithPrevious.fillEmptyCoordWithPrevious)(hotspots, currentIndex, 'yCoord');
21
21
  }
22
22
 
23
23
  accumulate.push(current);
@@ -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 currentImage = orientation === 'x' ? activeImageX : activeImageY;
35
- var anchorId = popupProps.anchorId,
36
- open = popupProps.open;
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,
@@ -193,9 +193,9 @@ var _getSpeedFactor = require("./auto-play/get-speed-factor");
193
193
 
194
194
  var _isCompletedOneCycle = require("./auto-play/is-completed-one-cycle");
195
195
 
196
- var _addClass = require("./common/add-class");
196
+ var _addClass = require("./class-names/add-class");
197
197
 
198
- var _removeClass = require("./common/remove-class");
198
+ var _removeClass = require("./class-names/remove-class");
199
199
 
200
200
  var _getMovingDirection = require("./spin-y/get-moving-direction");
201
201
 
@@ -217,12 +217,12 @@ Object.keys(_containerElements).forEach(function (key) {
217
217
  });
218
218
  });
219
219
 
220
- var _updateHotspots = require("./hotspot/update-hotspots");
220
+ var _updateHotspots = require("./hotspots/update-hotspots");
221
221
 
222
- var _createHotspots = require("./hotspot/elements/create-hotspots");
222
+ var _createHotspots = require("./hotspots/elements/create-hotspots");
223
223
 
224
- var _generateHotspotsConfigs = require("./hotspot/generate-hotspots-configs");
224
+ var _generateHotspotsConfigs = require("./hotspots/generate-hotspots-configs");
225
225
 
226
- var _isMouseOnHotspot = require("./hotspot/is-mouse-on-hotspot");
226
+ var _isMouseOnHotspot = require("./hotspots/is-mouse-on-hotspot");
227
227
 
228
- var _hideHotspotsIcons = require("./hotspot/hide-hotspots-icons");
228
+ var _hideHotspotsIcons = require("./hotspots/hide-hotspots-icons");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-cloudimage-360-view",
3
- "version": "2.7.6",
3
+ "version": "2.7.7",
4
4
  "main": "dist/index.js",
5
5
  "description": "",
6
6
  "author": "scaleflex",
@@ -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;