js-cloudimage-360-view 3.0.0-beta.2 → 3.0.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.
- package/CHANGELOG.md +93 -0
- package/LICENSE +13 -1
- package/README.md +361 -127
- package/dist/ci360.service.js +882 -1157
- package/dist/ci360.utils.js +28 -204
- 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/props-require-reload.js +21 -0
- package/dist/constants/regex.js +10 -0
- package/dist/index.js +73 -12
- package/dist/static/css/hotspots.css +229 -0
- package/dist/static/css/style.css +113 -4
- 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/class-names/add-class.js +18 -0
- package/dist/utils/class-names/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 +109 -0
- package/dist/utils/container-elements/remove-child-from-parent.js +16 -0
- package/dist/utils/controls/get-item-skipped.js +13 -0
- package/dist/utils/controls/init-controls.js +77 -0
- package/dist/utils/hotspots/attach-events/hide-popup.js +15 -0
- package/dist/utils/hotspots/attach-events/show-popup.js +14 -0
- package/dist/utils/hotspots/configs-error-handler.js +27 -0
- package/dist/utils/hotspots/create-popper-instace.js +32 -0
- package/dist/utils/hotspots/elements/create-carousel-dot.js +26 -0
- package/dist/utils/hotspots/elements/create-carousel-image.js +22 -0
- package/dist/utils/hotspots/elements/create-hotspot-icon.js +66 -0
- package/dist/utils/hotspots/elements/create-hotspot-popup-link.js +23 -0
- package/dist/utils/hotspots/elements/create-hotspots.js +25 -0
- package/dist/utils/hotspots/elements/create-images-carousel.js +27 -0
- package/dist/utils/hotspots/elements/create-modal-description.js +15 -0
- package/dist/utils/hotspots/elements/create-modal-title.js +15 -0
- package/dist/utils/hotspots/elements/create-model-elements.js +66 -0
- package/dist/utils/hotspots/elements/create-popup-arrow.js +16 -0
- package/dist/utils/hotspots/elements/create-popup.js +67 -0
- package/dist/utils/hotspots/elements/create-read-more-btn.js +17 -0
- package/dist/utils/hotspots/fill-empty-coord-with-previous.js +26 -0
- package/dist/utils/hotspots/generate-hotspots-configs.js +58 -0
- package/dist/utils/hotspots/generate-popup-config.js +29 -0
- package/dist/utils/hotspots/get-hotspot-icon.js +14 -0
- package/dist/utils/hotspots/get-hotspot-orientation.js +21 -0
- package/dist/utils/hotspots/get-hotspot-popup-node.js +14 -0
- package/dist/utils/hotspots/get-popup-node.js +14 -0
- package/dist/utils/hotspots/hide-hotspot-icon.js +13 -0
- package/dist/utils/hotspots/hide-hotspots-icons.js +18 -0
- package/dist/utils/hotspots/is-mouse-on-hotspot.js +14 -0
- package/dist/utils/hotspots/prepare-hotspots-positions.js +28 -0
- package/dist/utils/hotspots/set-current-slide.js +23 -0
- package/dist/utils/hotspots/toggle-popup-events.js +23 -0
- package/dist/utils/hotspots/update-hotspot-icon-position.js +21 -0
- package/dist/utils/hotspots/update-hotspots.js +48 -0
- package/dist/utils/image-src/generate-images-path.js +40 -0
- package/dist/utils/image-src/is-props-change-require-reload.js +23 -0
- package/dist/utils/index.js +237 -0
- package/dist/utils/load-images/images-from-folder/prepare-images-from-folder.js +34 -0
- package/dist/utils/load-images/images-from-list/prepare-images-from-list.js +35 -0
- package/dist/utils/load-images/lazyload/init-lazyload.js +49 -0
- package/dist/utils/load-images/lazyload/prepare-first-image/prepare-first-image-from-folder.js +18 -0
- package/dist/utils/load-images/lazyload/prepare-first-image/prepare-first-image-from-list.js +29 -0
- package/dist/utils/load-images/load-image-as-promise.js +54 -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 +35 -0
- package/dist/utils/load-images/preload-original-images.js +35 -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 +13 -8
- package/dist/ci360.constants.js +0 -36
package/dist/ci360.service.js
CHANGED
|
@@ -1,155 +1,312 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
4
|
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
6
15
|
|
|
7
|
-
var
|
|
16
|
+
var _ci = require("./ci360.utils");
|
|
8
17
|
|
|
9
|
-
var
|
|
18
|
+
var _constants = require("./constants/");
|
|
10
19
|
|
|
11
|
-
|
|
20
|
+
require("./static/css/style.css");
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
require("./static/css/hotspots.css");
|
|
14
23
|
|
|
15
|
-
require(
|
|
24
|
+
var _utils = require("./utils");
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
var _togglePopupEvents = require("./utils/hotspots/toggle-popup-events");
|
|
18
27
|
|
|
19
|
-
function
|
|
28
|
+
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; }
|
|
20
29
|
|
|
21
|
-
var
|
|
22
|
-
function CI360Viewer(container, fullscreen, ratio) {
|
|
23
|
-
_classCallCheck(this, CI360Viewer);
|
|
30
|
+
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; }
|
|
24
31
|
|
|
32
|
+
var CI360Viewer = /*#__PURE__*/function () {
|
|
33
|
+
function CI360Viewer(container, fullscreen, hotspotsConfigs) {
|
|
34
|
+
(0, _classCallCheck2.default)(this, CI360Viewer);
|
|
25
35
|
this.container = container;
|
|
26
|
-
this.movementStart = {
|
|
36
|
+
this.movementStart = {
|
|
37
|
+
x: 0,
|
|
38
|
+
y: 0
|
|
39
|
+
};
|
|
27
40
|
this.isStartSpin = false;
|
|
28
|
-
this.movingDirection =
|
|
41
|
+
this.movingDirection = _constants.ORIENTATIONS.CENTER;
|
|
29
42
|
this.isClicked = false;
|
|
30
43
|
this.loadedImagesX = 0;
|
|
31
44
|
this.loadedImagesY = 0;
|
|
32
45
|
this.imagesLoaded = false;
|
|
33
46
|
this.reversed = false;
|
|
34
47
|
this.fullscreenView = !!fullscreen;
|
|
35
|
-
this.ratio = ratio;
|
|
36
48
|
this.imagesX = [];
|
|
37
49
|
this.imagesY = [];
|
|
38
|
-
this.resizedImagesX = [];
|
|
39
|
-
this.resizedImagesY = [];
|
|
40
50
|
this.originalImagesX = [];
|
|
41
51
|
this.originalImagesY = [];
|
|
52
|
+
this.resizedImagesX = [];
|
|
53
|
+
this.resizedImagesY = [];
|
|
42
54
|
this.devicePixelRatio = Math.round(window.devicePixelRatio || 1);
|
|
43
55
|
this.isMobile = !!('ontouchstart' in window || navigator.msMaxTouchPoints);
|
|
44
56
|
this.id = container.id;
|
|
45
|
-
this.
|
|
46
|
-
this.clickedToZoom = false;
|
|
57
|
+
this.hotspotsConfigs = hotspotsConfigs && (0, _utils.generateHotspotsConfigs)(hotspotsConfigs);
|
|
47
58
|
this.isMagnifyOpen = false;
|
|
59
|
+
this.isDragged = false;
|
|
48
60
|
this.startPointerZoom = false;
|
|
49
61
|
this.zoomIntensity = 0;
|
|
50
62
|
this.mouseTracked = false;
|
|
51
|
-
this.intialPositions = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
this.intialPositions = {
|
|
64
|
+
x: 0,
|
|
65
|
+
y: 0
|
|
66
|
+
};
|
|
67
|
+
this.pointerCurrentPosition = {
|
|
68
|
+
x: 0,
|
|
69
|
+
y: 0
|
|
70
|
+
};
|
|
71
|
+
this.isStartedLoadOriginalImages = false;
|
|
72
|
+
this.init(container);
|
|
55
73
|
}
|
|
56
74
|
|
|
57
|
-
|
|
58
|
-
key:
|
|
75
|
+
(0, _createClass2.default)(CI360Viewer, [{
|
|
76
|
+
key: "isReady",
|
|
77
|
+
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
|
+
var totalAmount = this.amountX + this.amountY;
|
|
85
|
+
return loadedXImages.length + loadedYImages.length === totalAmount;
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "mouseDown",
|
|
59
89
|
value: function mouseDown(event) {
|
|
60
|
-
|
|
61
|
-
|
|
90
|
+
if (!this.imagesLoaded) return;
|
|
91
|
+
var isMouseOnHotspotElement = (0, _utils.isMouseOnHotspot)();
|
|
62
92
|
var pageX = event.pageX,
|
|
63
93
|
pageY = event.pageY;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (!this.imagesLoaded) return;
|
|
67
|
-
|
|
68
94
|
this.hideInitialIcons();
|
|
69
95
|
|
|
70
96
|
if (this.autoplay || this.loopTimeoutId) {
|
|
71
97
|
this.stop();
|
|
72
98
|
this.autoplay = false;
|
|
99
|
+
this.isZoomReady = true;
|
|
73
100
|
}
|
|
74
101
|
|
|
75
|
-
this.intialPositions = {
|
|
76
|
-
|
|
102
|
+
this.intialPositions = {
|
|
103
|
+
x: pageX,
|
|
104
|
+
y: pageY
|
|
105
|
+
};
|
|
106
|
+
this.movementStart = {
|
|
107
|
+
x: pageX,
|
|
108
|
+
y: pageY
|
|
109
|
+
};
|
|
77
110
|
this.isClicked = true;
|
|
78
|
-
this.
|
|
79
|
-
|
|
111
|
+
this.isDragged = false;
|
|
112
|
+
|
|
113
|
+
if (this.hotspotsConfigs) {
|
|
114
|
+
(0, _togglePopupEvents.togglePopupEvents)(this.hotspotsConfigs, event, true);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (isMouseOnHotspotElement) {
|
|
118
|
+
this.isClicked = false;
|
|
119
|
+
}
|
|
80
120
|
}
|
|
81
121
|
}, {
|
|
82
|
-
key:
|
|
122
|
+
key: "mouseUp",
|
|
83
123
|
value: function mouseUp() {
|
|
84
|
-
|
|
124
|
+
var _this = this;
|
|
85
125
|
|
|
86
|
-
this.
|
|
126
|
+
if (!this.imagesLoaded || !this.isClicked) return;
|
|
127
|
+
this.movementStart = {
|
|
128
|
+
x: 0,
|
|
129
|
+
y: 0
|
|
130
|
+
};
|
|
87
131
|
this.isStartSpin = false;
|
|
88
132
|
this.isClicked = false;
|
|
89
|
-
this.container.style.cursor = 'grab';
|
|
90
133
|
|
|
91
|
-
if (this.bottomCircle && !this.
|
|
134
|
+
if (this.bottomCircle && !this.mouseTracked) {
|
|
92
135
|
this.show360ViewCircleIcon();
|
|
93
136
|
}
|
|
137
|
+
|
|
138
|
+
if (this.hotspotsConfigs) {
|
|
139
|
+
(0, _togglePopupEvents.togglePopupEvents)(this.hotspotsConfigs);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (this.pointerZoom && !this.fullscreenView) {
|
|
143
|
+
setTimeout(function () {
|
|
144
|
+
_this.isZoomReady = true;
|
|
145
|
+
}, 50);
|
|
146
|
+
|
|
147
|
+
if (this.mouseTracked) {
|
|
148
|
+
this.container.style.cursor = 'zoom-out';
|
|
149
|
+
} else {
|
|
150
|
+
this.container.style.cursor = 'zoom-in';
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
this.container.style.cursor = 'grab';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "mouseClick",
|
|
158
|
+
value: function mouseClick(event) {
|
|
159
|
+
if (!this.pointerZoom || this.fullscreenView) return;
|
|
160
|
+
this.setCursorPosition(event);
|
|
161
|
+
this.hideInitialIcons();
|
|
162
|
+
|
|
163
|
+
if (!this.isStartedLoadOriginalImages && !this.isDragged && this.isZoomReady) {
|
|
164
|
+
this.prepareOriginalImages(event);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (this.isAllOriginalImagesLoaded && !this.isDragged && this.isZoomReady) {
|
|
168
|
+
this.togglePointerZoom(event);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
;
|
|
94
172
|
}
|
|
95
173
|
}, {
|
|
96
|
-
key:
|
|
174
|
+
key: "mouseMove",
|
|
97
175
|
value: function mouseMove(event) {
|
|
98
176
|
if (!this.imagesLoaded) return;
|
|
99
|
-
|
|
100
177
|
var pageX = event.pageX,
|
|
101
178
|
pageY = event.pageY;
|
|
102
179
|
|
|
103
|
-
|
|
104
180
|
if (this.mouseTracked) {
|
|
105
181
|
this.setCursorPosition(event);
|
|
182
|
+
|
|
183
|
+
if (!this.isClicked) {
|
|
184
|
+
this.update();
|
|
185
|
+
}
|
|
106
186
|
}
|
|
107
187
|
|
|
108
188
|
if (this.isClicked) {
|
|
109
|
-
var nextPositions = {
|
|
110
|
-
|
|
111
|
-
|
|
189
|
+
var nextPositions = {
|
|
190
|
+
x: pageX,
|
|
191
|
+
y: pageY
|
|
192
|
+
};
|
|
193
|
+
this.container.style.cursor = 'grabbing';
|
|
194
|
+
this.isDragged = true;
|
|
195
|
+
this.movingDirection = (0, _utils.getMovingDirection)(this.isStartSpin, this.allowSpinY, this.intialPositions, nextPositions, this.movingDirection);
|
|
112
196
|
this.onMoveHandler(event);
|
|
113
|
-
} else if (this.zoomIntensity) {
|
|
114
|
-
this.update();
|
|
115
197
|
}
|
|
116
198
|
}
|
|
117
199
|
}, {
|
|
118
|
-
key:
|
|
119
|
-
value: function
|
|
120
|
-
if (this.
|
|
121
|
-
|
|
122
|
-
var differenceInPositionX = Math.abs(prevPosition.x - nextPositions.x);
|
|
123
|
-
var differenceInPositionY = Math.abs(prevPosition.y - nextPositions.y);
|
|
124
|
-
var sensitivity = 10;
|
|
200
|
+
key: "mouseLeave",
|
|
201
|
+
value: function mouseLeave() {
|
|
202
|
+
if (!this.imagesLoaded) return;
|
|
125
203
|
|
|
126
|
-
if (
|
|
204
|
+
if (this.pointerZoom && this.mouseTracked) {
|
|
205
|
+
this.togglePointerZoom();
|
|
206
|
+
}
|
|
127
207
|
|
|
128
|
-
if (
|
|
208
|
+
if (this.isMagnifyOpen) {
|
|
209
|
+
this.closeMagnifier();
|
|
210
|
+
}
|
|
129
211
|
}
|
|
130
212
|
}, {
|
|
131
|
-
key:
|
|
132
|
-
value: function
|
|
133
|
-
|
|
213
|
+
key: "togglePointerZoom",
|
|
214
|
+
value: function togglePointerZoom() {
|
|
215
|
+
var _this2 = this;
|
|
216
|
+
|
|
217
|
+
if (this.autoplay || this.loopTimeoutId) {
|
|
218
|
+
this.stop();
|
|
219
|
+
this.autoplay = false;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (this.mouseTracked) {
|
|
223
|
+
var zoomSteps = (0, _utils.generateZoomOutSteps)(this.pointerZoom);
|
|
224
|
+
this.container.style.cursor = 'zoom-in';
|
|
225
|
+
zoomSteps.forEach(function (step, index) {
|
|
226
|
+
setTimeout(function () {
|
|
227
|
+
_this2.zoomIntensity = step;
|
|
228
|
+
|
|
229
|
+
_this2.update();
|
|
230
|
+
|
|
231
|
+
var isReachedIntialScale = index === zoomSteps.length - 1;
|
|
232
|
+
|
|
233
|
+
if (isReachedIntialScale) {
|
|
234
|
+
_this2.mouseTracked = false;
|
|
235
|
+
|
|
236
|
+
_this2.update();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
;
|
|
240
|
+
}, (_this2.pointerZoom - step) * 200);
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
244
|
+
|
|
245
|
+
var _zoomSteps = (0, _utils.generateZoomInSteps)(this.pointerZoom);
|
|
246
|
+
|
|
247
|
+
if (this.hotspotsConfigs) {
|
|
248
|
+
(0, _utils.hideHotspotsIcons)();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
_zoomSteps.forEach(function (step) {
|
|
252
|
+
setTimeout(function () {
|
|
253
|
+
_this2.zoomIntensity = step;
|
|
134
254
|
|
|
135
|
-
|
|
136
|
-
|
|
255
|
+
_this2.update();
|
|
256
|
+
}, step * 200);
|
|
257
|
+
});
|
|
137
258
|
|
|
138
|
-
|
|
139
|
-
this.
|
|
259
|
+
this.mouseTracked = true;
|
|
260
|
+
this.container.style.cursor = 'zoom-out';
|
|
140
261
|
}
|
|
141
262
|
}
|
|
142
263
|
}, {
|
|
143
|
-
key:
|
|
144
|
-
value: function
|
|
145
|
-
if (
|
|
264
|
+
key: "onOriginalImageLoad",
|
|
265
|
+
value: function onOriginalImageLoad(orientation, event, image, index) {
|
|
266
|
+
if (orientation === _constants.ORIENTATIONS.Y) {
|
|
267
|
+
this.originalImagesY[index] = image;
|
|
268
|
+
} else {
|
|
269
|
+
this.originalImagesX[index] = image;
|
|
270
|
+
}
|
|
146
271
|
|
|
147
|
-
var
|
|
272
|
+
var loadedOriginalXImages = this.originalImagesX.filter(function (image) {
|
|
273
|
+
return image;
|
|
274
|
+
});
|
|
275
|
+
var loadedOriginalYImages = this.originalImagesY.filter(function (image) {
|
|
276
|
+
return image;
|
|
277
|
+
});
|
|
278
|
+
var totalAmount = this.amountX + this.amountY;
|
|
279
|
+
var totalLoadedImages = loadedOriginalXImages.length + loadedOriginalYImages.length;
|
|
280
|
+
var isAllImagesLoaded = loadedOriginalXImages.length + loadedOriginalYImages.length === this.amountX + this.amountY;
|
|
281
|
+
var percentage = Math.round(totalLoadedImages / totalAmount * 100);
|
|
282
|
+
this.updatePercentageInLoader(percentage);
|
|
148
283
|
|
|
149
|
-
if (
|
|
150
|
-
this.
|
|
151
|
-
|
|
284
|
+
if (isAllImagesLoaded) {
|
|
285
|
+
this.removeLoader();
|
|
286
|
+
this.togglePointerZoom(event);
|
|
287
|
+
this.mouseTracked = true;
|
|
288
|
+
this.isAllOriginalImagesLoaded = true;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}, {
|
|
292
|
+
key: "prepareOriginalImages",
|
|
293
|
+
value: function prepareOriginalImages(event) {
|
|
294
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
295
|
+
this.isStartedLoadOriginalImages = true;
|
|
296
|
+
this.loader = (0, _utils.createLoader)(this.innerBox);
|
|
297
|
+
this.container.style.cursor = 'wait';
|
|
298
|
+
(0, _utils.preloadOriginalImages)(this.srcXConfig, srcX, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.X, event));
|
|
152
299
|
|
|
300
|
+
if (this.allowSpinY) {
|
|
301
|
+
var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
|
|
302
|
+
(0, _utils.preloadOriginalImages)(this.srcYConfig, srcY, this.onOriginalImageLoad.bind(this, _constants.ORIENTATIONS.Y, event));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}, {
|
|
306
|
+
key: "touchStart",
|
|
307
|
+
value: function touchStart(event) {
|
|
308
|
+
if (!this.imagesLoaded) return;
|
|
309
|
+
var isMouseOnHotspotElement = (0, _utils.isMouseOnHotspot)();
|
|
153
310
|
this.hideInitialIcons();
|
|
154
311
|
|
|
155
312
|
if (this.autoplay || this.loopTimeoutId) {
|
|
@@ -157,48 +314,66 @@ var CI360Viewer = function () {
|
|
|
157
314
|
this.autoplay = false;
|
|
158
315
|
}
|
|
159
316
|
|
|
160
|
-
this.intialPositions = {
|
|
161
|
-
|
|
317
|
+
this.intialPositions = {
|
|
318
|
+
x: event.touches[0].clientX,
|
|
319
|
+
y: event.touches[0].clientY
|
|
320
|
+
};
|
|
321
|
+
this.movementStart = {
|
|
322
|
+
x: event.touches[0].clientX,
|
|
323
|
+
y: event.touches[0].clientY
|
|
324
|
+
};
|
|
162
325
|
this.isClicked = true;
|
|
326
|
+
|
|
327
|
+
if (isMouseOnHotspotElement) {
|
|
328
|
+
this.isClicked = false;
|
|
329
|
+
}
|
|
163
330
|
}
|
|
164
331
|
}, {
|
|
165
|
-
key:
|
|
332
|
+
key: "touchEnd",
|
|
166
333
|
value: function touchEnd() {
|
|
167
334
|
if (!this.imagesLoaded) return;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
335
|
+
if (this.bottomCircle) this.show360ViewCircleIcon();
|
|
336
|
+
this.movementStart = {
|
|
337
|
+
x: 0,
|
|
338
|
+
y: 0
|
|
339
|
+
};
|
|
172
340
|
this.isStartSpin = false;
|
|
173
341
|
this.isClicked = false;
|
|
174
|
-
|
|
175
|
-
if (this.bottomCircle) this.show360ViewCircleIcon();
|
|
176
342
|
}
|
|
177
343
|
}, {
|
|
178
|
-
key:
|
|
344
|
+
key: "touchMove",
|
|
179
345
|
value: function touchMove(event) {
|
|
180
346
|
if (!this.isClicked || !this.imagesLoaded) return;
|
|
181
347
|
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
} else {
|
|
185
|
-
var nextPositions = { x: event.touches[0].clientX, y: event.touches[0].clientY };
|
|
186
|
-
|
|
187
|
-
this.updateMovingDirection(this.intialPositions, nextPositions);
|
|
188
|
-
this.onMoveHandler(event);
|
|
348
|
+
if (event.cancelable) {
|
|
349
|
+
event.preventDefault();
|
|
189
350
|
}
|
|
351
|
+
|
|
352
|
+
var nextPositions = {
|
|
353
|
+
x: event.touches[0].clientX,
|
|
354
|
+
y: event.touches[0].clientY
|
|
355
|
+
};
|
|
356
|
+
this.movingDirection = (0, _utils.getMovingDirection)(this.isStartSpin, this.allowSpinY, this.intialPositions, nextPositions, this.movingDirection);
|
|
357
|
+
this.onMoveHandler(event);
|
|
190
358
|
}
|
|
191
359
|
}, {
|
|
192
|
-
key:
|
|
193
|
-
value: function keyDownGeneral() {
|
|
360
|
+
key: "keyDownGeneral",
|
|
361
|
+
value: function keyDownGeneral(event) {
|
|
194
362
|
if (!this.imagesLoaded) return;
|
|
195
363
|
|
|
196
364
|
if (this.glass) {
|
|
197
365
|
this.closeMagnifier();
|
|
198
366
|
}
|
|
367
|
+
|
|
368
|
+
if (event.keyCode === 27) {
|
|
369
|
+
//ESC
|
|
370
|
+
if (this.mouseTracked) {
|
|
371
|
+
this.togglePointerZoom();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
199
374
|
}
|
|
200
375
|
}, {
|
|
201
|
-
key:
|
|
376
|
+
key: "hideInitialIcons",
|
|
202
377
|
value: function hideInitialIcons() {
|
|
203
378
|
if (this.glass) {
|
|
204
379
|
this.closeMagnifier();
|
|
@@ -209,17 +384,7 @@ var CI360Viewer = function () {
|
|
|
209
384
|
}
|
|
210
385
|
}
|
|
211
386
|
}, {
|
|
212
|
-
key:
|
|
213
|
-
value: function initMouseScrollZoom(event) {
|
|
214
|
-
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
215
|
-
|
|
216
|
-
this.hideInitialIcons();
|
|
217
|
-
this.mouseTracked = true;
|
|
218
|
-
this.setCursorPosition(event);
|
|
219
|
-
this.mouseScrollZoom(event);
|
|
220
|
-
}
|
|
221
|
-
}, {
|
|
222
|
-
key: 'setCursorPosition',
|
|
387
|
+
key: "setCursorPosition",
|
|
223
388
|
value: function setCursorPosition(event) {
|
|
224
389
|
this.mousePositions = {
|
|
225
390
|
x: event.clientX,
|
|
@@ -227,153 +392,54 @@ var CI360Viewer = function () {
|
|
|
227
392
|
};
|
|
228
393
|
}
|
|
229
394
|
}, {
|
|
230
|
-
key:
|
|
395
|
+
key: "getCursorPositionInCanvas",
|
|
231
396
|
value: function getCursorPositionInCanvas() {
|
|
232
397
|
var canvasRect = this.canvas.getBoundingClientRect();
|
|
233
|
-
|
|
234
398
|
this.pointerCurrentPosition = {
|
|
235
399
|
x: this.mousePositions.x - canvasRect.left,
|
|
236
400
|
y: this.mousePositions.y - canvasRect.top
|
|
237
401
|
};
|
|
238
|
-
|
|
239
402
|
return this.pointerCurrentPosition;
|
|
240
403
|
}
|
|
241
404
|
}, {
|
|
242
|
-
key:
|
|
243
|
-
value: function
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (this.autoplay || this.loopTimeoutId) {
|
|
247
|
-
this.stop();
|
|
248
|
-
this.autoplay = false;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
var zoomFactor = (0, _ci.normalizeZoomFactor)(event, this.pointerZoomFactor);
|
|
252
|
-
var maxIntensity = (0, _ci.getMaxZoomIntensity)(this.canvas.width, this.maxScale);
|
|
253
|
-
this.startPointerZoom = true;
|
|
254
|
-
this.zoomIntensity += event.deltaY * zoomFactor;
|
|
255
|
-
this.zoomIntensity = Math.min(Math.max(0, this.zoomIntensity), maxIntensity);
|
|
256
|
-
|
|
257
|
-
if (this.zoomIntensity) {
|
|
258
|
-
if (this.resetZoomIcon) this.showResetZoomIcon();
|
|
259
|
-
} else {
|
|
260
|
-
if (this.resetZoomIcon) this.hideResetZoomIcon();
|
|
261
|
-
|
|
262
|
-
if (this.bottomCircle) this.show360ViewCircleIcon();
|
|
405
|
+
key: "keyDown",
|
|
406
|
+
value: function keyDown(event) {
|
|
407
|
+
if (!this.imagesLoaded) return;
|
|
263
408
|
|
|
264
|
-
|
|
265
|
-
this.
|
|
409
|
+
if (this.glass) {
|
|
410
|
+
this.closeMagnifier();
|
|
266
411
|
}
|
|
267
412
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
value: function initAndSetPinchZoom(event) {
|
|
273
|
-
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
274
|
-
|
|
275
|
-
var _getFingersPosition = this.getFingersPosition(event),
|
|
276
|
-
_getFingersPosition2 = _slicedToArray(_getFingersPosition, 2),
|
|
277
|
-
fingerOnePosition = _getFingersPosition2[0],
|
|
278
|
-
fingerTwoPosition = _getFingersPosition2[1];
|
|
279
|
-
|
|
280
|
-
this.prevDistanceBetweenFingers = this.getDistanceBetweenFingers(fingerOnePosition, fingerTwoPosition);
|
|
281
|
-
}
|
|
282
|
-
}, {
|
|
283
|
-
key: 'getDistanceBetweenFingers',
|
|
284
|
-
value: function getDistanceBetweenFingers(fingerOne, fingerTwo) {
|
|
285
|
-
var xPosition = fingerTwo.x - fingerOne.x;
|
|
286
|
-
var yPosition = fingerTwo.y - fingerOne.y;
|
|
287
|
-
|
|
288
|
-
return Math.sqrt(Math.pow(xPosition, 2) + Math.pow(yPosition, 2));
|
|
289
|
-
}
|
|
290
|
-
}, {
|
|
291
|
-
key: 'updateAveragePositionBetweenFingers',
|
|
292
|
-
value: function updateAveragePositionBetweenFingers(fingerOne, fingerTwo) {
|
|
293
|
-
var containerRect = this.canvas.getBoundingClientRect();
|
|
294
|
-
var offSetX = containerRect.left;
|
|
295
|
-
var offSetY = containerRect.top;
|
|
296
|
-
|
|
297
|
-
this.pointerCurrentPosition.x = (fingerOne.x + fingerTwo.x) / 2 - offSetX;
|
|
298
|
-
|
|
299
|
-
this.pointerCurrentPosition.y = (fingerOne.y + fingerTwo.y) / 2 - offSetY;
|
|
300
|
-
}
|
|
301
|
-
}, {
|
|
302
|
-
key: 'getFingersPosition',
|
|
303
|
-
value: function getFingersPosition(event) {
|
|
304
|
-
var p1 = event.targetTouches[0];
|
|
305
|
-
var p2 = event.targetTouches[1];
|
|
306
|
-
|
|
307
|
-
var fingerOnePosition = { x: p1.clientX, y: p1.clientY };
|
|
308
|
-
var fingerTwoPosition = { x: p2.clientX, y: p2.clientY };
|
|
309
|
-
|
|
310
|
-
return [fingerOnePosition, fingerTwoPosition];
|
|
311
|
-
}
|
|
312
|
-
}, {
|
|
313
|
-
key: 'fingersPinchZoom',
|
|
314
|
-
value: function fingersPinchZoom(event) {
|
|
315
|
-
var _getFingersPosition3 = this.getFingersPosition(event),
|
|
316
|
-
_getFingersPosition4 = _slicedToArray(_getFingersPosition3, 2),
|
|
317
|
-
fingerOnePosition = _getFingersPosition4[0],
|
|
318
|
-
fingerTwoPosition = _getFingersPosition4[1];
|
|
319
|
-
|
|
320
|
-
var currentDistanceBetweenFingers = this.getDistanceBetweenFingers(fingerOnePosition, fingerTwoPosition);
|
|
321
|
-
var zoomFactor = this.pinchZoomFactor * 30;
|
|
322
|
-
|
|
323
|
-
var zoomSensitivity = 1.5;
|
|
324
|
-
var isZoomIn = currentDistanceBetweenFingers > this.prevDistanceBetweenFingers + zoomSensitivity;
|
|
325
|
-
var isZoomOut = currentDistanceBetweenFingers + zoomSensitivity < this.prevDistanceBetweenFingers;
|
|
326
|
-
var maxIntensity = (0, _ci.getMaxZoomIntensity)(this.canvas.width, this.maxScale);
|
|
327
|
-
|
|
328
|
-
this.startPinchZoom = true;
|
|
329
|
-
|
|
330
|
-
this.updateAveragePositionBetweenFingers(fingerOnePosition, fingerTwoPosition);
|
|
331
|
-
|
|
332
|
-
if (isZoomIn && this.zoomIntensity <= maxIntensity) {
|
|
333
|
-
this.zoomIntensity += zoomFactor;
|
|
334
|
-
} else if (isZoomOut && this.zoomIntensity >= zoomFactor) {
|
|
335
|
-
this.zoomIntensity -= zoomFactor;
|
|
413
|
+
if (event.keyCode === 37) {
|
|
414
|
+
// left
|
|
415
|
+
this.keysReverse ? this.left() : this.right();
|
|
416
|
+
this.onSpin();
|
|
336
417
|
}
|
|
337
418
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
key: 'resetZoom',
|
|
343
|
-
value: function resetZoom() {
|
|
344
|
-
this.startPointerZoom = false;
|
|
345
|
-
this.startPinchZoom = false;
|
|
346
|
-
this.mouseTracked = false;
|
|
347
|
-
this.clickedToZoom = false;
|
|
348
|
-
|
|
349
|
-
if (this.resetZoomIcon) this.hideResetZoomIcon();
|
|
350
|
-
|
|
351
|
-
if (this.zoomIntensity) {
|
|
352
|
-
this.zoomIntensity = 0;
|
|
353
|
-
this.update();
|
|
419
|
+
if (event.keyCode === 39) {
|
|
420
|
+
// right
|
|
421
|
+
this.keysReverse ? this.right() : this.left();
|
|
422
|
+
this.onSpin();
|
|
354
423
|
}
|
|
355
|
-
}
|
|
356
|
-
}, {
|
|
357
|
-
key: 'keyDown',
|
|
358
|
-
value: function keyDown(event) {
|
|
359
|
-
if (!this.imagesLoaded) return;
|
|
360
424
|
|
|
361
|
-
if (this.
|
|
362
|
-
|
|
363
|
-
}
|
|
425
|
+
if (this.allowSpinY) {
|
|
426
|
+
event.preventDefault();
|
|
364
427
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (this.reversed) this.right();else this.left();
|
|
428
|
+
if (event.keyCode === 38) {
|
|
429
|
+
// up
|
|
430
|
+
this.keysReverse ? this.top() : this.bottom();
|
|
431
|
+
this.onSpin();
|
|
370
432
|
}
|
|
371
433
|
|
|
372
|
-
|
|
434
|
+
if (event.keyCode === 40) {
|
|
435
|
+
// down
|
|
436
|
+
this.keysReverse ? this.bottom() : this.top();
|
|
437
|
+
this.onSpin();
|
|
438
|
+
}
|
|
373
439
|
}
|
|
374
440
|
}
|
|
375
441
|
}, {
|
|
376
|
-
key:
|
|
442
|
+
key: "onSpin",
|
|
377
443
|
value: function onSpin() {
|
|
378
444
|
if (this.bottomCircle) {
|
|
379
445
|
this.hide360ViewCircleIcon();
|
|
@@ -389,7 +455,7 @@ var CI360Viewer = function () {
|
|
|
389
455
|
}
|
|
390
456
|
}
|
|
391
457
|
}, {
|
|
392
|
-
key:
|
|
458
|
+
key: "keyUp",
|
|
393
459
|
value: function keyUp(event) {
|
|
394
460
|
if (!this.imagesLoaded) return;
|
|
395
461
|
|
|
@@ -398,87 +464,12 @@ var CI360Viewer = function () {
|
|
|
398
464
|
}
|
|
399
465
|
}
|
|
400
466
|
}, {
|
|
401
|
-
key:
|
|
467
|
+
key: "onFinishSpin",
|
|
402
468
|
value: function onFinishSpin() {
|
|
403
469
|
if (this.bottomCircle) this.show360ViewCircleIcon();
|
|
404
470
|
}
|
|
405
471
|
}, {
|
|
406
|
-
key:
|
|
407
|
-
value: function onMoveHandler(event) {
|
|
408
|
-
var currentPositionX = this.isMobile ? event.touches[0].clientX : event.pageX;
|
|
409
|
-
var currentPositionY = this.isMobile ? event.touches[0].clientY : event.pageY;
|
|
410
|
-
|
|
411
|
-
var isMoveRight = currentPositionX - this.movementStart.x >= this.speedFactor;
|
|
412
|
-
var isMoveLeft = this.movementStart.x - currentPositionX >= this.speedFactor;
|
|
413
|
-
var isMoveTop = this.movementStart.y - currentPositionY >= this.speedFactor;
|
|
414
|
-
var isMoveBottom = currentPositionY - this.movementStart.y >= this.speedFactor;
|
|
415
|
-
|
|
416
|
-
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
417
|
-
|
|
418
|
-
if (isMoveRight && this.movingDirection === _ci2.ORIENTATIONS.X) {
|
|
419
|
-
this.moveRight(currentPositionX);
|
|
420
|
-
|
|
421
|
-
this.isStartSpin = true;
|
|
422
|
-
} else if (isMoveLeft && this.movingDirection === _ci2.ORIENTATIONS.X) {
|
|
423
|
-
this.moveLeft(currentPositionX);
|
|
424
|
-
|
|
425
|
-
this.isStartSpin = true;
|
|
426
|
-
} else if (isMoveTop && this.movingDirection === _ci2.ORIENTATIONS.Y) {
|
|
427
|
-
this.moveTop(currentPositionY);
|
|
428
|
-
|
|
429
|
-
this.isStartSpin = true;
|
|
430
|
-
} else if (isMoveBottom && this.movingDirection === _ci2.ORIENTATIONS.Y) {
|
|
431
|
-
this.moveBottom(currentPositionY);
|
|
432
|
-
|
|
433
|
-
this.isStartSpin = true;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}, {
|
|
437
|
-
key: 'moveRight',
|
|
438
|
-
value: function moveRight(currentPositionX) {
|
|
439
|
-
var itemsSkippedRight = Math.floor((currentPositionX - this.movementStart.x) / this.speedFactor) || 1;
|
|
440
|
-
|
|
441
|
-
this.spinReverse ? this.moveActiveIndexDown(itemsSkippedRight) : this.moveActiveIndexUp(itemsSkippedRight);
|
|
442
|
-
|
|
443
|
-
this.movementStart.x = currentPositionX;
|
|
444
|
-
this.activeImageY = 1;
|
|
445
|
-
this.update();
|
|
446
|
-
}
|
|
447
|
-
}, {
|
|
448
|
-
key: 'moveLeft',
|
|
449
|
-
value: function moveLeft(currentPositionX) {
|
|
450
|
-
var itemsSkippedLeft = Math.floor((this.movementStart.x - currentPositionX) / this.speedFactor) || 1;
|
|
451
|
-
|
|
452
|
-
this.spinReverse ? this.moveActiveIndexUp(itemsSkippedLeft) : this.moveActiveIndexDown(itemsSkippedLeft);
|
|
453
|
-
|
|
454
|
-
this.activeImageY = 1;
|
|
455
|
-
this.movementStart.x = currentPositionX;
|
|
456
|
-
this.update();
|
|
457
|
-
}
|
|
458
|
-
}, {
|
|
459
|
-
key: 'moveTop',
|
|
460
|
-
value: function moveTop(currentPositionY) {
|
|
461
|
-
var itemsSkippedTop = Math.floor((this.movementStart.y - currentPositionY) / this.speedFactor) || 1;
|
|
462
|
-
|
|
463
|
-
this.spinReverse ? this.moveActiveYIndexUp(itemsSkippedTop) : this.moveActiveYIndexDown(itemsSkippedTop);
|
|
464
|
-
|
|
465
|
-
this.activeImageX = 1;
|
|
466
|
-
this.movementStart.y = currentPositionY;
|
|
467
|
-
this.update();
|
|
468
|
-
}
|
|
469
|
-
}, {
|
|
470
|
-
key: 'moveBottom',
|
|
471
|
-
value: function moveBottom(currentPositionY) {
|
|
472
|
-
var itemsSkippedBottom = Math.floor((currentPositionY - this.movementStart.y) / this.speedFactor) || 1;
|
|
473
|
-
|
|
474
|
-
this.spinReverse ? this.moveActiveYIndexDown(itemsSkippedBottom) : this.moveActiveYIndexUp(itemsSkippedBottom);
|
|
475
|
-
|
|
476
|
-
this.activeImageX = 1;
|
|
477
|
-
this.movementStart.y = currentPositionY;
|
|
478
|
-
this.update();
|
|
479
|
-
}
|
|
480
|
-
}, {
|
|
481
|
-
key: 'moveActiveIndexUp',
|
|
472
|
+
key: "moveActiveIndexUp",
|
|
482
473
|
value: function moveActiveIndexUp(itemsSkipped) {
|
|
483
474
|
var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
|
|
484
475
|
|
|
@@ -488,24 +479,21 @@ var CI360Viewer = function () {
|
|
|
488
479
|
if (isReachedTheEdge) {
|
|
489
480
|
this.activeImageX = this.amountX;
|
|
490
481
|
|
|
491
|
-
if (isReverse ? this.
|
|
492
|
-
(0,
|
|
482
|
+
if (isReverse ? this.leftElem : this.rightElem) {
|
|
483
|
+
(0, _utils.addClass)(isReverse ? this.leftElem : this.rightElem, 'not-active');
|
|
493
484
|
}
|
|
494
485
|
} else {
|
|
495
486
|
this.activeImageX += itemsSkipped;
|
|
496
|
-
|
|
497
|
-
if (this.
|
|
498
|
-
|
|
499
|
-
if (this.leftElem) (0, _ci.removeClass)(this.leftElem, 'not-active');
|
|
487
|
+
if (this.rightElem) (0, _utils.removeClass)(this.rightElem, 'not-active');
|
|
488
|
+
if (this.leftElem) (0, _utils.removeClass)(this.leftElem, 'not-active');
|
|
500
489
|
}
|
|
501
490
|
} else {
|
|
502
491
|
this.activeImageX = (this.activeImageX + itemsSkipped) % this.amountX || this.amountX;
|
|
503
|
-
|
|
504
492
|
if (this.activeImageX === this.amountX && this.allowSpinY) this.spinY = true;
|
|
505
493
|
}
|
|
506
494
|
}
|
|
507
495
|
}, {
|
|
508
|
-
key:
|
|
496
|
+
key: "moveActiveIndexDown",
|
|
509
497
|
value: function moveActiveIndexDown(itemsSkipped) {
|
|
510
498
|
var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
|
|
511
499
|
|
|
@@ -516,14 +504,12 @@ var CI360Viewer = function () {
|
|
|
516
504
|
this.activeImageX = 1;
|
|
517
505
|
|
|
518
506
|
if (isReverse ? this.rightElem : this.leftElem) {
|
|
519
|
-
(0,
|
|
507
|
+
(0, _utils.addClass)(isReverse ? this.rightElem : this.leftElem, 'not-active');
|
|
520
508
|
}
|
|
521
509
|
} else {
|
|
522
510
|
this.activeImageX -= itemsSkipped;
|
|
523
|
-
|
|
524
|
-
if (this.
|
|
525
|
-
|
|
526
|
-
if (this.rightElem) (0, _ci.removeClass)(this.rightElem, 'not-active');
|
|
511
|
+
if (this.leftElem) (0, _utils.removeClass)(this.leftElem, 'not-active');
|
|
512
|
+
if (this.rightElem) (0, _utils.removeClass)(this.rightElem, 'not-active');
|
|
527
513
|
}
|
|
528
514
|
} else {
|
|
529
515
|
if (this.activeImageX - itemsSkipped < 1) {
|
|
@@ -535,7 +521,7 @@ var CI360Viewer = function () {
|
|
|
535
521
|
}
|
|
536
522
|
}
|
|
537
523
|
}, {
|
|
538
|
-
key:
|
|
524
|
+
key: "moveActiveYIndexUp",
|
|
539
525
|
value: function moveActiveYIndexUp(itemsSkipped) {
|
|
540
526
|
var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
|
|
541
527
|
|
|
@@ -546,23 +532,20 @@ var CI360Viewer = function () {
|
|
|
546
532
|
this.activeImageY = this.amountY;
|
|
547
533
|
|
|
548
534
|
if (isReverse ? this.bottomElem : this.topElem) {
|
|
549
|
-
(0,
|
|
535
|
+
(0, _utils.addClass)(isReverse ? this.bottomElem : this.topElem, 'not-active');
|
|
550
536
|
}
|
|
551
537
|
} else {
|
|
552
538
|
this.activeImageY += itemsSkipped;
|
|
553
|
-
|
|
554
|
-
if (this.
|
|
555
|
-
|
|
556
|
-
if (this.bottomElem) (0, _ci.removeClass)(this.bottomElem, 'not-active');
|
|
539
|
+
if (this.topElem) (0, _utils.removeClass)(this.topElem, 'not-active');
|
|
540
|
+
if (this.bottomElem) (0, _utils.removeClass)(this.bottomElem, 'not-active');
|
|
557
541
|
}
|
|
558
542
|
} else {
|
|
559
543
|
this.activeImageY = (this.activeImageY + itemsSkipped) % this.amountY || this.amountY;
|
|
560
|
-
|
|
561
544
|
if (this.activeImageY === this.amountY) this.spinY = false;
|
|
562
545
|
}
|
|
563
546
|
}
|
|
564
547
|
}, {
|
|
565
|
-
key:
|
|
548
|
+
key: "moveActiveYIndexDown",
|
|
566
549
|
value: function moveActiveYIndexDown(itemsSkipped) {
|
|
567
550
|
var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
|
|
568
551
|
|
|
@@ -573,13 +556,12 @@ var CI360Viewer = function () {
|
|
|
573
556
|
this.activeImageY = 1;
|
|
574
557
|
|
|
575
558
|
if (isReverse ? this.topElem : this.bottomElem) {
|
|
576
|
-
(0,
|
|
559
|
+
(0, _utils.addClass)(isReverse ? this.topElem : this.bottomElem, 'not-active');
|
|
577
560
|
}
|
|
578
561
|
} else {
|
|
579
562
|
this.activeImageY -= itemsSkipped;
|
|
580
|
-
|
|
581
|
-
if (this.
|
|
582
|
-
if (this.topElem) (0, _ci.removeClass)(this.topElem, 'not-active');
|
|
563
|
+
if (this.bottomElem) (0, _utils.removeClass)(this.bottomElem, 'not-active');
|
|
564
|
+
if (this.topElem) (0, _utils.removeClass)(this.topElem, 'not-active');
|
|
583
565
|
}
|
|
584
566
|
} else {
|
|
585
567
|
if (this.activeImageY - itemsSkipped < 1) {
|
|
@@ -591,219 +573,242 @@ var CI360Viewer = function () {
|
|
|
591
573
|
}
|
|
592
574
|
}
|
|
593
575
|
}, {
|
|
594
|
-
key:
|
|
595
|
-
value: function
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
576
|
+
key: "moveRight",
|
|
577
|
+
value: function moveRight(currentPositionX) {
|
|
578
|
+
var itemsSkippedRight = (0, _utils.getItemSkipped)(currentPositionX, this.movementStart.x, this.speedFactor);
|
|
579
|
+
this.spinReverse ? this.moveActiveIndexDown(itemsSkippedRight) : this.moveActiveIndexUp(itemsSkippedRight);
|
|
580
|
+
this.movementStart.x = currentPositionX;
|
|
581
|
+
this.activeImageY = 1;
|
|
582
|
+
this.update();
|
|
583
|
+
}
|
|
584
|
+
}, {
|
|
585
|
+
key: "moveLeft",
|
|
586
|
+
value: function moveLeft(currentPositionX) {
|
|
587
|
+
var itemsSkippedLeft = (0, _utils.getItemSkipped)(this.movementStart.x, currentPositionX, this.speedFactor);
|
|
588
|
+
this.spinReverse ? this.moveActiveIndexUp(itemsSkippedLeft) : this.moveActiveIndexDown(itemsSkippedLeft);
|
|
589
|
+
this.activeImageY = 1;
|
|
590
|
+
this.movementStart.x = currentPositionX;
|
|
591
|
+
this.update();
|
|
592
|
+
}
|
|
593
|
+
}, {
|
|
594
|
+
key: "moveTop",
|
|
595
|
+
value: function moveTop(currentPositionY) {
|
|
596
|
+
var itemsSkippedTop = (0, _utils.getItemSkipped)(this.movementStart.y, currentPositionY, this.speedFactor);
|
|
597
|
+
this.spinReverse ? this.moveActiveYIndexUp(itemsSkippedTop) : this.moveActiveYIndexDown(itemsSkippedTop);
|
|
598
|
+
this.activeImageX = 1;
|
|
599
|
+
this.movementStart.y = currentPositionY;
|
|
600
|
+
this.update();
|
|
601
|
+
}
|
|
602
|
+
}, {
|
|
603
|
+
key: "moveBottom",
|
|
604
|
+
value: function moveBottom(currentPositionY) {
|
|
605
|
+
var itemsSkippedBottom = (0, _utils.getItemSkipped)(currentPositionY, this.movementStart.y, this.speedFactor);
|
|
606
|
+
this.spinReverse ? this.moveActiveYIndexDown(itemsSkippedBottom) : this.moveActiveYIndexUp(itemsSkippedBottom);
|
|
607
|
+
this.activeImageX = 1;
|
|
608
|
+
this.movementStart.y = currentPositionY;
|
|
609
|
+
this.update();
|
|
610
|
+
}
|
|
611
|
+
}, {
|
|
612
|
+
key: "onMoveHandler",
|
|
613
|
+
value: function onMoveHandler(event) {
|
|
614
|
+
var currentPositionX = this.isMobile ? event.touches[0].clientX : event.pageX;
|
|
615
|
+
var currentPositionY = this.isMobile ? event.touches[0].clientY : event.pageY;
|
|
616
|
+
var isMoveRight = currentPositionX - this.movementStart.x >= this.speedFactor;
|
|
617
|
+
var isMoveLeft = this.movementStart.x - currentPositionX >= this.speedFactor;
|
|
618
|
+
var isMoveTop = this.movementStart.y - currentPositionY >= this.speedFactor;
|
|
619
|
+
var isMoveBottom = currentPositionY - this.movementStart.y >= this.speedFactor;
|
|
620
|
+
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
616
621
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
622
|
+
if (isMoveRight && this.movingDirection === _constants.ORIENTATIONS.X) {
|
|
623
|
+
this.moveRight(currentPositionX);
|
|
624
|
+
this.isStartSpin = true;
|
|
625
|
+
} else if (isMoveLeft && this.movingDirection === _constants.ORIENTATIONS.X) {
|
|
626
|
+
this.moveLeft(currentPositionX);
|
|
627
|
+
this.isStartSpin = true;
|
|
628
|
+
} else if (isMoveTop && this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
629
|
+
this.moveTop(currentPositionY);
|
|
630
|
+
this.isStartSpin = true;
|
|
631
|
+
} else if (isMoveBottom && this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
632
|
+
this.moveBottom(currentPositionY);
|
|
633
|
+
this.isStartSpin = true;
|
|
620
634
|
}
|
|
621
635
|
}
|
|
622
636
|
}, {
|
|
623
|
-
key:
|
|
624
|
-
value: function
|
|
625
|
-
this.movingDirection =
|
|
637
|
+
key: "left",
|
|
638
|
+
value: function left() {
|
|
639
|
+
this.movingDirection = _constants.ORIENTATIONS.X;
|
|
626
640
|
this.activeImageY = this.reversed ? this.amountY : 1;
|
|
627
|
-
|
|
628
|
-
this.moveActiveIndexUp(1);
|
|
641
|
+
this.moveActiveIndexDown(1);
|
|
629
642
|
this.update();
|
|
630
643
|
}
|
|
631
644
|
}, {
|
|
632
|
-
key:
|
|
633
|
-
value: function
|
|
634
|
-
this.movingDirection =
|
|
645
|
+
key: "right",
|
|
646
|
+
value: function right() {
|
|
647
|
+
this.movingDirection = _constants.ORIENTATIONS.X;
|
|
635
648
|
this.activeImageY = this.reversed ? this.amountY : 1;
|
|
636
|
-
|
|
637
|
-
this.moveActiveIndexDown(1);
|
|
649
|
+
this.moveActiveIndexUp(1);
|
|
638
650
|
this.update();
|
|
639
651
|
}
|
|
640
652
|
}, {
|
|
641
|
-
key:
|
|
653
|
+
key: "top",
|
|
642
654
|
value: function top() {
|
|
643
|
-
this.movingDirection =
|
|
655
|
+
this.movingDirection = _constants.ORIENTATIONS.Y;
|
|
644
656
|
this.activeImageX = this.reversed ? this.amountX : 1;
|
|
645
|
-
|
|
646
657
|
this.moveActiveYIndexUp(1);
|
|
647
658
|
this.update();
|
|
648
659
|
}
|
|
649
660
|
}, {
|
|
650
|
-
key:
|
|
661
|
+
key: "bottom",
|
|
651
662
|
value: function bottom() {
|
|
652
|
-
this.movingDirection =
|
|
663
|
+
this.movingDirection = _constants.ORIENTATIONS.Y;
|
|
653
664
|
this.activeImageX = this.reversed ? this.amountX : 1;
|
|
654
|
-
|
|
655
665
|
this.moveActiveYIndexDown(1);
|
|
656
666
|
this.update();
|
|
657
667
|
}
|
|
658
668
|
}, {
|
|
659
|
-
key:
|
|
660
|
-
value: function
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
this.update();
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}, {
|
|
672
|
-
key: 'replaceImages',
|
|
673
|
-
value: function replaceImages(orientation) {
|
|
674
|
-
if (orientation === _ci2.ORIENTATIONS.Y) {
|
|
675
|
-
this.imagesY = this.resizedImagesY;
|
|
676
|
-
} else {
|
|
677
|
-
this.imagesX = this.resizedImagesX;
|
|
678
|
-
}
|
|
669
|
+
key: "loop",
|
|
670
|
+
value: function loop(reversed) {
|
|
671
|
+
var loopTriggers = {
|
|
672
|
+
left: this.left.bind(this),
|
|
673
|
+
right: this.right.bind(this),
|
|
674
|
+
top: this.top.bind(this),
|
|
675
|
+
bottom: this.bottom.bind(this)
|
|
676
|
+
};
|
|
677
|
+
(0, _utils.loop)(this.autoplayBehavior, this.spinY, reversed, loopTriggers);
|
|
679
678
|
}
|
|
680
679
|
}, {
|
|
681
|
-
key:
|
|
682
|
-
value: function
|
|
683
|
-
var
|
|
680
|
+
key: "updateContainerAndCanvasSize",
|
|
681
|
+
value: function updateContainerAndCanvasSize(image) {
|
|
682
|
+
var imageAspectRatio = (0, _utils.getImageAspectRatio)(image, this.ratio);
|
|
684
683
|
|
|
685
|
-
if (
|
|
686
|
-
this.
|
|
687
|
-
this.
|
|
688
|
-
|
|
689
|
-
this.
|
|
690
|
-
this.
|
|
684
|
+
if (this.fullscreenView) {
|
|
685
|
+
this.container.width = window.innerWidth * this.devicePixelRatio;
|
|
686
|
+
this.container.style.width = window.innerWidth + 'px';
|
|
687
|
+
this.container.height = window.innerHeight * this.devicePixelRatio;
|
|
688
|
+
this.container.style.height = window.innerHeight + 'px';
|
|
689
|
+
this.container.style.maxWidth = 'unset';
|
|
690
|
+
this.canvas.width = window.innerWidth * this.devicePixelRatio;
|
|
691
|
+
this.canvas.style.width = window.innerWidth + 'px';
|
|
692
|
+
this.canvas.height = window.innerHeight * this.devicePixelRatio;
|
|
693
|
+
this.canvas.style.height = window.innerHeight + 'px';
|
|
694
|
+
return;
|
|
691
695
|
}
|
|
692
696
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
_this.addUpdatedSizeImage(resultSrc, orientation, _this.lazyload, _this.lazySelector, index);
|
|
698
|
-
});
|
|
697
|
+
this.canvas.width = this.container.offsetWidth * this.devicePixelRatio;
|
|
698
|
+
this.canvas.style.width = this.container.offsetWidth + 'px';
|
|
699
|
+
this.canvas.height = this.container.offsetWidth / imageAspectRatio * this.devicePixelRatio;
|
|
700
|
+
this.canvas.style.height = this.container.offsetWidth / imageAspectRatio + 'px';
|
|
699
701
|
}
|
|
700
702
|
}, {
|
|
701
|
-
key:
|
|
702
|
-
value: function
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
if (lazyload && !this.fullscreenView) {
|
|
706
|
-
image.setAttribute('data-src', resultSrc);
|
|
707
|
-
image.className = image.className.length ? image.className + (' ' + lazySelector) : lazySelector;
|
|
708
|
-
|
|
709
|
-
if (index === 0) {
|
|
710
|
-
this.lazyloadInitImage = image;
|
|
711
|
-
image.style.position = 'absolute';
|
|
712
|
-
image.style.top = '0';
|
|
713
|
-
image.style.left = '0';
|
|
714
|
-
this.innerBox.appendChild(image);
|
|
715
|
-
}
|
|
703
|
+
key: "onResizedImageLoad",
|
|
704
|
+
value: function onResizedImageLoad(orientation, image, index) {
|
|
705
|
+
if (orientation === _constants.ORIENTATIONS.Y) {
|
|
706
|
+
this.resizedImagesY[index] = image;
|
|
716
707
|
} else {
|
|
717
|
-
|
|
708
|
+
this.resizedImagesX[index] = image;
|
|
718
709
|
}
|
|
719
710
|
|
|
720
|
-
|
|
721
|
-
|
|
711
|
+
var loadedResizedXImages = this.resizedImagesX.filter(function (image) {
|
|
712
|
+
return image;
|
|
713
|
+
});
|
|
714
|
+
var loadedResizedYImages = this.resizedImagesY.filter(function (image) {
|
|
715
|
+
return image;
|
|
716
|
+
});
|
|
717
|
+
var isAllImagesLoaded = loadedResizedXImages.length + loadedResizedYImages.length === this.amountX + this.amountY;
|
|
722
718
|
|
|
723
|
-
if (
|
|
724
|
-
this.
|
|
725
|
-
|
|
726
|
-
this.
|
|
719
|
+
if (isAllImagesLoaded) {
|
|
720
|
+
this.imagesX = this.resizedImagesX;
|
|
721
|
+
this.imagesY = this.resizedImagesY;
|
|
722
|
+
this.update();
|
|
727
723
|
}
|
|
728
724
|
}
|
|
729
725
|
}, {
|
|
730
|
-
key:
|
|
726
|
+
key: "showImageInfo",
|
|
727
|
+
value: function showImageInfo(ctx) {
|
|
728
|
+
ctx.font = "".concat(this.fullscreenView ? 28 : 14, "px serif");
|
|
729
|
+
ctx.fillStyle = this.info === 'white' ? '#FFF' : '#000';
|
|
730
|
+
var imageDimension = "image-dimension: ".concat(this.container.offsetWidth, "x").concat(this.container.offsetHeight, "px");
|
|
731
|
+
var currentXImage = 'active-index-x: ' + this.activeImageX;
|
|
732
|
+
var currentYImage = 'active-index-y: ' + this.activeImageY;
|
|
733
|
+
var imageIndex = [currentXImage, currentYImage].join(' | ');
|
|
734
|
+
ctx.fillText(imageDimension, 20, this.container.offsetHeight - 35);
|
|
735
|
+
ctx.fillText(imageIndex, 20, this.container.offsetHeight - 10);
|
|
736
|
+
}
|
|
737
|
+
}, {
|
|
738
|
+
key: "requestResizedImages",
|
|
731
739
|
value: function requestResizedImages() {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
740
|
+
if (!this.isReady()) return;
|
|
741
|
+
var responsive = this.ciParams.ciToken;
|
|
742
|
+
var firstImage = this.imagesX[0];
|
|
743
|
+
this.update();
|
|
744
|
+
if (!responsive || this.container.offsetWidth < firstImage.width * 1.5) return;
|
|
745
|
+
this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
|
|
746
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
747
|
+
(0, _utils.preloadImages)(this.srcXConfig, srcX, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.X));
|
|
735
748
|
|
|
736
749
|
if (this.allowSpinY) {
|
|
737
|
-
var srcY =
|
|
738
|
-
|
|
739
|
-
this.requestNewImages(srcY, this.amountY, _ci2.ORIENTATIONS.Y);
|
|
750
|
+
var srcY = (0, _utils.generateImagesPath)(this.srcYConfig);
|
|
751
|
+
(0, _utils.preloadImages)(this.srcYConfig, srcY, this.onResizedImageLoad.bind(this, _constants.ORIENTATIONS.Y));
|
|
740
752
|
}
|
|
741
753
|
}
|
|
742
754
|
}, {
|
|
743
|
-
key:
|
|
755
|
+
key: "update",
|
|
744
756
|
value: function update() {
|
|
745
757
|
var image = this.imagesX[this.activeImageX - 1];
|
|
746
758
|
|
|
747
|
-
if (this.movingDirection ===
|
|
759
|
+
if (this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
748
760
|
image = this.imagesY[this.activeImageY - 1];
|
|
749
761
|
}
|
|
750
762
|
|
|
763
|
+
if (!image) return;
|
|
751
764
|
var ctx = this.canvas.getContext("2d");
|
|
752
|
-
|
|
753
765
|
ctx.scale(this.devicePixelRatio, this.devicePixelRatio);
|
|
766
|
+
this.updateContainerAndCanvasSize(image);
|
|
754
767
|
|
|
755
768
|
if (this.fullscreenView) {
|
|
756
|
-
this.canvas.width
|
|
757
|
-
this.canvas.style.width = window.innerWidth + 'px';
|
|
758
|
-
this.canvas.height = window.innerHeight * this.devicePixelRatio;
|
|
759
|
-
this.canvas.style.height = window.innerHeight + 'px';
|
|
760
|
-
|
|
761
|
-
var _contain = (0, _ci.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
|
|
762
|
-
offsetX = _contain.offsetX,
|
|
763
|
-
offsetY = _contain.offsetY,
|
|
769
|
+
var _contain = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
|
|
764
770
|
width = _contain.width,
|
|
765
|
-
height = _contain.height
|
|
771
|
+
height = _contain.height,
|
|
772
|
+
offsetX = _contain.offsetX,
|
|
773
|
+
offsetY = _contain.offsetY;
|
|
766
774
|
|
|
767
775
|
ctx.drawImage(image, offsetX, offsetY, width, height);
|
|
768
776
|
} else {
|
|
769
|
-
|
|
770
|
-
this.canvas.style.width = this.container.offsetWidth + 'px';
|
|
771
|
-
this.canvas.height = this.container.offsetWidth * this.devicePixelRatio / image.width * image.height;
|
|
772
|
-
this.canvas.style.height = this.container.offsetWidth / image.width * image.height + 'px';
|
|
773
|
-
|
|
774
|
-
if (this.startPointerZoom || this.startPinchZoom) {
|
|
777
|
+
if (this.mouseTracked) {
|
|
775
778
|
this.updateImageScale(ctx);
|
|
776
779
|
} else {
|
|
780
|
+
if (this.hotspotsConfigs && !this.autoplay) {
|
|
781
|
+
(0, _utils.updateHotspots)(this.container, this.hotspotsConfigs, this.activeImageX, this.activeImageY, this.movingDirection, this.isClicked);
|
|
782
|
+
}
|
|
783
|
+
|
|
777
784
|
ctx.drawImage(image, 0, 0, this.canvas.width, this.canvas.height);
|
|
778
785
|
}
|
|
779
786
|
}
|
|
787
|
+
|
|
788
|
+
if (this.info) {
|
|
789
|
+
this.showImageInfo(ctx);
|
|
790
|
+
}
|
|
780
791
|
}
|
|
781
792
|
}, {
|
|
782
|
-
key:
|
|
793
|
+
key: "updateImageScale",
|
|
783
794
|
value: function updateImageScale(ctx) {
|
|
784
795
|
var image = this.originalImagesX[this.activeImageX - 1];
|
|
785
796
|
|
|
786
|
-
if (this.movingDirection ===
|
|
797
|
+
if (this.movingDirection === _constants.ORIENTATIONS.Y) {
|
|
787
798
|
image = this.originalImagesY[this.activeImageY - 1];
|
|
788
799
|
}
|
|
789
800
|
|
|
790
|
-
var position = this.
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
var
|
|
795
|
-
var imageHeight = this.canvas.height / this.devicePixelRatio;
|
|
796
|
-
|
|
797
|
-
var width = this.canvas.width + this.zoomIntensity * (this.canvas.width / this.canvas.height);
|
|
798
|
-
var height = this.canvas.height + this.zoomIntensity;
|
|
799
|
-
|
|
801
|
+
var position = this.getCursorPositionInCanvas();
|
|
802
|
+
var imageWidth = this.canvas.width;
|
|
803
|
+
var imageHeight = this.canvas.height;
|
|
804
|
+
var width = this.canvas.width * this.zoomIntensity;
|
|
805
|
+
var height = this.canvas.height * this.zoomIntensity;
|
|
800
806
|
var pointX = 0 - position.x / imageWidth * (width - this.canvas.width);
|
|
801
807
|
var pointY = 0 - position.y / imageHeight * (height - this.canvas.height);
|
|
802
|
-
|
|
803
808
|
ctx.drawImage(image, pointX, pointY, width, height);
|
|
804
809
|
}
|
|
805
810
|
}, {
|
|
806
|
-
key:
|
|
811
|
+
key: "updatePercentageInLoader",
|
|
807
812
|
value: function updatePercentageInLoader(percentage) {
|
|
808
813
|
if (this.loader) {
|
|
809
814
|
this.loader.style.width = percentage + '%';
|
|
@@ -814,127 +819,40 @@ var CI360Viewer = function () {
|
|
|
814
819
|
}
|
|
815
820
|
}
|
|
816
821
|
}, {
|
|
817
|
-
key:
|
|
818
|
-
value: function
|
|
819
|
-
this.
|
|
820
|
-
|
|
821
|
-
this.
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
this.removeLoader();
|
|
825
|
-
|
|
826
|
-
if (!this.fullscreenView) {
|
|
827
|
-
this.speedFactor = Math.floor(this.dragSpeed / 150 * 36 / this.amountX * 25 * this.container.offsetWidth / 1500) || 1;
|
|
828
|
-
} else {
|
|
829
|
-
var containerRatio = this.container.offsetHeight / this.container.offsetWidth;
|
|
830
|
-
var imageOffsetWidth = this.container.offsetWidth;
|
|
831
|
-
|
|
832
|
-
if (this.ratio > containerRatio) {
|
|
833
|
-
imageOffsetWidth = this.container.offsetHeight / this.ratio;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
this.speedFactor = Math.floor(this.dragSpeed / 150 * 36 / this.amountX * 25 * imageOffsetWidth / 1500) || 1;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
if (this.imageOffset) {
|
|
840
|
-
this.activeImageX = this.imageOffset;
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
if (this.autoplay) {
|
|
844
|
-
this.play();
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
if (this.view360Icon) {
|
|
848
|
-
this.view360Icon.innerText = '';
|
|
849
|
-
(0, _ci.setView360Icon)(this.view360Icon, this.logoSrc);
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
this.initControls();
|
|
853
|
-
}
|
|
854
|
-
}, {
|
|
855
|
-
key: 'onFirstImageLoaded',
|
|
856
|
-
value: function onFirstImageLoaded(event) {
|
|
857
|
-
var _this2 = this;
|
|
858
|
-
|
|
859
|
-
if (!this.hide360Logo) {
|
|
860
|
-
this.add360ViewIcon();
|
|
861
|
-
}
|
|
822
|
+
key: "onFirstImageLoaded",
|
|
823
|
+
value: function onFirstImageLoaded(image) {
|
|
824
|
+
if (!this.hide360Logo && !this.lazyload) this.add360ViewIcon();
|
|
825
|
+
var ctx = this.canvas.getContext("2d");
|
|
826
|
+
ctx.scale(this.devicePixelRatio, this.devicePixelRatio);
|
|
827
|
+
this.updateContainerAndCanvasSize(image);
|
|
862
828
|
|
|
863
829
|
if (this.fullscreenView) {
|
|
864
|
-
this.canvas.width
|
|
865
|
-
this.canvas.style.width = window.innerWidth + 'px';
|
|
866
|
-
this.canvas.height = window.innerHeight * this.devicePixelRatio;
|
|
867
|
-
this.canvas.style.height = window.innerHeight + 'px';
|
|
868
|
-
|
|
869
|
-
var ctx = this.canvas.getContext("2d");
|
|
870
|
-
|
|
871
|
-
var _contain2 = (0, _ci.contain)(this.canvas.width, this.canvas.height, event.target.width, event.target.height),
|
|
830
|
+
var _contain2 = (0, _utils.contain)(this.canvas.width, this.canvas.height, image.width, image.height),
|
|
872
831
|
offsetX = _contain2.offsetX,
|
|
873
832
|
offsetY = _contain2.offsetY,
|
|
874
833
|
width = _contain2.width,
|
|
875
834
|
height = _contain2.height;
|
|
876
835
|
|
|
877
|
-
this.offset = {
|
|
878
|
-
|
|
879
|
-
|
|
836
|
+
this.offset = {
|
|
837
|
+
x: offsetX,
|
|
838
|
+
y: offsetY
|
|
839
|
+
};
|
|
840
|
+
this.addCloseFullscreenView();
|
|
841
|
+
ctx.drawImage(image, offsetX, offsetY, width, height);
|
|
880
842
|
} else {
|
|
881
|
-
|
|
882
|
-
var imagePreview = event.target;
|
|
883
|
-
|
|
884
|
-
if (this.imageOffset) {
|
|
885
|
-
imagePreview = this.imagesX[this.imageOffset];
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
if (this.container.offsetWidth === 0) {
|
|
889
|
-
var modalRef = this.container.parentElement;
|
|
890
|
-
|
|
891
|
-
this.canvas.width = parseInt(modalRef.style.width) * this.devicePixelRatio;
|
|
892
|
-
this.canvas.style.width = modalRef.style.width;
|
|
893
|
-
|
|
894
|
-
this.canvas.height = parseInt(modalRef.style.height) * this.devicePixelRatio / event.target.width * event.target.height;
|
|
895
|
-
this.canvas.style.height = parseInt(modalRef.style.width) / event.target.width * event.target.height + 'px';
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
if (this.container.offsetWidth > 0) {
|
|
899
|
-
this.canvas.width = this.container.offsetWidth * this.devicePixelRatio;
|
|
900
|
-
this.canvas.style.width = this.container.offsetWidth + 'px';
|
|
901
|
-
|
|
902
|
-
this.canvas.height = this.container.offsetWidth * this.devicePixelRatio / event.target.width * event.target.height;
|
|
903
|
-
this.canvas.style.height = this.container.offsetWidth / event.target.width * event.target.height + 'px';
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
_ctx.drawImage(imagePreview, 0, 0, this.canvas.width, this.canvas.height);
|
|
843
|
+
ctx.drawImage(image, 0, 0, this.canvas.width, this.canvas.height);
|
|
907
844
|
}
|
|
908
845
|
|
|
909
|
-
if (this.
|
|
910
|
-
this.
|
|
911
|
-
if (index === 0) {
|
|
912
|
-
_this2.innerBox.removeChild(_this2.lazyloadInitImage);
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
var dataSrc = image.getAttribute('data-src');
|
|
917
|
-
|
|
918
|
-
if (dataSrc) {
|
|
919
|
-
image.src = image.getAttribute('data-src');
|
|
920
|
-
}
|
|
921
|
-
});
|
|
846
|
+
if (this.info) {
|
|
847
|
+
this.showImageInfo(ctx);
|
|
922
848
|
}
|
|
923
849
|
|
|
924
|
-
if (this.
|
|
925
|
-
this.container.style.minHeight = 'auto';
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
if (this.fullscreenView) {
|
|
929
|
-
this.addCloseFullscreenView();
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
if (this.magnifier && !this.fullscreenView || this.magnifyInFullscreen) {
|
|
850
|
+
if (this.magnifier) {
|
|
933
851
|
this.addMagnifier();
|
|
934
852
|
}
|
|
935
853
|
|
|
936
854
|
if (this.boxShadow && !this.fullscreenView) {
|
|
937
|
-
this.
|
|
855
|
+
this.boxShadowEl = (0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
|
|
938
856
|
}
|
|
939
857
|
|
|
940
858
|
if (this.bottomCircle && !this.fullscreenView) {
|
|
@@ -945,458 +863,166 @@ var CI360Viewer = function () {
|
|
|
945
863
|
this.addFullscreenIcon();
|
|
946
864
|
}
|
|
947
865
|
|
|
948
|
-
if (
|
|
949
|
-
this.
|
|
866
|
+
if (this.hotspotsConfigs && !this.autoplay) {
|
|
867
|
+
(0, _utils.updateHotspots)(this.container, this.hotspotsConfigs, this.activeImageX, this.activeImageY, this.movingDirection);
|
|
950
868
|
}
|
|
951
869
|
}
|
|
952
870
|
}, {
|
|
953
|
-
key:
|
|
954
|
-
value: function
|
|
955
|
-
|
|
956
|
-
|
|
871
|
+
key: "onAllImagesLoaded",
|
|
872
|
+
value: function onAllImagesLoaded() {
|
|
873
|
+
this.removeLoader();
|
|
874
|
+
this.imagesLoaded = true;
|
|
875
|
+
|
|
876
|
+
if (this.autoplay && this.pointerZoom) {
|
|
877
|
+
this.container.style.cursor = 'zoom-in';
|
|
957
878
|
} else {
|
|
958
|
-
this.
|
|
879
|
+
this.container.style.cursor = 'grab';
|
|
959
880
|
}
|
|
960
|
-
}
|
|
961
|
-
}, {
|
|
962
|
-
key: 'onImageLoad',
|
|
963
|
-
value: function onImageLoad(index, orientation, event) {
|
|
964
|
-
this.incrementLoadedImages(orientation);
|
|
965
|
-
|
|
966
|
-
var totalAmount = this.amountX + this.amountY;
|
|
967
|
-
var totalLoadedImages = this.loadedImagesX + this.loadedImagesY;
|
|
968
881
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
this.updatePercentageInLoader(percentage);
|
|
882
|
+
this.speedFactor = (0, _utils.getSpeedFactor)(this.dragSpeed, this.amountX, this.container.offsetWidth);
|
|
972
883
|
|
|
973
|
-
if (
|
|
974
|
-
this.
|
|
884
|
+
if (this.autoplay) {
|
|
885
|
+
this.play();
|
|
975
886
|
}
|
|
976
887
|
|
|
977
|
-
if (
|
|
978
|
-
this.
|
|
888
|
+
if (this.disableDrag) {
|
|
889
|
+
this.container.style.cursor = 'default';
|
|
979
890
|
}
|
|
980
|
-
}
|
|
981
|
-
}, {
|
|
982
|
-
key: 'addCloseFullscreenView',
|
|
983
|
-
value: function addCloseFullscreenView(event) {
|
|
984
|
-
var closeFullscreenIcon = document.createElement('div');
|
|
985
|
-
closeFullscreenIcon.className = 'cloudimage-360-close-fullscreen-icon';
|
|
986
|
-
closeFullscreenIcon.onclick = this.setFullscreenEvents.bind(this, event);
|
|
987
|
-
|
|
988
|
-
window.onkeyup = this.setFullscreenEvents.bind(this, event);
|
|
989
|
-
|
|
990
|
-
this.iconsContainer.appendChild(closeFullscreenIcon);
|
|
991
|
-
}
|
|
992
|
-
}, {
|
|
993
|
-
key: 'add360ViewIcon',
|
|
994
|
-
value: function add360ViewIcon() {
|
|
995
|
-
var view360Icon = document.createElement('div');
|
|
996
|
-
|
|
997
|
-
view360Icon.className = 'cloudimage-360-view-360-icon';
|
|
998
|
-
view360Icon.innerText = '0%';
|
|
999
|
-
|
|
1000
|
-
this.view360Icon = view360Icon;
|
|
1001
|
-
this.innerBox.appendChild(view360Icon);
|
|
1002
|
-
}
|
|
1003
|
-
}, {
|
|
1004
|
-
key: 'addFullscreenIcon',
|
|
1005
|
-
value: function addFullscreenIcon() {
|
|
1006
|
-
var fullscreenIcon = document.createElement('div');
|
|
1007
|
-
|
|
1008
|
-
fullscreenIcon.className = 'cloudimage-360-fullscreen-icon';
|
|
1009
|
-
fullscreenIcon.onclick = this.openFullscreenModal.bind(this);
|
|
1010
|
-
|
|
1011
|
-
this.fullscreenIcon = fullscreenIcon;
|
|
1012
|
-
|
|
1013
|
-
this.iconsContainer.appendChild(fullscreenIcon);
|
|
1014
|
-
}
|
|
1015
|
-
}, {
|
|
1016
|
-
key: 'hideFullscreenIcon',
|
|
1017
|
-
value: function hideFullscreenIcon() {
|
|
1018
|
-
if (!this.fullscreenIcon) return;
|
|
1019
|
-
|
|
1020
|
-
this.fullscreenIcon.style.opacity = '0.4';
|
|
1021
|
-
this.fullscreenIcon.style.pointerEvents = 'none';
|
|
1022
|
-
}
|
|
1023
|
-
}, {
|
|
1024
|
-
key: 'showFullscreenIcon',
|
|
1025
|
-
value: function showFullscreenIcon() {
|
|
1026
|
-
if (!this.fullscreenIcon) return;
|
|
1027
|
-
|
|
1028
|
-
this.fullscreenIcon.style.opacity = '1';
|
|
1029
|
-
this.fullscreenIcon.style.pointerEvents = 'auto';
|
|
1030
|
-
}
|
|
1031
|
-
}, {
|
|
1032
|
-
key: 'addMagnifier',
|
|
1033
|
-
value: function addMagnifier() {
|
|
1034
|
-
var magnifyIcon = document.createElement('div');
|
|
1035
|
-
|
|
1036
|
-
magnifyIcon.className = 'cloudimage-360-magnifier-icon';
|
|
1037
|
-
magnifyIcon.onclick = this.magnify.bind(this);
|
|
1038
|
-
|
|
1039
|
-
this.magnifierIcon = magnifyIcon;
|
|
1040
|
-
|
|
1041
|
-
this.iconsContainer.appendChild(magnifyIcon);
|
|
1042
|
-
}
|
|
1043
|
-
}, {
|
|
1044
|
-
key: 'disableMagnifierIcon',
|
|
1045
|
-
value: function disableMagnifierIcon() {
|
|
1046
|
-
if (!this.magnifierIcon) return;
|
|
1047
|
-
|
|
1048
|
-
this.magnifierIcon.style.opacity = '0.4';
|
|
1049
|
-
this.magnifierIcon.style.pointerEvents = 'none';
|
|
1050
|
-
}
|
|
1051
|
-
}, {
|
|
1052
|
-
key: 'enableMagnifierIcon',
|
|
1053
|
-
value: function enableMagnifierIcon() {
|
|
1054
|
-
if (!this.magnifierIcon) return;
|
|
1055
891
|
|
|
1056
|
-
this.
|
|
1057
|
-
|
|
1058
|
-
}
|
|
1059
|
-
}, {
|
|
1060
|
-
key: 'getOriginalSrc',
|
|
1061
|
-
value: function getOriginalSrc() {
|
|
1062
|
-
var currentImage = this.originalImagesX[this.activeImageX - 1];
|
|
1063
|
-
|
|
1064
|
-
if (this.movingDirection === _ci2.ORIENTATIONS.Y) {
|
|
1065
|
-
currentImage = this.originalImagesY[this.activeImageY - 1];
|
|
1066
|
-
};
|
|
1067
|
-
|
|
1068
|
-
return currentImage.src;
|
|
1069
|
-
}
|
|
1070
|
-
}, {
|
|
1071
|
-
key: 'magnify',
|
|
1072
|
-
value: function magnify() {
|
|
1073
|
-
var _this3 = this;
|
|
1074
|
-
|
|
1075
|
-
var image = new Image();
|
|
1076
|
-
var src = this.getOriginalSrc();
|
|
1077
|
-
this.isMagnifyOpen = true;
|
|
1078
|
-
|
|
1079
|
-
image.src = src;
|
|
1080
|
-
image.onload = function () {
|
|
1081
|
-
if (_this3.glass) {
|
|
1082
|
-
_this3.glass.style.cursor = 'none';
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
this.glass = document.createElement('div');
|
|
1087
|
-
this.container.style.overflow = 'hidden';
|
|
1088
|
-
|
|
1089
|
-
(0, _ci.magnify)(this.container, this.offset, src, this.glass, this.magnifier || 3);
|
|
1090
|
-
}
|
|
1091
|
-
}, {
|
|
1092
|
-
key: 'closeMagnifier',
|
|
1093
|
-
value: function closeMagnifier() {
|
|
1094
|
-
if (!this.glass) return;
|
|
1095
|
-
|
|
1096
|
-
this.container.style.overflow = 'visible';
|
|
1097
|
-
this.container.removeChild(this.glass);
|
|
1098
|
-
this.glass = null;
|
|
1099
|
-
this.isMagnifyOpen = false;
|
|
1100
|
-
}
|
|
1101
|
-
}, {
|
|
1102
|
-
key: 'openFullscreenModal',
|
|
1103
|
-
value: function openFullscreenModal() {
|
|
1104
|
-
var fullscreenModal = document.createElement('div');
|
|
1105
|
-
|
|
1106
|
-
fullscreenModal.className = 'cloudimage-360-fullscreen-modal';
|
|
1107
|
-
|
|
1108
|
-
var fullscreenContainer = this.container.cloneNode();
|
|
1109
|
-
var image = this.imagesX[0];
|
|
1110
|
-
var ratio = image.height / image.width;
|
|
1111
|
-
|
|
1112
|
-
fullscreenContainer.style.height = '100%';
|
|
1113
|
-
fullscreenContainer.style.maxHeight = '100%';
|
|
1114
|
-
|
|
1115
|
-
fullscreenModal.appendChild(fullscreenContainer);
|
|
1116
|
-
|
|
1117
|
-
window.document.body.style.overflow = 'hidden';
|
|
1118
|
-
window.document.body.appendChild(fullscreenModal);
|
|
1119
|
-
|
|
1120
|
-
new CI360Viewer(fullscreenContainer, true, ratio);
|
|
1121
|
-
}
|
|
1122
|
-
}, {
|
|
1123
|
-
key: 'setFullscreenEvents',
|
|
1124
|
-
value: function setFullscreenEvents(_, event) {
|
|
1125
|
-
if (event.type === 'click') return this.closeFullscreenModal();
|
|
1126
|
-
if (event.key === 'Escape') return this.closeFullscreenModalOnEsc();
|
|
1127
|
-
}
|
|
1128
|
-
}, {
|
|
1129
|
-
key: 'closeFullscreenModalOnEsc',
|
|
1130
|
-
value: function closeFullscreenModalOnEsc() {
|
|
1131
|
-
|
|
1132
|
-
if (this.container.parentNode.parentNode === document.body) {
|
|
1133
|
-
this.closeFullscreenModal();
|
|
1134
|
-
};
|
|
1135
|
-
}
|
|
1136
|
-
}, {
|
|
1137
|
-
key: 'closeFullscreenModal',
|
|
1138
|
-
value: function closeFullscreenModal() {
|
|
1139
|
-
document.body.removeChild(this.container.parentNode);
|
|
1140
|
-
window.document.body.style.overflow = 'visible';
|
|
1141
|
-
}
|
|
1142
|
-
}, {
|
|
1143
|
-
key: 'add360ViewCircleIcon',
|
|
1144
|
-
value: function add360ViewCircleIcon() {
|
|
1145
|
-
var view360CircleIcon = new Image();
|
|
1146
|
-
|
|
1147
|
-
view360CircleIcon.src = 'https://scaleflex.ultrafast.io/https://scaleflex.api.airstore.io/v1/get/_/2236d56f-914a-5a8b-a3ae-f7bde1c50000/360.svg';
|
|
1148
|
-
|
|
1149
|
-
view360CircleIcon.style.bottom = this.bottomCircleOffset + '%';
|
|
1150
|
-
view360CircleIcon.className = 'cloudimage-360-view-360-circle';
|
|
1151
|
-
|
|
1152
|
-
this.view360CircleIcon = view360CircleIcon;
|
|
1153
|
-
this.innerBox.appendChild(view360CircleIcon);
|
|
1154
|
-
}
|
|
1155
|
-
}, {
|
|
1156
|
-
key: 'hide360ViewCircleIcon',
|
|
1157
|
-
value: function hide360ViewCircleIcon() {
|
|
1158
|
-
if (!this.view360CircleIcon) return;
|
|
1159
|
-
|
|
1160
|
-
this.view360CircleIcon.style.opacity = '0';
|
|
1161
|
-
}
|
|
1162
|
-
}, {
|
|
1163
|
-
key: 'show360ViewCircleIcon',
|
|
1164
|
-
value: function show360ViewCircleIcon() {
|
|
1165
|
-
if (!this.view360CircleIcon) return;
|
|
1166
|
-
|
|
1167
|
-
this.view360CircleIcon.style.opacity = '1';
|
|
1168
|
-
}
|
|
1169
|
-
}, {
|
|
1170
|
-
key: 'remove360ViewCircleIcon',
|
|
1171
|
-
value: function remove360ViewCircleIcon() {
|
|
1172
|
-
if (!this.view360CircleIcon) return;
|
|
1173
|
-
|
|
1174
|
-
this.innerBox.removeChild(this.view360CircleIcon);
|
|
1175
|
-
this.view360CircleIcon = null;
|
|
1176
|
-
}
|
|
1177
|
-
}, {
|
|
1178
|
-
key: 'addResetZoomIcon',
|
|
1179
|
-
value: function addResetZoomIcon() {
|
|
1180
|
-
var resetZoomIcon = document.createElement('div');
|
|
892
|
+
if (this.view360Icon) {
|
|
893
|
+
this.view360Icon.innerText = ''; //TODO [deprecated]: remove setView360Icon in the upcoming versions
|
|
1181
894
|
|
|
1182
|
-
|
|
1183
|
-
|
|
895
|
+
if (this.logoSrc) (0, _ci.setView360Icon)(this.view360Icon, this.logoSrc);
|
|
896
|
+
}
|
|
1184
897
|
|
|
1185
|
-
|
|
898
|
+
this.initControls();
|
|
1186
899
|
|
|
1187
|
-
this.
|
|
900
|
+
if (this.hotspotsConfigs && !this.autoplay) {
|
|
901
|
+
(0, _utils.updateHotspots)(this.container, this.hotspotsConfigs, this.activeImageX, this.activeImageY, this.movingDirection);
|
|
902
|
+
}
|
|
1188
903
|
}
|
|
1189
904
|
}, {
|
|
1190
|
-
key:
|
|
1191
|
-
value: function
|
|
1192
|
-
|
|
1193
|
-
if (this.magnifierIcon) this.enableMagnifierIcon();
|
|
1194
|
-
if (this.fullscreenIcon) this.showFullscreenIcon();
|
|
905
|
+
key: "magnify",
|
|
906
|
+
value: function magnify(event) {
|
|
907
|
+
var _this3 = this;
|
|
1195
908
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
value: function showResetZoomIcon() {
|
|
1201
|
-
if (!this.resetZoomIcon) return;
|
|
1202
|
-
if (this.magnifierIcon) this.disableMagnifierIcon();
|
|
1203
|
-
if (this.fullscreenIcon) this.hideFullscreenIcon();
|
|
909
|
+
event.stopPropagation();
|
|
910
|
+
if (this.mouseTracked) this.togglePointerZoom();
|
|
911
|
+
var currentOriginalImage = (0, _utils.getCurrentOriginalImage)(this.movingDirection, this.imagesX, this.imagesY, this.activeImageX, this.activeImageY);
|
|
912
|
+
this.isMagnifyOpen = true;
|
|
1204
913
|
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
var loader = document.createElement('div');
|
|
1211
|
-
loader.className = 'cloudimage-360-loader';
|
|
914
|
+
currentOriginalImage.onload = function () {
|
|
915
|
+
if (_this3.glass) {
|
|
916
|
+
_this3.glass.style.cursor = 'none';
|
|
917
|
+
}
|
|
918
|
+
};
|
|
1212
919
|
|
|
1213
|
-
this.
|
|
1214
|
-
this.
|
|
920
|
+
this.glass = document.createElement('div');
|
|
921
|
+
this.container.style.overflow = 'hidden';
|
|
922
|
+
(0, _utils.magnify)(this.container, this.offset, currentOriginalImage, this.glass, this.magnifier || 3);
|
|
1215
923
|
}
|
|
1216
924
|
}, {
|
|
1217
|
-
key:
|
|
1218
|
-
value: function
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
this.innerBox.appendChild(boxShadow);
|
|
925
|
+
key: "closeMagnifier",
|
|
926
|
+
value: function closeMagnifier() {
|
|
927
|
+
if (!this.glass) return;
|
|
928
|
+
this.container.style.overflow = 'visible';
|
|
929
|
+
this.container.removeChild(this.glass);
|
|
930
|
+
this.glass = null;
|
|
931
|
+
this.isMagnifyOpen = false;
|
|
1225
932
|
}
|
|
1226
933
|
}, {
|
|
1227
|
-
key:
|
|
1228
|
-
value: function
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
this.
|
|
934
|
+
key: "openFullscreenModal",
|
|
935
|
+
value: function openFullscreenModal(event) {
|
|
936
|
+
event.stopPropagation();
|
|
937
|
+
if (this.mouseTracked) this.togglePointerZoom();
|
|
938
|
+
var fullscreenContainer = (0, _utils.createFullscreenModal)(this.container);
|
|
939
|
+
new CI360Viewer(fullscreenContainer, true, this.hotspotsConfigs);
|
|
1233
940
|
}
|
|
1234
941
|
}, {
|
|
1235
|
-
key:
|
|
1236
|
-
value: function
|
|
1237
|
-
if (
|
|
942
|
+
key: "setFullscreenEvents",
|
|
943
|
+
value: function setFullscreenEvents(_, event) {
|
|
944
|
+
if (event.type === 'click') return this.closeFullscreenModal(event);
|
|
1238
945
|
|
|
1239
|
-
this.
|
|
1240
|
-
|
|
946
|
+
if (event.key === 'Escape' && this.container.parentNode.parentNode === document.body) {
|
|
947
|
+
this.closeFullscreenModalOnEsc(event);
|
|
948
|
+
}
|
|
1241
949
|
}
|
|
1242
950
|
}, {
|
|
1243
|
-
key:
|
|
1244
|
-
value: function
|
|
1245
|
-
|
|
1246
|
-
case _ci2.AUTOPLAY_BEHAVIOR.SPIN_XY:
|
|
1247
|
-
case _ci2.AUTOPLAY_BEHAVIOR.SPIN_Y:
|
|
1248
|
-
{
|
|
1249
|
-
var isReachedTheEdge = this.reversed ? this.activeImageY === 1 : this.activeImageY === this.amountY;
|
|
1250
|
-
|
|
1251
|
-
if (isReachedTheEdge) return true;
|
|
1252
|
-
|
|
1253
|
-
return false;
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
case _ci2.AUTOPLAY_BEHAVIOR.SPIN_X:
|
|
1257
|
-
case _ci2.AUTOPLAY_BEHAVIOR.SPIN_YX:
|
|
1258
|
-
default:
|
|
1259
|
-
{
|
|
1260
|
-
var _isReachedTheEdge = this.reversed ? this.activeImageX === 1 : this.activeImageX === this.amountX;
|
|
1261
|
-
|
|
1262
|
-
if (_isReachedTheEdge) return true;
|
|
1263
|
-
|
|
1264
|
-
return false;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
951
|
+
key: "closeFullscreenModalOnEsc",
|
|
952
|
+
value: function closeFullscreenModalOnEsc(event) {
|
|
953
|
+
this.closeFullscreenModal(event);
|
|
1267
954
|
}
|
|
1268
955
|
}, {
|
|
1269
|
-
key:
|
|
956
|
+
key: "play",
|
|
1270
957
|
value: function play() {
|
|
1271
958
|
var _this4 = this;
|
|
1272
959
|
|
|
1273
960
|
if (this.bottomCircle) this.hide360ViewCircleIcon();
|
|
1274
961
|
this.remove360ViewIcon();
|
|
1275
|
-
|
|
1276
962
|
this.loopTimeoutId = window.setInterval(function () {
|
|
1277
963
|
_this4.loop(_this4.reversed);
|
|
1278
964
|
|
|
1279
|
-
var isPlayedOnce = _this4.
|
|
965
|
+
var isPlayedOnce = (0, _utils.isCompletedOneCycle)(_this4.autoplayBehavior, _this4.activeImageX, _this4.activeImageY, _this4.amountX, _this4.amountY, _this4.reversed);
|
|
1280
966
|
|
|
1281
967
|
if (_this4.playOnce && isPlayedOnce) {
|
|
1282
968
|
window.clearTimeout(_this4.loopTimeoutId);
|
|
969
|
+
_this4.autoplay = false;
|
|
970
|
+
|
|
971
|
+
if (!_this4.hide360Logo) {
|
|
972
|
+
_this4.add360ViewIcon();
|
|
973
|
+
|
|
974
|
+
_this4.view360Icon.innerText = '';
|
|
975
|
+
(0, _ci.setView360Icon)(_this4.view360Icon, _this4.logoSrc);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
if (_this4.hotspotsConfigs) {
|
|
979
|
+
(0, _utils.updateHotspots)(_this4.container, _this4.hotspotsConfigs, _this4.activeImageX, _this4.activeImageY, _this4.movingDirection, _this4.isClicked);
|
|
980
|
+
}
|
|
1283
981
|
}
|
|
1284
982
|
}, this.autoplaySpeed);
|
|
1285
983
|
}
|
|
1286
984
|
}, {
|
|
1287
|
-
key:
|
|
985
|
+
key: "stop",
|
|
1288
986
|
value: function stop() {
|
|
1289
|
-
if (this.bottomCircle
|
|
987
|
+
if (this.bottomCircle) this.show360ViewCircleIcon();
|
|
1290
988
|
window.clearTimeout(this.loopTimeoutId);
|
|
1291
989
|
}
|
|
1292
990
|
}, {
|
|
1293
|
-
key:
|
|
1294
|
-
value: function
|
|
1295
|
-
var ciToken = _ref.ciToken,
|
|
1296
|
-
ciFilters = _ref.ciFilters,
|
|
1297
|
-
ciTransformation = _ref.ciTransformation;
|
|
1298
|
-
|
|
1299
|
-
var src = '' + folder + filename;
|
|
1300
|
-
|
|
1301
|
-
if (responsive) {
|
|
1302
|
-
var imageOffsetWidth = container.offsetWidth;
|
|
1303
|
-
|
|
1304
|
-
if (this.fullscreenView) {
|
|
1305
|
-
var containerRatio = container.offsetHeight / container.offsetWidth;
|
|
1306
|
-
|
|
1307
|
-
if (this.ratio > containerRatio) {
|
|
1308
|
-
imageOffsetWidth = container.offsetHeight / this.ratio;
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
var ciSizeNext = (0, _ci.getSizeAccordingToPixelRatio)((0, _ci.getResponsiveWidthOfContainer)(imageOffsetWidth));
|
|
1313
|
-
|
|
1314
|
-
src = 'https://' + ciToken + '.cloudimg.io/v7/' + src + '?' + (ciTransformation ? ciTransformation : 'width=' + ciSizeNext) + (ciFilters ? '&f=' + ciFilters : '');
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
return src;
|
|
1318
|
-
}
|
|
1319
|
-
}, {
|
|
1320
|
-
key: 'preloadImages',
|
|
1321
|
-
value: function preloadImages(amount, src) {
|
|
1322
|
-
var orientation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ci2.ORIENTATIONS.X;
|
|
1323
|
-
var lazyload = arguments[3];
|
|
1324
|
-
var lazySelector = arguments[4];
|
|
1325
|
-
var container = arguments[5];
|
|
1326
|
-
|
|
991
|
+
key: "updateView",
|
|
992
|
+
value: function updateView(forceUpdate, viewers) {
|
|
1327
993
|
var _this5 = this;
|
|
1328
994
|
|
|
1329
|
-
var
|
|
1330
|
-
var
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
try {
|
|
1334
|
-
var images = JSON.parse(this.imageList);
|
|
1335
|
-
|
|
1336
|
-
this.amountX = images.length;
|
|
1337
|
-
images.forEach(function (src, index) {
|
|
1338
|
-
var folder = /(http(s?)):\/\//gi.test(src) ? '' : _this5.folder;
|
|
1339
|
-
var resultSrc = _this5.getSrc(responsive, container, folder, src, ciParams);
|
|
1340
|
-
var lastIndex = resultSrc.lastIndexOf('//');
|
|
1341
|
-
var originalSrc = resultSrc.slice(lastIndex);
|
|
1342
|
-
|
|
1343
|
-
_this5.addImage(resultSrc, originalSrc, orientation, lazyload, lazySelector, index);
|
|
1344
|
-
});
|
|
1345
|
-
} catch (error) {
|
|
1346
|
-
console.error('Wrong format in image-list attribute: ' + error.message);
|
|
1347
|
-
}
|
|
1348
|
-
} else {
|
|
1349
|
-
[].concat(_toConsumableArray(new Array(amount))).map(function (_item, index) {
|
|
1350
|
-
var nextZeroFilledIndex = (0, _ci.pad)(index + 1, _this5.indexZeroBase);
|
|
1351
|
-
var resultSrc = src.replace('{index}', nextZeroFilledIndex);
|
|
1352
|
-
var originalSrc = resultSrc.replace(_ci2.ORGINAL_SIZE_REGEX, '').replace(_ci2.AND_SYMBOL_REGEX, '?');
|
|
995
|
+
var container = this.container;
|
|
996
|
+
var imageProps = (0, _ci.get360ViewProps)(container);
|
|
997
|
+
var srcPropsChanged = (0, _utils.isPropsChangeRequireReload)(this, imageProps);
|
|
998
|
+
var reInitView = srcPropsChanged || forceUpdate;
|
|
1353
999
|
|
|
1354
|
-
|
|
1000
|
+
if (reInitView) {
|
|
1001
|
+
var oldElement = this.container;
|
|
1002
|
+
var viewIndex = viewers.findIndex(function (view) {
|
|
1003
|
+
return view.id === _this5.container.id;
|
|
1355
1004
|
});
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
var image = new Image();
|
|
1362
|
-
var originalImage = new Image();
|
|
1363
|
-
|
|
1364
|
-
if (lazyload && !this.fullscreenView) {
|
|
1365
|
-
image.setAttribute('data-src', resultSrc);
|
|
1366
|
-
image.className = image.className.length ? image.className + (' ' + lazySelector) : lazySelector;
|
|
1367
|
-
|
|
1368
|
-
if (index === 0) {
|
|
1369
|
-
this.lazyloadInitImage = image;
|
|
1370
|
-
image.style.position = 'absolute';
|
|
1371
|
-
image.style.top = '0';
|
|
1372
|
-
image.style.left = '0';
|
|
1373
|
-
this.innerBox.appendChild(image);
|
|
1374
|
-
}
|
|
1375
|
-
} else {
|
|
1376
|
-
image.src = resultSrc;
|
|
1377
|
-
originalImage.src = originalSrc;
|
|
1005
|
+
container.removeChild(this.innerBox);
|
|
1006
|
+
container = container.cloneNode(true);
|
|
1007
|
+
container.className = container.className.replace(' initialized', '');
|
|
1008
|
+
oldElement.parentNode.replaceChild(container, oldElement);
|
|
1009
|
+
return viewers.splice(viewIndex, 1, new CI360Viewer(container));
|
|
1378
1010
|
}
|
|
1379
1011
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
} else {
|
|
1387
|
-
this.imagesX.push(image);
|
|
1388
|
-
this.originalImagesX.push(originalImage);
|
|
1389
|
-
}
|
|
1012
|
+
container.style.position = 'relative';
|
|
1013
|
+
container.style.width = '100%';
|
|
1014
|
+
container.style.cursor = 'default';
|
|
1015
|
+
container.setAttribute('draggable', 'false');
|
|
1016
|
+
this.stop();
|
|
1017
|
+
this.init(container, true);
|
|
1390
1018
|
}
|
|
1391
1019
|
}, {
|
|
1392
|
-
key:
|
|
1020
|
+
key: "destroy",
|
|
1393
1021
|
value: function destroy() {
|
|
1394
1022
|
stop();
|
|
1395
|
-
|
|
1396
1023
|
var oldElement = this.container;
|
|
1397
1024
|
var newElement = oldElement.cloneNode(true);
|
|
1398
1025
|
var innerBox = newElement.querySelector('.cloudimage-360-inner-box');
|
|
1399
|
-
|
|
1400
1026
|
newElement.className = newElement.className.replace(' initialized', '');
|
|
1401
1027
|
newElement.style.position = 'relative';
|
|
1402
1028
|
newElement.style.width = '100%';
|
|
@@ -1407,244 +1033,243 @@ var CI360Viewer = function () {
|
|
|
1407
1033
|
oldElement.parentNode.replaceChild(newElement, oldElement);
|
|
1408
1034
|
}
|
|
1409
1035
|
}, {
|
|
1410
|
-
key:
|
|
1036
|
+
key: "addCloseFullscreenView",
|
|
1037
|
+
value: function addCloseFullscreenView(event) {
|
|
1038
|
+
var closeFullscreenIcon = (0, _utils.createCloseFullscreenIcon)();
|
|
1039
|
+
closeFullscreenIcon.onclick = this.setFullscreenEvents.bind(this, event);
|
|
1040
|
+
window.onkeyup = this.setFullscreenEvents.bind(this, event);
|
|
1041
|
+
this.iconsContainer.appendChild(closeFullscreenIcon);
|
|
1042
|
+
}
|
|
1043
|
+
}, {
|
|
1044
|
+
key: "add360ViewIcon",
|
|
1045
|
+
value: function add360ViewIcon() {
|
|
1046
|
+
this.view360Icon = (0, _utils.create360ViewIcon)();
|
|
1047
|
+
this.innerBox.appendChild(this.view360Icon);
|
|
1048
|
+
}
|
|
1049
|
+
}, {
|
|
1050
|
+
key: "addFullscreenIcon",
|
|
1051
|
+
value: function addFullscreenIcon() {
|
|
1052
|
+
this.fullscreenIcon = (0, _utils.createFullscreenIcon)();
|
|
1053
|
+
this.fullscreenIcon.onclick = this.openFullscreenModal.bind(this);
|
|
1054
|
+
this.iconsContainer.appendChild(this.fullscreenIcon);
|
|
1055
|
+
}
|
|
1056
|
+
}, {
|
|
1057
|
+
key: "showFullscreenIcon",
|
|
1058
|
+
value: function showFullscreenIcon() {
|
|
1059
|
+
if (!this.fullscreenIcon) return;
|
|
1060
|
+
this.fullscreenIcon.style.display = 'block';
|
|
1061
|
+
this.fullscreenIcon.style.pointerEvents = 'auto';
|
|
1062
|
+
}
|
|
1063
|
+
}, {
|
|
1064
|
+
key: "hideFullscreenIcon",
|
|
1065
|
+
value: function hideFullscreenIcon() {
|
|
1066
|
+
if (!this.fullscreenIcon) return;
|
|
1067
|
+
this.fullscreenIcon.style.display = 'none';
|
|
1068
|
+
this.fullscreenIcon.style.pointerEvents = 'none';
|
|
1069
|
+
}
|
|
1070
|
+
}, {
|
|
1071
|
+
key: "addMagnifier",
|
|
1072
|
+
value: function addMagnifier() {
|
|
1073
|
+
this.magnifierIcon = (0, _utils.createMagnifierIcon)();
|
|
1074
|
+
this.magnifierIcon.onclick = this.magnify.bind(this);
|
|
1075
|
+
this.iconsContainer.appendChild(this.magnifierIcon);
|
|
1076
|
+
}
|
|
1077
|
+
}, {
|
|
1078
|
+
key: "enableMagnifierIcon",
|
|
1079
|
+
value: function enableMagnifierIcon() {
|
|
1080
|
+
if (!this.magnifierIcon) return;
|
|
1081
|
+
this.magnifierIcon.style.display = 'block';
|
|
1082
|
+
this.magnifierIcon.style.pointerEvents = 'auto';
|
|
1083
|
+
}
|
|
1084
|
+
}, {
|
|
1085
|
+
key: "disableMagnifierIcon",
|
|
1086
|
+
value: function disableMagnifierIcon() {
|
|
1087
|
+
if (!this.magnifierIcon) return;
|
|
1088
|
+
this.magnifierIcon.style.display = 'none';
|
|
1089
|
+
this.magnifierIcon.style.pointerEvents = 'none';
|
|
1090
|
+
}
|
|
1091
|
+
}, {
|
|
1092
|
+
key: "closeFullscreenModal",
|
|
1093
|
+
value: function closeFullscreenModal(event) {
|
|
1094
|
+
event.stopPropagation();
|
|
1095
|
+
document.body.removeChild(this.container.parentNode);
|
|
1096
|
+
window.document.body.style.overflow = 'visible';
|
|
1097
|
+
}
|
|
1098
|
+
}, {
|
|
1099
|
+
key: "add360ViewCircleIcon",
|
|
1100
|
+
value: function add360ViewCircleIcon() {
|
|
1101
|
+
this.view360CircleIcon = (0, _utils.create360ViewCircleIcon)(this.bottomCircleOffset);
|
|
1102
|
+
this.innerBox.appendChild(this.view360CircleIcon);
|
|
1103
|
+
}
|
|
1104
|
+
}, {
|
|
1105
|
+
key: "show360ViewCircleIcon",
|
|
1106
|
+
value: function show360ViewCircleIcon() {
|
|
1107
|
+
if (!this.view360CircleIcon) return;
|
|
1108
|
+
this.view360CircleIcon.style.opacity = '1';
|
|
1109
|
+
}
|
|
1110
|
+
}, {
|
|
1111
|
+
key: "hide360ViewCircleIcon",
|
|
1112
|
+
value: function hide360ViewCircleIcon() {
|
|
1113
|
+
if (!this.view360CircleIcon) return;
|
|
1114
|
+
this.view360CircleIcon.style.opacity = '0';
|
|
1115
|
+
}
|
|
1116
|
+
}, {
|
|
1117
|
+
key: "remove360ViewCircleIcon",
|
|
1118
|
+
value: function remove360ViewCircleIcon() {
|
|
1119
|
+
if (!this.view360CircleIcon) return;
|
|
1120
|
+
this.innerBox.removeChild(this.view360CircleIcon);
|
|
1121
|
+
this.view360CircleIcon = null;
|
|
1122
|
+
}
|
|
1123
|
+
}, {
|
|
1124
|
+
key: "removeLoader",
|
|
1125
|
+
value: function removeLoader() {
|
|
1126
|
+
if (!this.loader) return;
|
|
1127
|
+
this.innerBox.removeChild(this.loader);
|
|
1128
|
+
this.loader = null;
|
|
1129
|
+
}
|
|
1130
|
+
}, {
|
|
1131
|
+
key: "remove360ViewIcon",
|
|
1132
|
+
value: function remove360ViewIcon() {
|
|
1133
|
+
if (!this.view360Icon) return;
|
|
1134
|
+
|
|
1135
|
+
try {
|
|
1136
|
+
this.innerBox.removeChild(this.view360Icon);
|
|
1137
|
+
this.view360Icon = null;
|
|
1138
|
+
} catch (_unused) {}
|
|
1139
|
+
}
|
|
1140
|
+
}, {
|
|
1141
|
+
key: "initControls",
|
|
1411
1142
|
value: function initControls() {
|
|
1412
1143
|
var _this6 = this;
|
|
1413
1144
|
|
|
1414
|
-
var isReverse = this.controlReverse ? !this.spinReverse : this.spinReverse;
|
|
1415
|
-
// TODO [deprecated]: remove .cloud-360-left, .cloud-360-right in the upcoming versions
|
|
1416
|
-
var left = this.container.querySelector('.cloudimage-360-left') || this.container.querySelector('.cloudimage-360-prev');
|
|
1417
|
-
var right = this.container.querySelector('.cloudimage-360-right') || this.container.querySelector('.cloudimage-360-next');
|
|
1418
|
-
|
|
1419
|
-
var top = this.container.querySelector('.cloudimage-360-top');
|
|
1420
|
-
var bottom = this.container.querySelector('.cloudimage-360-bottom');
|
|
1421
|
-
|
|
1422
|
-
if (!left && !right && !top && !bottom) return;
|
|
1423
|
-
|
|
1424
1145
|
var onLeftStart = function onLeftStart(event) {
|
|
1425
1146
|
event.stopPropagation();
|
|
1147
|
+
|
|
1426
1148
|
_this6.onSpin();
|
|
1149
|
+
|
|
1427
1150
|
_this6.left();
|
|
1151
|
+
|
|
1428
1152
|
_this6.loopTimeoutId = window.setInterval(_this6.left.bind(_this6), _this6.autoplaySpeed);
|
|
1429
1153
|
};
|
|
1154
|
+
|
|
1430
1155
|
var onRightStart = function onRightStart(event) {
|
|
1431
1156
|
event.stopPropagation();
|
|
1157
|
+
|
|
1432
1158
|
_this6.onSpin();
|
|
1159
|
+
|
|
1433
1160
|
_this6.right();
|
|
1161
|
+
|
|
1434
1162
|
_this6.loopTimeoutId = window.setInterval(_this6.right.bind(_this6), _this6.autoplaySpeed);
|
|
1435
1163
|
};
|
|
1436
1164
|
|
|
1437
1165
|
var onTopStart = function onTopStart(event) {
|
|
1438
1166
|
event.stopPropagation();
|
|
1167
|
+
|
|
1439
1168
|
_this6.onSpin();
|
|
1169
|
+
|
|
1440
1170
|
_this6.top();
|
|
1171
|
+
|
|
1441
1172
|
_this6.loopTimeoutId = window.setInterval(_this6.top.bind(_this6), _this6.autoplaySpeed);
|
|
1442
1173
|
};
|
|
1443
1174
|
|
|
1444
1175
|
var onBottomStart = function onBottomStart(event) {
|
|
1445
1176
|
event.stopPropagation();
|
|
1177
|
+
|
|
1446
1178
|
_this6.onSpin();
|
|
1179
|
+
|
|
1447
1180
|
_this6.bottom();
|
|
1181
|
+
|
|
1448
1182
|
_this6.loopTimeoutId = window.setInterval(_this6.bottom.bind(_this6), _this6.autoplaySpeed);
|
|
1449
1183
|
};
|
|
1450
1184
|
|
|
1451
|
-
var
|
|
1185
|
+
var onEventEnd = function onEventEnd() {
|
|
1452
1186
|
_this6.onFinishSpin();
|
|
1453
|
-
window.clearTimeout(_this6.loopTimeoutId);
|
|
1454
|
-
};
|
|
1455
1187
|
|
|
1456
|
-
var onRightEnd = function onRightEnd() {
|
|
1457
|
-
_this6.onFinishSpin();
|
|
1458
1188
|
window.clearTimeout(_this6.loopTimeoutId);
|
|
1459
1189
|
};
|
|
1460
1190
|
|
|
1461
|
-
var
|
|
1462
|
-
|
|
1463
|
-
|
|
1191
|
+
var controlsConfig = {
|
|
1192
|
+
container: this.container,
|
|
1193
|
+
controlReverse: this.controlReverse,
|
|
1194
|
+
spinReverse: this.spinReverse,
|
|
1195
|
+
stopAtEdges: this.stopAtEdges
|
|
1464
1196
|
};
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1197
|
+
var controlsTriggers = {
|
|
1198
|
+
onLeftStart: onLeftStart,
|
|
1199
|
+
onRightStart: onRightStart,
|
|
1200
|
+
onTopStart: onTopStart,
|
|
1201
|
+
onBottomStart: onBottomStart,
|
|
1202
|
+
onEventEnd: onEventEnd
|
|
1469
1203
|
};
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
left.addEventListener('mouseup', isReverse ? onRightEnd : onLeftEnd);
|
|
1476
|
-
left.addEventListener('touchend', isReverse ? onRightEnd : onLeftEnd);
|
|
1477
|
-
|
|
1478
|
-
this.leftElem = left;
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
if (right) {
|
|
1482
|
-
right.style.display = 'block';
|
|
1483
|
-
right.addEventListener('mousedown', isReverse ? onLeftStart : onRightStart);
|
|
1484
|
-
right.addEventListener('touchstart', isReverse ? onLeftStart : onRightStart, { passive: true });
|
|
1485
|
-
right.addEventListener('mouseup', isReverse ? onLeftEnd : onRightEnd);
|
|
1486
|
-
right.addEventListener('touchend', isReverse ? onLeftEnd : onRightEnd);
|
|
1487
|
-
|
|
1488
|
-
this.rightElem = right;
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
if (top) {
|
|
1492
|
-
top.style.display = 'block';
|
|
1493
|
-
top.addEventListener('mousedown', isReverse ? onBottomStart : onTopStart);
|
|
1494
|
-
top.addEventListener('touchstart', isReverse ? onBottomStart : onTopStart);
|
|
1495
|
-
top.addEventListener('mouseup', isReverse ? onBottomEnd : onTopEnd);
|
|
1496
|
-
top.addEventListener('touchend', isReverse ? onBottomEnd : onTopEnd);
|
|
1497
|
-
|
|
1498
|
-
this.topElem = top;
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
if (bottom) {
|
|
1502
|
-
bottom.style.display = 'block';
|
|
1503
|
-
bottom.addEventListener('mousedown', isReverse ? onTopStart : onBottomStart);
|
|
1504
|
-
bottom.addEventListener('touchstart', isReverse ? onTopStart : onBottomStart);
|
|
1505
|
-
bottom.addEventListener('mouseup', isReverse ? onTopEnd : onBottomEnd);
|
|
1506
|
-
bottom.addEventListener('touchend', isReverse ? onTopEnd : onBottomEnd);
|
|
1507
|
-
|
|
1508
|
-
this.bottomElem = bottom;
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
if (isReverse ? right : left) {
|
|
1512
|
-
if (this.stopAtEdges) {
|
|
1513
|
-
(0, _ci.addClass)(isReverse ? right : left, 'not-active');
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
}, {
|
|
1518
|
-
key: 'addInnerBox',
|
|
1519
|
-
value: function addInnerBox() {
|
|
1520
|
-
this.innerBox = document.createElement('div');
|
|
1521
|
-
this.innerBox.className = 'cloudimage-360-inner-box';
|
|
1522
|
-
this.container.appendChild(this.innerBox);
|
|
1523
|
-
}
|
|
1524
|
-
}, {
|
|
1525
|
-
key: 'addIconsContainer',
|
|
1526
|
-
value: function addIconsContainer() {
|
|
1527
|
-
this.iconsContainer = document.createElement('div');
|
|
1528
|
-
this.iconsContainer.className = 'cloudimage-360-icons-container';
|
|
1529
|
-
|
|
1530
|
-
this.innerBox.appendChild(this.iconsContainer);
|
|
1531
|
-
}
|
|
1532
|
-
}, {
|
|
1533
|
-
key: 'addCanvas',
|
|
1534
|
-
value: function addCanvas() {
|
|
1535
|
-
this.canvas = document.createElement('canvas');
|
|
1536
|
-
this.canvas.style.width = '100%';
|
|
1537
|
-
this.canvas.style.fontSize = '0';
|
|
1538
|
-
|
|
1539
|
-
if (this.ratio) {
|
|
1540
|
-
this.container.style.minHeight = this.container.offsetWidth * this.ratio + 'px';
|
|
1541
|
-
this.canvas.height = parseInt(this.container.style.minHeight);
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
this.innerBox.appendChild(this.canvas);
|
|
1204
|
+
var controlsElements = (0, _utils.initControls)(controlsConfig, controlsTriggers);
|
|
1205
|
+
this.topElem = controlsElements.top;
|
|
1206
|
+
this.bottomElem = controlsElements.bottom;
|
|
1207
|
+
this.leftElem = controlsElements.left;
|
|
1208
|
+
this.rightElem = controlsElements.right;
|
|
1545
1209
|
}
|
|
1546
1210
|
}, {
|
|
1547
|
-
key:
|
|
1211
|
+
key: "attachEvents",
|
|
1548
1212
|
value: function attachEvents(draggable, swipeable, keys) {
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
window.addEventListener('resize', (0, _ci.debounce)(function () {
|
|
1552
|
-
_this7.requestResizedImages();
|
|
1553
|
-
}, 300));
|
|
1213
|
+
window.addEventListener('resize', this.requestResizedImages.bind(this));
|
|
1554
1214
|
|
|
1555
1215
|
if (draggable && !this.disableDrag) {
|
|
1216
|
+
this.container.addEventListener('click', this.mouseClick.bind(this));
|
|
1556
1217
|
this.container.addEventListener('mousedown', this.mouseDown.bind(this));
|
|
1557
1218
|
this.container.addEventListener('mousemove', this.mouseMove.bind(this));
|
|
1219
|
+
this.container.addEventListener('mouseleave', this.mouseLeave.bind(this));
|
|
1558
1220
|
document.addEventListener('mouseup', this.mouseUp.bind(this));
|
|
1559
1221
|
}
|
|
1560
1222
|
|
|
1561
1223
|
if (swipeable && !this.disableDrag) {
|
|
1562
|
-
this.container.addEventListener('touchstart', this.touchStart.bind(this), {
|
|
1224
|
+
this.container.addEventListener('touchstart', this.touchStart.bind(this), {
|
|
1225
|
+
passive: true
|
|
1226
|
+
});
|
|
1563
1227
|
this.container.addEventListener('touchend', this.touchEnd.bind(this));
|
|
1564
|
-
this.container.addEventListener('touchmove', this.touchMove.bind(this)
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
if (!this.disablePointerZoom && !this.fullscreenView) {
|
|
1568
|
-
this.container.addEventListener('wheel', this.mouseScroll.bind(this));
|
|
1228
|
+
this.container.addEventListener('touchmove', this.touchMove.bind(this));
|
|
1569
1229
|
}
|
|
1570
1230
|
|
|
1571
1231
|
if (keys) {
|
|
1572
1232
|
document.addEventListener('keydown', this.keyDown.bind(this));
|
|
1573
1233
|
document.addEventListener('keyup', this.keyUp.bind(this));
|
|
1574
|
-
} else {
|
|
1575
|
-
document.addEventListener('keydown', this.keyDownGeneral.bind(this));
|
|
1576
1234
|
}
|
|
1577
|
-
}
|
|
1578
|
-
}, {
|
|
1579
|
-
key: 'applyStylesToContainer',
|
|
1580
|
-
value: function applyStylesToContainer() {
|
|
1581
|
-
this.container.style.position = 'relative';
|
|
1582
|
-
this.container.style.width = '100%';
|
|
1583
|
-
this.container.style.cursor = 'wait';
|
|
1584
|
-
this.container.setAttribute('draggable', 'false');
|
|
1585
|
-
this.container.className = this.container.className + ' initialized';
|
|
1586
|
-
}
|
|
1587
|
-
}, {
|
|
1588
|
-
key: 'setMouseLeaveActions',
|
|
1589
|
-
value: function setMouseLeaveActions(actions) {
|
|
1590
|
-
var _this8 = this;
|
|
1591
|
-
|
|
1592
|
-
var mouseLeaveActions = actions.split(',');
|
|
1593
1235
|
|
|
1594
|
-
|
|
1595
|
-
return _this8.applyMouseLeaveAction(action);
|
|
1596
|
-
});
|
|
1597
|
-
}
|
|
1598
|
-
}, {
|
|
1599
|
-
key: 'applyMouseLeaveAction',
|
|
1600
|
-
value: function applyMouseLeaveAction(action) {
|
|
1601
|
-
switch (action) {
|
|
1602
|
-
case _ci2.MOUSE_LEAVE_ACTIONS.RESET_ZOOM:
|
|
1603
|
-
this.container.addEventListener('mouseleave', this.resetZoom.bind(this));
|
|
1604
|
-
break;
|
|
1605
|
-
}
|
|
1236
|
+
document.addEventListener('keydown', this.keyDownGeneral.bind(this));
|
|
1606
1237
|
}
|
|
1607
1238
|
}, {
|
|
1608
|
-
key:
|
|
1239
|
+
key: "init",
|
|
1609
1240
|
value: function init(container) {
|
|
1241
|
+
var _this7 = this;
|
|
1242
|
+
|
|
1243
|
+
var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1244
|
+
|
|
1610
1245
|
var _get360ViewProps = (0, _ci.get360ViewProps)(container),
|
|
1611
1246
|
folder = _get360ViewProps.folder,
|
|
1247
|
+
apiVersion = _get360ViewProps.apiVersion,
|
|
1612
1248
|
filenameX = _get360ViewProps.filenameX,
|
|
1613
1249
|
filenameY = _get360ViewProps.filenameY,
|
|
1614
|
-
|
|
1250
|
+
imageListX = _get360ViewProps.imageListX,
|
|
1251
|
+
imageListY = _get360ViewProps.imageListY,
|
|
1615
1252
|
indexZeroBase = _get360ViewProps.indexZeroBase,
|
|
1616
1253
|
amountX = _get360ViewProps.amountX,
|
|
1617
1254
|
amountY = _get360ViewProps.amountY,
|
|
1618
|
-
imageOffset = _get360ViewProps.imageOffset,
|
|
1619
1255
|
_get360ViewProps$drag = _get360ViewProps.draggable,
|
|
1620
|
-
draggable = _get360ViewProps$drag ===
|
|
1256
|
+
draggable = _get360ViewProps$drag === void 0 ? true : _get360ViewProps$drag,
|
|
1621
1257
|
_get360ViewProps$swip = _get360ViewProps.swipeable,
|
|
1622
|
-
swipeable = _get360ViewProps$swip ===
|
|
1258
|
+
swipeable = _get360ViewProps$swip === void 0 ? true : _get360ViewProps$swip,
|
|
1623
1259
|
keys = _get360ViewProps.keys,
|
|
1260
|
+
keysReverse = _get360ViewProps.keysReverse,
|
|
1624
1261
|
bottomCircle = _get360ViewProps.bottomCircle,
|
|
1625
1262
|
bottomCircleOffset = _get360ViewProps.bottomCircleOffset,
|
|
1626
1263
|
boxShadow = _get360ViewProps.boxShadow,
|
|
1627
1264
|
autoplay = _get360ViewProps.autoplay,
|
|
1628
1265
|
autoplayBehavior = _get360ViewProps.autoplayBehavior,
|
|
1629
1266
|
playOnce = _get360ViewProps.playOnce,
|
|
1630
|
-
pointerZoomFactor = _get360ViewProps.pointerZoomFactor,
|
|
1631
|
-
pinchZoomFactor = _get360ViewProps.pinchZoomFactor,
|
|
1632
|
-
maxScale = _get360ViewProps.maxScale,
|
|
1633
|
-
toStartPointerZoom = _get360ViewProps.toStartPointerZoom,
|
|
1634
|
-
onMouseLeave = _get360ViewProps.onMouseLeave,
|
|
1635
|
-
_get360ViewProps$disa = _get360ViewProps.disablePointerZoom,
|
|
1636
|
-
disablePointerZoom = _get360ViewProps$disa === undefined ? true : _get360ViewProps$disa,
|
|
1637
|
-
_get360ViewProps$disa2 = _get360ViewProps.disablePinchZoom,
|
|
1638
|
-
disablePinchZoom = _get360ViewProps$disa2 === undefined ? true : _get360ViewProps$disa2,
|
|
1639
1267
|
speed = _get360ViewProps.speed,
|
|
1640
1268
|
autoplayReverse = _get360ViewProps.autoplayReverse,
|
|
1641
|
-
_get360ViewProps$
|
|
1642
|
-
disableDrag = _get360ViewProps$
|
|
1269
|
+
_get360ViewProps$disa = _get360ViewProps.disableDrag,
|
|
1270
|
+
disableDrag = _get360ViewProps$disa === void 0 ? true : _get360ViewProps$disa,
|
|
1643
1271
|
fullscreen = _get360ViewProps.fullscreen,
|
|
1644
1272
|
magnifier = _get360ViewProps.magnifier,
|
|
1645
|
-
magnifyInFullscreen = _get360ViewProps.magnifyInFullscreen,
|
|
1646
|
-
ratio = _get360ViewProps.ratio,
|
|
1647
|
-
responsive = _get360ViewProps.responsive,
|
|
1648
1273
|
ciToken = _get360ViewProps.ciToken,
|
|
1649
1274
|
ciFilters = _get360ViewProps.ciFilters,
|
|
1650
1275
|
ciTransformation = _get360ViewProps.ciTransformation,
|
|
@@ -1655,76 +1280,176 @@ var CI360Viewer = function () {
|
|
|
1655
1280
|
stopAtEdges = _get360ViewProps.stopAtEdges,
|
|
1656
1281
|
controlReverse = _get360ViewProps.controlReverse,
|
|
1657
1282
|
hide360Logo = _get360ViewProps.hide360Logo,
|
|
1658
|
-
logoSrc = _get360ViewProps.logoSrc
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
this.addIconsContainer();
|
|
1664
|
-
this.addLoader();
|
|
1283
|
+
logoSrc = _get360ViewProps.logoSrc,
|
|
1284
|
+
pointerZoom = _get360ViewProps.pointerZoom,
|
|
1285
|
+
ratio = _get360ViewProps.ratio,
|
|
1286
|
+
_get360ViewProps$imag = _get360ViewProps.imageInfo,
|
|
1287
|
+
imageInfo = _get360ViewProps$imag === void 0 ? 'black' : _get360ViewProps$imag;
|
|
1665
1288
|
|
|
1289
|
+
var ciParams = {
|
|
1290
|
+
ciToken: ciToken,
|
|
1291
|
+
ciFilters: ciFilters,
|
|
1292
|
+
ciTransformation: ciTransformation
|
|
1293
|
+
};
|
|
1666
1294
|
this.folder = folder;
|
|
1295
|
+
this.apiVersion = apiVersion;
|
|
1667
1296
|
this.filenameX = filenameX;
|
|
1668
1297
|
this.filenameY = filenameY;
|
|
1669
|
-
this.
|
|
1298
|
+
this.imageListX = imageListX;
|
|
1299
|
+
this.imageListY = imageListY;
|
|
1670
1300
|
this.indexZeroBase = indexZeroBase;
|
|
1671
|
-
this.amountX = amountX;
|
|
1672
|
-
this.amountY = amountY;
|
|
1673
|
-
this.allowSpinY = !!amountY
|
|
1674
|
-
this.activeImageX = autoplayReverse ? amountX : 1;
|
|
1675
|
-
this.activeImageY = autoplayReverse ? amountY : 1;
|
|
1676
|
-
this.spinY = autoplayBehavior ===
|
|
1677
|
-
this.imageOffset = imageOffset;
|
|
1301
|
+
this.amountX = imageListX ? JSON.parse(imageListX).length : amountX;
|
|
1302
|
+
this.amountY = imageListY ? JSON.parse(imageListY).length : amountY;
|
|
1303
|
+
this.allowSpinY = !!this.amountY;
|
|
1304
|
+
this.activeImageX = autoplayReverse ? this.amountX : 1;
|
|
1305
|
+
this.activeImageY = autoplayReverse ? this.amountY : 1;
|
|
1306
|
+
this.spinY = autoplayBehavior === _constants.AUTOPLAY_BEHAVIOR.SPIN_YX ? true : false;
|
|
1678
1307
|
this.bottomCircle = bottomCircle;
|
|
1679
1308
|
this.bottomCircleOffset = bottomCircleOffset;
|
|
1680
1309
|
this.boxShadow = boxShadow;
|
|
1681
1310
|
this.autoplay = autoplay;
|
|
1682
1311
|
this.autoplayBehavior = autoplayBehavior;
|
|
1683
1312
|
this.playOnce = playOnce;
|
|
1684
|
-
this.toStartPointerZoom = toStartPointerZoom, this.disablePointerZoom = disablePointerZoom;
|
|
1685
|
-
this.disablePinchZoom = disablePinchZoom;
|
|
1686
|
-
this.pointerZoomFactor = pointerZoomFactor;
|
|
1687
|
-
this.pinchZoomFactor = pinchZoomFactor;
|
|
1688
|
-
this.maxScale = maxScale;
|
|
1689
1313
|
this.speed = speed;
|
|
1690
1314
|
this.reversed = autoplayReverse;
|
|
1691
1315
|
this.disableDrag = disableDrag;
|
|
1692
1316
|
this.fullscreen = fullscreen;
|
|
1693
|
-
this.magnifier = !this.isMobile && magnifier ? magnifier :
|
|
1694
|
-
this.magnifyInFullscreen = magnifyInFullscreen;
|
|
1695
|
-
this.lazyload = lazyload;
|
|
1317
|
+
this.magnifier = !this.isMobile && magnifier > 1 ? Math.min(magnifier, 5) : 0;
|
|
1696
1318
|
this.lazySelector = lazySelector;
|
|
1697
|
-
this.ratio = ratio;
|
|
1698
1319
|
this.spinReverse = spinReverse;
|
|
1699
1320
|
this.controlReverse = controlReverse;
|
|
1700
|
-
this.dragSpeed = dragSpeed;
|
|
1321
|
+
this.dragSpeed = Math.max(dragSpeed, 50);
|
|
1701
1322
|
this.autoplaySpeed = this.speed * 36 / this.amountX;
|
|
1702
1323
|
this.stopAtEdges = stopAtEdges;
|
|
1703
1324
|
this.hide360Logo = hide360Logo;
|
|
1704
1325
|
this.logoSrc = logoSrc;
|
|
1705
|
-
this.responsive = responsive;
|
|
1706
1326
|
this.ciParams = ciParams;
|
|
1327
|
+
this.apiVersion = apiVersion;
|
|
1328
|
+
this.pointerZoom = pointerZoom > 1 ? Math.min(pointerZoom, 3) : 0;
|
|
1329
|
+
this.keysReverse = keysReverse;
|
|
1330
|
+
this.info = imageInfo;
|
|
1331
|
+
this.keys = keys;
|
|
1332
|
+
this.ratio = ratio && JSON.parse(ratio);
|
|
1333
|
+
|
|
1334
|
+
if (update) {
|
|
1335
|
+
(0, _utils.removeChildFromParent)(this.innerBox, this.iconsContainer);
|
|
1336
|
+
(0, _utils.removeChildFromParent)(this.innerBox, this.boxShadowEl);
|
|
1337
|
+
(0, _utils.removeChildFromParent)(this.innerBox, this.view360Icon);
|
|
1338
|
+
this.remove360ViewCircleIcon();
|
|
1339
|
+
this.iconsContainer = (0, _utils.createIconsContainer)(this.innerBox);
|
|
1340
|
+
|
|
1341
|
+
if (!this.hide360Logo && !this.lazyload && this.logoSrc) {
|
|
1342
|
+
this.add360ViewIcon();
|
|
1343
|
+
(0, _ci.setView360Icon)(this.view360Icon, this.logoSrc);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
if (this.magnifier) {
|
|
1347
|
+
this.addMagnifier();
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
if (this.bottomCircle && !this.fullscreenView) {
|
|
1351
|
+
this.add360ViewCircleIcon();
|
|
1352
|
+
}
|
|
1707
1353
|
|
|
1708
|
-
|
|
1354
|
+
if (this.fullscreen && !this.fullscreenView) {
|
|
1355
|
+
this.addFullscreenIcon();
|
|
1356
|
+
}
|
|
1709
1357
|
|
|
1710
|
-
|
|
1358
|
+
if (this.boxShadow && !this.fullscreenView) {
|
|
1359
|
+
this.boxShadowEl = (0, _utils.createBoxShadow)(this.boxShadow, this.innerBox);
|
|
1360
|
+
}
|
|
1711
1361
|
|
|
1712
|
-
|
|
1713
|
-
|
|
1362
|
+
return this.onAllImagesLoaded();
|
|
1363
|
+
}
|
|
1714
1364
|
|
|
1715
|
-
this.
|
|
1365
|
+
this.innerBox = (0, _utils.createInnerBox)(this.container);
|
|
1366
|
+
this.iconsContainer = (0, _utils.createIconsContainer)(this.innerBox);
|
|
1367
|
+
this.canvas = (0, _utils.createCanvas)(this.innerBox);
|
|
1368
|
+
this.loader = (0, _utils.createLoader)(this.innerBox);
|
|
1716
1369
|
|
|
1717
|
-
if (
|
|
1718
|
-
|
|
1370
|
+
if (this.hotspotsConfigs && !this.fullscreenView) {
|
|
1371
|
+
(0, _utils.createHotspots)(container, this.hotspotsConfigs);
|
|
1719
1372
|
}
|
|
1720
1373
|
|
|
1721
|
-
|
|
1374
|
+
(0, _utils.applyStylesToContainer)(this.container);
|
|
1375
|
+
this.srcXConfig = {
|
|
1376
|
+
folder: folder,
|
|
1377
|
+
filename: filenameX,
|
|
1378
|
+
imageList: imageListX,
|
|
1379
|
+
container: container,
|
|
1380
|
+
innerBox: this.innerBox,
|
|
1381
|
+
apiVersion: apiVersion,
|
|
1382
|
+
ciParams: ciParams,
|
|
1383
|
+
lazySelector: lazySelector,
|
|
1384
|
+
amount: this.amountX,
|
|
1385
|
+
indexZeroBase: indexZeroBase,
|
|
1386
|
+
fullscreen: this.fullscreenView
|
|
1387
|
+
};
|
|
1388
|
+
this.srcYConfig = _objectSpread(_objectSpread({}, this.srcXConfig), {}, {
|
|
1389
|
+
filename: filenameY,
|
|
1390
|
+
orientation: _constants.ORIENTATIONS.Y,
|
|
1391
|
+
imageList: imageListY,
|
|
1392
|
+
amount: this.amountY
|
|
1393
|
+
});
|
|
1394
|
+
var srcX = (0, _utils.generateImagesPath)(this.srcXConfig);
|
|
1395
|
+
|
|
1396
|
+
var onImageLoad = function onImageLoad(orientation, image, index) {
|
|
1397
|
+
if (orientation !== _constants.ORIENTATIONS.Y) {
|
|
1398
|
+
_this7.imagesX[index] = image;
|
|
1399
|
+
} else {
|
|
1400
|
+
_this7.imagesY[index] = image;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
var loadedXImages = _this7.imagesX.filter(function (image) {
|
|
1404
|
+
return image;
|
|
1405
|
+
});
|
|
1406
|
+
|
|
1407
|
+
var loadedYImages = _this7.imagesY.filter(function (image) {
|
|
1408
|
+
return image;
|
|
1409
|
+
});
|
|
1410
|
+
|
|
1411
|
+
var totalAmount = _this7.amountX + _this7.amountY;
|
|
1412
|
+
var totalLoadedImages = loadedXImages.length + loadedYImages.length;
|
|
1413
|
+
var isFirstImageLoaded = !index && orientation !== _constants.ORIENTATIONS.Y;
|
|
1414
|
+
var percentage = Math.round(totalLoadedImages / totalAmount * 100);
|
|
1415
|
+
|
|
1416
|
+
_this7.updatePercentageInLoader(percentage);
|
|
1722
1417
|
|
|
1723
|
-
|
|
1418
|
+
if (isFirstImageLoaded) {
|
|
1419
|
+
_this7.onFirstImageLoaded(image);
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
if (_this7.isReady()) {
|
|
1423
|
+
_this7.onAllImagesLoaded();
|
|
1424
|
+
}
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
var loadImages = function loadImages() {
|
|
1428
|
+
(0, _utils.preloadImages)(_this7.srcXConfig, srcX, onImageLoad.bind(_this7, _constants.ORIENTATIONS.X));
|
|
1429
|
+
|
|
1430
|
+
if (_this7.allowSpinY) {
|
|
1431
|
+
var srcY = (0, _utils.generateImagesPath)(_this7.srcYConfig);
|
|
1432
|
+
(0, _utils.preloadImages)(_this7.srcYConfig, srcY, onImageLoad.bind(_this7, _constants.ORIENTATIONS.Y));
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1436
|
+
if (lazyload) {
|
|
1437
|
+
var onFirstImageLoad = function onFirstImageLoad(image) {
|
|
1438
|
+
_this7.innerBox.removeChild(image);
|
|
1439
|
+
|
|
1440
|
+
loadImages();
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
(0, _utils.initLazyload)(srcX, this.srcXConfig, onFirstImageLoad);
|
|
1444
|
+
} else {
|
|
1445
|
+
loadImages();
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
this.attachEvents(draggable, swipeable, keys);
|
|
1724
1449
|
}
|
|
1725
1450
|
}]);
|
|
1726
|
-
|
|
1727
1451
|
return CI360Viewer;
|
|
1728
1452
|
}();
|
|
1729
1453
|
|
|
1730
|
-
|
|
1454
|
+
var _default = CI360Viewer;
|
|
1455
|
+
exports.default = _default;
|