js-cloudimage-360-view 2.7.6 → 2.7.9

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 (49) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +15 -4
  3. package/dist/ci360.service.js +147 -69
  4. package/dist/ci360.utils.js +5 -2
  5. package/dist/constants/props-require-reload.js +21 -0
  6. package/dist/index.js +37 -7
  7. package/dist/static/css/hotspots.css +222 -0
  8. package/dist/utils/{common → class-names}/add-class.js +0 -0
  9. package/dist/utils/{common → class-names}/remove-class.js +0 -0
  10. package/dist/utils/container-elements/index.js +9 -1
  11. package/dist/utils/container-elements/remove-child-from-parent.js +16 -0
  12. package/dist/utils/controls/init-controls.js +1 -1
  13. package/dist/utils/{hotspot → hotspots}/attach-popup-events.js +1 -1
  14. package/dist/utils/{hotspot → hotspots}/configs-error-handler.js +7 -10
  15. package/dist/utils/{hotspot → hotspots}/create-popper-instace.js +0 -0
  16. package/dist/utils/{hotspot → hotspots}/elements/create-carousel-dot.js +1 -1
  17. package/dist/utils/{hotspot → hotspots}/elements/create-carousel-image.js +0 -0
  18. package/dist/utils/{hotspot → hotspots}/elements/create-hotspot-icon.js +4 -5
  19. package/dist/utils/{hotspot → hotspots}/elements/create-hotspot-popup-link.js +0 -0
  20. package/dist/utils/{hotspot → hotspots}/elements/create-hotspots.js +0 -0
  21. package/dist/utils/{hotspot → hotspots}/elements/create-images-carousel.js +0 -0
  22. package/dist/utils/{hotspot → hotspots}/elements/create-modal-description.js +0 -0
  23. package/dist/utils/{hotspot → hotspots}/elements/create-modal-title.js +0 -0
  24. package/dist/utils/hotspots/elements/create-model-elements.js +66 -0
  25. package/dist/utils/{hotspot → hotspots}/elements/create-popup-arrow.js +0 -0
  26. package/dist/utils/{hotspot → hotspots}/elements/create-popup.js +10 -7
  27. package/dist/utils/hotspots/elements/create-read-more-btn.js +17 -0
  28. package/dist/utils/{hotspot/fill-previous-coord-with-previous.js → hotspots/fill-empty-coord-with-previous.js} +3 -3
  29. package/dist/utils/hotspots/generate-hotspots-configs.js +58 -0
  30. package/dist/utils/{hotspot → hotspots}/generate-popup-config.js +3 -8
  31. package/dist/utils/{hotspot → hotspots}/get-hotspot-icon.js +0 -0
  32. package/dist/utils/{hotspot → hotspots}/get-hotspot-orientation.js +0 -0
  33. package/dist/utils/{hotspot → hotspots}/get-hotspot-popup-node.js +4 -2
  34. package/dist/utils/{hotspot → hotspots}/get-popup-node.js +1 -1
  35. package/dist/utils/{hotspot → hotspots}/hide-hotspot-icon.js +0 -0
  36. package/dist/utils/{hotspot → hotspots}/hide-hotspots-icons.js +0 -0
  37. package/dist/utils/{hotspot → hotspots}/is-mouse-on-hotspot.js +0 -0
  38. package/dist/utils/{hotspot → hotspots}/prepare-hotspots-positions.js +3 -3
  39. package/dist/utils/{hotspot → hotspots}/set-current-slide.js +0 -0
  40. package/dist/utils/{hotspot → hotspots}/update-hotspot-icon-position.js +0 -0
  41. package/dist/utils/{hotspot → hotspots}/update-hotspots.js +10 -9
  42. package/dist/utils/image-src/is-props-change-require-reload.js +23 -0
  43. package/dist/utils/index.js +11 -11
  44. package/package.json +1 -1
  45. package/dist/constants/image-src-props.js +0 -8
  46. package/dist/utils/hotspot/elements/create-model-elements.js +0 -49
  47. package/dist/utils/hotspot/generate-hotspots-configs.js +0 -41
  48. package/dist/utils/hotspot/get-hotspot-variant.js +0 -20
  49. package/dist/utils/image-src/is-src-props-changed.js +0 -23
@@ -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,
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isPropsChangeRequireReload = void 0;
7
+
8
+ var _propsRequireReload = require("../../constants/props-require-reload");
9
+
10
+ var isPropsChangeRequireReload = function isPropsChangeRequireReload(currentProps, changedProps) {
11
+ return Object.keys(changedProps).reduce(function (acc, current) {
12
+ var isPropChanged = currentProps[current] !== changedProps[current];
13
+ var isSrcProp = _propsRequireReload.PROPS_REQUIRE_RELOAD.indexOf(current) !== -1;
14
+
15
+ if (isSrcProp && isPropChanged) {
16
+ acc = true;
17
+ }
18
+
19
+ return acc;
20
+ }, false);
21
+ };
22
+
23
+ exports.isPropsChangeRequireReload = isPropsChangeRequireReload;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  var _exportNames = {
7
- isSrcPropsChanged: true,
7
+ isPropsChangeRequireReload: true,
8
8
  generateImagesPath: true,
9
9
  preloadImages: true,
10
10
  preloadOriginalImages: true,
@@ -124,10 +124,10 @@ Object.defineProperty(exports, "isMouseOnHotspot", {
124
124
  return _isMouseOnHotspot.isMouseOnHotspot;
125
125
  }
126
126
  });
127
- Object.defineProperty(exports, "isSrcPropsChanged", {
127
+ Object.defineProperty(exports, "isPropsChangeRequireReload", {
128
128
  enumerable: true,
129
129
  get: function get() {
130
- return _isSrcPropsChanged.isSrcPropsChanged;
130
+ return _isPropsChangeRequireReload.isPropsChangeRequireReload;
131
131
  }
132
132
  });
133
133
  Object.defineProperty(exports, "loop", {
@@ -167,7 +167,7 @@ Object.defineProperty(exports, "updateHotspots", {
167
167
  }
168
168
  });
169
169
 
170
- var _isSrcPropsChanged = require("./image-src/is-src-props-changed");
170
+ var _isPropsChangeRequireReload = require("./image-src/is-props-change-require-reload");
171
171
 
172
172
  var _generateImagesPath = require("./image-src/generate-images-path");
173
173
 
@@ -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.9",
4
4
  "main": "dist/index.js",
5
5
  "description": "",
6
6
  "author": "scaleflex",
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.IMAGE_SRC_PROPS = void 0;
7
- var IMAGE_SRC_PROPS = ['folder', 'filenameX', 'filenameY', 'apiVersion', 'imageListX', 'imageListY', 'indexZeroBase', 'amountX', 'amountY', 'lazySelector'];
8
- exports.IMAGE_SRC_PROPS = IMAGE_SRC_PROPS;
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.createModalElements = void 0;
9
-
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
- var _createImagesCarousel3 = require("./create-images-carousel");
13
-
14
- var _createModalDescription = require("./create-modal-description");
15
-
16
- var _createModalTitle = require("./create-modal-title");
17
-
18
- var createModalElements = function createModalElements(variant, container, popup) {
19
- var images = variant.images,
20
- title = variant.title,
21
- description = variant.description;
22
- var imagesCarouselWrapper = document.createElement('div');
23
- var modalWrapper = document.createElement('div');
24
-
25
- var _createImagesCarousel = (0, _createImagesCarousel3.createImagesCarousel)(images, popup, container),
26
- _createImagesCarousel2 = (0, _slicedToArray2.default)(_createImagesCarousel, 2),
27
- imagesCarousel = _createImagesCarousel2[0],
28
- carouselDots = _createImagesCarousel2[1];
29
-
30
- modalWrapper.className = 'cloudimage-360-modal-wrapper';
31
- imagesCarouselWrapper.className = 'cloudimage-360-images-carousel-wrapper';
32
- imagesCarouselWrapper.appendChild(imagesCarousel);
33
- imagesCarouselWrapper.appendChild(carouselDots);
34
- modalWrapper.appendChild(imagesCarouselWrapper);
35
-
36
- if (title) {
37
- var modalTitle = (0, _createModalTitle.createModalTitle)(title);
38
- modalWrapper.appendChild(modalTitle);
39
- }
40
-
41
- if (description) {
42
- var modalDescription = (0, _createModalDescription.createModalDescription)(description);
43
- modalWrapper.appendChild(modalDescription);
44
- }
45
-
46
- popup.appendChild(modalWrapper);
47
- };
48
-
49
- exports.createModalElements = createModalElements;
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.generateHotspotsConfigs = void 0;
7
-
8
- var _configsErrorHandler = require("./configs-error-handler");
9
-
10
- var _generatePopupConfig = require("./generate-popup-config");
11
-
12
- var generateHotspotsConfigs = function generateHotspotsConfigs(hotspotsProps) {
13
- var hotspotsConfigs = hotspotsProps.map(function (hotspotProps) {
14
- var _hotspotProps$variant = hotspotProps.variant,
15
- variant = _hotspotProps$variant === void 0 ? {} : _hotspotProps$variant,
16
- _hotspotProps$hotspot = hotspotProps.hotspots,
17
- hotspots = _hotspotProps$hotspot === void 0 ? [] : _hotspotProps$hotspot,
18
- _hotspotProps$indicat = hotspotProps.indicatorClass,
19
- indicatorClass = _hotspotProps$indicat === void 0 ? '' : _hotspotProps$indicat,
20
- _hotspotProps$popupPr = hotspotProps.popupProps,
21
- popupProps = _hotspotProps$popupPr === void 0 ? {} : _hotspotProps$popupPr,
22
- _hotspotProps$orienta = hotspotProps.orientation,
23
- orientation = _hotspotProps$orienta === void 0 ? 'x' : _hotspotProps$orienta,
24
- _hotspotProps$initial = hotspotProps.initialDimensions,
25
- initialDimensions = _hotspotProps$initial === void 0 ? [500, 500] : _hotspotProps$initial;
26
- (0, _configsErrorHandler.configsErrorHandler)(hotspotProps);
27
- var popupConfig = (0, _generatePopupConfig.generatePopupConfig)(popupProps);
28
- var hotspotConfig = {
29
- variant: variant,
30
- popupProps: popupConfig,
31
- hotspots: hotspots,
32
- indicatorClass: indicatorClass,
33
- initialDimensions: initialDimensions,
34
- orientation: orientation.toLowerCase()
35
- };
36
- return hotspotConfig;
37
- });
38
- return hotspotsConfigs;
39
- };
40
-
41
- exports.generateHotspotsConfigs = generateHotspotsConfigs;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getHotspotVariant = void 0;
7
-
8
- var getHotspotVariant = function getHotspotVariant(variant) {
9
- if (variant.toLowerCase() === 'link') {
10
- return 'link';
11
- }
12
-
13
- if (variant.toLowerCase() === 'custom') {
14
- return 'custom';
15
- }
16
-
17
- return 'link';
18
- };
19
-
20
- exports.getHotspotVariant = getHotspotVariant;
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isSrcPropsChanged = void 0;
7
-
8
- var _imageSrcProps = require("../../constants/image-src-props");
9
-
10
- var isSrcPropsChanged = function isSrcPropsChanged(currentProps, changedProps) {
11
- return Object.keys(changedProps).reduce(function (acc, current) {
12
- var isPropChanged = currentProps[current] !== changedProps[current];
13
- var isSrcProp = _imageSrcProps.IMAGE_SRC_PROPS.indexOf(current) !== -1;
14
-
15
- if (isSrcProp && isPropChanged) {
16
- acc = true;
17
- }
18
-
19
- return acc;
20
- }, false);
21
- };
22
-
23
- exports.isSrcPropsChanged = isSrcPropsChanged;