js-cloudimage-360-view 3.0.4 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +11 -0
  3. package/dist/ci360.service.js +65 -245
  4. package/dist/ci360.utils.js +2 -14
  5. package/dist/constants/index.js +0 -4
  6. package/dist/constants/props-require-reload.js +24 -12
  7. package/dist/index.js +0 -27
  8. package/dist/utils/auto-play/get-speed-factor.js +0 -2
  9. package/dist/utils/auto-play/is-completed-one-cycle.js +0 -5
  10. package/dist/utils/auto-play/loop.js +3 -14
  11. package/dist/utils/class-names/add-class.js +0 -3
  12. package/dist/utils/class-names/remove-class.js +0 -2
  13. package/dist/utils/container-elements/apply-styles-to-container.js +0 -2
  14. package/dist/utils/container-elements/create-360-view-circle-icon.js +0 -2
  15. package/dist/utils/container-elements/create-360-view-icon.js +0 -2
  16. package/dist/utils/container-elements/create-box-shadow.js +0 -2
  17. package/dist/utils/container-elements/create-canvas.js +0 -2
  18. package/dist/utils/container-elements/create-close-fullscreen-icon.js +0 -2
  19. package/dist/utils/container-elements/create-fullscreen-icon.js +0 -2
  20. package/dist/utils/container-elements/create-fullscreen-modal.js +0 -2
  21. package/dist/utils/container-elements/create-icons-container.js +0 -2
  22. package/dist/utils/container-elements/create-inner-box.js +0 -2
  23. package/dist/utils/container-elements/create-loader.js +0 -2
  24. package/dist/utils/container-elements/create-magnifier-icon.js +0 -2
  25. package/dist/utils/container-elements/index.js +0 -13
  26. package/dist/utils/container-elements/remove-child-from-parent.js +0 -2
  27. package/dist/utils/controls/get-item-skipped.js +0 -2
  28. package/dist/utils/controls/init-controls.js +7 -16
  29. package/dist/utils/hotspots/attach-events/hide-popup.js +0 -2
  30. package/dist/utils/hotspots/attach-events/show-popup.js +0 -2
  31. package/dist/utils/hotspots/configs-error-handler.js +6 -10
  32. package/dist/utils/hotspots/create-popper-instace.js +1 -4
  33. package/dist/utils/hotspots/elements/create-carousel-dot.js +0 -6
  34. package/dist/utils/hotspots/elements/create-carousel-image.js +0 -4
  35. package/dist/utils/hotspots/elements/create-hotspot-icon.js +3 -14
  36. package/dist/utils/hotspots/elements/create-hotspot-popup-link.js +2 -6
  37. package/dist/utils/hotspots/elements/create-hotspots.js +0 -5
  38. package/dist/utils/hotspots/elements/create-images-carousel.js +0 -4
  39. package/dist/utils/hotspots/elements/create-modal-description.js +0 -2
  40. package/dist/utils/hotspots/elements/create-modal-title.js +0 -2
  41. package/dist/utils/hotspots/elements/create-model-elements.js +8 -25
  42. package/dist/utils/hotspots/elements/create-popup-arrow.js +0 -2
  43. package/dist/utils/hotspots/elements/create-popup.js +6 -18
  44. package/dist/utils/hotspots/elements/create-read-more-btn.js +0 -2
  45. package/dist/utils/hotspots/fill-empty-coord-with-previous.js +1 -6
  46. package/dist/utils/hotspots/generate-hotspots-configs.js +11 -21
  47. package/dist/utils/hotspots/generate-popup-config.js +9 -11
  48. package/dist/utils/hotspots/get-hotspot-icon.js +0 -2
  49. package/dist/utils/hotspots/get-hotspot-orientation.js +0 -4
  50. package/dist/utils/hotspots/get-hotspot-popup-node.js +0 -2
  51. package/dist/utils/hotspots/get-popup-node.js +0 -2
  52. package/dist/utils/hotspots/hide-hotspot-icon.js +0 -2
  53. package/dist/utils/hotspots/hide-hotspots-icons.js +0 -3
  54. package/dist/utils/hotspots/is-mouse-on-hotspot.js +0 -2
  55. package/dist/utils/hotspots/prepare-hotspots-positions.js +0 -6
  56. package/dist/utils/hotspots/set-current-slide.js +0 -2
  57. package/dist/utils/hotspots/toggle-popup-events.js +0 -4
  58. package/dist/utils/hotspots/update-hotspot-icon-position.js +0 -2
  59. package/dist/utils/hotspots/update-hotspots.js +6 -14
  60. package/dist/utils/image-src/generate-images-path.js +8 -17
  61. package/dist/utils/image-src/is-props-change-require-reload.js +0 -5
  62. package/dist/utils/index.js +0 -26
  63. package/dist/utils/load-images/images-from-folder/prepare-images-from-folder.js +2 -11
  64. package/dist/utils/load-images/images-from-list/prepare-images-from-list.js +0 -8
  65. package/dist/utils/load-images/lazyload/init-lazyload.js +3 -11
  66. package/dist/utils/load-images/lazyload/prepare-first-image/prepare-first-image-from-folder.js +1 -5
  67. package/dist/utils/load-images/lazyload/prepare-first-image/prepare-first-image-from-list.js +0 -9
  68. package/dist/utils/load-images/load-image-as-promise.js +8 -46
  69. package/dist/utils/load-images/load-images-relative-to-container-size.js +10 -49
  70. package/dist/utils/load-images/load-original-images.js +23 -37
  71. package/dist/utils/load-images/pad.js +0 -2
  72. package/dist/utils/load-images/preload-images.js +2 -9
  73. package/dist/utils/load-images/preload-original-images.js +2 -9
  74. package/dist/utils/magnify/get-current-original-image.js +0 -6
  75. package/dist/utils/magnify/get-cursor-position.js +0 -2
  76. package/dist/utils/magnify/magnify.js +4 -11
  77. package/dist/utils/magnify/move-magnifier.js +6 -14
  78. package/dist/utils/responsive/contain.js +0 -2
  79. package/dist/utils/responsive/fit.js +0 -4
  80. package/dist/utils/responsive/get-image-aspect-ratio.js +0 -8
  81. package/dist/utils/responsive/get-responsive-width-of-container.js +0 -3
  82. package/dist/utils/responsive/get-size-according-to-pixel-ratio.js +0 -2
  83. package/dist/utils/responsive/get-size-limit.js +0 -2
  84. package/dist/utils/spin-y/get-moving-direction.js +0 -3
  85. package/dist/utils/zoom/generate-zoom-in-steps.js +0 -2
  86. package/dist/utils/zoom/generate-zoom-out-steps.js +0 -2
  87. package/package.json +2 -2
  88. package/yarn-error.log +27 -6779
@@ -1,34 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _ci = require("./ci360.utils");
17
-
18
12
  var _constants = require("./constants/");
19
-
20
13
  require("./static/css/style.css");
21
-
22
14
  require("./static/css/hotspots.css");
23
-
24
15
  var _utils = require("./utils");
25
-
26
16
  var _togglePopupEvents = require("./utils/hotspots/toggle-popup-events");
27
-
28
17
  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; }
29
-
30
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; }
31
-
32
19
  var CI360Viewer = /*#__PURE__*/function () {
33
20
  function CI360Viewer(container, fullscreen, hotspotsConfigs) {
34
21
  (0, _classCallCheck2.default)(this, CI360Viewer);
@@ -71,18 +58,11 @@ var CI360Viewer = /*#__PURE__*/function () {
71
58
  this.isStartedLoadOriginalImages = false;
72
59
  this.init(container);
73
60
  }
74
-
75
61
  (0, _createClass2.default)(CI360Viewer, [{
76
62
  key: "isReady",
77
63
  value: function isReady() {
78
- var loadedXImages = this.imagesX.filter(function (image) {
79
- return image;
80
- });
81
- var loadedYImages = this.imagesY.filter(function (image) {
82
- return image;
83
- });
84
64
  var totalAmount = this.amountX + this.amountY;
85
- return loadedXImages.length + loadedYImages.length === totalAmount;
65
+ return this.imagesX.length + this.imagesY.length === totalAmount;
86
66
  }
87
67
  }, {
88
68
  key: "mouseDown",
@@ -90,15 +70,13 @@ var CI360Viewer = /*#__PURE__*/function () {
90
70
  if (!this.imagesLoaded) return;
91
71
  var isMouseOnHotspotElement = (0, _utils.isMouseOnHotspot)();
92
72
  var pageX = event.pageX,
93
- pageY = event.pageY;
73
+ pageY = event.pageY;
94
74
  this.hideInitialIcons();
95
-
96
75
  if (this.autoplay || this.loopTimeoutId) {
97
76
  this.stop();
98
77
  this.autoplay = false;
99
78
  this.isZoomReady = true;
100
79
  }
101
-
102
80
  this.intialPositions = {
103
81
  x: pageX,
104
82
  y: pageY
@@ -109,15 +87,12 @@ var CI360Viewer = /*#__PURE__*/function () {
109
87
  };
110
88
  this.isClicked = true;
111
89
  this.isDragged = false;
112
-
113
90
  if (this.hotspotsConfigs) {
114
91
  (0, _togglePopupEvents.togglePopupEvents)(this.hotspotsConfigs, event, true);
115
92
  }
116
-
117
93
  if (isMouseOnHotspotElement) {
118
94
  this.isClicked = false;
119
95
  }
120
-
121
96
  if (this.hotspotsConfigs) {
122
97
  (0, _utils.updateHotspots)(this.container, this.hotspotsConfigs, this.activeImageX, this.activeImageY, this.movingDirection);
123
98
  }
@@ -126,7 +101,6 @@ var CI360Viewer = /*#__PURE__*/function () {
126
101
  key: "mouseUp",
127
102
  value: function mouseUp() {
128
103
  var _this = this;
129
-
130
104
  if (!this.imagesLoaded || !this.isClicked) return;
131
105
  this.movementStart = {
132
106
  x: 0,
@@ -134,20 +108,16 @@ var CI360Viewer = /*#__PURE__*/function () {
134
108
  };
135
109
  this.isStartSpin = false;
136
110
  this.isClicked = false;
137
-
138
111
  if (this.bottomCircle && !this.mouseTracked) {
139
112
  this.show360ViewCircleIcon();
140
113
  }
141
-
142
114
  if (this.hotspotsConfigs) {
143
115
  (0, _togglePopupEvents.togglePopupEvents)(this.hotspotsConfigs);
144
116
  }
145
-
146
117
  if (this.pointerZoom && !this.fullscreenView) {
147
118
  setTimeout(function () {
148
119
  _this.isZoomReady = true;
149
120
  }, 50);
150
-
151
121
  if (this.mouseTracked) {
152
122
  this.container.style.cursor = 'zoom-out';
153
123
  } else {
@@ -163,15 +133,12 @@ var CI360Viewer = /*#__PURE__*/function () {
163
133
  if (!this.pointerZoom || this.fullscreenView) return;
164
134
  this.setCursorPosition(event);
165
135
  this.hideInitialIcons();
166
-
167
136
  if (!this.isStartedLoadOriginalImages && !this.isDragged && this.isZoomReady) {
168
137
  this.prepareOriginalImages(event);
169
138
  }
170
-
171
139
  if (this.isAllOriginalImagesLoaded && !this.isDragged && this.isZoomReady) {
172
140
  this.togglePointerZoom(event);
173
141
  }
174
-
175
142
  ;
176
143
  }
177
144
  }, {
@@ -179,16 +146,13 @@ var CI360Viewer = /*#__PURE__*/function () {
179
146
  value: function mouseMove(event) {
180
147
  if (!this.imagesLoaded) return;
181
148
  var pageX = event.pageX,
182
- pageY = event.pageY;
183
-
149
+ pageY = event.pageY;
184
150
  if (this.mouseTracked) {
185
151
  this.setCursorPosition(event);
186
-
187
152
  if (!this.isClicked) {
188
153
  this.update();
189
154
  }
190
155
  }
191
-
192
156
  if (this.isClicked) {
193
157
  var nextPositions = {
194
158
  x: pageX,
@@ -204,11 +168,9 @@ var CI360Viewer = /*#__PURE__*/function () {
204
168
  key: "mouseLeave",
205
169
  value: function mouseLeave() {
206
170
  if (!this.imagesLoaded) return;
207
-
208
171
  if (this.pointerZoom && this.mouseTracked) {
209
172
  this.togglePointerZoom();
210
173
  }
211
-
212
174
  if (this.isMagnifyOpen) {
213
175
  this.closeMagnifier();
214
176
  }
@@ -217,49 +179,37 @@ var CI360Viewer = /*#__PURE__*/function () {
217
179
  key: "togglePointerZoom",
218
180
  value: function togglePointerZoom() {
219
181
  var _this2 = this;
220
-
221
182
  if (this.autoplay || this.loopTimeoutId) {
222
183
  this.stop();
223
184
  this.autoplay = false;
224
185
  }
225
-
226
186
  if (this.mouseTracked) {
227
187
  var zoomSteps = (0, _utils.generateZoomOutSteps)(this.pointerZoom);
228
188
  this.container.style.cursor = 'zoom-in';
229
189
  zoomSteps.forEach(function (step, index) {
230
190
  setTimeout(function () {
231
191
  _this2.zoomIntensity = step;
232
-
233
192
  _this2.update();
234
-
235
193
  var isReachedIntialScale = index === zoomSteps.length - 1;
236
-
237
194
  if (isReachedIntialScale) {
238
195
  _this2.mouseTracked = false;
239
-
240
196
  _this2.update();
241
197
  }
242
-
243
198
  ;
244
199
  }, (_this2.pointerZoom - step) * 200);
245
200
  });
246
201
  } else {
247
202
  if (this.bottomCircle) this.hide360ViewCircleIcon();
248
-
249
203
  var _zoomSteps = (0, _utils.generateZoomInSteps)(this.pointerZoom);
250
-
251
204
  if (this.hotspotsConfigs) {
252
205
  (0, _utils.hideHotspotsIcons)();
253
206
  }
254
-
255
207
  _zoomSteps.forEach(function (step) {
256
208
  setTimeout(function () {
257
209
  _this2.zoomIntensity = step;
258
-
259
210
  _this2.update();
260
211
  }, step * 200);
261
212
  });
262
-
263
213
  this.mouseTracked = true;
264
214
  this.container.style.cursor = 'zoom-out';
265
215
  }
@@ -272,7 +222,6 @@ var CI360Viewer = /*#__PURE__*/function () {
272
222
  } else {
273
223
  this.originalImagesX[index] = image;
274
224
  }
275
-
276
225
  var loadedOriginalXImages = this.originalImagesX.filter(function (image) {
277
226
  return image;
278
227
  });
@@ -284,7 +233,6 @@ var CI360Viewer = /*#__PURE__*/function () {
284
233
  var isAllImagesLoaded = loadedOriginalXImages.length + loadedOriginalYImages.length === this.amountX + this.amountY;
285
234
  var percentage = Math.round(totalLoadedImages / totalAmount * 100);
286
235
  this.updatePercentageInLoader(percentage);
287
-
288
236
  if (isAllImagesLoaded) {
289
237
  this.removeLoader();
290
238
  this.togglePointerZoom(event);
@@ -300,7 +248,6 @@ var CI360Viewer = /*#__PURE__*/function () {
300
248
  this.loader = (0, _utils.createLoader)(this.innerBox);
301
249
  this.container.style.cursor = 'wait';
302
250
  (0, _utils.preloadOriginalImages)(this.srcXConfig, srcX, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.X, event));
303
-
304
251
  if (this.allowSpinY) {
305
252
  var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
306
253
  (0, _utils.preloadOriginalImages)(this.srcYConfig, srcY, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.Y, event));
@@ -312,12 +259,10 @@ var CI360Viewer = /*#__PURE__*/function () {
312
259
  if (!this.imagesLoaded) return;
313
260
  var isMouseOnHotspotElement = (0, _utils.isMouseOnHotspot)();
314
261
  this.hideInitialIcons();
315
-
316
262
  if (this.autoplay || this.loopTimeoutId) {
317
263
  this.stop();
318
264
  this.autoplay = false;
319
265
  }
320
-
321
266
  this.intialPositions = {
322
267
  x: event.touches[0].clientX,
323
268
  y: event.touches[0].clientY
@@ -327,7 +272,6 @@ var CI360Viewer = /*#__PURE__*/function () {
327
272
  y: event.touches[0].clientY
328
273
  };
329
274
  this.isClicked = true;
330
-
331
275
  if (isMouseOnHotspotElement) {
332
276
  this.isClicked = false;
333
277
  }
@@ -348,11 +292,9 @@ var CI360Viewer = /*#__PURE__*/function () {
348
292
  key: "touchMove",
349
293
  value: function touchMove(event) {
350
294
  if (!this.isClicked || !this.imagesLoaded) return;
351
-
352
- if (event.cancelable) {
295
+ if (event.cancelable && this.allowSpinY) {
353
296
  event.preventDefault();
354
297
  }
355
-
356
298
  var nextPositions = {
357
299
  x: event.touches[0].clientX,
358
300
  y: event.touches[0].clientY
@@ -364,11 +306,9 @@ var CI360Viewer = /*#__PURE__*/function () {
364
306
  key: "keyDownGeneral",
365
307
  value: function keyDownGeneral(event) {
366
308
  if (!this.imagesLoaded) return;
367
-
368
309
  if (this.glass) {
369
310
  this.closeMagnifier();
370
311
  }
371
-
372
312
  if (event.keyCode === 27) {
373
313
  //ESC
374
314
  if (this.mouseTracked) {
@@ -382,7 +322,6 @@ var CI360Viewer = /*#__PURE__*/function () {
382
322
  if (this.glass) {
383
323
  this.closeMagnifier();
384
324
  }
385
-
386
325
  if (this.view360Icon) {
387
326
  this.remove360ViewIcon();
388
327
  }
@@ -409,32 +348,26 @@ var CI360Viewer = /*#__PURE__*/function () {
409
348
  key: "keyDown",
410
349
  value: function keyDown(event) {
411
350
  if (!this.imagesLoaded) return;
412
-
413
351
  if (this.glass) {
414
352
  this.closeMagnifier();
415
353
  }
416
-
417
354
  if (event.keyCode === 37) {
418
355
  // left
419
356
  this.keysReverse ? this.left() : this.right();
420
357
  this.onSpin();
421
358
  }
422
-
423
359
  if (event.keyCode === 39) {
424
360
  // right
425
361
  this.keysReverse ? this.right() : this.left();
426
362
  this.onSpin();
427
363
  }
428
-
429
364
  if (this.allowSpinY) {
430
365
  event.preventDefault();
431
-
432
366
  if (event.keyCode === 38) {
433
367
  // up
434
368
  this.keysReverse ? this.top() : this.bottom();
435
369
  this.onSpin();
436
370
  }
437
-
438
371
  if (event.keyCode === 40) {
439
372
  // down
440
373
  this.keysReverse ? this.bottom() : this.top();
@@ -448,11 +381,9 @@ var CI360Viewer = /*#__PURE__*/function () {
448
381
  if (this.bottomCircle) {
449
382
  this.hide360ViewCircleIcon();
450
383
  }
451
-
452
384
  if (this.view360Icon) {
453
385
  this.remove360ViewIcon();
454
386
  }
455
-
456
387
  if (this.autoplay || this.loopTimeoutId) {
457
388
  this.stop();
458
389
  this.autoplay = false;
@@ -462,7 +393,6 @@ var CI360Viewer = /*#__PURE__*/function () {
462
393
  key: "keyUp",
463
394
  value: function keyUp(event) {
464
395
  if (!this.imagesLoaded) return;
465
-
466
396
  if ([37, 39].indexOf(event.keyCode) !== -1) {
467
397
  this.onFinishSpin();
468
398
  }
@@ -476,13 +406,10 @@ var CI360Viewer = /*#__PURE__*/function () {
476
406
  key: "moveActiveIndexUp",
477
407
  value: function moveActiveIndexUp(itemsSkipped) {
478
408
  var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
479
-
480
409
  if (this.stopAtEdges) {
481
410
  var isReachedTheEdge = this.activeImageX + itemsSkipped >= this.amountX;
482
-
483
411
  if (isReachedTheEdge) {
484
412
  this.activeImageX = this.amountX;
485
-
486
413
  if (isReverse ? this.leftElem : this.rightElem) {
487
414
  (0, _utils.addClass)(isReverse ? this.leftElem : this.rightElem, 'not-active');
488
415
  }
@@ -500,13 +427,10 @@ var CI360Viewer = /*#__PURE__*/function () {
500
427
  key: "moveActiveIndexDown",
501
428
  value: function moveActiveIndexDown(itemsSkipped) {
502
429
  var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
503
-
504
430
  if (this.stopAtEdges) {
505
431
  var isReachedTheEdge = this.activeImageX - itemsSkipped <= 1;
506
-
507
432
  if (isReachedTheEdge) {
508
433
  this.activeImageX = 1;
509
-
510
434
  if (isReverse ? this.rightElem : this.leftElem) {
511
435
  (0, _utils.addClass)(isReverse ? this.rightElem : this.leftElem, 'not-active');
512
436
  }
@@ -528,13 +452,10 @@ var CI360Viewer = /*#__PURE__*/function () {
528
452
  key: "moveActiveYIndexUp",
529
453
  value: function moveActiveYIndexUp(itemsSkipped) {
530
454
  var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
531
-
532
455
  if (this.stopAtEdges) {
533
456
  var isReachedTheEdge = this.activeImageY + itemsSkipped >= this.amountY;
534
-
535
457
  if (isReachedTheEdge) {
536
458
  this.activeImageY = this.amountY;
537
-
538
459
  if (isReverse ? this.bottomElem : this.topElem) {
539
460
  (0, _utils.addClass)(isReverse ? this.bottomElem : this.topElem, 'not-active');
540
461
  }
@@ -552,13 +473,10 @@ var CI360Viewer = /*#__PURE__*/function () {
552
473
  key: "moveActiveYIndexDown",
553
474
  value: function moveActiveYIndexDown(itemsSkipped) {
554
475
  var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
555
-
556
476
  if (this.stopAtEdges) {
557
477
  var isReachedTheEdge = this.activeImageY - itemsSkipped <= 1;
558
-
559
478
  if (isReachedTheEdge) {
560
479
  this.activeImageY = 1;
561
-
562
480
  if (isReverse ? this.topElem : this.bottomElem) {
563
481
  (0, _utils.addClass)(isReverse ? this.topElem : this.bottomElem, 'not-active');
564
482
  }
@@ -622,7 +540,6 @@ var CI360Viewer = /*#__PURE__*/function () {
622
540
  var isMoveTop = this.movementStart.y - currentPositionY >= this.speedFactor;
623
541
  var isMoveBottom = currentPositionY - this.movementStart.y >= this.speedFactor;
624
542
  if (this.bottomCircle) this.hide360ViewCircleIcon();
625
-
626
543
  if (isMoveRight && this.movingDirection === _constants.ORIENTATIONS.X) {
627
544
  this.moveRight(currentPositionX);
628
545
  this.isStartSpin = true;
@@ -684,7 +601,6 @@ var CI360Viewer = /*#__PURE__*/function () {
684
601
  key: "updateContainerAndCanvasSize",
685
602
  value: function updateContainerAndCanvasSize(image) {
686
603
  var imageAspectRatio = (0, _utils.getImageAspectRatio)(image, this.ratio);
687
-
688
604
  if (this.fullscreenView) {
689
605
  this.container.width = window.innerWidth * this.devicePixelRatio;
690
606
  this.container.style.width = window.innerWidth + 'px';
@@ -697,7 +613,6 @@ var CI360Viewer = /*#__PURE__*/function () {
697
613
  this.canvas.style.height = window.innerHeight + 'px';
698
614
  return;
699
615
  }
700
-
701
616
  this.canvas.width = this.container.offsetWidth * this.devicePixelRatio;
702
617
  this.canvas.style.width = this.container.offsetWidth + 'px';
703
618
  this.canvas.height = this.container.offsetWidth / imageAspectRatio * this.devicePixelRatio;
@@ -711,15 +626,7 @@ var CI360Viewer = /*#__PURE__*/function () {
711
626
  } else {
712
627
  this.resizedImagesX[index] = image;
713
628
  }
714
-
715
- var loadedResizedXImages = this.resizedImagesX.filter(function (image) {
716
- return image;
717
- });
718
- var loadedResizedYImages = this.resizedImagesY.filter(function (image) {
719
- return image;
720
- });
721
- var isAllImagesLoaded = loadedResizedXImages.length + loadedResizedYImages.length === this.amountX + this.amountY;
722
-
629
+ var isAllImagesLoaded = this.resizedImagesX.length + this.resizedImagesY.length === this.amountX + this.amountY;
723
630
  if (isAllImagesLoaded) {
724
631
  this.imagesX = this.resizedImagesX;
725
632
  this.imagesY = this.resizedImagesY;
@@ -745,11 +652,10 @@ var CI360Viewer = /*#__PURE__*/function () {
745
652
  var responsive = this.ciParams.ciToken;
746
653
  var firstImage = this.imagesX[0];
747
654
  this.update();
748
- if (!responsive || this.container.offsetWidth < firstImage.width * 1.5) return;
655
+ if (!responsive || !this.requestResponsiveImages || this.container.offsetWidth < firstImage.width * 1.5) return;
749
656
  this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
750
657
  var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
751
658
  (0, _utils.preloadImages)(this.srcXConfig, srcX, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.X));
752
-
753
659
  if (this.allowSpinY) {
754
660
  var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
755
661
  (0, _utils.preloadImages)(this.srcYConfig, srcY, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.Y));
@@ -759,23 +665,19 @@ var CI360Viewer = /*#__PURE__*/function () {
759
665
  key: "update",
760
666
  value: function update() {
761
667
  var image = this.imagesX[this.activeImageX - 1];
762
-
763
668
  if (this.movingDirection === _constants.ORIENTATIONS.Y) {
764
669
  image = this.imagesY[this.activeImageY - 1];
765
670
  }
766
-
767
671
  if (!image) return;
768
672
  var ctx = this.canvas.getContext("2d");
769
673
  ctx.scale(this.devicePixelRatio, this.devicePixelRatio);
770
674
  this.updateContainerAndCanvasSize(image);
771
-
772
675
  if (this.fullscreenView) {
773
676
  var _contain = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
774
- width = _contain.width,
775
- height = _contain.height,
776
- offsetX = _contain.offsetX,
777
- offsetY = _contain.offsetY;
778
-
677
+ width = _contain.width,
678
+ height = _contain.height,
679
+ offsetX = _contain.offsetX,
680
+ offsetY = _contain.offsetY;
779
681
  ctx.drawImage(image, offsetX, offsetY, width, height);
780
682
  } else {
781
683
  if (this.mouseTracked) {
@@ -784,11 +686,9 @@ var CI360Viewer = /*#__PURE__*/function () {
784
686
  if (this.hotspotsConfigs && !this.autoplay) {
785
687
  (0, _utils.updateHotspots)(this.container, this.hotspotsConfigs, this.activeImageX, this.activeImageY, this.movingDirection, this.isClicked);
786
688
  }
787
-
788
689
  ctx.drawImage(image, 0, 0, this.canvas.width, this.canvas.height);
789
690
  }
790
691
  }
791
-
792
692
  if (this.info) {
793
693
  this.showImageInfo(ctx);
794
694
  }
@@ -797,11 +697,9 @@ var CI360Viewer = /*#__PURE__*/function () {
797
697
  key: "updateImageScale",
798
698
  value: function updateImageScale(ctx) {
799
699
  var image = this.originalImagesX[this.activeImageX - 1];
800
-
801
700
  if (this.movingDirection === _constants.ORIENTATIONS.Y) {
802
701
  image = this.originalImagesY[this.activeImageY - 1];
803
702
  }
804
-
805
703
  var position = this.getCursorPositionInCanvas();
806
704
  var imageWidth = this.canvas.width;
807
705
  var imageHeight = this.canvas.height;
@@ -817,7 +715,6 @@ var CI360Viewer = /*#__PURE__*/function () {
817
715
  if (this.loader) {
818
716
  this.loader.style.width = percentage + '%';
819
717
  }
820
-
821
718
  if (this.view360Icon) {
822
719
  this.view360Icon.innerText = percentage + '%';
823
720
  }
@@ -829,14 +726,12 @@ var CI360Viewer = /*#__PURE__*/function () {
829
726
  var ctx = this.canvas.getContext("2d");
830
727
  ctx.scale(this.devicePixelRatio, this.devicePixelRatio);
831
728
  this.updateContainerAndCanvasSize(image);
832
-
833
729
  if (this.fullscreenView) {
834
730
  var _contain2 = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
835
- offsetX = _contain2.offsetX,
836
- offsetY = _contain2.offsetY,
837
- width = _contain2.width,
838
- height = _contain2.height;
839
-
731
+ offsetX = _contain2.offsetX,
732
+ offsetY = _contain2.offsetY,
733
+ width = _contain2.width,
734
+ height = _contain2.height;
840
735
  this.offset = {
841
736
  x: offsetX,
842
737
  y: offsetY
@@ -846,23 +741,18 @@ var CI360Viewer = /*#__PURE__*/function () {
846
741
  } else {
847
742
  ctx.drawImage(image, 0, 0, this.canvas.width, this.canvas.height);
848
743
  }
849
-
850
744
  if (this.info) {
851
745
  this.showImageInfo(ctx);
852
746
  }
853
-
854
747
  if (this.magnifier) {
855
748
  this.addMagnifier();
856
749
  }
857
-
858
750
  if (this.boxShadow && !this.fullscreenView) {
859
751
  this.boxShadowEl = (0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
860
752
  }
861
-
862
753
  if (this.bottomCircle && !this.fullscreenView) {
863
754
  this.add360ViewCircleIcon();
864
755
  }
865
-
866
756
  if (this.fullscreen && !this.fullscreenView) {
867
757
  this.addFullscreenIcon();
868
758
  }
@@ -872,48 +762,39 @@ var CI360Viewer = /*#__PURE__*/function () {
872
762
  value: function onAllImagesLoaded() {
873
763
  this.removeLoader();
874
764
  this.imagesLoaded = true;
875
-
876
765
  if (this.autoplay && this.pointerZoom) {
877
766
  this.container.style.cursor = 'zoom-in';
878
767
  } else {
879
768
  this.container.style.cursor = 'grab';
880
769
  }
881
-
882
770
  this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
883
-
884
771
  if (this.autoplay) {
885
772
  this.play();
886
773
  }
887
-
888
774
  if (this.disableDrag) {
889
775
  this.container.style.cursor = 'default';
890
776
  }
891
-
892
777
  if (this.view360Icon) {
893
778
  if (this.hide360Logo) return this.remove360ViewIcon();
894
- this.view360Icon.innerText = ''; //TODO [deprecated]: remove setView360Icon in the upcoming versions
895
-
779
+ this.view360Icon.innerText = '';
780
+ //TODO [deprecated]: remove setView360Icon in the upcoming versions
896
781
  if (this.logoSrc) (0, _ci.setView360Icon)(this.view360Icon, this.logoSrc);
897
782
  }
898
-
899
783
  this.initControls();
900
784
  }
901
785
  }, {
902
786
  key: "magnify",
903
787
  value: function magnify(event) {
904
788
  var _this3 = this;
905
-
906
789
  event.stopPropagation();
907
790
  if (this.mouseTracked) this.togglePointerZoom();
908
791
  var currentOriginalImage = (0, _utils.getCurrentOriginalImage)(this.movingDirection, this.imagesX, this.imagesY, this.activeImageX, this.activeImageY);
909
792
  this.isMagnifyOpen = true;
910
-
911
793
  currentOriginalImage.onload = function () {
912
794
  if (_this3.glass) {
913
795
  _this3.glass.style.cursor = 'none';
914
796
  }
915
797
  };
916
-
917
798
  this.glass = document.createElement('div');
918
799
  this.container.style.overflow = 'hidden';
919
800
  (0, _utils.magnify)(this.container, this.offset, currentOriginalImage, this.glass, this.magnifier || 3);
@@ -939,7 +820,6 @@ var CI360Viewer = /*#__PURE__*/function () {
939
820
  key: "setFullscreenEvents",
940
821
  value: function setFullscreenEvents(_, event) {
941
822
  if (event.type === 'click') return this.closeFullscreenModal(event);
942
-
943
823
  if (event.key === 'Escape' && this.container.parentNode.parentNode === document.body) {
944
824
  this.closeFullscreenModalOnEsc(event);
945
825
  }
@@ -953,18 +833,14 @@ var CI360Viewer = /*#__PURE__*/function () {
953
833
  key: "play",
954
834
  value: function play() {
955
835
  var _this4 = this;
956
-
957
836
  if (this.bottomCircle) this.hide360ViewCircleIcon();
958
837
  this.remove360ViewIcon();
959
838
  this.loopTimeoutId = window.setInterval(function () {
960
839
  _this4.loop(_this4.reversed);
961
-
962
840
  var isPlayedOnce = (0, _utils.isCompletedOneCycle)(_this4.autoplayBehavior, _this4.activeImageX, _this4.activeImageY, _this4.amountX, _this4.amountY, _this4.reversed);
963
-
964
841
  if (_this4.playOnce && isPlayedOnce) {
965
842
  window.clearTimeout(_this4.loopTimeoutId);
966
843
  _this4.autoplay = false;
967
-
968
844
  if (_this4.hotspotsConfigs) {
969
845
  (0, _utils.updateHotspots)(_this4.container, _this4.hotspotsConfigs, _this4.activeImageX, _this4.activeImageY, _this4.movingDirection, _this4.isClicked);
970
846
  }
@@ -981,12 +857,10 @@ var CI360Viewer = /*#__PURE__*/function () {
981
857
  key: "updateView",
982
858
  value: function updateView(forceUpdate, viewers) {
983
859
  var _this5 = this;
984
-
985
860
  var container = this.container;
986
861
  var imageProps = (0, _ci.get360ViewProps)(container);
987
862
  var srcPropsChanged = (0, _utils.isPropsChangeRequireReload)(this, imageProps);
988
863
  var reInitView = srcPropsChanged || forceUpdate;
989
-
990
864
  if (reInitView) {
991
865
  var oldElement = this.container;
992
866
  var viewIndex = viewers.findIndex(function (view) {
@@ -998,7 +872,6 @@ var CI360Viewer = /*#__PURE__*/function () {
998
872
  oldElement.parentNode.replaceChild(container, oldElement);
999
873
  return viewers.splice(viewIndex, 1, new CI360Viewer(container));
1000
874
  }
1001
-
1002
875
  container.style.position = 'relative';
1003
876
  container.style.width = '100%';
1004
877
  container.style.cursor = 'default';
@@ -1009,7 +882,7 @@ var CI360Viewer = /*#__PURE__*/function () {
1009
882
  }, {
1010
883
  key: "destroy",
1011
884
  value: function destroy() {
1012
- stop();
885
+ this.stop();
1013
886
  var oldElement = this.container;
1014
887
  var newElement = oldElement.cloneNode(true);
1015
888
  var innerBox = newElement.querySelector('.cloudimage-360-inner-box');
@@ -1121,7 +994,6 @@ var CI360Viewer = /*#__PURE__*/function () {
1121
994
  key: "remove360ViewIcon",
1122
995
  value: function remove360ViewIcon() {
1123
996
  if (!this.view360Icon) return;
1124
-
1125
997
  try {
1126
998
  this.innerBox.removeChild(this.view360Icon);
1127
999
  this.view360Icon = null;
@@ -1131,53 +1003,34 @@ var CI360Viewer = /*#__PURE__*/function () {
1131
1003
  key: "initControls",
1132
1004
  value: function initControls() {
1133
1005
  var _this6 = this;
1134
-
1135
1006
  var onLeftStart = function onLeftStart(event) {
1136
1007
  event.stopPropagation();
1137
-
1138
1008
  _this6.onSpin();
1139
-
1140
1009
  _this6.left();
1141
-
1142
1010
  _this6.loopTimeoutId = window.setInterval(_this6.left.bind(_this6), _this6.autoplaySpeed);
1143
1011
  };
1144
-
1145
1012
  var onRightStart = function onRightStart(event) {
1146
1013
  event.stopPropagation();
1147
-
1148
1014
  _this6.onSpin();
1149
-
1150
1015
  _this6.right();
1151
-
1152
1016
  _this6.loopTimeoutId = window.setInterval(_this6.right.bind(_this6), _this6.autoplaySpeed);
1153
1017
  };
1154
-
1155
1018
  var onTopStart = function onTopStart(event) {
1156
1019
  event.stopPropagation();
1157
-
1158
1020
  _this6.onSpin();
1159
-
1160
1021
  _this6.top();
1161
-
1162
1022
  _this6.loopTimeoutId = window.setInterval(_this6.top.bind(_this6), _this6.autoplaySpeed);
1163
1023
  };
1164
-
1165
1024
  var onBottomStart = function onBottomStart(event) {
1166
1025
  event.stopPropagation();
1167
-
1168
1026
  _this6.onSpin();
1169
-
1170
1027
  _this6.bottom();
1171
-
1172
1028
  _this6.loopTimeoutId = window.setInterval(_this6.bottom.bind(_this6), _this6.autoplaySpeed);
1173
1029
  };
1174
-
1175
1030
  var onEventEnd = function onEventEnd() {
1176
1031
  _this6.onFinishSpin();
1177
-
1178
1032
  window.clearTimeout(_this6.loopTimeoutId);
1179
1033
  };
1180
-
1181
1034
  var controlsConfig = {
1182
1035
  container: this.container,
1183
1036
  controlReverse: this.controlReverse,
@@ -1201,7 +1054,6 @@ var CI360Viewer = /*#__PURE__*/function () {
1201
1054
  key: "attachEvents",
1202
1055
  value: function attachEvents(draggable, swipeable, keys) {
1203
1056
  window.addEventListener('resize', this.requestResizedImages.bind(this));
1204
-
1205
1057
  if (draggable && !this.disableDrag) {
1206
1058
  this.container.addEventListener('click', this.mouseClick.bind(this));
1207
1059
  this.container.addEventListener('mousedown', this.mouseDown.bind(this));
@@ -1209,7 +1061,6 @@ var CI360Viewer = /*#__PURE__*/function () {
1209
1061
  this.container.addEventListener('mouseleave', this.mouseLeave.bind(this));
1210
1062
  document.addEventListener('mouseup', this.mouseUp.bind(this));
1211
1063
  }
1212
-
1213
1064
  if (swipeable && !this.disableDrag) {
1214
1065
  this.container.addEventListener('touchstart', this.touchStart.bind(this), {
1215
1066
  passive: true
@@ -1217,65 +1068,61 @@ var CI360Viewer = /*#__PURE__*/function () {
1217
1068
  this.container.addEventListener('touchend', this.touchEnd.bind(this));
1218
1069
  this.container.addEventListener('touchmove', this.touchMove.bind(this));
1219
1070
  }
1220
-
1221
1071
  if (keys) {
1222
1072
  document.addEventListener('keydown', this.keyDown.bind(this));
1223
1073
  document.addEventListener('keyup', this.keyUp.bind(this));
1224
1074
  }
1225
-
1226
1075
  document.addEventListener('keydown', this.keyDownGeneral.bind(this));
1227
1076
  }
1228
1077
  }, {
1229
1078
  key: "init",
1230
1079
  value: function init(container) {
1231
1080
  var _this7 = this;
1232
-
1233
1081
  var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1234
-
1235
1082
  var _get360ViewProps = (0, _ci.get360ViewProps)(container),
1236
- folder = _get360ViewProps.folder,
1237
- apiVersion = _get360ViewProps.apiVersion,
1238
- filenameX = _get360ViewProps.filenameX,
1239
- filenameY = _get360ViewProps.filenameY,
1240
- imageListX = _get360ViewProps.imageListX,
1241
- imageListY = _get360ViewProps.imageListY,
1242
- indexZeroBase = _get360ViewProps.indexZeroBase,
1243
- amountX = _get360ViewProps.amountX,
1244
- amountY = _get360ViewProps.amountY,
1245
- _get360ViewProps$drag = _get360ViewProps.draggable,
1246
- draggable = _get360ViewProps$drag === void 0 ? true : _get360ViewProps$drag,
1247
- _get360ViewProps$swip = _get360ViewProps.swipeable,
1248
- swipeable = _get360ViewProps$swip === void 0 ? true : _get360ViewProps$swip,
1249
- keys = _get360ViewProps.keys,
1250
- keysReverse = _get360ViewProps.keysReverse,
1251
- bottomCircle = _get360ViewProps.bottomCircle,
1252
- bottomCircleOffset = _get360ViewProps.bottomCircleOffset,
1253
- boxShadow = _get360ViewProps.boxShadow,
1254
- autoplay = _get360ViewProps.autoplay,
1255
- autoplayBehavior = _get360ViewProps.autoplayBehavior,
1256
- playOnce = _get360ViewProps.playOnce,
1257
- speed = _get360ViewProps.speed,
1258
- autoplayReverse = _get360ViewProps.autoplayReverse,
1259
- _get360ViewProps$disa = _get360ViewProps.disableDrag,
1260
- disableDrag = _get360ViewProps$disa === void 0 ? true : _get360ViewProps$disa,
1261
- fullscreen = _get360ViewProps.fullscreen,
1262
- magnifier = _get360ViewProps.magnifier,
1263
- ciToken = _get360ViewProps.ciToken,
1264
- ciFilters = _get360ViewProps.ciFilters,
1265
- ciTransformation = _get360ViewProps.ciTransformation,
1266
- lazyload = _get360ViewProps.lazyload,
1267
- lazySelector = _get360ViewProps.lazySelector,
1268
- spinReverse = _get360ViewProps.spinReverse,
1269
- dragSpeed = _get360ViewProps.dragSpeed,
1270
- stopAtEdges = _get360ViewProps.stopAtEdges,
1271
- controlReverse = _get360ViewProps.controlReverse,
1272
- hide360Logo = _get360ViewProps.hide360Logo,
1273
- logoSrc = _get360ViewProps.logoSrc,
1274
- pointerZoom = _get360ViewProps.pointerZoom,
1275
- ratio = _get360ViewProps.ratio,
1276
- _get360ViewProps$imag = _get360ViewProps.imageInfo,
1277
- imageInfo = _get360ViewProps$imag === void 0 ? 'black' : _get360ViewProps$imag;
1278
-
1083
+ folder = _get360ViewProps.folder,
1084
+ apiVersion = _get360ViewProps.apiVersion,
1085
+ filenameX = _get360ViewProps.filenameX,
1086
+ filenameY = _get360ViewProps.filenameY,
1087
+ imageListX = _get360ViewProps.imageListX,
1088
+ imageListY = _get360ViewProps.imageListY,
1089
+ indexZeroBase = _get360ViewProps.indexZeroBase,
1090
+ amountX = _get360ViewProps.amountX,
1091
+ amountY = _get360ViewProps.amountY,
1092
+ _get360ViewProps$drag = _get360ViewProps.draggable,
1093
+ draggable = _get360ViewProps$drag === void 0 ? true : _get360ViewProps$drag,
1094
+ _get360ViewProps$swip = _get360ViewProps.swipeable,
1095
+ swipeable = _get360ViewProps$swip === void 0 ? true : _get360ViewProps$swip,
1096
+ keys = _get360ViewProps.keys,
1097
+ keysReverse = _get360ViewProps.keysReverse,
1098
+ bottomCircle = _get360ViewProps.bottomCircle,
1099
+ bottomCircleOffset = _get360ViewProps.bottomCircleOffset,
1100
+ boxShadow = _get360ViewProps.boxShadow,
1101
+ autoplay = _get360ViewProps.autoplay,
1102
+ autoplayBehavior = _get360ViewProps.autoplayBehavior,
1103
+ playOnce = _get360ViewProps.playOnce,
1104
+ speed = _get360ViewProps.speed,
1105
+ autoplayReverse = _get360ViewProps.autoplayReverse,
1106
+ _get360ViewProps$disa = _get360ViewProps.disableDrag,
1107
+ disableDrag = _get360ViewProps$disa === void 0 ? true : _get360ViewProps$disa,
1108
+ fullscreen = _get360ViewProps.fullscreen,
1109
+ magnifier = _get360ViewProps.magnifier,
1110
+ ciToken = _get360ViewProps.ciToken,
1111
+ ciFilters = _get360ViewProps.ciFilters,
1112
+ ciTransformation = _get360ViewProps.ciTransformation,
1113
+ lazyload = _get360ViewProps.lazyload,
1114
+ lazySelector = _get360ViewProps.lazySelector,
1115
+ spinReverse = _get360ViewProps.spinReverse,
1116
+ dragSpeed = _get360ViewProps.dragSpeed,
1117
+ stopAtEdges = _get360ViewProps.stopAtEdges,
1118
+ controlReverse = _get360ViewProps.controlReverse,
1119
+ hide360Logo = _get360ViewProps.hide360Logo,
1120
+ logoSrc = _get360ViewProps.logoSrc,
1121
+ pointerZoom = _get360ViewProps.pointerZoom,
1122
+ ratio = _get360ViewProps.ratio,
1123
+ _get360ViewProps$imag = _get360ViewProps.imageInfo,
1124
+ imageInfo = _get360ViewProps$imag === void 0 ? 'black' : _get360ViewProps$imag,
1125
+ requestResponsiveImages = _get360ViewProps.requestResponsiveImages;
1279
1126
  var ciParams = {
1280
1127
  ciToken: ciToken,
1281
1128
  ciFilters: ciFilters,
@@ -1320,47 +1167,38 @@ var CI360Viewer = /*#__PURE__*/function () {
1320
1167
  this.info = imageInfo;
1321
1168
  this.keys = keys;
1322
1169
  this.ratio = ratio && JSON.parse(ratio);
1323
-
1170
+ this.requestResponsiveImages = requestResponsiveImages;
1324
1171
  if (update) {
1325
1172
  (0, _utils.removeChildFromParent)(this.innerBox, this.iconsContainer);
1326
1173
  (0, _utils.removeChildFromParent)(this.innerBox, this.boxShadowEl);
1327
1174
  (0, _utils.removeChildFromParent)(this.innerBox, this.view360Icon);
1328
1175
  this.remove360ViewCircleIcon();
1329
1176
  this.iconsContainer = (0, _utils.createIconsContainer)(this.innerBox);
1330
-
1331
1177
  if (!this.hide360Logo && !this.lazyload && this.logoSrc) {
1332
1178
  this.add360ViewIcon();
1333
1179
  (0, _ci.setView360Icon)(this.view360Icon, this.logoSrc);
1334
1180
  }
1335
-
1336
1181
  if (this.magnifier) {
1337
1182
  this.addMagnifier();
1338
1183
  }
1339
-
1340
1184
  if (this.bottomCircle && !this.fullscreenView) {
1341
1185
  this.add360ViewCircleIcon();
1342
1186
  }
1343
-
1344
1187
  if (this.fullscreen && !this.fullscreenView) {
1345
1188
  this.addFullscreenIcon();
1346
1189
  }
1347
-
1348
1190
  if (this.boxShadow && !this.fullscreenView) {
1349
1191
  this.boxShadowEl = (0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
1350
1192
  }
1351
-
1352
1193
  return this.onAllImagesLoaded();
1353
1194
  }
1354
-
1355
1195
  this.innerBox = (0, _utils.createInnerBox)(this.container);
1356
1196
  this.iconsContainer = (0, _utils.createIconsContainer)(this.innerBox);
1357
1197
  this.canvas = (0, _utils.createCanvas)(this.innerBox);
1358
1198
  this.loader = (0, _utils.createLoader)(this.innerBox);
1359
-
1360
1199
  if (this.hotspotsConfigs && !this.fullscreenView) {
1361
1200
  (0, _utils.createHotspots)(container, this.hotspotsConfigs);
1362
1201
  }
1363
-
1364
1202
  (0, _utils.applyStylesToContainer)(this.container);
1365
1203
  this.srcXConfig = {
1366
1204
  folder: folder,
@@ -1382,64 +1220,46 @@ var CI360Viewer = /*#__PURE__*/function () {
1382
1220
  amount: this.amountY
1383
1221
  });
1384
1222
  var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
1385
-
1386
1223
  var onImageLoad = function onImageLoad(orientation, image, index) {
1387
- if (orientation !== _constants.ORIENTATIONS.Y) {
1224
+ if (orientation === _constants.ORIENTATIONS.X) {
1388
1225
  _this7.imagesX[index] = image;
1389
1226
  } else {
1390
1227
  _this7.imagesY[index] = image;
1391
1228
  }
1392
-
1393
- var loadedXImages = _this7.imagesX.filter(function (image) {
1394
- return image;
1395
- });
1396
-
1397
- var loadedYImages = _this7.imagesY.filter(function (image) {
1398
- return image;
1399
- });
1400
-
1401
1229
  var totalAmount = _this7.amountX + _this7.amountY;
1402
- var totalLoadedImages = loadedXImages.length + loadedYImages.length;
1230
+ var totalLoadedImages = _this7.imagesX.length + _this7.imagesY.length;
1403
1231
  var isFirstImageLoaded = !index && orientation !== _constants.ORIENTATIONS.Y;
1404
1232
  var percentage = Math.round(totalLoadedImages / totalAmount * 100);
1405
-
1406
1233
  _this7.updatePercentageInLoader(percentage);
1407
-
1408
1234
  if (isFirstImageLoaded) {
1409
1235
  _this7.onFirstImageLoaded(image);
1236
+ } else if (_this7.autoplay) {
1237
+ _this7.moveRight(index);
1410
1238
  }
1411
-
1412
1239
  if (_this7.isReady()) {
1413
1240
  _this7.onAllImagesLoaded();
1414
1241
  }
1415
1242
  };
1416
-
1417
1243
  var loadImages = function loadImages() {
1418
1244
  (0, _utils.preloadImages)(_this7.srcXConfig, srcX, onImageLoad.bind(_this7, _constants.ORIENTATIONS.X));
1419
-
1420
1245
  if (_this7.allowSpinY) {
1421
1246
  var srcY = (0, _utils.generateImagesPath)(_this7.srcYConfig);
1422
1247
  (0, _utils.preloadImages)(_this7.srcYConfig, srcY, onImageLoad.bind(_this7, _constants.ORIENTATIONS.Y));
1423
1248
  }
1424
1249
  };
1425
-
1426
1250
  if (lazyload) {
1427
1251
  var onFirstImageLoad = function onFirstImageLoad(image) {
1428
1252
  _this7.innerBox.removeChild(image);
1429
-
1430
1253
  loadImages();
1431
1254
  };
1432
-
1433
1255
  (0, _utils.initLazyload)(srcX, this.srcXConfig, onFirstImageLoad);
1434
1256
  } else {
1435
1257
  loadImages();
1436
1258
  }
1437
-
1438
1259
  this.attachEvents(draggable, swipeable, keys);
1439
1260
  }
1440
1261
  }]);
1441
1262
  return CI360Viewer;
1442
1263
  }();
1443
-
1444
1264
  var _default = CI360Viewer;
1445
1265
  exports.default = _default;