js-cloudimage-360-view 2.7.2-beta.8 → 2.7.6
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.
- package/CHANGELOG.md +32 -3
- package/LICENSE +13 -1
- package/README.md +169 -88
- package/dist/ci360.service.js +132 -121
- package/dist/ci360.utils.js +4 -6
- package/dist/constants/auto-play-behavior.js +13 -0
- package/dist/constants/falsy-values.js +8 -0
- package/dist/constants/image-src-props.js +8 -0
- package/dist/constants/index.js +43 -0
- package/dist/constants/orientations.js +12 -0
- package/dist/constants/regex.js +10 -0
- package/dist/index.js +28 -2
- package/dist/utils/auto-play/get-speed-factor.js +14 -0
- package/dist/utils/auto-play/is-completed-one-cycle.js +32 -0
- package/dist/utils/auto-play/loop.js +67 -0
- package/dist/utils/common/add-class.js +18 -0
- package/dist/utils/common/remove-class.js +16 -0
- package/dist/utils/container-elements/apply-styles-to-container.js +16 -0
- package/dist/utils/container-elements/create-360-view-circle-icon.js +16 -0
- package/dist/utils/container-elements/create-360-view-icon.js +15 -0
- package/dist/utils/container-elements/create-box-shadow.js +16 -0
- package/dist/utils/container-elements/create-canvas.js +16 -0
- package/dist/utils/container-elements/create-close-fullscreen-icon.js +14 -0
- package/dist/utils/container-elements/create-fullscreen-icon.js +14 -0
- package/dist/utils/container-elements/create-fullscreen-modal.js +20 -0
- package/dist/utils/container-elements/create-icons-container.js +15 -0
- package/dist/utils/container-elements/create-inner-box.js +15 -0
- package/dist/utils/container-elements/create-loader.js +15 -0
- package/dist/utils/container-elements/create-magnifier-icon.js +14 -0
- package/dist/utils/container-elements/index.js +101 -0
- package/dist/utils/controls/get-item-skipped.js +13 -0
- package/dist/utils/controls/init-controls.js +77 -0
- package/dist/utils/hotspot/attach-popup-events.js +63 -0
- package/dist/utils/hotspot/configs-error-handler.js +30 -0
- package/dist/utils/hotspot/create-popper-instace.js +32 -0
- package/dist/utils/hotspot/elements/create-carousel-dot.js +26 -0
- package/dist/utils/hotspot/elements/create-carousel-image.js +21 -0
- package/dist/utils/hotspot/elements/create-hotspot-icon.js +42 -0
- package/dist/utils/hotspot/elements/create-hotspot-popup-link.js +23 -0
- package/dist/utils/hotspot/elements/create-hotspots.js +20 -0
- package/dist/utils/hotspot/elements/create-images-carousel.js +27 -0
- package/dist/utils/hotspot/elements/create-modal-description.js +15 -0
- package/dist/utils/hotspot/elements/create-modal-title.js +15 -0
- package/dist/utils/hotspot/elements/create-model-elements.js +49 -0
- package/dist/utils/hotspot/elements/create-popup-arrow.js +16 -0
- package/dist/utils/hotspot/elements/create-popup.js +60 -0
- package/dist/utils/hotspot/fill-previous-coord-with-previous.js +26 -0
- package/dist/utils/hotspot/generate-hotspots-configs.js +41 -0
- package/dist/utils/hotspot/generate-popup-config.js +34 -0
- package/dist/utils/hotspot/get-hotspot-icon.js +14 -0
- package/dist/utils/hotspot/get-hotspot-orientation.js +21 -0
- package/dist/utils/hotspot/get-hotspot-popup-node.js +19 -0
- package/dist/utils/hotspot/get-hotspot-variant.js +20 -0
- package/dist/utils/hotspot/get-popup-node.js +14 -0
- package/dist/utils/hotspot/hide-hotspot-icon.js +13 -0
- package/dist/utils/hotspot/hide-hotspots-icons.js +18 -0
- package/dist/utils/hotspot/is-mouse-on-hotspot.js +14 -0
- package/dist/utils/hotspot/prepare-hotspots-positions.js +28 -0
- package/dist/utils/hotspot/set-current-slide.js +23 -0
- package/dist/utils/hotspot/update-hotspot-icon-position.js +21 -0
- package/dist/utils/hotspot/update-hotspots.js +60 -0
- package/dist/utils/image-src/generate-images-path.js +40 -0
- package/dist/utils/image-src/is-src-props-changed.js +23 -0
- package/dist/utils/index.js +228 -0
- package/dist/utils/load-images/images-from-folder/prepare-images-from-folder.js +36 -0
- package/dist/utils/load-images/images-from-list/prepare-images-from-list.js +37 -0
- package/dist/utils/load-images/load-image-as-promise.js +79 -0
- package/dist/utils/load-images/load-image.js +26 -0
- package/dist/utils/load-images/load-images-relative-to-container-size.js +58 -0
- package/dist/utils/load-images/load-original-images.js +58 -0
- package/dist/utils/load-images/pad.js +14 -0
- package/dist/utils/load-images/preload-images.js +38 -0
- package/dist/utils/load-images/preload-original-images.js +38 -0
- package/dist/utils/magnify/get-current-original-image.js +29 -0
- package/dist/utils/magnify/get-cursor-position.js +24 -0
- package/dist/utils/magnify/magnify.js +54 -0
- package/dist/utils/magnify/move-magnifier.js +47 -0
- package/dist/utils/responsive/contain.js +11 -0
- package/dist/utils/responsive/fit.js +33 -0
- package/dist/utils/responsive/get-image-aspect-ratio.js +39 -0
- package/dist/utils/responsive/get-responsive-width-of-container.js +14 -0
- package/dist/utils/responsive/get-size-according-to-pixel-ratio.js +17 -0
- package/dist/utils/responsive/get-size-limit.js +14 -0
- package/dist/utils/spin-y/get-moving-direction.js +21 -0
- package/dist/utils/zoom/generate-zoom-in-steps.js +20 -0
- package/dist/utils/zoom/generate-zoom-out-steps.js +20 -0
- package/package.json +4 -3
- package/.vscode/settings.json +0 -2
- package/dist/ci360.constants.js +0 -34
package/dist/ci360.service.js
CHANGED
|
@@ -15,11 +15,11 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
15
15
|
|
|
16
16
|
var _ci = require("./ci360.utils");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _constants = require("./constants/");
|
|
19
19
|
|
|
20
20
|
require("./static/css/style.css");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _utils = require("./utils");
|
|
23
23
|
|
|
24
24
|
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; }
|
|
25
25
|
|
|
@@ -34,7 +34,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
34
34
|
y: 0
|
|
35
35
|
};
|
|
36
36
|
this.isStartSpin = false;
|
|
37
|
-
this.movingDirection =
|
|
37
|
+
this.movingDirection = _constants.ORIENTATIONS.CENTER;
|
|
38
38
|
this.isClicked = false;
|
|
39
39
|
this.loadedImagesX = 0;
|
|
40
40
|
this.loadedImagesY = 0;
|
|
@@ -163,7 +163,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
163
163
|
};
|
|
164
164
|
this.container.style.cursor = 'grabbing';
|
|
165
165
|
this.isDragged = true;
|
|
166
|
-
this.movingDirection = (0,
|
|
166
|
+
this.movingDirection = (0, _utils.getMovingDirection)(this.isStartSpin, this.allowSpinY, this.intialPositions, nextPositions, this.movingDirection);
|
|
167
167
|
this.onMoveHandler(event);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -175,6 +175,10 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
175
175
|
if (this.pointerZoom && this.mouseTracked) {
|
|
176
176
|
this.togglePointerZoom();
|
|
177
177
|
}
|
|
178
|
+
|
|
179
|
+
if (this.isMagnifyOpen) {
|
|
180
|
+
this.closeMagnifier();
|
|
181
|
+
}
|
|
178
182
|
}
|
|
179
183
|
}, {
|
|
180
184
|
key: "togglePointerZoom",
|
|
@@ -187,7 +191,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
187
191
|
}
|
|
188
192
|
|
|
189
193
|
if (this.mouseTracked) {
|
|
190
|
-
var zoomSteps = (0,
|
|
194
|
+
var zoomSteps = (0, _utils.generateZoomOutSteps)(this.pointerZoom);
|
|
191
195
|
this.container.style.cursor = 'zoom-in';
|
|
192
196
|
zoomSteps.forEach(function (step, index) {
|
|
193
197
|
setTimeout(function () {
|
|
@@ -209,7 +213,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
209
213
|
} else {
|
|
210
214
|
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
211
215
|
|
|
212
|
-
var _zoomSteps = (0,
|
|
216
|
+
var _zoomSteps = (0, _utils.generateZoomInSteps)(this.pointerZoom);
|
|
213
217
|
|
|
214
218
|
_zoomSteps.forEach(function (step) {
|
|
215
219
|
setTimeout(function () {
|
|
@@ -226,7 +230,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
226
230
|
}, {
|
|
227
231
|
key: "onOriginalImageLoad",
|
|
228
232
|
value: function onOriginalImageLoad(orientation, event, image, index) {
|
|
229
|
-
if (orientation ===
|
|
233
|
+
if (orientation === _constants.ORIENTATIONS.Y) {
|
|
230
234
|
this.originalImagesY[index] = image;
|
|
231
235
|
} else {
|
|
232
236
|
this.originalImagesX[index] = image;
|
|
@@ -254,15 +258,15 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
254
258
|
}, {
|
|
255
259
|
key: "prepareOriginalImages",
|
|
256
260
|
value: function prepareOriginalImages(event) {
|
|
257
|
-
var srcX = (0,
|
|
261
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
258
262
|
this.isStartedLoadOriginalImages = true;
|
|
259
|
-
this.loader = (0,
|
|
263
|
+
this.loader = (0, _utils.createLoader)(this.innerBox);
|
|
260
264
|
this.container.style.cursor = 'wait';
|
|
261
|
-
(0,
|
|
265
|
+
(0, _utils.preloadOriginalImages)(this.srcXConfig, srcX, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.X, event));
|
|
262
266
|
|
|
263
267
|
if (this.allowSpinY) {
|
|
264
|
-
var srcY = (0,
|
|
265
|
-
(0,
|
|
268
|
+
var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
|
|
269
|
+
(0, _utils.preloadOriginalImages)(this.srcXConfig, srcY, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.Y, event));
|
|
266
270
|
}
|
|
267
271
|
}
|
|
268
272
|
}, {
|
|
@@ -302,11 +306,16 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
302
306
|
key: "touchMove",
|
|
303
307
|
value: function touchMove(event) {
|
|
304
308
|
if (!this.isClicked || !this.imagesLoaded) return;
|
|
309
|
+
|
|
310
|
+
if (event.cancelable) {
|
|
311
|
+
event.preventDefault();
|
|
312
|
+
}
|
|
313
|
+
|
|
305
314
|
var nextPositions = {
|
|
306
315
|
x: event.touches[0].clientX,
|
|
307
316
|
y: event.touches[0].clientY
|
|
308
317
|
};
|
|
309
|
-
this.movingDirection = (0,
|
|
318
|
+
this.movingDirection = (0, _utils.getMovingDirection)(this.isStartSpin, this.allowSpinY, this.intialPositions, nextPositions, this.movingDirection);
|
|
310
319
|
this.onMoveHandler(event);
|
|
311
320
|
}
|
|
312
321
|
}, {
|
|
@@ -433,12 +442,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
433
442
|
this.activeImageX = this.amountX;
|
|
434
443
|
|
|
435
444
|
if (isReverse ? this.leftElem : this.rightElem) {
|
|
436
|
-
(0,
|
|
445
|
+
(0, _utils.addClass)(isReverse ? this.leftElem : this.rightElem, 'not-active');
|
|
437
446
|
}
|
|
438
447
|
} else {
|
|
439
448
|
this.activeImageX += itemsSkipped;
|
|
440
|
-
if (this.rightElem) (0,
|
|
441
|
-
if (this.leftElem) (0,
|
|
449
|
+
if (this.rightElem) (0, _utils.removeClass)(this.rightElem, 'not-active');
|
|
450
|
+
if (this.leftElem) (0, _utils.removeClass)(this.leftElem, 'not-active');
|
|
442
451
|
}
|
|
443
452
|
} else {
|
|
444
453
|
this.activeImageX = (this.activeImageX + itemsSkipped) % this.amountX || this.amountX;
|
|
@@ -457,12 +466,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
457
466
|
this.activeImageX = 1;
|
|
458
467
|
|
|
459
468
|
if (isReverse ? this.rightElem : this.leftElem) {
|
|
460
|
-
(0,
|
|
469
|
+
(0, _utils.addClass)(isReverse ? this.rightElem : this.leftElem, 'not-active');
|
|
461
470
|
}
|
|
462
471
|
} else {
|
|
463
472
|
this.activeImageX -= itemsSkipped;
|
|
464
|
-
if (this.leftElem) (0,
|
|
465
|
-
if (this.rightElem) (0,
|
|
473
|
+
if (this.leftElem) (0, _utils.removeClass)(this.leftElem, 'not-active');
|
|
474
|
+
if (this.rightElem) (0, _utils.removeClass)(this.rightElem, 'not-active');
|
|
466
475
|
}
|
|
467
476
|
} else {
|
|
468
477
|
if (this.activeImageX - itemsSkipped < 1) {
|
|
@@ -485,12 +494,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
485
494
|
this.activeImageY = this.amountY;
|
|
486
495
|
|
|
487
496
|
if (isReverse ? this.bottomElem : this.topElem) {
|
|
488
|
-
(0,
|
|
497
|
+
(0, _utils.addClass)(isReverse ? this.bottomElem : this.topElem, 'not-active');
|
|
489
498
|
}
|
|
490
499
|
} else {
|
|
491
500
|
this.activeImageY += itemsSkipped;
|
|
492
|
-
if (this.topElem) (0,
|
|
493
|
-
if (this.bottomElem) (0,
|
|
501
|
+
if (this.topElem) (0, _utils.removeClass)(this.topElem, 'not-active');
|
|
502
|
+
if (this.bottomElem) (0, _utils.removeClass)(this.bottomElem, 'not-active');
|
|
494
503
|
}
|
|
495
504
|
} else {
|
|
496
505
|
this.activeImageY = (this.activeImageY + itemsSkipped) % this.amountY || this.amountY;
|
|
@@ -509,12 +518,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
509
518
|
this.activeImageY = 1;
|
|
510
519
|
|
|
511
520
|
if (isReverse ? this.topElem : this.bottomElem) {
|
|
512
|
-
(0,
|
|
521
|
+
(0, _utils.addClass)(isReverse ? this.topElem : this.bottomElem, 'not-active');
|
|
513
522
|
}
|
|
514
523
|
} else {
|
|
515
524
|
this.activeImageY -= itemsSkipped;
|
|
516
|
-
if (this.bottomElem) (0,
|
|
517
|
-
if (this.topElem) (0,
|
|
525
|
+
if (this.bottomElem) (0, _utils.removeClass)(this.bottomElem, 'not-active');
|
|
526
|
+
if (this.topElem) (0, _utils.removeClass)(this.topElem, 'not-active');
|
|
518
527
|
}
|
|
519
528
|
} else {
|
|
520
529
|
if (this.activeImageY - itemsSkipped < 1) {
|
|
@@ -528,7 +537,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
528
537
|
}, {
|
|
529
538
|
key: "moveRight",
|
|
530
539
|
value: function moveRight(currentPositionX) {
|
|
531
|
-
var itemsSkippedRight = (0,
|
|
540
|
+
var itemsSkippedRight = (0, _utils.getItemSkipped)(currentPositionX, this.movementStart.x, this.speedFactor);
|
|
532
541
|
this.spinReverse ? this.moveActiveIndexDown(itemsSkippedRight) : this.moveActiveIndexUp(itemsSkippedRight);
|
|
533
542
|
this.movementStart.x = currentPositionX;
|
|
534
543
|
this.activeImageY = 1;
|
|
@@ -537,7 +546,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
537
546
|
}, {
|
|
538
547
|
key: "moveLeft",
|
|
539
548
|
value: function moveLeft(currentPositionX) {
|
|
540
|
-
var itemsSkippedLeft = (0,
|
|
549
|
+
var itemsSkippedLeft = (0, _utils.getItemSkipped)(this.movementStart.x, currentPositionX, this.speedFactor);
|
|
541
550
|
this.spinReverse ? this.moveActiveIndexUp(itemsSkippedLeft) : this.moveActiveIndexDown(itemsSkippedLeft);
|
|
542
551
|
this.activeImageY = 1;
|
|
543
552
|
this.movementStart.x = currentPositionX;
|
|
@@ -546,7 +555,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
546
555
|
}, {
|
|
547
556
|
key: "moveTop",
|
|
548
557
|
value: function moveTop(currentPositionY) {
|
|
549
|
-
var itemsSkippedTop = (0,
|
|
558
|
+
var itemsSkippedTop = (0, _utils.getItemSkipped)(this.movementStart.y, currentPositionY, this.speedFactor);
|
|
550
559
|
this.spinReverse ? this.moveActiveYIndexUp(itemsSkippedTop) : this.moveActiveYIndexDown(itemsSkippedTop);
|
|
551
560
|
this.activeImageX = 1;
|
|
552
561
|
this.movementStart.y = currentPositionY;
|
|
@@ -555,7 +564,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
555
564
|
}, {
|
|
556
565
|
key: "moveBottom",
|
|
557
566
|
value: function moveBottom(currentPositionY) {
|
|
558
|
-
var itemsSkippedBottom = (0,
|
|
567
|
+
var itemsSkippedBottom = (0, _utils.getItemSkipped)(currentPositionY, this.movementStart.y, this.speedFactor);
|
|
559
568
|
this.spinReverse ? this.moveActiveYIndexDown(itemsSkippedBottom) : this.moveActiveYIndexUp(itemsSkippedBottom);
|
|
560
569
|
this.activeImageX = 1;
|
|
561
570
|
this.movementStart.y = currentPositionY;
|
|
@@ -572,16 +581,16 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
572
581
|
var isMoveBottom = currentPositionY - this.movementStart.y >= this.speedFactor;
|
|
573
582
|
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
574
583
|
|
|
575
|
-
if (isMoveRight && this.movingDirection ===
|
|
584
|
+
if (isMoveRight && this.movingDirection === _constants.ORIENTATIONS.X) {
|
|
576
585
|
this.moveRight(currentPositionX);
|
|
577
586
|
this.isStartSpin = true;
|
|
578
|
-
} else if (isMoveLeft && this.movingDirection ===
|
|
587
|
+
} else if (isMoveLeft && this.movingDirection === _constants.ORIENTATIONS.X) {
|
|
579
588
|
this.moveLeft(currentPositionX);
|
|
580
589
|
this.isStartSpin = true;
|
|
581
|
-
} else if (isMoveTop && this.movingDirection ===
|
|
590
|
+
} else if (isMoveTop && this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
582
591
|
this.moveTop(currentPositionY);
|
|
583
592
|
this.isStartSpin = true;
|
|
584
|
-
} else if (isMoveBottom && this.movingDirection ===
|
|
593
|
+
} else if (isMoveBottom && this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
585
594
|
this.moveBottom(currentPositionY);
|
|
586
595
|
this.isStartSpin = true;
|
|
587
596
|
}
|
|
@@ -589,7 +598,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
589
598
|
}, {
|
|
590
599
|
key: "left",
|
|
591
600
|
value: function left() {
|
|
592
|
-
this.movingDirection =
|
|
601
|
+
this.movingDirection = _constants.ORIENTATIONS.X;
|
|
593
602
|
this.activeImageY = this.reversed ? this.amountY : 1;
|
|
594
603
|
this.moveActiveIndexDown(1);
|
|
595
604
|
this.update();
|
|
@@ -597,7 +606,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
597
606
|
}, {
|
|
598
607
|
key: "right",
|
|
599
608
|
value: function right() {
|
|
600
|
-
this.movingDirection =
|
|
609
|
+
this.movingDirection = _constants.ORIENTATIONS.X;
|
|
601
610
|
this.activeImageY = this.reversed ? this.amountY : 1;
|
|
602
611
|
this.moveActiveIndexUp(1);
|
|
603
612
|
this.update();
|
|
@@ -605,7 +614,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
605
614
|
}, {
|
|
606
615
|
key: "top",
|
|
607
616
|
value: function top() {
|
|
608
|
-
this.movingDirection =
|
|
617
|
+
this.movingDirection = _constants.ORIENTATIONS.Y;
|
|
609
618
|
this.activeImageX = this.reversed ? this.amountX : 1;
|
|
610
619
|
this.moveActiveYIndexUp(1);
|
|
611
620
|
this.update();
|
|
@@ -613,7 +622,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
613
622
|
}, {
|
|
614
623
|
key: "bottom",
|
|
615
624
|
value: function bottom() {
|
|
616
|
-
this.movingDirection =
|
|
625
|
+
this.movingDirection = _constants.ORIENTATIONS.Y;
|
|
617
626
|
this.activeImageX = this.reversed ? this.amountX : 1;
|
|
618
627
|
this.moveActiveYIndexDown(1);
|
|
619
628
|
this.update();
|
|
@@ -627,16 +636,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
627
636
|
top: this.top.bind(this),
|
|
628
637
|
bottom: this.bottom.bind(this)
|
|
629
638
|
};
|
|
630
|
-
(0,
|
|
639
|
+
(0, _utils.loop)(this.autoplayBehavior, this.spinY, reversed, loopTriggers);
|
|
631
640
|
}
|
|
632
641
|
}, {
|
|
633
|
-
key: "
|
|
634
|
-
value: function
|
|
635
|
-
var
|
|
636
|
-
var imageAspectRatio = image.width / image.height;
|
|
637
|
-
var isProvidedHeightLessThanWidth = this.containerHeight < this.containerWidth;
|
|
638
|
-
var containerWidth = (0, _jsCloudimage360ViewUtils.getContainerResponsiveWidth)(parentEl, this.containerWidth);
|
|
639
|
-
var containerHeight = (0, _jsCloudimage360ViewUtils.getContainerResponsiveHeight)(this.container, containerWidth, this.containerHeight);
|
|
642
|
+
key: "updateContainerAndCanvasSize",
|
|
643
|
+
value: function updateContainerAndCanvasSize(image) {
|
|
644
|
+
var imageAspectRatio = (0, _utils.getImageAspectRatio)(image, this.ratio);
|
|
640
645
|
|
|
641
646
|
if (this.fullscreenView) {
|
|
642
647
|
this.container.width = window.innerWidth * this.devicePixelRatio;
|
|
@@ -647,29 +652,15 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
647
652
|
return;
|
|
648
653
|
}
|
|
649
654
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
if (!this.containerWidth && !this.containerHeight) {
|
|
657
|
-
this.container.style.height = containerHeight / imageAspectRatio + 'px';
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
if ((isProvidedHeightLessThanWidth || !this.containerWidth) && this.containerHeight) {
|
|
662
|
-
this.container.style.maxWidth = containerHeight * imageAspectRatio + 'px';
|
|
663
|
-
this.container.style.height = containerHeight + 'px';
|
|
664
|
-
} else {
|
|
665
|
-
this.container.style.maxWidth = containerWidth + 'px';
|
|
666
|
-
this.container.style.height = containerWidth / imageAspectRatio + 'px';
|
|
667
|
-
}
|
|
655
|
+
this.canvas.width = this.container.offsetWidth * this.devicePixelRatio;
|
|
656
|
+
this.canvas.style.width = this.container.offsetWidth + 'px';
|
|
657
|
+
this.canvas.height = this.container.offsetWidth / imageAspectRatio * this.devicePixelRatio;
|
|
658
|
+
this.canvas.style.height = this.container.offsetWidth / imageAspectRatio + 'px';
|
|
668
659
|
}
|
|
669
660
|
}, {
|
|
670
661
|
key: "onResizedImageLoad",
|
|
671
662
|
value: function onResizedImageLoad(orientation, image, index) {
|
|
672
|
-
if (orientation ===
|
|
663
|
+
if (orientation === _constants.ORIENTATIONS.Y) {
|
|
673
664
|
this.resizedImagesY[index] = image;
|
|
674
665
|
} else {
|
|
675
666
|
this.resizedImagesX[index] = image;
|
|
@@ -694,16 +685,16 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
694
685
|
value: function requestResizedImages() {
|
|
695
686
|
var responsive = this.ciParams.ciToken;
|
|
696
687
|
var firstImage = this.imagesX[0];
|
|
697
|
-
this.
|
|
688
|
+
this.updateContainerAndCanvasSize(firstImage);
|
|
698
689
|
this.update();
|
|
699
|
-
this.speedFactor = (0,
|
|
700
|
-
var srcX = (0,
|
|
690
|
+
this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
|
|
691
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
701
692
|
if (!responsive || this.container.offsetWidth < firstImage.width * 1.5) return;
|
|
702
|
-
(0,
|
|
693
|
+
(0, _utils.preloadImages)(this.srcXConfig, srcX, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.X), true);
|
|
703
694
|
|
|
704
695
|
if (this.allowSpinY) {
|
|
705
|
-
var srcY = (0,
|
|
706
|
-
(0,
|
|
696
|
+
var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
|
|
697
|
+
(0, _utils.preloadImages)(this.srcYConfig, srcY, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.Y), true);
|
|
707
698
|
}
|
|
708
699
|
}
|
|
709
700
|
}, {
|
|
@@ -711,19 +702,15 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
711
702
|
value: function update() {
|
|
712
703
|
var image = this.imagesX[this.activeImageX - 1];
|
|
713
704
|
|
|
714
|
-
if (this.movingDirection ===
|
|
705
|
+
if (this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
715
706
|
image = this.imagesY[this.activeImageY - 1];
|
|
716
707
|
}
|
|
717
708
|
|
|
718
709
|
var ctx = this.canvas.getContext("2d");
|
|
719
710
|
ctx.scale(this.devicePixelRatio, this.devicePixelRatio);
|
|
720
|
-
this.canvas.width = this.container.offsetWidth * this.devicePixelRatio;
|
|
721
|
-
this.canvas.style.width = this.container.offsetWidth + 'px';
|
|
722
|
-
this.canvas.height = this.container.offsetHeight * this.devicePixelRatio;
|
|
723
|
-
this.canvas.style.height = this.container.offsetHeight + 'px';
|
|
724
711
|
|
|
725
712
|
if (this.fullscreenView) {
|
|
726
|
-
var _contain = (0,
|
|
713
|
+
var _contain = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
|
|
727
714
|
width = _contain.width,
|
|
728
715
|
height = _contain.height,
|
|
729
716
|
offsetX = _contain.offsetX,
|
|
@@ -743,7 +730,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
743
730
|
value: function updateImageScale(ctx) {
|
|
744
731
|
var image = this.originalImagesX[this.activeImageX - 1];
|
|
745
732
|
|
|
746
|
-
if (this.movingDirection ===
|
|
733
|
+
if (this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
747
734
|
image = this.originalImagesY[this.activeImageY - 1];
|
|
748
735
|
}
|
|
749
736
|
|
|
@@ -779,7 +766,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
779
766
|
this.canvas.height = window.innerHeight * this.devicePixelRatio;
|
|
780
767
|
this.canvas.style.height = window.innerHeight + 'px';
|
|
781
768
|
|
|
782
|
-
var _contain2 = (0,
|
|
769
|
+
var _contain2 = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
|
|
783
770
|
offsetX = _contain2.offsetX,
|
|
784
771
|
offsetY = _contain2.offsetY,
|
|
785
772
|
width = _contain2.width,
|
|
@@ -807,7 +794,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
807
794
|
}
|
|
808
795
|
|
|
809
796
|
if (this.boxShadow && !this.fullscreenView) {
|
|
810
|
-
(0,
|
|
797
|
+
(0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
|
|
811
798
|
}
|
|
812
799
|
|
|
813
800
|
if (this.bottomCircle && !this.fullscreenView) {
|
|
@@ -830,7 +817,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
830
817
|
this.container.style.cursor = 'grab';
|
|
831
818
|
}
|
|
832
819
|
|
|
833
|
-
this.speedFactor = (0,
|
|
820
|
+
this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
|
|
834
821
|
|
|
835
822
|
if (this.autoplay) {
|
|
836
823
|
this.play();
|
|
@@ -841,8 +828,9 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
841
828
|
}
|
|
842
829
|
|
|
843
830
|
if (this.view360Icon) {
|
|
844
|
-
this.view360Icon.innerText = '';
|
|
845
|
-
|
|
831
|
+
this.view360Icon.innerText = ''; //TODO [deprecated]: remove setView360Icon in the upcoming versions
|
|
832
|
+
|
|
833
|
+
if (this.logoSrc) (0, _ci.setView360Icon)(this.view360Icon, this.logoSrc);
|
|
846
834
|
}
|
|
847
835
|
|
|
848
836
|
this.initControls();
|
|
@@ -854,7 +842,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
854
842
|
|
|
855
843
|
event.stopPropagation();
|
|
856
844
|
if (this.mouseTracked) this.togglePointerZoom();
|
|
857
|
-
var currentOriginalImage = (0,
|
|
845
|
+
var currentOriginalImage = (0, _utils.getCurrentOriginalImage)(this.movingDirection, this.imagesX, this.imagesY, this.activeImageX, this.activeImageY);
|
|
858
846
|
this.isMagnifyOpen = true;
|
|
859
847
|
|
|
860
848
|
currentOriginalImage.onload = function () {
|
|
@@ -865,7 +853,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
865
853
|
|
|
866
854
|
this.glass = document.createElement('div');
|
|
867
855
|
this.container.style.overflow = 'hidden';
|
|
868
|
-
(0,
|
|
856
|
+
(0, _utils.magnify)(this.container, this.offset, currentOriginalImage, this.glass, this.magnifier || 3);
|
|
869
857
|
}
|
|
870
858
|
}, {
|
|
871
859
|
key: "closeMagnifier",
|
|
@@ -881,7 +869,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
881
869
|
value: function openFullscreenModal(event) {
|
|
882
870
|
event.stopPropagation();
|
|
883
871
|
if (this.mouseTracked) this.togglePointerZoom();
|
|
884
|
-
var fullscreenContainer = (0,
|
|
872
|
+
var fullscreenContainer = (0, _utils.createFullscreenModal)(this.container);
|
|
885
873
|
new CI360Viewer(fullscreenContainer, true);
|
|
886
874
|
}
|
|
887
875
|
}, {
|
|
@@ -908,7 +896,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
908
896
|
this.loopTimeoutId = window.setInterval(function () {
|
|
909
897
|
_this4.loop(_this4.reversed);
|
|
910
898
|
|
|
911
|
-
var isPlayedOnce = (0,
|
|
899
|
+
var isPlayedOnce = (0, _utils.isCompletedOneCycle)(_this4.autoplayBehavior, _this4.activeImageX, _this4.activeImageY, _this4.amountX, _this4.amountY, _this4.reversed);
|
|
912
900
|
|
|
913
901
|
if (_this4.playOnce && isPlayedOnce) {
|
|
914
902
|
window.clearTimeout(_this4.loopTimeoutId);
|
|
@@ -926,6 +914,21 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
926
914
|
if (this.bottomCircle) this.show360ViewCircleIcon();
|
|
927
915
|
window.clearTimeout(this.loopTimeoutId);
|
|
928
916
|
}
|
|
917
|
+
}, {
|
|
918
|
+
key: "updatePlugin",
|
|
919
|
+
value: function updatePlugin(forceUpdate) {
|
|
920
|
+
var container = this.container;
|
|
921
|
+
var imageProps = (0, _ci.get360ViewProps)(container);
|
|
922
|
+
var srcPropsChanged = (0, _utils.isSrcPropsChanged)(this, imageProps);
|
|
923
|
+
var reloadPlugin = srcPropsChanged || forceUpdate;
|
|
924
|
+
container.style.position = 'relative';
|
|
925
|
+
container.style.width = '100%';
|
|
926
|
+
container.style.cursor = 'default';
|
|
927
|
+
container.setAttribute('draggable', 'false');
|
|
928
|
+
if (reloadPlugin) container.innerHTML = '';
|
|
929
|
+
this.stop();
|
|
930
|
+
this.init(container, !reloadPlugin, reloadPlugin);
|
|
931
|
+
}
|
|
929
932
|
}, {
|
|
930
933
|
key: "destroy",
|
|
931
934
|
value: function destroy() {
|
|
@@ -945,7 +948,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
945
948
|
}, {
|
|
946
949
|
key: "addCloseFullscreenView",
|
|
947
950
|
value: function addCloseFullscreenView(event) {
|
|
948
|
-
var closeFullscreenIcon = (0,
|
|
951
|
+
var closeFullscreenIcon = (0, _utils.createCloseFullscreenIcon)();
|
|
949
952
|
closeFullscreenIcon.onclick = this.setFullscreenEvents.bind(this, event);
|
|
950
953
|
window.onkeyup = this.setFullscreenEvents.bind(this, event);
|
|
951
954
|
this.iconsContainer.appendChild(closeFullscreenIcon);
|
|
@@ -953,13 +956,13 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
953
956
|
}, {
|
|
954
957
|
key: "add360ViewIcon",
|
|
955
958
|
value: function add360ViewIcon() {
|
|
956
|
-
this.view360Icon = (0,
|
|
959
|
+
this.view360Icon = (0, _utils.create360ViewIcon)();
|
|
957
960
|
this.innerBox.appendChild(this.view360Icon);
|
|
958
961
|
}
|
|
959
962
|
}, {
|
|
960
963
|
key: "addFullscreenIcon",
|
|
961
964
|
value: function addFullscreenIcon() {
|
|
962
|
-
this.fullscreenIcon = (0,
|
|
965
|
+
this.fullscreenIcon = (0, _utils.createFullscreenIcon)();
|
|
963
966
|
this.fullscreenIcon.onclick = this.openFullscreenModal.bind(this);
|
|
964
967
|
this.iconsContainer.appendChild(this.fullscreenIcon);
|
|
965
968
|
}
|
|
@@ -980,7 +983,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
980
983
|
}, {
|
|
981
984
|
key: "addMagnifier",
|
|
982
985
|
value: function addMagnifier() {
|
|
983
|
-
this.magnifierIcon = (0,
|
|
986
|
+
this.magnifierIcon = (0, _utils.createMagnifierIcon)();
|
|
984
987
|
this.magnifierIcon.onclick = this.magnify.bind(this);
|
|
985
988
|
this.iconsContainer.appendChild(this.magnifierIcon);
|
|
986
989
|
}
|
|
@@ -1008,7 +1011,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1008
1011
|
}, {
|
|
1009
1012
|
key: "add360ViewCircleIcon",
|
|
1010
1013
|
value: function add360ViewCircleIcon() {
|
|
1011
|
-
this.view360CircleIcon = (0,
|
|
1014
|
+
this.view360CircleIcon = (0, _utils.create360ViewCircleIcon)(this.bottomCircleOffset);
|
|
1012
1015
|
this.innerBox.appendChild(this.view360CircleIcon);
|
|
1013
1016
|
}
|
|
1014
1017
|
}, {
|
|
@@ -1108,7 +1111,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1108
1111
|
onBottomStart: onBottomStart,
|
|
1109
1112
|
onEventEnd: onEventEnd
|
|
1110
1113
|
};
|
|
1111
|
-
var controlsElements = (0,
|
|
1114
|
+
var controlsElements = (0, _utils.initControls)(controlsConfig, controlsTriggers);
|
|
1112
1115
|
this.topElem = controlsElements.top || {};
|
|
1113
1116
|
this.bottomElem = controlsElements.bottom || {};
|
|
1114
1117
|
this.leftElem = controlsElements.left || {};
|
|
@@ -1132,9 +1135,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1132
1135
|
passive: true
|
|
1133
1136
|
});
|
|
1134
1137
|
this.container.addEventListener('touchend', this.touchEnd.bind(this));
|
|
1135
|
-
this.container.addEventListener('touchmove', this.touchMove.bind(this)
|
|
1136
|
-
passive: true
|
|
1137
|
-
});
|
|
1138
|
+
this.container.addEventListener('touchmove', this.touchMove.bind(this));
|
|
1138
1139
|
}
|
|
1139
1140
|
|
|
1140
1141
|
if (keys) {
|
|
@@ -1149,6 +1150,9 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1149
1150
|
value: function init(container) {
|
|
1150
1151
|
var _this6 = this;
|
|
1151
1152
|
|
|
1153
|
+
var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1154
|
+
var reload = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1155
|
+
|
|
1152
1156
|
var _get360ViewProps = (0, _ci.get360ViewProps)(container),
|
|
1153
1157
|
folder = _get360ViewProps.folder,
|
|
1154
1158
|
apiVersion = _get360ViewProps.apiVersion,
|
|
@@ -1159,7 +1163,6 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1159
1163
|
indexZeroBase = _get360ViewProps.indexZeroBase,
|
|
1160
1164
|
amountX = _get360ViewProps.amountX,
|
|
1161
1165
|
amountY = _get360ViewProps.amountY,
|
|
1162
|
-
imageOffset = _get360ViewProps.imageOffset,
|
|
1163
1166
|
_get360ViewProps$drag = _get360ViewProps.draggable,
|
|
1164
1167
|
draggable = _get360ViewProps$drag === void 0 ? true : _get360ViewProps$drag,
|
|
1165
1168
|
_get360ViewProps$swip = _get360ViewProps.swipeable,
|
|
@@ -1189,9 +1192,8 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1189
1192
|
controlReverse = _get360ViewProps.controlReverse,
|
|
1190
1193
|
hide360Logo = _get360ViewProps.hide360Logo,
|
|
1191
1194
|
logoSrc = _get360ViewProps.logoSrc,
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
pointerZoom = _get360ViewProps.pointerZoom;
|
|
1195
|
+
pointerZoom = _get360ViewProps.pointerZoom,
|
|
1196
|
+
ratio = _get360ViewProps.ratio;
|
|
1195
1197
|
|
|
1196
1198
|
var ciParams = {
|
|
1197
1199
|
ciToken: ciToken,
|
|
@@ -1210,8 +1212,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1210
1212
|
this.allowSpinY = !!this.amountY;
|
|
1211
1213
|
this.activeImageX = autoplayReverse ? this.amountX : 1;
|
|
1212
1214
|
this.activeImageY = autoplayReverse ? this.amountY : 1;
|
|
1213
|
-
this.spinY = autoplayBehavior ===
|
|
1214
|
-
this.imageOffset = imageOffset;
|
|
1215
|
+
this.spinY = autoplayBehavior === _constants.AUTOPLAY_BEHAVIOR.SPIN_YX ? true : false;
|
|
1215
1216
|
this.bottomCircle = bottomCircle;
|
|
1216
1217
|
this.bottomCircleOffset = bottomCircleOffset;
|
|
1217
1218
|
this.boxShadow = boxShadow;
|
|
@@ -1222,28 +1223,38 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1222
1223
|
this.reversed = autoplayReverse;
|
|
1223
1224
|
this.disableDrag = disableDrag;
|
|
1224
1225
|
this.fullscreen = fullscreen;
|
|
1225
|
-
this.magnifier = !this.isMobile && magnifier ? magnifier :
|
|
1226
|
+
this.magnifier = !this.isMobile && magnifier > 1 ? Math.min(magnifier, 5) : 0;
|
|
1226
1227
|
this.lazyloadX = lazyload;
|
|
1227
1228
|
this.lazyloadY = lazyload;
|
|
1228
1229
|
this.lazySelector = lazySelector;
|
|
1229
1230
|
this.spinReverse = spinReverse;
|
|
1230
1231
|
this.controlReverse = controlReverse;
|
|
1231
|
-
this.dragSpeed = dragSpeed;
|
|
1232
|
+
this.dragSpeed = Math.max(dragSpeed, 50);
|
|
1232
1233
|
this.autoplaySpeed = this.speed * 36 / this.amountX;
|
|
1233
1234
|
this.stopAtEdges = stopAtEdges;
|
|
1234
1235
|
this.hide360Logo = hide360Logo;
|
|
1235
1236
|
this.logoSrc = logoSrc;
|
|
1236
1237
|
this.ciParams = ciParams;
|
|
1237
1238
|
this.apiVersion = apiVersion;
|
|
1238
|
-
this.containerWidth = containerWidth;
|
|
1239
|
-
this.containerHeight = containerHeight;
|
|
1240
1239
|
this.pointerZoom = pointerZoom > 1 ? Math.min(pointerZoom, 3) : 0;
|
|
1241
1240
|
this.keysReverse = keysReverse;
|
|
1242
|
-
this.
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1241
|
+
this.ratio = ratio && JSON.parse(ratio);
|
|
1242
|
+
|
|
1243
|
+
if (reload) {
|
|
1244
|
+
new CI360Viewer(this.container);
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
if (update) {
|
|
1249
|
+
this.onAllImagesLoaded();
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
this.innerBox = (0, _utils.createInnerBox)(this.container);
|
|
1254
|
+
this.iconsContainer = (0, _utils.createIconsContainer)(this.innerBox);
|
|
1255
|
+
this.canvas = (0, _utils.createCanvas)(this.innerBox);
|
|
1256
|
+
this.loader = (0, _utils.createLoader)(this.innerBox);
|
|
1257
|
+
(0, _utils.applyStylesToContainer)(this.container);
|
|
1247
1258
|
this.srcXConfig = {
|
|
1248
1259
|
folder: folder,
|
|
1249
1260
|
filename: filenameX,
|
|
@@ -1260,12 +1271,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1260
1271
|
};
|
|
1261
1272
|
this.srcYConfig = _objectSpread(_objectSpread({}, this.srcXConfig), {}, {
|
|
1262
1273
|
filename: filenameY,
|
|
1263
|
-
orientation:
|
|
1274
|
+
orientation: _constants.ORIENTATIONS.Y,
|
|
1264
1275
|
imageList: imageListY,
|
|
1265
1276
|
amount: this.amountY
|
|
1266
1277
|
});
|
|
1267
|
-
var srcX = (0,
|
|
1268
|
-
var srcY = (0,
|
|
1278
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
1279
|
+
var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
|
|
1269
1280
|
|
|
1270
1281
|
var initLazyload = function initLazyload(image, orientation) {
|
|
1271
1282
|
var lazyloadXConfig = _objectSpread(_objectSpread({}, _this6.srcXConfig), {}, {
|
|
@@ -1276,18 +1287,18 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1276
1287
|
lazyload: false
|
|
1277
1288
|
});
|
|
1278
1289
|
|
|
1279
|
-
if (orientation ===
|
|
1290
|
+
if (orientation === _constants.ORIENTATIONS.Y) {
|
|
1280
1291
|
_this6.lazyloadY = false;
|
|
1281
|
-
(0,
|
|
1292
|
+
(0, _utils.preloadImages)(lazyloadXConfig, srcX, onImageLoad.bind(_this6, _constants.ORIENTATIONS.X));
|
|
1282
1293
|
} else {
|
|
1283
1294
|
_this6.lazyloadX = false;
|
|
1284
1295
|
_this6.lazyloadInitImageX = image;
|
|
1285
|
-
(0,
|
|
1296
|
+
(0, _utils.preloadImages)(lazyloadYConfig, srcY, onImageLoad.bind(_this6, _constants.ORIENTATIONS.Y));
|
|
1286
1297
|
}
|
|
1287
1298
|
};
|
|
1288
1299
|
|
|
1289
1300
|
var onImageLoad = function onImageLoad(orientation, image, index) {
|
|
1290
|
-
if (orientation !==
|
|
1301
|
+
if (orientation !== _constants.ORIENTATIONS.Y) {
|
|
1291
1302
|
_this6.imagesX[index] = image;
|
|
1292
1303
|
} else {
|
|
1293
1304
|
_this6.imagesY[index] = image;
|
|
@@ -1303,7 +1314,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1303
1314
|
|
|
1304
1315
|
var totalAmount = _this6.amountX + _this6.amountY;
|
|
1305
1316
|
var totalLoadedImages = _this6.imagesX.length + _this6.imagesY.length;
|
|
1306
|
-
var isFirstImageLoaded = index === 0 && orientation !==
|
|
1317
|
+
var isFirstImageLoaded = index === 0 && orientation !== _constants.ORIENTATIONS.Y;
|
|
1307
1318
|
var isAllImagesLoaded = loadedXImages.length + loadedYImages.length === _this6.amountX + _this6.amountY;
|
|
1308
1319
|
var percentage = Math.round(totalLoadedImages / totalAmount * 100);
|
|
1309
1320
|
|
|
@@ -1312,7 +1323,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1312
1323
|
if (_this6.lazyloadX || _this6.lazyloadY) return initLazyload(image, orientation);
|
|
1313
1324
|
|
|
1314
1325
|
if (isFirstImageLoaded) {
|
|
1315
|
-
_this6.
|
|
1326
|
+
_this6.updateContainerAndCanvasSize(image);
|
|
1316
1327
|
|
|
1317
1328
|
_this6.onFirstImageLoaded(image);
|
|
1318
1329
|
}
|
|
@@ -1326,10 +1337,10 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1326
1337
|
}
|
|
1327
1338
|
};
|
|
1328
1339
|
|
|
1329
|
-
(0,
|
|
1340
|
+
(0, _utils.preloadImages)(this.srcXConfig, srcX, onImageLoad.bind(this, _constants.ORIENTATIONS.X));
|
|
1330
1341
|
|
|
1331
1342
|
if (this.allowSpinY) {
|
|
1332
|
-
(0,
|
|
1343
|
+
(0, _utils.preloadImages)(this.srcYConfig, srcY, onImageLoad.bind(this, _constants.ORIENTATIONS.Y));
|
|
1333
1344
|
}
|
|
1334
1345
|
|
|
1335
1346
|
this.attachEvents(draggable, swipeable, keys);
|