lightgallery 2.5.0 → 2.6.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/README.md +1 -1
- package/css/lg-rotate.css +7 -0
- package/css/lg-zoom.css +37 -5
- package/css/lightgallery-bundle.css +45 -6
- package/css/lightgallery-bundle.min.css +1 -1
- package/css/lightgallery.css +1 -1
- package/lib/lightgallery.js +21 -16
- package/lib/lightgallery.js.map +1 -1
- package/lib/plugins/rotate/lg-rotate.js +15 -8
- package/lib/plugins/rotate/lg-rotate.js.map +1 -1
- package/lib/plugins/thumbnail/lg-thumbnail-settings.js.map +1 -1
- package/lib/plugins/zoom/lg-zoom.js +281 -293
- package/lib/plugins/zoom/lg-zoom.js.map +1 -1
- package/lightgallery.d.ts +1 -0
- package/lightgallery.es5.js +22 -17
- package/lightgallery.es5.js.map +1 -1
- package/lightgallery.min.js +2 -2
- package/lightgallery.umd.js +22 -17
- package/lightgallery.umd.js.map +1 -1
- package/lit/lightgallery.esm.js +2 -2
- package/lit/lightgallery.umd.js +2 -2
- package/package.json +1 -1
- package/plugins/autoplay/lg-autoplay.es5.js +1 -1
- package/plugins/autoplay/lg-autoplay.min.js +1 -1
- package/plugins/autoplay/lg-autoplay.umd.js +1 -1
- package/plugins/comment/lg-comment.es5.js +1 -1
- package/plugins/comment/lg-comment.min.js +1 -1
- package/plugins/comment/lg-comment.umd.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.min.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
- package/plugins/hash/lg-hash.es5.js +1 -1
- package/plugins/hash/lg-hash.min.js +1 -1
- package/plugins/hash/lg-hash.umd.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
- package/plugins/pager/lg-pager.es5.js +1 -1
- package/plugins/pager/lg-pager.min.js +1 -1
- package/plugins/pager/lg-pager.umd.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
- package/plugins/rotate/lg-rotate.es5.js +16 -9
- package/plugins/rotate/lg-rotate.es5.js.map +1 -1
- package/plugins/rotate/lg-rotate.min.js +2 -2
- package/plugins/rotate/lg-rotate.umd.js +16 -9
- package/plugins/rotate/lg-rotate.umd.js.map +1 -1
- package/plugins/share/lg-share.es5.js +1 -1
- package/plugins/share/lg-share.min.js +1 -1
- package/plugins/share/lg-share.umd.js +1 -1
- package/plugins/thumbnail/lg-thumbnail-settings.d.ts +2 -1
- package/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -1
- package/plugins/thumbnail/lg-thumbnail.min.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -1
- package/plugins/video/lg-video.es5.js +1 -1
- package/plugins/video/lg-video.min.js +1 -1
- package/plugins/video/lg-video.umd.js +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.min.js +1 -1
- package/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +1 -1
- package/plugins/zoom/lg-zoom.d.ts +12 -23
- package/plugins/zoom/lg-zoom.es5.js +282 -294
- package/plugins/zoom/lg-zoom.es5.js.map +1 -1
- package/plugins/zoom/lg-zoom.min.js +2 -2
- package/plugins/zoom/lg-zoom.umd.js +282 -294
- package/plugins/zoom/lg-zoom.umd.js.map +1 -1
- package/react/Lightgallery.es5.js +23 -18
- package/react/Lightgallery.es5.js.map +1 -1
- package/react/Lightgallery.umd.js +23 -18
- package/react/Lightgallery.umd.js.map +1 -1
- package/scss/_lg-variables.scss +1 -1
- package/scss/lg-rotate.scss +8 -0
- package/scss/lg-zoom.scss +29 -2
- package/vue/LightGalleryVue.common.js +24 -19
- package/vue/LightGalleryVue.common.js.map +1 -1
- package/vue/LightGalleryVue.umd.js +24 -19
- package/vue/LightGalleryVue.umd.js.map +1 -1
- package/vue/LightGalleryVue.umd.min.js +1 -1
- package/vue/LightGalleryVue.umd.min.js.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* lightgallery | 2.
|
|
2
|
+
* lightgallery | 2.6.0 | August 29th 2022
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -135,158 +135,50 @@ var Zoom = /** @class */ (function () {
|
|
|
135
135
|
// Add zoomable class
|
|
136
136
|
this.core.LGel.on(lGEvents.slideItemLoad + ".zoom", this.enableZoom.bind(this));
|
|
137
137
|
};
|
|
138
|
-
Zoom.prototype.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (!transformValues) {
|
|
143
|
-
return 1;
|
|
144
|
-
}
|
|
145
|
-
var modifier = 1;
|
|
146
|
-
if (axis === 'X') {
|
|
147
|
-
var flipHorizontalValue = Math.sign(parseFloat(transformValues[0]));
|
|
148
|
-
if (rotateValue === 0 || rotateValue === 180) {
|
|
149
|
-
modifier = 1;
|
|
150
|
-
}
|
|
151
|
-
else if (rotateValue === 90) {
|
|
152
|
-
if ((originalRotate === -90 && flipHorizontalValue === 1) ||
|
|
153
|
-
(originalRotate === 90 && flipHorizontalValue === -1)) {
|
|
154
|
-
modifier = -1;
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
modifier = 1;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
modifier = modifier * flipHorizontalValue;
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
var flipVerticalValue = Math.sign(parseFloat(transformValues[3]));
|
|
164
|
-
if (rotateValue === 0 || rotateValue === 180) {
|
|
165
|
-
modifier = 1;
|
|
166
|
-
}
|
|
167
|
-
else if (rotateValue === 90) {
|
|
168
|
-
var sinX = parseFloat(transformValues[1]);
|
|
169
|
-
var sinMinusX = parseFloat(transformValues[2]);
|
|
170
|
-
modifier = Math.sign(sinX * sinMinusX * originalRotate * flipVerticalValue);
|
|
171
|
-
}
|
|
172
|
-
modifier = modifier * flipVerticalValue;
|
|
173
|
-
}
|
|
174
|
-
return modifier;
|
|
175
|
-
};
|
|
176
|
-
Zoom.prototype.getImageSize = function ($image, rotateValue, axis) {
|
|
177
|
-
var imageSizes = {
|
|
178
|
-
y: 'offsetHeight',
|
|
179
|
-
x: 'offsetWidth',
|
|
138
|
+
Zoom.prototype.getDragCords = function (e) {
|
|
139
|
+
return {
|
|
140
|
+
x: e.pageX,
|
|
141
|
+
y: e.pageY,
|
|
180
142
|
};
|
|
181
|
-
if (Math.abs(rotateValue) === 90) {
|
|
182
|
-
// Swap axis
|
|
183
|
-
if (axis === 'x') {
|
|
184
|
-
axis = 'y';
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
axis = 'x';
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return $image[imageSizes[axis]];
|
|
191
|
-
};
|
|
192
|
-
Zoom.prototype.getDragCords = function (e, rotateValue) {
|
|
193
|
-
if (rotateValue === 90) {
|
|
194
|
-
return {
|
|
195
|
-
x: e.pageY,
|
|
196
|
-
y: e.pageX,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
return {
|
|
201
|
-
x: e.pageX,
|
|
202
|
-
y: e.pageY,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
Zoom.prototype.getSwipeCords = function (e, rotateValue) {
|
|
207
|
-
var x = e.targetTouches[0].pageX;
|
|
208
|
-
var y = e.targetTouches[0].pageY;
|
|
209
|
-
if (rotateValue === 90) {
|
|
210
|
-
return {
|
|
211
|
-
x: y,
|
|
212
|
-
y: x,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
return {
|
|
217
|
-
x: x,
|
|
218
|
-
y: y,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
Zoom.prototype.getDragAllowedAxises = function (rotateValue, scale) {
|
|
223
|
-
scale = scale || this.scale || 1;
|
|
224
|
-
var allowY = this.imageYSize * scale > this.containerRect.height;
|
|
225
|
-
var allowX = this.imageXSize * scale > this.containerRect.width;
|
|
226
|
-
if (rotateValue === 90) {
|
|
227
|
-
return {
|
|
228
|
-
allowX: allowY,
|
|
229
|
-
allowY: allowX,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
return {
|
|
234
|
-
allowX: allowX,
|
|
235
|
-
allowY: allowY,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
143
|
};
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (!el) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
var st = window.getComputedStyle(el, null);
|
|
250
|
-
var tm = st.getPropertyValue('-webkit-transform') ||
|
|
251
|
-
st.getPropertyValue('-moz-transform') ||
|
|
252
|
-
st.getPropertyValue('-ms-transform') ||
|
|
253
|
-
st.getPropertyValue('-o-transform') ||
|
|
254
|
-
st.getPropertyValue('transform') ||
|
|
255
|
-
'none';
|
|
256
|
-
if (tm !== 'none') {
|
|
257
|
-
return tm.split('(')[1].split(')')[0].split(',');
|
|
258
|
-
}
|
|
259
|
-
return;
|
|
260
|
-
};
|
|
261
|
-
Zoom.prototype.getCurrentRotation = function (el) {
|
|
262
|
-
if (!el) {
|
|
263
|
-
return 0;
|
|
264
|
-
}
|
|
265
|
-
var values = this.getCurrentTransform(el);
|
|
266
|
-
if (values) {
|
|
267
|
-
return Math.round(Math.atan2(parseFloat(values[1]), parseFloat(values[0])) *
|
|
268
|
-
(180 / Math.PI));
|
|
269
|
-
// If you want rotate in 360
|
|
270
|
-
//return (angle < 0 ? angle + 360 : angle);
|
|
271
|
-
}
|
|
272
|
-
return 0;
|
|
144
|
+
Zoom.prototype.getSwipeCords = function (e) {
|
|
145
|
+
var x = e.touches[0].pageX;
|
|
146
|
+
var y = e.touches[0].pageY;
|
|
147
|
+
return {
|
|
148
|
+
x: x,
|
|
149
|
+
y: y,
|
|
150
|
+
};
|
|
273
151
|
};
|
|
274
|
-
Zoom.prototype.
|
|
152
|
+
Zoom.prototype.getDragAllowedAxises = function (scale, scaleDiff) {
|
|
275
153
|
var $image = this.core
|
|
276
154
|
.getSlideItem(this.core.index)
|
|
277
155
|
.find('.lg-image')
|
|
278
|
-
.first();
|
|
279
|
-
var rotateEl = this.core
|
|
280
|
-
.getSlideItem(this.core.index)
|
|
281
|
-
.find('.lg-img-rotate')
|
|
282
156
|
.first()
|
|
283
157
|
.get();
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
158
|
+
var height = 0;
|
|
159
|
+
var width = 0;
|
|
160
|
+
var rect = $image.getBoundingClientRect();
|
|
161
|
+
if (scale) {
|
|
162
|
+
height = $image.offsetHeight * scale;
|
|
163
|
+
width = $image.offsetWidth * scale;
|
|
164
|
+
}
|
|
165
|
+
else if (scaleDiff) {
|
|
166
|
+
height = rect.height + scaleDiff * rect.height;
|
|
167
|
+
width = rect.width + scaleDiff * rect.width;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
height = rect.height;
|
|
171
|
+
width = rect.width;
|
|
172
|
+
}
|
|
173
|
+
var allowY = height > this.containerRect.height;
|
|
174
|
+
var allowX = width > this.containerRect.width;
|
|
175
|
+
return {
|
|
176
|
+
allowX: allowX,
|
|
177
|
+
allowY: allowY,
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
Zoom.prototype.setZoomEssentials = function () {
|
|
181
|
+
this.containerRect = this.core.$content.get().getBoundingClientRect();
|
|
290
182
|
};
|
|
291
183
|
/**
|
|
292
184
|
* @desc Image zoom
|
|
@@ -294,86 +186,152 @@ var Zoom = /** @class */ (function () {
|
|
|
294
186
|
*
|
|
295
187
|
* @param {String} scale - Zoom decrement/increment value
|
|
296
188
|
*/
|
|
297
|
-
Zoom.prototype.zoomImage = function (scale) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
this.imageYSize -
|
|
305
|
-
topBottomSpacing * this.modifierX) /
|
|
306
|
-
2 +
|
|
307
|
-
this.scrollTop +
|
|
308
|
-
this.containerRect.top;
|
|
189
|
+
Zoom.prototype.zoomImage = function (scale, scaleDiff, reposition, resetToMax) {
|
|
190
|
+
if (Math.abs(scaleDiff) <= 0)
|
|
191
|
+
return;
|
|
192
|
+
var offsetX = this.containerRect.width / 2 + this.containerRect.left;
|
|
193
|
+
var offsetY = this.containerRect.height / 2 +
|
|
194
|
+
this.containerRect.top +
|
|
195
|
+
this.scrollTop;
|
|
309
196
|
var originalX;
|
|
310
197
|
var originalY;
|
|
311
198
|
if (scale === 1) {
|
|
312
199
|
this.positionChanged = false;
|
|
313
200
|
}
|
|
314
|
-
var dragAllowedAxises = this.getDragAllowedAxises(
|
|
201
|
+
var dragAllowedAxises = this.getDragAllowedAxises(0, scaleDiff);
|
|
315
202
|
var allowY = dragAllowedAxises.allowY, allowX = dragAllowedAxises.allowX;
|
|
316
203
|
if (this.positionChanged) {
|
|
317
|
-
originalX = this.left / (this.scale -
|
|
318
|
-
originalY = this.top / (this.scale -
|
|
319
|
-
this.pageX =
|
|
320
|
-
this.pageY =
|
|
204
|
+
originalX = this.left / (this.scale - scaleDiff);
|
|
205
|
+
originalY = this.top / (this.scale - scaleDiff);
|
|
206
|
+
this.pageX = offsetX - originalX;
|
|
207
|
+
this.pageY = offsetY - originalY;
|
|
321
208
|
this.positionChanged = false;
|
|
322
209
|
}
|
|
323
|
-
var possibleSwipeCords = this.getPossibleSwipeDragCords(
|
|
210
|
+
var possibleSwipeCords = this.getPossibleSwipeDragCords(scaleDiff);
|
|
211
|
+
var x;
|
|
212
|
+
var y;
|
|
324
213
|
var _x = offsetX - this.pageX;
|
|
325
214
|
var _y = offsetY - this.pageY;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
215
|
+
if (scale - scaleDiff > 1) {
|
|
216
|
+
var scaleVal = (scale - scaleDiff) / Math.abs(scaleDiff);
|
|
217
|
+
_x =
|
|
218
|
+
(scaleDiff < 0 ? -_x : _x) +
|
|
219
|
+
this.left * (scaleVal + (scaleDiff < 0 ? -1 : 1));
|
|
220
|
+
_y =
|
|
221
|
+
(scaleDiff < 0 ? -_y : _y) +
|
|
222
|
+
this.top * (scaleVal + (scaleDiff < 0 ? -1 : 1));
|
|
223
|
+
x = _x / scaleVal;
|
|
224
|
+
y = _y / scaleVal;
|
|
335
225
|
}
|
|
336
226
|
else {
|
|
337
|
-
|
|
338
|
-
|
|
227
|
+
var scaleVal = (scale - scaleDiff) * scaleDiff;
|
|
228
|
+
x = _x * scaleVal;
|
|
229
|
+
y = _y * scaleVal;
|
|
230
|
+
}
|
|
231
|
+
if (reposition) {
|
|
232
|
+
if (allowX) {
|
|
233
|
+
if (this.isBeyondPossibleLeft(x, possibleSwipeCords.minX)) {
|
|
339
234
|
x = possibleSwipeCords.minX;
|
|
340
235
|
}
|
|
341
|
-
else if (x
|
|
236
|
+
else if (this.isBeyondPossibleRight(x, possibleSwipeCords.maxX)) {
|
|
342
237
|
x = possibleSwipeCords.maxX;
|
|
343
238
|
}
|
|
344
239
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
240
|
+
else {
|
|
241
|
+
if (scale > 1) {
|
|
242
|
+
if (x < possibleSwipeCords.minX) {
|
|
243
|
+
x = possibleSwipeCords.minX;
|
|
244
|
+
}
|
|
245
|
+
else if (x > possibleSwipeCords.maxX) {
|
|
246
|
+
x = possibleSwipeCords.maxX;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
352
249
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
if (scale > 1) {
|
|
357
|
-
//If image goes beyond viewport top, use the minim possible translate value
|
|
358
|
-
if (y < possibleSwipeCords.minY) {
|
|
250
|
+
// @todo fix this
|
|
251
|
+
if (allowY) {
|
|
252
|
+
if (this.isBeyondPossibleTop(y, possibleSwipeCords.minY)) {
|
|
359
253
|
y = possibleSwipeCords.minY;
|
|
360
254
|
}
|
|
361
|
-
else if (y
|
|
255
|
+
else if (this.isBeyondPossibleBottom(y, possibleSwipeCords.maxY)) {
|
|
362
256
|
y = possibleSwipeCords.maxY;
|
|
363
257
|
}
|
|
364
258
|
}
|
|
259
|
+
else {
|
|
260
|
+
// If the translate value based on index of beyond the viewport, utilize the available space to prevent image being cut out
|
|
261
|
+
if (scale > 1) {
|
|
262
|
+
//If image goes beyond viewport top, use the minim possible translate value
|
|
263
|
+
if (y < possibleSwipeCords.minY) {
|
|
264
|
+
y = possibleSwipeCords.minY;
|
|
265
|
+
}
|
|
266
|
+
else if (y > possibleSwipeCords.maxY) {
|
|
267
|
+
y = possibleSwipeCords.maxY;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
365
271
|
}
|
|
366
272
|
this.setZoomStyles({
|
|
367
273
|
x: x,
|
|
368
274
|
y: y,
|
|
369
275
|
scale: scale,
|
|
370
276
|
});
|
|
277
|
+
this.left = x;
|
|
278
|
+
this.top = y;
|
|
279
|
+
if (resetToMax) {
|
|
280
|
+
var actualSizeScale = this.getCurrentImageActualSizeScale();
|
|
281
|
+
if (scale >= actualSizeScale) {
|
|
282
|
+
this.setZoomImageSize();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
Zoom.prototype.resetImageTranslate = function () {
|
|
287
|
+
var $image = this.core
|
|
288
|
+
.getSlideItem(this.core.index)
|
|
289
|
+
.find('.lg-image')
|
|
290
|
+
.first();
|
|
291
|
+
this.imageReset = false;
|
|
292
|
+
$image.removeClass('reset-transition reset-transition-y reset-transition-x');
|
|
293
|
+
this.core.outer.removeClass('lg-actual-size');
|
|
294
|
+
$image.css('width', 'auto').css('height', 'auto');
|
|
295
|
+
setTimeout(function () {
|
|
296
|
+
$image.removeClass('no-transition');
|
|
297
|
+
}, 10);
|
|
298
|
+
};
|
|
299
|
+
Zoom.prototype.setZoomImageSize = function () {
|
|
300
|
+
var _this = this;
|
|
301
|
+
var $image = this.core
|
|
302
|
+
.getSlideItem(this.core.index)
|
|
303
|
+
.find('.lg-image')
|
|
304
|
+
.first();
|
|
305
|
+
setTimeout(function () {
|
|
306
|
+
$image.addClass('no-transition');
|
|
307
|
+
_this.imageReset = true;
|
|
308
|
+
}, 500);
|
|
309
|
+
setTimeout(function () {
|
|
310
|
+
var dragAllowedAxises = _this.getDragAllowedAxises(_this.scale);
|
|
311
|
+
$image
|
|
312
|
+
.css('width', $image.get().naturalWidth + 'px')
|
|
313
|
+
.css('height', $image.get().naturalHeight + 'px');
|
|
314
|
+
_this.core.outer.addClass('lg-actual-size');
|
|
315
|
+
if (dragAllowedAxises.allowX && dragAllowedAxises.allowY) {
|
|
316
|
+
$image.addClass('reset-transition');
|
|
317
|
+
}
|
|
318
|
+
else if (dragAllowedAxises.allowX && !dragAllowedAxises.allowY) {
|
|
319
|
+
$image.addClass('reset-transition-x');
|
|
320
|
+
}
|
|
321
|
+
else if (!dragAllowedAxises.allowX && dragAllowedAxises.allowY) {
|
|
322
|
+
$image.addClass('reset-transition-y');
|
|
323
|
+
}
|
|
324
|
+
}, 550);
|
|
371
325
|
};
|
|
372
326
|
/**
|
|
373
327
|
* @desc apply scale3d to image and translate to image wrap
|
|
374
328
|
* @param {style} X,Y and scale
|
|
375
329
|
*/
|
|
376
330
|
Zoom.prototype.setZoomStyles = function (style) {
|
|
331
|
+
var $imageWrap = this.core
|
|
332
|
+
.getSlideItem(this.core.index)
|
|
333
|
+
.find('.lg-img-wrap')
|
|
334
|
+
.first();
|
|
377
335
|
var $image = this.core
|
|
378
336
|
.getSlideItem(this.core.index)
|
|
379
337
|
.find('.lg-image')
|
|
@@ -381,14 +339,11 @@ var Zoom = /** @class */ (function () {
|
|
|
381
339
|
var $dummyImage = this.core.outer
|
|
382
340
|
.find('.lg-current .lg-dummy-img')
|
|
383
341
|
.first();
|
|
384
|
-
var $imageWrap = $image.parent();
|
|
385
342
|
this.scale = style.scale;
|
|
386
343
|
$image.css('transform', 'scale3d(' + style.scale + ', ' + style.scale + ', 1)');
|
|
387
344
|
$dummyImage.css('transform', 'scale3d(' + style.scale + ', ' + style.scale + ', 1)');
|
|
388
345
|
var transform = 'translate3d(' + style.x + 'px, ' + style.y + 'px, 0)';
|
|
389
346
|
$imageWrap.css('transform', transform);
|
|
390
|
-
this.left = style.x;
|
|
391
|
-
this.top = style.y;
|
|
392
347
|
};
|
|
393
348
|
/**
|
|
394
349
|
* @param index - Index of the current slide
|
|
@@ -396,24 +351,29 @@ var Zoom = /** @class */ (function () {
|
|
|
396
351
|
*/
|
|
397
352
|
Zoom.prototype.setActualSize = function (index, event) {
|
|
398
353
|
var _this = this;
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
this.core.outer.hasClass('lg-first-slide-loading')) {
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
var scale = this.getCurrentImageActualSizeScale();
|
|
405
|
-
if (this.core.outer.hasClass('lg-zoomed')) {
|
|
406
|
-
this.scale = 1;
|
|
407
|
-
}
|
|
408
|
-
else {
|
|
409
|
-
this.scale = this.getScale(scale);
|
|
410
|
-
}
|
|
411
|
-
this.setPageCords(event);
|
|
412
|
-
this.beginZoom(this.scale);
|
|
413
|
-
this.zoomImage(this.scale);
|
|
354
|
+
var currentItem = this.core.galleryItems[this.core.index];
|
|
355
|
+
this.resetImageTranslate();
|
|
414
356
|
setTimeout(function () {
|
|
415
|
-
|
|
416
|
-
|
|
357
|
+
// Allow zoom only on image
|
|
358
|
+
if (!currentItem.src ||
|
|
359
|
+
_this.core.outer.hasClass('lg-first-slide-loading')) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
var scale = _this.getCurrentImageActualSizeScale();
|
|
363
|
+
var prevScale = _this.scale;
|
|
364
|
+
if (_this.core.outer.hasClass('lg-zoomed')) {
|
|
365
|
+
_this.scale = 1;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
_this.scale = _this.getScale(scale);
|
|
369
|
+
}
|
|
370
|
+
_this.setPageCords(event);
|
|
371
|
+
_this.beginZoom(_this.scale);
|
|
372
|
+
_this.zoomImage(_this.scale, _this.scale - prevScale, true, true);
|
|
373
|
+
setTimeout(function () {
|
|
374
|
+
_this.core.outer.removeClass('lg-grabbing').addClass('lg-grab');
|
|
375
|
+
}, 10);
|
|
376
|
+
}, 50);
|
|
417
377
|
};
|
|
418
378
|
Zoom.prototype.getNaturalWidth = function (index) {
|
|
419
379
|
var $image = this.core.getSlideItem(index).find('.lg-image').first();
|
|
@@ -425,7 +385,7 @@ var Zoom = /** @class */ (function () {
|
|
|
425
385
|
Zoom.prototype.getActualSizeScale = function (naturalWidth, width) {
|
|
426
386
|
var _scale;
|
|
427
387
|
var scale;
|
|
428
|
-
if (naturalWidth
|
|
388
|
+
if (naturalWidth >= width) {
|
|
429
389
|
_scale = naturalWidth / width;
|
|
430
390
|
scale = _scale || 2;
|
|
431
391
|
}
|
|
@@ -446,11 +406,13 @@ var Zoom = /** @class */ (function () {
|
|
|
446
406
|
Zoom.prototype.getPageCords = function (event) {
|
|
447
407
|
var cords = {};
|
|
448
408
|
if (event) {
|
|
449
|
-
cords.x = event.pageX || event.
|
|
450
|
-
cords.y = event.pageY || event.
|
|
409
|
+
cords.x = event.pageX || event.touches[0].pageX;
|
|
410
|
+
cords.y = event.pageY || event.touches[0].pageY;
|
|
451
411
|
}
|
|
452
412
|
else {
|
|
453
|
-
var containerRect = this.core
|
|
413
|
+
var containerRect = this.core.$content
|
|
414
|
+
.get()
|
|
415
|
+
.getBoundingClientRect();
|
|
454
416
|
cords.x = containerRect.width / 2 + containerRect.left;
|
|
455
417
|
cords.y =
|
|
456
418
|
containerRect.height / 2 + this.scrollTop + containerRect.top;
|
|
@@ -462,15 +424,18 @@ var Zoom = /** @class */ (function () {
|
|
|
462
424
|
this.pageX = pageCords.x;
|
|
463
425
|
this.pageY = pageCords.y;
|
|
464
426
|
};
|
|
427
|
+
Zoom.prototype.manageActualPixelClassNames = function () {
|
|
428
|
+
var $actualSize = this.core.getElementById('lg-actual-size');
|
|
429
|
+
$actualSize
|
|
430
|
+
.removeClass(this.settings.actualSizeIcons.zoomIn)
|
|
431
|
+
.addClass(this.settings.actualSizeIcons.zoomOut);
|
|
432
|
+
};
|
|
465
433
|
// If true, zoomed - in else zoomed out
|
|
466
434
|
Zoom.prototype.beginZoom = function (scale) {
|
|
467
435
|
this.core.outer.removeClass('lg-zoom-drag-transition lg-zoom-dragging');
|
|
468
436
|
if (scale > 1) {
|
|
469
437
|
this.core.outer.addClass('lg-zoomed');
|
|
470
|
-
|
|
471
|
-
$actualSize
|
|
472
|
-
.removeClass(this.settings.actualSizeIcons.zoomIn)
|
|
473
|
-
.addClass(this.settings.actualSizeIcons.zoomOut);
|
|
438
|
+
this.manageActualPixelClassNames();
|
|
474
439
|
}
|
|
475
440
|
else {
|
|
476
441
|
this.resetZoom();
|
|
@@ -503,8 +468,7 @@ var Zoom = /** @class */ (function () {
|
|
|
503
468
|
});
|
|
504
469
|
this.core.outer.on('touchstart.lg', function (event) {
|
|
505
470
|
var $target = _this.$LG(event.target);
|
|
506
|
-
if (event.
|
|
507
|
-
$target.hasClass('lg-image')) {
|
|
471
|
+
if (event.touches.length === 1 && $target.hasClass('lg-image')) {
|
|
508
472
|
if (!tapped) {
|
|
509
473
|
tapped = setTimeout(function () {
|
|
510
474
|
tapped = null;
|
|
@@ -518,13 +482,21 @@ var Zoom = /** @class */ (function () {
|
|
|
518
482
|
}
|
|
519
483
|
}
|
|
520
484
|
});
|
|
521
|
-
// Update zoom on resize and orientationchange
|
|
522
485
|
this.core.LGel.on(lGEvents.containerResize + ".zoom " + lGEvents.rotateRight + ".zoom " + lGEvents.rotateLeft + ".zoom " + lGEvents.flipHorizontal + ".zoom " + lGEvents.flipVertical + ".zoom", function () {
|
|
523
|
-
if (!_this.core.lgOpened ||
|
|
486
|
+
if (!_this.core.lgOpened ||
|
|
487
|
+
!_this.isImageSlide() ||
|
|
488
|
+
_this.core.touchAction) {
|
|
524
489
|
return;
|
|
525
|
-
|
|
490
|
+
}
|
|
491
|
+
var _LGel = _this.core
|
|
492
|
+
.getSlideItem(_this.core.index)
|
|
493
|
+
.find('.lg-img-wrap')
|
|
494
|
+
.first();
|
|
495
|
+
_this.top = 0;
|
|
496
|
+
_this.left = 0;
|
|
526
497
|
_this.setZoomEssentials();
|
|
527
|
-
_this.
|
|
498
|
+
_this.setZoomSwipeStyles(_LGel, { x: 0, y: 0 });
|
|
499
|
+
_this.positionChanged = true;
|
|
528
500
|
});
|
|
529
501
|
// Update zoom on resize and orientationchange
|
|
530
502
|
this.$LG(window).on("scroll.lg.zoom.global" + this.core.lgId, function () {
|
|
@@ -533,12 +505,23 @@ var Zoom = /** @class */ (function () {
|
|
|
533
505
|
_this.scrollTop = _this.$LG(window).scrollTop();
|
|
534
506
|
});
|
|
535
507
|
this.core.getElementById('lg-zoom-out').on('click.lg', function () {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
_this.beginZoom(_this.scale);
|
|
540
|
-
_this.zoomImage(_this.scale);
|
|
508
|
+
// Allow zoom only on image
|
|
509
|
+
if (!_this.isImageSlide()) {
|
|
510
|
+
return;
|
|
541
511
|
}
|
|
512
|
+
var timeout = 0;
|
|
513
|
+
if (_this.imageReset) {
|
|
514
|
+
_this.resetImageTranslate();
|
|
515
|
+
timeout = 50;
|
|
516
|
+
}
|
|
517
|
+
setTimeout(function () {
|
|
518
|
+
var scale = _this.scale - _this.settings.scale;
|
|
519
|
+
if (scale < 1) {
|
|
520
|
+
scale = 1;
|
|
521
|
+
}
|
|
522
|
+
_this.beginZoom(scale);
|
|
523
|
+
_this.zoomImage(scale, -_this.settings.scale, true, true);
|
|
524
|
+
}, timeout);
|
|
542
525
|
});
|
|
543
526
|
this.core.getElementById('lg-zoom-in').on('click.lg', function () {
|
|
544
527
|
_this.zoomIn();
|
|
@@ -574,20 +557,15 @@ var Zoom = /** @class */ (function () {
|
|
|
574
557
|
this.zoomableTimeout = false;
|
|
575
558
|
this.positionChanged = false;
|
|
576
559
|
};
|
|
577
|
-
Zoom.prototype.zoomIn = function (
|
|
560
|
+
Zoom.prototype.zoomIn = function () {
|
|
578
561
|
// Allow zoom only on image
|
|
579
562
|
if (!this.isImageSlide()) {
|
|
580
563
|
return;
|
|
581
564
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
this.scale += this.settings.scale;
|
|
587
|
-
}
|
|
588
|
-
this.scale = this.getScale(this.scale);
|
|
589
|
-
this.beginZoom(this.scale);
|
|
590
|
-
this.zoomImage(this.scale);
|
|
565
|
+
var scale = this.scale + this.settings.scale;
|
|
566
|
+
scale = this.getScale(scale);
|
|
567
|
+
this.beginZoom(scale);
|
|
568
|
+
this.zoomImage(scale, this.settings.scale, true, true);
|
|
591
569
|
};
|
|
592
570
|
// Reset zoom effect
|
|
593
571
|
Zoom.prototype.resetZoom = function (index) {
|
|
@@ -606,34 +584,38 @@ var Zoom = /** @class */ (function () {
|
|
|
606
584
|
this.setPageCords();
|
|
607
585
|
};
|
|
608
586
|
Zoom.prototype.getTouchDistance = function (e) {
|
|
609
|
-
return Math.sqrt((e.
|
|
610
|
-
(e.
|
|
611
|
-
(e.
|
|
612
|
-
(e.
|
|
587
|
+
return Math.sqrt((e.touches[0].pageX - e.touches[1].pageX) *
|
|
588
|
+
(e.touches[0].pageX - e.touches[1].pageX) +
|
|
589
|
+
(e.touches[0].pageY - e.touches[1].pageY) *
|
|
590
|
+
(e.touches[0].pageY - e.touches[1].pageY));
|
|
613
591
|
};
|
|
614
592
|
Zoom.prototype.pinchZoom = function () {
|
|
615
593
|
var _this = this;
|
|
616
594
|
var startDist = 0;
|
|
617
595
|
var pinchStarted = false;
|
|
618
596
|
var initScale = 1;
|
|
597
|
+
var prevScale = 0;
|
|
619
598
|
var $item = this.core.getSlideItem(this.core.index);
|
|
620
|
-
this.core
|
|
599
|
+
this.core.outer.on('touchstart.lg', function (e) {
|
|
621
600
|
$item = _this.core.getSlideItem(_this.core.index);
|
|
622
601
|
if (!_this.isImageSlide()) {
|
|
623
602
|
return;
|
|
624
603
|
}
|
|
625
|
-
if (e.
|
|
626
|
-
|
|
627
|
-
(_this
|
|
628
|
-
|
|
604
|
+
if (e.touches.length === 2) {
|
|
605
|
+
e.preventDefault();
|
|
606
|
+
if (_this.core.outer.hasClass('lg-first-slide-loading')) {
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
629
609
|
initScale = _this.scale || 1;
|
|
630
610
|
_this.core.outer.removeClass('lg-zoom-drag-transition lg-zoom-dragging');
|
|
611
|
+
_this.setPageCords(e);
|
|
612
|
+
_this.resetImageTranslate();
|
|
631
613
|
_this.core.touchAction = 'pinch';
|
|
632
614
|
startDist = _this.getTouchDistance(e);
|
|
633
615
|
}
|
|
634
616
|
});
|
|
635
617
|
this.core.$inner.on('touchmove.lg', function (e) {
|
|
636
|
-
if (e.
|
|
618
|
+
if (e.touches.length === 2 &&
|
|
637
619
|
_this.core.touchAction === 'pinch' &&
|
|
638
620
|
(_this.$LG(e.target).hasClass('lg-item') ||
|
|
639
621
|
$item.get().contains(e.target))) {
|
|
@@ -644,8 +626,12 @@ var Zoom = /** @class */ (function () {
|
|
|
644
626
|
pinchStarted = true;
|
|
645
627
|
}
|
|
646
628
|
if (pinchStarted) {
|
|
647
|
-
|
|
648
|
-
|
|
629
|
+
prevScale = _this.scale;
|
|
630
|
+
var _scale = Math.max(1, initScale + -distance * 0.02);
|
|
631
|
+
_this.scale =
|
|
632
|
+
Math.round((_scale + Number.EPSILON) * 100) / 100;
|
|
633
|
+
var diff = _this.scale - prevScale;
|
|
634
|
+
_this.zoomImage(_this.scale, Math.round((diff + Number.EPSILON) * 100) / 100, false, false);
|
|
649
635
|
}
|
|
650
636
|
}
|
|
651
637
|
});
|
|
@@ -659,15 +645,22 @@ var Zoom = /** @class */ (function () {
|
|
|
659
645
|
_this.resetZoom();
|
|
660
646
|
}
|
|
661
647
|
else {
|
|
662
|
-
|
|
663
|
-
|
|
648
|
+
var actualSizeScale = _this.getCurrentImageActualSizeScale();
|
|
649
|
+
if (_this.scale >= actualSizeScale) {
|
|
650
|
+
var scaleDiff = actualSizeScale - _this.scale;
|
|
651
|
+
if (scaleDiff === 0) {
|
|
652
|
+
scaleDiff = 0.01;
|
|
653
|
+
}
|
|
654
|
+
_this.zoomImage(actualSizeScale, scaleDiff, false, true);
|
|
655
|
+
}
|
|
656
|
+
_this.manageActualPixelClassNames();
|
|
664
657
|
_this.core.outer.addClass('lg-zoomed');
|
|
665
658
|
}
|
|
666
659
|
_this.core.touchAction = undefined;
|
|
667
660
|
}
|
|
668
661
|
});
|
|
669
662
|
};
|
|
670
|
-
Zoom.prototype.touchendZoom = function (startCoords, endCoords, allowX, allowY, touchDuration
|
|
663
|
+
Zoom.prototype.touchendZoom = function (startCoords, endCoords, allowX, allowY, touchDuration) {
|
|
671
664
|
var distanceXnew = endCoords.x - startCoords.x;
|
|
672
665
|
var distanceYnew = endCoords.y - startCoords.y;
|
|
673
666
|
var speedX = Math.abs(distanceXnew) / touchDuration + 1;
|
|
@@ -685,9 +678,9 @@ var Zoom = /** @class */ (function () {
|
|
|
685
678
|
.find('.lg-img-wrap')
|
|
686
679
|
.first();
|
|
687
680
|
var distance = {};
|
|
688
|
-
distance.x = this.left + distanceXnew
|
|
689
|
-
distance.y = this.top + distanceYnew
|
|
690
|
-
var possibleSwipeCords = this.getPossibleSwipeDragCords(
|
|
681
|
+
distance.x = this.left + distanceXnew;
|
|
682
|
+
distance.y = this.top + distanceYnew;
|
|
683
|
+
var possibleSwipeCords = this.getPossibleSwipeDragCords();
|
|
691
684
|
if (Math.abs(distanceXnew) > 15 || Math.abs(distanceYnew) > 15) {
|
|
692
685
|
if (allowY) {
|
|
693
686
|
if (this.isBeyondPossibleTop(distance.y, possibleSwipeCords.minY)) {
|
|
@@ -724,8 +717,7 @@ var Zoom = /** @class */ (function () {
|
|
|
724
717
|
Zoom.prototype.getZoomSwipeCords = function (startCoords, endCoords, allowX, allowY, possibleSwipeCords) {
|
|
725
718
|
var distance = {};
|
|
726
719
|
if (allowY) {
|
|
727
|
-
distance.y =
|
|
728
|
-
this.top + (endCoords.y - startCoords.y) * this.modifierY;
|
|
720
|
+
distance.y = this.top + (endCoords.y - startCoords.y);
|
|
729
721
|
if (this.isBeyondPossibleTop(distance.y, possibleSwipeCords.minY)) {
|
|
730
722
|
var diffMinY = possibleSwipeCords.minY - distance.y;
|
|
731
723
|
distance.y = possibleSwipeCords.minY - diffMinY / 6;
|
|
@@ -739,8 +731,7 @@ var Zoom = /** @class */ (function () {
|
|
|
739
731
|
distance.y = this.top;
|
|
740
732
|
}
|
|
741
733
|
if (allowX) {
|
|
742
|
-
distance.x =
|
|
743
|
-
this.left + (endCoords.x - startCoords.x) * this.modifierX;
|
|
734
|
+
distance.x = this.left + (endCoords.x - startCoords.x);
|
|
744
735
|
if (this.isBeyondPossibleLeft(distance.x, possibleSwipeCords.minX)) {
|
|
745
736
|
var diffMinX = possibleSwipeCords.minX - distance.x;
|
|
746
737
|
distance.x = possibleSwipeCords.minX - diffMinX / 6;
|
|
@@ -771,30 +762,29 @@ var Zoom = /** @class */ (function () {
|
|
|
771
762
|
var currentItem = this.core.galleryItems[this.core.index];
|
|
772
763
|
return this.core.getSlideType(currentItem) === 'image';
|
|
773
764
|
};
|
|
774
|
-
Zoom.prototype.getPossibleSwipeDragCords = function (
|
|
775
|
-
var
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
var
|
|
780
|
-
|
|
781
|
-
var
|
|
782
|
-
var
|
|
783
|
-
|
|
765
|
+
Zoom.prototype.getPossibleSwipeDragCords = function (scale) {
|
|
766
|
+
var $image = this.core
|
|
767
|
+
.getSlideItem(this.core.index)
|
|
768
|
+
.find('.lg-image')
|
|
769
|
+
.first();
|
|
770
|
+
var bottom = this.core.mediaContainerPosition.bottom;
|
|
771
|
+
var imgRect = $image.get().getBoundingClientRect();
|
|
772
|
+
var imageHeight = imgRect.height;
|
|
773
|
+
var imageWidth = imgRect.width;
|
|
774
|
+
if (scale) {
|
|
775
|
+
imageHeight = imageHeight + scale * imageHeight;
|
|
776
|
+
imageWidth = imageWidth + scale * imageWidth;
|
|
777
|
+
}
|
|
778
|
+
var minY = (imageHeight - this.containerRect.height) / 2;
|
|
779
|
+
var maxY = (this.containerRect.height - imageHeight) / 2 + bottom;
|
|
780
|
+
var minX = (imageWidth - this.containerRect.width) / 2;
|
|
781
|
+
var maxX = (this.containerRect.width - imageWidth) / 2;
|
|
784
782
|
var possibleSwipeCords = {
|
|
785
783
|
minY: minY,
|
|
786
784
|
maxY: maxY,
|
|
787
785
|
minX: minX,
|
|
788
786
|
maxX: maxX,
|
|
789
787
|
};
|
|
790
|
-
if (Math.abs(rotateValue) === 90) {
|
|
791
|
-
possibleSwipeCords = {
|
|
792
|
-
minY: minX,
|
|
793
|
-
maxY: maxX,
|
|
794
|
-
minX: minY,
|
|
795
|
-
maxX: maxY,
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
788
|
return possibleSwipeCords;
|
|
799
789
|
};
|
|
800
790
|
Zoom.prototype.setZoomSwipeStyles = function (LGel, distance) {
|
|
@@ -822,7 +812,7 @@ var Zoom = /** @class */ (function () {
|
|
|
822
812
|
$item = _this.core.getSlideItem(_this.core.index);
|
|
823
813
|
if ((_this.$LG(e.target).hasClass('lg-item') ||
|
|
824
814
|
$item.get().contains(e.target)) &&
|
|
825
|
-
e.
|
|
815
|
+
e.touches.length === 1 &&
|
|
826
816
|
_this.core.outer.hasClass('lg-zoomed')) {
|
|
827
817
|
e.preventDefault();
|
|
828
818
|
startTime = new Date();
|
|
@@ -831,25 +821,25 @@ var Zoom = /** @class */ (function () {
|
|
|
831
821
|
.getSlideItem(_this.core.index)
|
|
832
822
|
.find('.lg-img-wrap')
|
|
833
823
|
.first();
|
|
834
|
-
var dragAllowedAxises = _this.getDragAllowedAxises(
|
|
824
|
+
var dragAllowedAxises = _this.getDragAllowedAxises(0);
|
|
835
825
|
allowY = dragAllowedAxises.allowY;
|
|
836
826
|
allowX = dragAllowedAxises.allowX;
|
|
837
827
|
if (allowX || allowY) {
|
|
838
|
-
startCoords = _this.getSwipeCords(e
|
|
828
|
+
startCoords = _this.getSwipeCords(e);
|
|
839
829
|
}
|
|
840
|
-
possibleSwipeCords = _this.getPossibleSwipeDragCords(
|
|
830
|
+
possibleSwipeCords = _this.getPossibleSwipeDragCords();
|
|
841
831
|
// reset opacity and transition duration
|
|
842
832
|
_this.core.outer.addClass('lg-zoom-dragging lg-zoom-drag-transition');
|
|
843
833
|
}
|
|
844
834
|
});
|
|
845
835
|
this.core.$inner.on('touchmove.lg', function (e) {
|
|
846
|
-
if (e.
|
|
836
|
+
if (e.touches.length === 1 &&
|
|
847
837
|
_this.core.touchAction === 'zoomSwipe' &&
|
|
848
838
|
(_this.$LG(e.target).hasClass('lg-item') ||
|
|
849
839
|
$item.get().contains(e.target))) {
|
|
850
840
|
e.preventDefault();
|
|
851
841
|
_this.core.touchAction = 'zoomSwipe';
|
|
852
|
-
endCoords = _this.getSwipeCords(e
|
|
842
|
+
endCoords = _this.getSwipeCords(e);
|
|
853
843
|
var distance = _this.getZoomSwipeCords(startCoords, endCoords, allowX, allowY, possibleSwipeCords);
|
|
854
844
|
if (Math.abs(endCoords.x - startCoords.x) > 15 ||
|
|
855
845
|
Math.abs(endCoords.y - startCoords.y) > 15) {
|
|
@@ -862,6 +852,7 @@ var Zoom = /** @class */ (function () {
|
|
|
862
852
|
if (_this.core.touchAction === 'zoomSwipe' &&
|
|
863
853
|
(_this.$LG(e.target).hasClass('lg-item') ||
|
|
864
854
|
$item.get().contains(e.target))) {
|
|
855
|
+
e.preventDefault();
|
|
865
856
|
_this.core.touchAction = undefined;
|
|
866
857
|
_this.core.outer.removeClass('lg-zoom-dragging');
|
|
867
858
|
if (!isMoved) {
|
|
@@ -870,7 +861,7 @@ var Zoom = /** @class */ (function () {
|
|
|
870
861
|
isMoved = false;
|
|
871
862
|
endTime = new Date();
|
|
872
863
|
var touchDuration = endTime.valueOf() - startTime.valueOf();
|
|
873
|
-
_this.touchendZoom(startCoords, endCoords, allowX, allowY, touchDuration
|
|
864
|
+
_this.touchendZoom(startCoords, endCoords, allowX, allowY, touchDuration);
|
|
874
865
|
}
|
|
875
866
|
});
|
|
876
867
|
};
|
|
@@ -901,19 +892,16 @@ var Zoom = /** @class */ (function () {
|
|
|
901
892
|
.getSlideItem(_this.core.index)
|
|
902
893
|
.find('.lg-img-wrap')
|
|
903
894
|
.first();
|
|
904
|
-
var dragAllowedAxises = _this.getDragAllowedAxises(
|
|
895
|
+
var dragAllowedAxises = _this.getDragAllowedAxises(0);
|
|
905
896
|
allowY = dragAllowedAxises.allowY;
|
|
906
897
|
allowX = dragAllowedAxises.allowX;
|
|
907
898
|
if (_this.core.outer.hasClass('lg-zoomed')) {
|
|
908
899
|
if (_this.$LG(e.target).hasClass('lg-object') &&
|
|
909
900
|
(allowX || allowY)) {
|
|
910
901
|
e.preventDefault();
|
|
911
|
-
startCoords = _this.getDragCords(e
|
|
912
|
-
possibleSwipeCords = _this.getPossibleSwipeDragCords(
|
|
902
|
+
startCoords = _this.getDragCords(e);
|
|
903
|
+
possibleSwipeCords = _this.getPossibleSwipeDragCords();
|
|
913
904
|
isDragging = true;
|
|
914
|
-
// ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
|
|
915
|
-
_this.core.outer.get().scrollLeft += 1;
|
|
916
|
-
_this.core.outer.get().scrollLeft -= 1;
|
|
917
905
|
_this.core.outer
|
|
918
906
|
.removeClass('lg-grab')
|
|
919
907
|
.addClass('lg-grabbing lg-zoom-drag-transition lg-zoom-dragging');
|
|
@@ -925,7 +913,7 @@ var Zoom = /** @class */ (function () {
|
|
|
925
913
|
this.$LG(window).on("mousemove.lg.zoom.global" + this.core.lgId, function (e) {
|
|
926
914
|
if (isDragging) {
|
|
927
915
|
isMoved = true;
|
|
928
|
-
endCoords = _this.getDragCords(e
|
|
916
|
+
endCoords = _this.getDragCords(e);
|
|
929
917
|
var distance = _this.getZoomSwipeCords(startCoords, endCoords, allowX, allowY, possibleSwipeCords);
|
|
930
918
|
_this.setZoomSwipeStyles(_LGel, distance);
|
|
931
919
|
}
|
|
@@ -939,9 +927,9 @@ var Zoom = /** @class */ (function () {
|
|
|
939
927
|
if (isMoved &&
|
|
940
928
|
(startCoords.x !== endCoords.x ||
|
|
941
929
|
startCoords.y !== endCoords.y)) {
|
|
942
|
-
endCoords = _this.getDragCords(e
|
|
930
|
+
endCoords = _this.getDragCords(e);
|
|
943
931
|
var touchDuration = endTime.valueOf() - startTime.valueOf();
|
|
944
|
-
_this.touchendZoom(startCoords, endCoords, allowX, allowY, touchDuration
|
|
932
|
+
_this.touchendZoom(startCoords, endCoords, allowX, allowY, touchDuration);
|
|
945
933
|
}
|
|
946
934
|
isMoved = false;
|
|
947
935
|
}
|