js-cloudimage-360-view 2.7.2-beta.8 → 2.7.3
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 +16 -3
- package/LICENSE +13 -1
- package/README.md +117 -90
- package/dist/ci360.service.js +81 -80
- package/dist/ci360.utils.js +2 -2
- package/dist/constants/auto-play-behavior.js +13 -0
- package/dist/constants/falsy-values.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 +6 -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/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-container-responsive-height.js +20 -0
- package/dist/utils/responsive/get-container-responsive-width.js +20 -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 +3 -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
|
}
|
|
@@ -187,7 +187,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
if (this.mouseTracked) {
|
|
190
|
-
var zoomSteps = (0,
|
|
190
|
+
var zoomSteps = (0, _utils.generateZoomOutSteps)(this.pointerZoom);
|
|
191
191
|
this.container.style.cursor = 'zoom-in';
|
|
192
192
|
zoomSteps.forEach(function (step, index) {
|
|
193
193
|
setTimeout(function () {
|
|
@@ -209,7 +209,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
209
209
|
} else {
|
|
210
210
|
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
211
211
|
|
|
212
|
-
var _zoomSteps = (0,
|
|
212
|
+
var _zoomSteps = (0, _utils.generateZoomInSteps)(this.pointerZoom);
|
|
213
213
|
|
|
214
214
|
_zoomSteps.forEach(function (step) {
|
|
215
215
|
setTimeout(function () {
|
|
@@ -226,7 +226,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
226
226
|
}, {
|
|
227
227
|
key: "onOriginalImageLoad",
|
|
228
228
|
value: function onOriginalImageLoad(orientation, event, image, index) {
|
|
229
|
-
if (orientation ===
|
|
229
|
+
if (orientation === _constants.ORIENTATIONS.Y) {
|
|
230
230
|
this.originalImagesY[index] = image;
|
|
231
231
|
} else {
|
|
232
232
|
this.originalImagesX[index] = image;
|
|
@@ -254,15 +254,15 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
254
254
|
}, {
|
|
255
255
|
key: "prepareOriginalImages",
|
|
256
256
|
value: function prepareOriginalImages(event) {
|
|
257
|
-
var srcX = (0,
|
|
257
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
258
258
|
this.isStartedLoadOriginalImages = true;
|
|
259
|
-
this.loader = (0,
|
|
259
|
+
this.loader = (0, _utils.createLoader)(this.innerBox);
|
|
260
260
|
this.container.style.cursor = 'wait';
|
|
261
|
-
(0,
|
|
261
|
+
(0, _utils.preloadOriginalImages)(this.srcXConfig, srcX, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.X, event));
|
|
262
262
|
|
|
263
263
|
if (this.allowSpinY) {
|
|
264
|
-
var srcY = (0,
|
|
265
|
-
(0,
|
|
264
|
+
var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
|
|
265
|
+
(0, _utils.preloadOriginalImages)(this.srcXConfig, srcY, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.Y, event));
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}, {
|
|
@@ -306,7 +306,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
306
306
|
x: event.touches[0].clientX,
|
|
307
307
|
y: event.touches[0].clientY
|
|
308
308
|
};
|
|
309
|
-
this.movingDirection = (0,
|
|
309
|
+
this.movingDirection = (0, _utils.getMovingDirection)(this.isStartSpin, this.allowSpinY, this.intialPositions, nextPositions);
|
|
310
310
|
this.onMoveHandler(event);
|
|
311
311
|
}
|
|
312
312
|
}, {
|
|
@@ -433,12 +433,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
433
433
|
this.activeImageX = this.amountX;
|
|
434
434
|
|
|
435
435
|
if (isReverse ? this.leftElem : this.rightElem) {
|
|
436
|
-
(0,
|
|
436
|
+
(0, _utils.addClass)(isReverse ? this.leftElem : this.rightElem, 'not-active');
|
|
437
437
|
}
|
|
438
438
|
} else {
|
|
439
439
|
this.activeImageX += itemsSkipped;
|
|
440
|
-
if (this.rightElem) (0,
|
|
441
|
-
if (this.leftElem) (0,
|
|
440
|
+
if (this.rightElem) (0, _utils.removeClass)(this.rightElem, 'not-active');
|
|
441
|
+
if (this.leftElem) (0, _utils.removeClass)(this.leftElem, 'not-active');
|
|
442
442
|
}
|
|
443
443
|
} else {
|
|
444
444
|
this.activeImageX = (this.activeImageX + itemsSkipped) % this.amountX || this.amountX;
|
|
@@ -457,12 +457,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
457
457
|
this.activeImageX = 1;
|
|
458
458
|
|
|
459
459
|
if (isReverse ? this.rightElem : this.leftElem) {
|
|
460
|
-
(0,
|
|
460
|
+
(0, _utils.addClass)(isReverse ? this.rightElem : this.leftElem, 'not-active');
|
|
461
461
|
}
|
|
462
462
|
} else {
|
|
463
463
|
this.activeImageX -= itemsSkipped;
|
|
464
|
-
if (this.leftElem) (0,
|
|
465
|
-
if (this.rightElem) (0,
|
|
464
|
+
if (this.leftElem) (0, _utils.removeClass)(this.leftElem, 'not-active');
|
|
465
|
+
if (this.rightElem) (0, _utils.removeClass)(this.rightElem, 'not-active');
|
|
466
466
|
}
|
|
467
467
|
} else {
|
|
468
468
|
if (this.activeImageX - itemsSkipped < 1) {
|
|
@@ -485,12 +485,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
485
485
|
this.activeImageY = this.amountY;
|
|
486
486
|
|
|
487
487
|
if (isReverse ? this.bottomElem : this.topElem) {
|
|
488
|
-
(0,
|
|
488
|
+
(0, _utils.addClass)(isReverse ? this.bottomElem : this.topElem, 'not-active');
|
|
489
489
|
}
|
|
490
490
|
} else {
|
|
491
491
|
this.activeImageY += itemsSkipped;
|
|
492
|
-
if (this.topElem) (0,
|
|
493
|
-
if (this.bottomElem) (0,
|
|
492
|
+
if (this.topElem) (0, _utils.removeClass)(this.topElem, 'not-active');
|
|
493
|
+
if (this.bottomElem) (0, _utils.removeClass)(this.bottomElem, 'not-active');
|
|
494
494
|
}
|
|
495
495
|
} else {
|
|
496
496
|
this.activeImageY = (this.activeImageY + itemsSkipped) % this.amountY || this.amountY;
|
|
@@ -509,12 +509,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
509
509
|
this.activeImageY = 1;
|
|
510
510
|
|
|
511
511
|
if (isReverse ? this.topElem : this.bottomElem) {
|
|
512
|
-
(0,
|
|
512
|
+
(0, _utils.addClass)(isReverse ? this.topElem : this.bottomElem, 'not-active');
|
|
513
513
|
}
|
|
514
514
|
} else {
|
|
515
515
|
this.activeImageY -= itemsSkipped;
|
|
516
|
-
if (this.bottomElem) (0,
|
|
517
|
-
if (this.topElem) (0,
|
|
516
|
+
if (this.bottomElem) (0, _utils.removeClass)(this.bottomElem, 'not-active');
|
|
517
|
+
if (this.topElem) (0, _utils.removeClass)(this.topElem, 'not-active');
|
|
518
518
|
}
|
|
519
519
|
} else {
|
|
520
520
|
if (this.activeImageY - itemsSkipped < 1) {
|
|
@@ -528,7 +528,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
528
528
|
}, {
|
|
529
529
|
key: "moveRight",
|
|
530
530
|
value: function moveRight(currentPositionX) {
|
|
531
|
-
var itemsSkippedRight = (0,
|
|
531
|
+
var itemsSkippedRight = (0, _utils.getItemSkipped)(currentPositionX, this.movementStart.x, this.speedFactor);
|
|
532
532
|
this.spinReverse ? this.moveActiveIndexDown(itemsSkippedRight) : this.moveActiveIndexUp(itemsSkippedRight);
|
|
533
533
|
this.movementStart.x = currentPositionX;
|
|
534
534
|
this.activeImageY = 1;
|
|
@@ -537,7 +537,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
537
537
|
}, {
|
|
538
538
|
key: "moveLeft",
|
|
539
539
|
value: function moveLeft(currentPositionX) {
|
|
540
|
-
var itemsSkippedLeft = (0,
|
|
540
|
+
var itemsSkippedLeft = (0, _utils.getItemSkipped)(this.movementStart.x, currentPositionX, this.speedFactor);
|
|
541
541
|
this.spinReverse ? this.moveActiveIndexUp(itemsSkippedLeft) : this.moveActiveIndexDown(itemsSkippedLeft);
|
|
542
542
|
this.activeImageY = 1;
|
|
543
543
|
this.movementStart.x = currentPositionX;
|
|
@@ -546,7 +546,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
546
546
|
}, {
|
|
547
547
|
key: "moveTop",
|
|
548
548
|
value: function moveTop(currentPositionY) {
|
|
549
|
-
var itemsSkippedTop = (0,
|
|
549
|
+
var itemsSkippedTop = (0, _utils.getItemSkipped)(this.movementStart.y, currentPositionY, this.speedFactor);
|
|
550
550
|
this.spinReverse ? this.moveActiveYIndexUp(itemsSkippedTop) : this.moveActiveYIndexDown(itemsSkippedTop);
|
|
551
551
|
this.activeImageX = 1;
|
|
552
552
|
this.movementStart.y = currentPositionY;
|
|
@@ -555,7 +555,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
555
555
|
}, {
|
|
556
556
|
key: "moveBottom",
|
|
557
557
|
value: function moveBottom(currentPositionY) {
|
|
558
|
-
var itemsSkippedBottom = (0,
|
|
558
|
+
var itemsSkippedBottom = (0, _utils.getItemSkipped)(currentPositionY, this.movementStart.y, this.speedFactor);
|
|
559
559
|
this.spinReverse ? this.moveActiveYIndexDown(itemsSkippedBottom) : this.moveActiveYIndexUp(itemsSkippedBottom);
|
|
560
560
|
this.activeImageX = 1;
|
|
561
561
|
this.movementStart.y = currentPositionY;
|
|
@@ -572,16 +572,16 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
572
572
|
var isMoveBottom = currentPositionY - this.movementStart.y >= this.speedFactor;
|
|
573
573
|
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
574
574
|
|
|
575
|
-
if (isMoveRight && this.movingDirection ===
|
|
575
|
+
if (isMoveRight && this.movingDirection === _constants.ORIENTATIONS.X) {
|
|
576
576
|
this.moveRight(currentPositionX);
|
|
577
577
|
this.isStartSpin = true;
|
|
578
|
-
} else if (isMoveLeft && this.movingDirection ===
|
|
578
|
+
} else if (isMoveLeft && this.movingDirection === _constants.ORIENTATIONS.X) {
|
|
579
579
|
this.moveLeft(currentPositionX);
|
|
580
580
|
this.isStartSpin = true;
|
|
581
|
-
} else if (isMoveTop && this.movingDirection ===
|
|
581
|
+
} else if (isMoveTop && this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
582
582
|
this.moveTop(currentPositionY);
|
|
583
583
|
this.isStartSpin = true;
|
|
584
|
-
} else if (isMoveBottom && this.movingDirection ===
|
|
584
|
+
} else if (isMoveBottom && this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
585
585
|
this.moveBottom(currentPositionY);
|
|
586
586
|
this.isStartSpin = true;
|
|
587
587
|
}
|
|
@@ -589,7 +589,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
589
589
|
}, {
|
|
590
590
|
key: "left",
|
|
591
591
|
value: function left() {
|
|
592
|
-
this.movingDirection =
|
|
592
|
+
this.movingDirection = _constants.ORIENTATIONS.X;
|
|
593
593
|
this.activeImageY = this.reversed ? this.amountY : 1;
|
|
594
594
|
this.moveActiveIndexDown(1);
|
|
595
595
|
this.update();
|
|
@@ -597,7 +597,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
597
597
|
}, {
|
|
598
598
|
key: "right",
|
|
599
599
|
value: function right() {
|
|
600
|
-
this.movingDirection =
|
|
600
|
+
this.movingDirection = _constants.ORIENTATIONS.X;
|
|
601
601
|
this.activeImageY = this.reversed ? this.amountY : 1;
|
|
602
602
|
this.moveActiveIndexUp(1);
|
|
603
603
|
this.update();
|
|
@@ -605,7 +605,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
605
605
|
}, {
|
|
606
606
|
key: "top",
|
|
607
607
|
value: function top() {
|
|
608
|
-
this.movingDirection =
|
|
608
|
+
this.movingDirection = _constants.ORIENTATIONS.Y;
|
|
609
609
|
this.activeImageX = this.reversed ? this.amountX : 1;
|
|
610
610
|
this.moveActiveYIndexUp(1);
|
|
611
611
|
this.update();
|
|
@@ -613,7 +613,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
613
613
|
}, {
|
|
614
614
|
key: "bottom",
|
|
615
615
|
value: function bottom() {
|
|
616
|
-
this.movingDirection =
|
|
616
|
+
this.movingDirection = _constants.ORIENTATIONS.Y;
|
|
617
617
|
this.activeImageX = this.reversed ? this.amountX : 1;
|
|
618
618
|
this.moveActiveYIndexDown(1);
|
|
619
619
|
this.update();
|
|
@@ -627,7 +627,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
627
627
|
top: this.top.bind(this),
|
|
628
628
|
bottom: this.bottom.bind(this)
|
|
629
629
|
};
|
|
630
|
-
(0,
|
|
630
|
+
(0, _utils.loop)(this.autoplayBehavior, this.spinY, reversed, loopTriggers);
|
|
631
631
|
}
|
|
632
632
|
}, {
|
|
633
633
|
key: "updateContainerSize",
|
|
@@ -635,8 +635,8 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
635
635
|
var parentEl = this.container.parentNode || {};
|
|
636
636
|
var imageAspectRatio = image.width / image.height;
|
|
637
637
|
var isProvidedHeightLessThanWidth = this.containerHeight < this.containerWidth;
|
|
638
|
-
var containerWidth = (0,
|
|
639
|
-
var containerHeight = (0,
|
|
638
|
+
var containerWidth = (0, _utils.getContainerResponsiveWidth)(parentEl, this.containerWidth);
|
|
639
|
+
var containerHeight = (0, _utils.getContainerResponsiveHeight)(this.container, containerWidth, this.containerHeight);
|
|
640
640
|
|
|
641
641
|
if (this.fullscreenView) {
|
|
642
642
|
this.container.width = window.innerWidth * this.devicePixelRatio;
|
|
@@ -669,7 +669,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
669
669
|
}, {
|
|
670
670
|
key: "onResizedImageLoad",
|
|
671
671
|
value: function onResizedImageLoad(orientation, image, index) {
|
|
672
|
-
if (orientation ===
|
|
672
|
+
if (orientation === _constants.ORIENTATIONS.Y) {
|
|
673
673
|
this.resizedImagesY[index] = image;
|
|
674
674
|
} else {
|
|
675
675
|
this.resizedImagesX[index] = image;
|
|
@@ -696,14 +696,14 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
696
696
|
var firstImage = this.imagesX[0];
|
|
697
697
|
this.updateContainerSize(firstImage);
|
|
698
698
|
this.update();
|
|
699
|
-
this.speedFactor = (0,
|
|
700
|
-
var srcX = (0,
|
|
699
|
+
this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
|
|
700
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
701
701
|
if (!responsive || this.container.offsetWidth < firstImage.width * 1.5) return;
|
|
702
|
-
(0,
|
|
702
|
+
(0, _utils.preloadImages)(this.srcXConfig, srcX, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.X), true);
|
|
703
703
|
|
|
704
704
|
if (this.allowSpinY) {
|
|
705
|
-
var srcY = (0,
|
|
706
|
-
(0,
|
|
705
|
+
var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
|
|
706
|
+
(0, _utils.preloadImages)(this.srcYConfig, srcY, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.Y), true);
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
709
|
}, {
|
|
@@ -711,7 +711,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
711
711
|
value: function update() {
|
|
712
712
|
var image = this.imagesX[this.activeImageX - 1];
|
|
713
713
|
|
|
714
|
-
if (this.movingDirection ===
|
|
714
|
+
if (this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
715
715
|
image = this.imagesY[this.activeImageY - 1];
|
|
716
716
|
}
|
|
717
717
|
|
|
@@ -723,7 +723,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
723
723
|
this.canvas.style.height = this.container.offsetHeight + 'px';
|
|
724
724
|
|
|
725
725
|
if (this.fullscreenView) {
|
|
726
|
-
var _contain = (0,
|
|
726
|
+
var _contain = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
|
|
727
727
|
width = _contain.width,
|
|
728
728
|
height = _contain.height,
|
|
729
729
|
offsetX = _contain.offsetX,
|
|
@@ -743,7 +743,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
743
743
|
value: function updateImageScale(ctx) {
|
|
744
744
|
var image = this.originalImagesX[this.activeImageX - 1];
|
|
745
745
|
|
|
746
|
-
if (this.movingDirection ===
|
|
746
|
+
if (this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
747
747
|
image = this.originalImagesY[this.activeImageY - 1];
|
|
748
748
|
}
|
|
749
749
|
|
|
@@ -779,7 +779,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
779
779
|
this.canvas.height = window.innerHeight * this.devicePixelRatio;
|
|
780
780
|
this.canvas.style.height = window.innerHeight + 'px';
|
|
781
781
|
|
|
782
|
-
var _contain2 = (0,
|
|
782
|
+
var _contain2 = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
|
|
783
783
|
offsetX = _contain2.offsetX,
|
|
784
784
|
offsetY = _contain2.offsetY,
|
|
785
785
|
width = _contain2.width,
|
|
@@ -807,7 +807,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
807
807
|
}
|
|
808
808
|
|
|
809
809
|
if (this.boxShadow && !this.fullscreenView) {
|
|
810
|
-
(0,
|
|
810
|
+
(0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
|
|
811
811
|
}
|
|
812
812
|
|
|
813
813
|
if (this.bottomCircle && !this.fullscreenView) {
|
|
@@ -830,7 +830,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
830
830
|
this.container.style.cursor = 'grab';
|
|
831
831
|
}
|
|
832
832
|
|
|
833
|
-
this.speedFactor = (0,
|
|
833
|
+
this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
|
|
834
834
|
|
|
835
835
|
if (this.autoplay) {
|
|
836
836
|
this.play();
|
|
@@ -841,8 +841,9 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
841
841
|
}
|
|
842
842
|
|
|
843
843
|
if (this.view360Icon) {
|
|
844
|
-
this.view360Icon.innerText = '';
|
|
845
|
-
|
|
844
|
+
this.view360Icon.innerText = ''; //TODO [deprecated]: remove setView360Icon in the upcoming versions
|
|
845
|
+
|
|
846
|
+
if (this.logoSrc) (0, _ci.setView360Icon)(this.view360Icon, this.logoSrc);
|
|
846
847
|
}
|
|
847
848
|
|
|
848
849
|
this.initControls();
|
|
@@ -854,7 +855,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
854
855
|
|
|
855
856
|
event.stopPropagation();
|
|
856
857
|
if (this.mouseTracked) this.togglePointerZoom();
|
|
857
|
-
var currentOriginalImage = (0,
|
|
858
|
+
var currentOriginalImage = (0, _utils.getCurrentOriginalImage)(this.movingDirection, this.imagesX, this.imagesY, this.activeImageX, this.activeImageY);
|
|
858
859
|
this.isMagnifyOpen = true;
|
|
859
860
|
|
|
860
861
|
currentOriginalImage.onload = function () {
|
|
@@ -865,7 +866,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
865
866
|
|
|
866
867
|
this.glass = document.createElement('div');
|
|
867
868
|
this.container.style.overflow = 'hidden';
|
|
868
|
-
(0,
|
|
869
|
+
(0, _utils.magnify)(this.container, this.offset, currentOriginalImage, this.glass, this.magnifier || 3);
|
|
869
870
|
}
|
|
870
871
|
}, {
|
|
871
872
|
key: "closeMagnifier",
|
|
@@ -881,7 +882,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
881
882
|
value: function openFullscreenModal(event) {
|
|
882
883
|
event.stopPropagation();
|
|
883
884
|
if (this.mouseTracked) this.togglePointerZoom();
|
|
884
|
-
var fullscreenContainer = (0,
|
|
885
|
+
var fullscreenContainer = (0, _utils.createFullscreenModal)(this.container);
|
|
885
886
|
new CI360Viewer(fullscreenContainer, true);
|
|
886
887
|
}
|
|
887
888
|
}, {
|
|
@@ -908,7 +909,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
908
909
|
this.loopTimeoutId = window.setInterval(function () {
|
|
909
910
|
_this4.loop(_this4.reversed);
|
|
910
911
|
|
|
911
|
-
var isPlayedOnce = (0,
|
|
912
|
+
var isPlayedOnce = (0, _utils.isCompletedOneCycle)(_this4.autoplayBehavior, _this4.activeImageX, _this4.activeImageY, _this4.amountX, _this4.amountY, _this4.reversed);
|
|
912
913
|
|
|
913
914
|
if (_this4.playOnce && isPlayedOnce) {
|
|
914
915
|
window.clearTimeout(_this4.loopTimeoutId);
|
|
@@ -945,7 +946,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
945
946
|
}, {
|
|
946
947
|
key: "addCloseFullscreenView",
|
|
947
948
|
value: function addCloseFullscreenView(event) {
|
|
948
|
-
var closeFullscreenIcon = (0,
|
|
949
|
+
var closeFullscreenIcon = (0, _utils.createCloseFullscreenIcon)();
|
|
949
950
|
closeFullscreenIcon.onclick = this.setFullscreenEvents.bind(this, event);
|
|
950
951
|
window.onkeyup = this.setFullscreenEvents.bind(this, event);
|
|
951
952
|
this.iconsContainer.appendChild(closeFullscreenIcon);
|
|
@@ -953,13 +954,13 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
953
954
|
}, {
|
|
954
955
|
key: "add360ViewIcon",
|
|
955
956
|
value: function add360ViewIcon() {
|
|
956
|
-
this.view360Icon = (0,
|
|
957
|
+
this.view360Icon = (0, _utils.create360ViewIcon)();
|
|
957
958
|
this.innerBox.appendChild(this.view360Icon);
|
|
958
959
|
}
|
|
959
960
|
}, {
|
|
960
961
|
key: "addFullscreenIcon",
|
|
961
962
|
value: function addFullscreenIcon() {
|
|
962
|
-
this.fullscreenIcon = (0,
|
|
963
|
+
this.fullscreenIcon = (0, _utils.createFullscreenIcon)();
|
|
963
964
|
this.fullscreenIcon.onclick = this.openFullscreenModal.bind(this);
|
|
964
965
|
this.iconsContainer.appendChild(this.fullscreenIcon);
|
|
965
966
|
}
|
|
@@ -980,7 +981,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
980
981
|
}, {
|
|
981
982
|
key: "addMagnifier",
|
|
982
983
|
value: function addMagnifier() {
|
|
983
|
-
this.magnifierIcon = (0,
|
|
984
|
+
this.magnifierIcon = (0, _utils.createMagnifierIcon)();
|
|
984
985
|
this.magnifierIcon.onclick = this.magnify.bind(this);
|
|
985
986
|
this.iconsContainer.appendChild(this.magnifierIcon);
|
|
986
987
|
}
|
|
@@ -1008,7 +1009,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1008
1009
|
}, {
|
|
1009
1010
|
key: "add360ViewCircleIcon",
|
|
1010
1011
|
value: function add360ViewCircleIcon() {
|
|
1011
|
-
this.view360CircleIcon = (0,
|
|
1012
|
+
this.view360CircleIcon = (0, _utils.create360ViewCircleIcon)(this.bottomCircleOffset);
|
|
1012
1013
|
this.innerBox.appendChild(this.view360CircleIcon);
|
|
1013
1014
|
}
|
|
1014
1015
|
}, {
|
|
@@ -1108,7 +1109,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1108
1109
|
onBottomStart: onBottomStart,
|
|
1109
1110
|
onEventEnd: onEventEnd
|
|
1110
1111
|
};
|
|
1111
|
-
var controlsElements = (0,
|
|
1112
|
+
var controlsElements = (0, _utils.initControls)(controlsConfig, controlsTriggers);
|
|
1112
1113
|
this.topElem = controlsElements.top || {};
|
|
1113
1114
|
this.bottomElem = controlsElements.bottom || {};
|
|
1114
1115
|
this.leftElem = controlsElements.left || {};
|
|
@@ -1210,7 +1211,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1210
1211
|
this.allowSpinY = !!this.amountY;
|
|
1211
1212
|
this.activeImageX = autoplayReverse ? this.amountX : 1;
|
|
1212
1213
|
this.activeImageY = autoplayReverse ? this.amountY : 1;
|
|
1213
|
-
this.spinY = autoplayBehavior ===
|
|
1214
|
+
this.spinY = autoplayBehavior === _constants.AUTOPLAY_BEHAVIOR.SPIN_YX ? true : false;
|
|
1214
1215
|
this.imageOffset = imageOffset;
|
|
1215
1216
|
this.bottomCircle = bottomCircle;
|
|
1216
1217
|
this.bottomCircleOffset = bottomCircleOffset;
|
|
@@ -1239,11 +1240,11 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1239
1240
|
this.containerHeight = containerHeight;
|
|
1240
1241
|
this.pointerZoom = pointerZoom > 1 ? Math.min(pointerZoom, 3) : 0;
|
|
1241
1242
|
this.keysReverse = keysReverse;
|
|
1242
|
-
this.innerBox = (0,
|
|
1243
|
-
this.iconsContainer = (0,
|
|
1244
|
-
this.canvas = (0,
|
|
1245
|
-
this.loader = (0,
|
|
1246
|
-
(0,
|
|
1243
|
+
this.innerBox = (0, _utils.createInnerBox)(this.container);
|
|
1244
|
+
this.iconsContainer = (0, _utils.createIconsContainer)(this.innerBox);
|
|
1245
|
+
this.canvas = (0, _utils.createCanvas)(this.innerBox);
|
|
1246
|
+
this.loader = (0, _utils.createLoader)(this.innerBox);
|
|
1247
|
+
(0, _utils.applyStylesToContainer)(this.container);
|
|
1247
1248
|
this.srcXConfig = {
|
|
1248
1249
|
folder: folder,
|
|
1249
1250
|
filename: filenameX,
|
|
@@ -1260,12 +1261,12 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1260
1261
|
};
|
|
1261
1262
|
this.srcYConfig = _objectSpread(_objectSpread({}, this.srcXConfig), {}, {
|
|
1262
1263
|
filename: filenameY,
|
|
1263
|
-
orientation:
|
|
1264
|
+
orientation: _constants.ORIENTATIONS.Y,
|
|
1264
1265
|
imageList: imageListY,
|
|
1265
1266
|
amount: this.amountY
|
|
1266
1267
|
});
|
|
1267
|
-
var srcX = (0,
|
|
1268
|
-
var srcY = (0,
|
|
1268
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
1269
|
+
var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
|
|
1269
1270
|
|
|
1270
1271
|
var initLazyload = function initLazyload(image, orientation) {
|
|
1271
1272
|
var lazyloadXConfig = _objectSpread(_objectSpread({}, _this6.srcXConfig), {}, {
|
|
@@ -1276,18 +1277,18 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1276
1277
|
lazyload: false
|
|
1277
1278
|
});
|
|
1278
1279
|
|
|
1279
|
-
if (orientation ===
|
|
1280
|
+
if (orientation === _constants.ORIENTATIONS.Y) {
|
|
1280
1281
|
_this6.lazyloadY = false;
|
|
1281
|
-
(0,
|
|
1282
|
+
(0, _utils.preloadImages)(lazyloadXConfig, srcX, onImageLoad.bind(_this6, _constants.ORIENTATIONS.X));
|
|
1282
1283
|
} else {
|
|
1283
1284
|
_this6.lazyloadX = false;
|
|
1284
1285
|
_this6.lazyloadInitImageX = image;
|
|
1285
|
-
(0,
|
|
1286
|
+
(0, _utils.preloadImages)(lazyloadYConfig, srcY, onImageLoad.bind(_this6, _constants.ORIENTATIONS.Y));
|
|
1286
1287
|
}
|
|
1287
1288
|
};
|
|
1288
1289
|
|
|
1289
1290
|
var onImageLoad = function onImageLoad(orientation, image, index) {
|
|
1290
|
-
if (orientation !==
|
|
1291
|
+
if (orientation !== _constants.ORIENTATIONS.Y) {
|
|
1291
1292
|
_this6.imagesX[index] = image;
|
|
1292
1293
|
} else {
|
|
1293
1294
|
_this6.imagesY[index] = image;
|
|
@@ -1303,7 +1304,7 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1303
1304
|
|
|
1304
1305
|
var totalAmount = _this6.amountX + _this6.amountY;
|
|
1305
1306
|
var totalLoadedImages = _this6.imagesX.length + _this6.imagesY.length;
|
|
1306
|
-
var isFirstImageLoaded = index === 0 && orientation !==
|
|
1307
|
+
var isFirstImageLoaded = index === 0 && orientation !== _constants.ORIENTATIONS.Y;
|
|
1307
1308
|
var isAllImagesLoaded = loadedXImages.length + loadedYImages.length === _this6.amountX + _this6.amountY;
|
|
1308
1309
|
var percentage = Math.round(totalLoadedImages / totalAmount * 100);
|
|
1309
1310
|
|
|
@@ -1326,10 +1327,10 @@ var CI360Viewer = /*#__PURE__*/function () {
|
|
|
1326
1327
|
}
|
|
1327
1328
|
};
|
|
1328
1329
|
|
|
1329
|
-
(0,
|
|
1330
|
+
(0, _utils.preloadImages)(this.srcXConfig, srcX, onImageLoad.bind(this, _constants.ORIENTATIONS.X));
|
|
1330
1331
|
|
|
1331
1332
|
if (this.allowSpinY) {
|
|
1332
|
-
(0,
|
|
1333
|
+
(0, _utils.preloadImages)(this.srcYConfig, srcY, onImageLoad.bind(this, _constants.ORIENTATIONS.Y));
|
|
1333
1334
|
}
|
|
1334
1335
|
|
|
1335
1336
|
this.attachEvents(draggable, swipeable, keys);
|
package/dist/ci360.utils.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.setView360Icon = exports.get360ViewProps = exports.debounce = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _constants = require("./constants");
|
|
9
9
|
|
|
10
10
|
var _this = void 0;
|
|
11
11
|
|
|
@@ -28,7 +28,7 @@ var get360ViewProps = function get360ViewProps(image) {
|
|
|
28
28
|
keysReverse: isTrue(image, 'keys-reverse'),
|
|
29
29
|
boxShadow: attr(image, 'box-shadow') || attr(image, 'data-box-shadow'),
|
|
30
30
|
autoplay: isTrue(image, 'autoplay'),
|
|
31
|
-
autoplayBehavior: attr(image, 'autoplay-behavior') || attr(image, 'data-autoplay-behavior') ||
|
|
31
|
+
autoplayBehavior: attr(image, 'autoplay-behavior') || attr(image, 'data-autoplay-behavior') || _constants.AUTOPLAY_BEHAVIOR.SPIN_X,
|
|
32
32
|
playOnce: isTrue(image, 'play-once'),
|
|
33
33
|
autoplayReverse: isTrue(image, 'autoplay-reverse'),
|
|
34
34
|
pointerZoom: parseFloat(attr(image, 'pointer-zoom') || attr(image, 'data-pointer-zoom') || 0, 10),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AUTOPLAY_BEHAVIOR = void 0;
|
|
7
|
+
var AUTOPLAY_BEHAVIOR = {
|
|
8
|
+
SPIN_X: 'spin-x',
|
|
9
|
+
SPIN_Y: 'spin-y',
|
|
10
|
+
SPIN_XY: 'spin-xy',
|
|
11
|
+
SPIN_YX: 'spin-yx'
|
|
12
|
+
};
|
|
13
|
+
exports.AUTOPLAY_BEHAVIOR = AUTOPLAY_BEHAVIOR;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AND_SYMBOL_REGEX", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _regex.AND_SYMBOL_REGEX;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "AUTOPLAY_BEHAVIOR", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _autoPlayBehavior.AUTOPLAY_BEHAVIOR;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "FALSY_VALUES", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _falsyValues.FALSY_VALUES;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "ORGINAL_SIZE_REGEX", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _regex.ORGINAL_SIZE_REGEX;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "ORIENTATIONS", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _orientations.ORIENTATIONS;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var _autoPlayBehavior = require("./auto-play-behavior");
|
|
38
|
+
|
|
39
|
+
var _falsyValues = require("./falsy-values");
|
|
40
|
+
|
|
41
|
+
var _orientations = require("./orientations");
|
|
42
|
+
|
|
43
|
+
var _regex = require("./regex");
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ORGINAL_SIZE_REGEX = exports.AND_SYMBOL_REGEX = void 0;
|
|
7
|
+
var ORGINAL_SIZE_REGEX = /width=\d+|w=\d+|h=\d+|&width=\d+|&w=\d+|&h=\d+|func=\w+|\?$/g;
|
|
8
|
+
exports.ORGINAL_SIZE_REGEX = ORGINAL_SIZE_REGEX;
|
|
9
|
+
var AND_SYMBOL_REGEX = /\?&/g;
|
|
10
|
+
exports.AND_SYMBOL_REGEX = AND_SYMBOL_REGEX;
|
package/dist/index.js
CHANGED
|
@@ -29,14 +29,18 @@ function destroy() {
|
|
|
29
29
|
window.CI360._viewers = [];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function getActiveIndexByID(id) {
|
|
32
|
+
function getActiveIndexByID(id, oriantation) {
|
|
33
33
|
if (isNoViewers()) return;
|
|
34
34
|
|
|
35
35
|
var currentViewer = window.CI360._viewers.filter(function (viewer) {
|
|
36
36
|
return viewer.id === id;
|
|
37
37
|
})[0];
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
if (oriantation === 'y') {
|
|
40
|
+
return currentViewer && currentViewer.activeImageY - 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return currentViewer && currentViewer.activeImageX - 1;
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
function isNoViewers() {
|