PageSourceSearch

https://app-ptf.web.app/build/image-assets/lightGallery/lg-zoom.js

js app-ptf.web.app collected 2026-10-03 12:18:30 UTC 35,046 bytes, 722 lines download raw bytes

vendor: 5,754 bytes, lines 1-117
1/**!
2 * lg-zoom.js | 1.3.0-beta.0 | October 5th 2020
3 * http://sachinchoolur.github.io/lg-zoom.js
4 * Copyright (c) 2016 Sachin N; 
5 * @license GPLv3 
6 */(function (f) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = f() } else if (typeof define === "function" && define.amd) { define([], f) } else { var g; if (typeof window !== "undefined") { g = window } else if (typeof global !== "undefined") { g = global } else if (typeof self !== "undefined") { g = self } else { g = this } g.LgZoom = f() } })(function () {
7     var define, module, exports; return (function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { if (!e[i]) { var c = "function" == typeof require && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error("Cannot find module '" + i + "'"); throw a.code = "MODULE_NOT_FOUND", a } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) } return n[i].exports } for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)o(t[i]); return o } return r })()({
8         1: [function (require, module, exports) {
9             (function (global, factory) {
10                 if (typeof define === "function" && define.amd) {
11                     define([], factory);
12                 } else if (typeof exports !== "undefined") {
13                     factory();
14                 } else {
15                     var mod = {
16                         exports: {}
17                     };
18                     factory();
19                     global.lgZoom = mod.exports;
20                 }
21             })(this, function () {
22                 'use strict';
23
24                 var _extends = Object.assign || function (target) {
25                     for (var i = 1; i < arguments.length; i++) {
26                         var source = arguments[i];
27
28                         for (var key in source) {
29                             if (Object.prototype.hasOwnProperty.call(source, key)) {
30                                 target[key] = source[key];
31                             }
32                         }
33                     }
34
35                     return target;
36                 };
37
38                 var getUseLeft = function getUseLeft() {
39                     var useLeft = false;
40                     var isChrome = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
41                     if (isChrome && parseInt(isChrome[2], 10) < 54) {
42                         useLeft = true;
43                     }
44
45                     return useLeft;
46                 };
47
48                 var zoomDefaults = {
49                     scale: 1,
50                     zoom: true,
51                     actualSize: true,
52                     enableZoomAfter: 300,
53                     useLeftForZoom: getUseLeft()
54                 };
55                 var Zoom = function Zoom(element) {
56
57                     this.el = element;
58
59                     this.core = window.lgData[this.el.getAttribute('lg-uid')];
60                     this.core.s = _extends({}, zoomDefaults, this.core.s);
61
62                     if (this.core.s.zoom && this.core.doCss()) {
63                         this.init();
64
65                         // Store the zoomable timeout value just to clear it while closing
66                         this.zoomabletimeout = false;
67
68                         // Set the initial value center
69                         this.pageX = window.innerWidth / 2;
70                         this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
71                     }
72
73                     return this;
74                 };
75
76                 Zoom.prototype.init = function () {
77
78                     var _this = this;
79                     var zoomIcons = '<button type="button" aria-label="Zoom in" id="lg-zoom-in" class="lg-icon"></button><button type="button" aria-label="Zoom out" id="lg-zoom-out" class="lg-icon"></button>';
80
81                     if (_this.core.s.actualSize) {
82                         zoomIcons += '<button type="button" aria-label="Actual size" id="lg-actual-size" class="lg-icon"></button>';
83                     }
84
85                     if (_this.core.s.useLeftForZoom) {
86                         utils.addClass(_this.core.outer, 'lg-use-left-for-zoom');
87                     } else {
88                         utils.addClass(_this.core.outer, 'lg-use-transition-for-zoom');
89                     }
90
91                     this.core.outer.querySelector('.lg-toolbar').insertAdjacentHTML('beforeend', zoomIcons);
92
93                     // Add zoomable class
94                     utils.on(_this.core.el, 'onSlideItemLoad.lgtmzoom', function (event) {
95
96                         // delay will be 0 except first time
97                         var _speed = _this.core.s.enableZoomAfter + event.detail.delay;
98
99                         // set _speed value 0 if gallery opened from direct url and if it is first slide
100                         if (utils.hasClass(document.body, 'lg-from-hash') && event.detail.delay) {
101
102                             // will execute only once
103                             _speed = 0;
104                         } else {
105
106                             // Remove lg-from-hash to enable starting animation.
107                             utils.removeClass(document.body, 'lg-from-hash');
108                         }
109
110                         _this.zoomabletimeout = setTimeout(function () {
111                             utils.addClass(_this.core.___slide[event.detail.index], 'lg-zoomable');
112                         }, _speed + 30);
113                     });
114
115                     var scale = 1;
116
117                     /**
118                      * @desc Image zoom
119                      * Translate the wrap and scale the image to get better user experience
120                      *
121                      * @param {String} scaleVal - Zoom decrement/increment value
122                      */
123                     var zoom = function zoom(scaleVal) {
124                         console.log("scaleVal", scaleVal)
125                         var image = _this.core.outer.querySelector('.lg-current .lg-image');
126                         var _x;
127                         var _y;
128
129                         // Find offset manually to avoid issue after zoom
130                         var offsetX = (window.innerWidth - image.clientWidth) / 2;
131                         var offsetY = (window.innerHeight - image.clientHeight) / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
132
133                         _x = _this.pageX - offsetX;
134                         _y = _this.pageY - offsetY;
135
136                         var x = (scaleVal - 1) * _x;
137                         var y = (scaleVal - 1) * _y;
138                         var translate = window["isZoomMode"] && scaleVal > 1 ? "translateY(50%) " : ""
139
140                         utils.setVendor(image, 'Transform', translate + 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)');
141                         //utils.setVendor(image, 'Transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)');
142                         image.setAttribute('data-scale', scaleVal);
143
144                         if (_this.core.s.useLeftForZoom) {
145                             image.parentElement.style.left = -x + 'px';
146                             image.parentElement.style.top = -y + 'px';
147                         } else {
148                             utils.setVendor(image.parentElement, 'Transform', 'translate3d(-' + x + 'px, -' + y + 'px, 0)');
149                         }
150
151                         image.parentElement.setAttribute('data-x', x);
152                         image.parentElement.setAttribute('data-y', y);
153                     };
154
155
156                     var callScale = function callScale() {
157                         if (scale > 1) {
158                             utils.addClass(_this.core.outer, 'lg-zoomed');
159                         } else {
160                             _this.resetZoom();
161                         }
162
163                         if (scale < 1) {
164                             scale = 1;
165                         }
166
167                         zoom(scale);
168                     };
169
170                     var actualSize = function actualSize(event, image, index, fromIcon) {
171                         var w = image.clientWidth;
172                         var nw;
173                         if (_this.core.s.dynamic) {
174                             nw = _this.core.s.dynamicEl[index].width || image.naturalWidth || w;
175                         } else {
176                             nw = _this.core.items[index].getAttribute('data-width') || image.naturalWidth || w;
177                         }
178
179                         var _scale;
180
181                         if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
182                             scale = 1;
183                         } else {
184                             if (nw > w) {
185                                 _scale = nw / w;
186                                 scale = _scale || 2;
187                             }
188                         }
189
190                         if (fromIcon) {
191                             _this.pageX = window.innerWidth / 2;
192                             _this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
193                         } else {
194                             _this.pageX = event.pageX || event.targetTouches[0].pageX;
195                             _this.pageY = event.pageY || event.targetTouches[0].pageY;
196                         }
197
198                         callScale();
199                         setTimeout(function () {
200                             utils.removeClass(_this.core.outer, 'lg-grabbing');
201                             utils.addClass(_this.core.outer, 'lg-grab');
202                         }, 10);
203                     };
204
205                     var tapped = false;
vendor: 24,939 bytes, lines 206-713
206
207                     // event triggered after appending slide content
208                     utils.on(_this.core.el, 'onAferAppendSlide.lgtmzoom', function (event) {
209
210                         var index = event.detail.index;
211
212                         // Get the current element
213                         var image = _this.core.___slide[index].querySelector('.lg-image');
214
215                         if (!_this.core.isTouch) {
216                             utils.on(image, 'dblclick', function (event) {
217                                 actualSize(event, image, index);
218                             });
219                         }
220
221                         if (_this.core.isTouch) {
222                             utils.on(image, 'touchstart', function (event) {
223                                 if (!tapped) {
224                                     tapped = setTimeout(function () {
225                                         tapped = null;
226                                     }, 300);
227                                 } else {
228                                     clearTimeout(tapped);
229                                     tapped = null;
230                                     actualSize(event, image, index);
231                                 }
232
233                                 event.preventDefault();
234                             });
235                         }
236                     });
237
238                     // Update zoom on resize and orientationchange
239                     utils.on(window, 'resize.lgzoom scroll.lgzoom orientationchange.lgzoom', function () {
240                         _this.pageX = window.innerWidth / 2;
241                         _this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
242                         zoom(scale);
243                     });
244
245                     utils.on(document.getElementById('lg-zoom-out'), 'click.lg', function () {
246                         if (_this.core.outer.querySelector('.lg-current .lg-image')) {
247                             scale -= _this.core.s.scale;
248                             callScale();
249                         }
250                     });
251
252                     utils.on(document.getElementById('lg-zoom-in'), 'click.lg', function () {
253                         if (_this.core.outer.querySelector('.lg-current .lg-image')) {
254                             scale += _this.core.s.scale;
255                             callScale();
256                         }
257                     });
258
259                     utils.on(document.getElementById('lg-actual-size'), 'click.lg', function (event) {
260                         actualSize(event, _this.core.___slide[_this.core.index].querySelector('.lg-image'), _this.core.index, true);
261                     });
262
263                     // Reset zoom on slide change
264                     utils.on(_this.core.el, 'onBeforeSlide.lgtm', function () {
265                         scale = 1;
266                         _this.resetZoom();
267                     });
268
269                     // Drag option after zoom
270                     if (!_this.core.isTouch) {
271                         _this.zoomDrag();
272                     }
273
274                     if (_this.core.isTouch) {
275                         _this.zoomSwipe();
276                     }
277                 };
278
279                 Zoom.prototype.getModifier = function (rotateValue, axis, el) {
280                     var originalRotate = rotateValue;
281                     rotateValue = Math.abs(rotateValue);
282                     var transformValues = this.getCurrentTransform(el);
283                     if (!transformValues) {
284                         return 1;
285                     }
286                     var modifier = 1;
287                     if (axis === 'X') {
288                         var flipHorizontalValue = Math.sign(parseFloat(transformValues[0]));
289                         if (rotateValue === 0 || rotateValue === 180) {
290                             modifier = 1;
291                         } else if (rotateValue === 90) {
292                             if (originalRotate === -90 && flipHorizontalValue === 1 || originalRotate === 90 && flipHorizontalValue === -1) {
293                                 modifier = -1;
294                             } else {
295                                 modifier = 1;
296                             }
297                         }
298                         modifier = modifier * flipHorizontalValue;
299                     } else {
300                         var flipVerticalValue = Math.sign(parseFloat(transformValues[3]));
301                         if (rotateValue === 0 || rotateValue === 180) {
302                             modifier = 1;
303                         } else if (rotateValue === 90) {
304                             var sinX = parseFloat(transformValues[1]);
305                             var sinMinusX = parseFloat(transformValues[2]);
306                             modifier = Math.sign(sinX * sinMinusX * originalRotate * flipVerticalValue);
307                         }
308                         modifier = modifier * flipVerticalValue;
309                     }
310                     return modifier;
311                 };
312
313                 Zoom.prototype.getImageSize = function ($image, rotateValue, axis) {
314                     var imageSizes = {
315                         y: 'offsetHeight',
316                         x: 'offsetWidth'
317                     };
318                     if (rotateValue === 90) {
319                         // Swap axis 
320                         if (axis === 'x') {
321                             axis = 'y';
322                         } else {
323                             axis = 'x';
324                         }
325                     }
326                     return $image[imageSizes[axis]];
327                 };
328
329                 Zoom.prototype.getDragCords = function (e, rotateValue) {
330                     if (rotateValue === 90) {
331                         return {
332                             x: e.pageY,
333                             y: e.pageX
334                         };
335                     } else {
336                         return {
337                             x: e.pageX,
338                             y: e.pageY
339                         };
340                     }
341                 };
342                 Zoom.prototype.getSwipeCords = function (e, rotateValue) {
343                     var x = e.targetTouches[0].pageX;
344                     var y = e.targetTouches[0].pageY;
345                     if (rotateValue === 90) {
346                         return {
347                             x: y,
348                             y: x
349                         };
350                     } else {
351                         return {
352                             x: x,
353                             y: y
354                         };
355                     }
356                 };
357
358                 Zoom.prototype.getPossibleDragCords = function ($image, rotateValue) {
359                     var cH = this.core.outer.querySelector('.lg').clientHeight
360                     var minY = (cH - this.getImageSize($image, rotateValue, 'y')) / 2 + window["isZoomMode"] ? (cH / 2) : 0;
361                     var maxY = Math.abs(this.getImageSize($image, rotateValue, 'y') * Math.abs($image.getAttribute('data-scale')) - this.core.outer.querySelector('.lg').clientHeight + minY);
362                     var minX = (this.core.outer.querySelector('.lg').clientWidth - this.getImageSize($image, rotateValue, 'x')) / 2;
363                     var maxX = Math.abs(this.getImageSize($image, rotateValue, 'x') * Math.abs($image.getAttribute('data-scale')) - this.core.outer.querySelector('.lg').clientWidth + minX);
364                     if (rotateValue === 90) {
365                         return {
366                             minY: minX,
367                             maxY: maxX,
368                             minX: minY,
369                             maxX: maxY
370                         };
371                     } else {
372                         return {
373                             minY: minY,
374                             maxY: maxY,
375                             minX: minX,
376                             maxX: maxX
377                         };
378                     }
379                 };
380
381                 Zoom.prototype.getDragAllowedAxises = function ($image, rotateValue) {
382                     var allowY = this.getImageSize($image, rotateValue, 'y') * $image.getAttribute('data-scale') > this.core.outer.querySelector('.lg').clientHeight;
383                     var allowX = this.getImageSize($image, rotateValue, 'x') * $image.getAttribute('data-scale') > this.core.outer.querySelector('.lg').clientWidth;
384                     if (rotateValue === 90) {
385                         return {
386                             allowX: allowY,
387                             allowY: allowX
388                         };
389                     } else {
390                         return {
391                             allowX: allowX,
392                             allowY: allowY
393                         };
394                     }
395                 };
396
397                 /**
398                  * 
399                  * @param {Element} el 
400                  * @return matrix(cos(X), sin(X), -sin(X), cos(X), 0, 0);
401                  * Get the current transform value
402                  */
403                 Zoom.prototype.getCurrentTransform = function (el) {
404                     if (!el) {
405                         return 0;
406                     }
407                     var st = window.getComputedStyle(el, null);
408                     var tm = st.getPropertyValue('-webkit-transform') || st.getPropertyValue('-moz-transform') || st.getPropertyValue('-ms-transform') || st.getPropertyValue('-o-transform') || st.getPropertyValue('transform') || 'none';
409                     if (tm !== 'none') {
410                         return tm.split('(')[1].split(')')[0].split(',');
411                     }
412                     return 0;
413                 };
414
415                 Zoom.prototype.getCurrentRotation = function (el) {
416                     if (!el) {
417                         return 0;
418                     }
419                     var values = this.getCurrentTransform(el);
420                     if (values) {
421                         return Math.round(Math.atan2(values[1], values[0]) * (180 / Math.PI));
422                         // If you want rotate in 360
423                         //return (angle < 0 ? angle + 360 : angle);
424                     }
425                     return 0;
426                 };
427
428                 // Reset zoom effect
429                 Zoom.prototype.resetZoom = function () {
430                     utils.removeClass(this.core.outer, 'lg-zoomed');
431                     for (var i = 0; i < this.core.___slide.length; i++) {
432                         if (this.core.___slide[i].querySelector('.lg-img-wrap')) {
433                             this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('style');
434                             this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('data-x');
435                             this.core.___slide[i].querySelector('.lg-img-wrap').removeAttribute('data-y');
436                         }
437                     }
438
439                     for (var j = 0; j < this.core.___slide.length; j++) {
440                         if (this.core.___slide[j].querySelector('.lg-image')) {
441                             this.core.___slide[j].querySelector('.lg-image').removeAttribute('style');
442                             this.core.___slide[j].querySelector('.lg-image').removeAttribute('data-scale');
443                         }
444                     }
445
446                     // Reset pagx pagy values to center
447                     this.pageX = window.innerWidth / 2;
448                     this.pageY = window.innerHeight / 2 + (document.documentElement.scrollTop || document.body.scrollTop);
449                 };
450
451                 Zoom.prototype.zoomSwipe = function () {
452                     var _this = this;
453                     var startCoords = {};
454                     var endCoords = {};
455                     var isMoved = false;
456
457                     // Allow x direction drag
458                     var allowX = false;
459
460                     // Allow Y direction drag
461                     var allowY = false;
462
463                     var rotateValue = 0;
464                     var rotateEl;
465
466                     for (var i = 0; i < _this.core.___slide.length; i++) {
467
468                         /*jshint loopfunc: true */
469                         utils.on(_this.core.___slide[i], 'touchstart.lg', function (e) {
470
471                             if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
472                                 var $image = _this.core.___slide[_this.core.index].querySelector('.lg-object');
473
474                                 rotateEl = _this.core.___slide[_this.core.index].querySelector('.lg-img-rotate');
475                                 rotateValue = _this.getCurrentRotation(rotateEl);
476
477                                 var dragAllowedAxises = _this.getDragAllowedAxises($image, Math.abs(rotateValue));
478                                 allowY = dragAllowedAxises.allowY;
479                                 allowX = dragAllowedAxises.allowX;
480
481                                 if (allowX || allowY) {
482                                     e.preventDefault();
483                                     startCoords = _this.getSwipeCords(e, Math.abs(rotateValue));
484                                 }
485                             }
486                         });
487                     }
488
489                     for (var j = 0; j < _this.core.___slide.length; j++) {
490
491                         /*jshint loopfunc: true */
492                         utils.on(_this.core.___slide[j], 'touchmove.lg', function (e) {
493
494                             if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
495
496                                 var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap');
497                                 var distanceX;
498                                 var distanceY;
499
500                                 e.preventDefault();
501                                 isMoved = true;
502
503                                 endCoords = _this.getSwipeCords(e, Math.abs(rotateValue));
504
505                                 // reset opacity and transition duration
506                                 utils.addClass(_this.core.outer, 'lg-zoom-dragging');
507
508                                 if (allowY) {
509                                     distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y) * _this.getModifier(rotateValue, 'Y', rotateEl);
510                                 } else {
511                                     distanceY = -Math.abs(_el.getAttribute('data-y'));
512                                 }
513
514                                 if (allowX) {
515                                     distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x) * _this.getModifier(rotateValue, 'X', rotateEl);
516                                 } else {
517                                     distanceX = -Math.abs(_el.getAttribute('data-x'));
518                                 }
519
520                                 if (Math.abs(endCoords.x - startCoords.x) > 15 || Math.abs(endCoords.y - startCoords.y) > 15) {
521
522                                     if (_this.core.s.useLeftForZoom) {
523                                         _el.style.left = distanceX + 'px';
524                                         _el.style.top = distanceY + 'px';
525                                     } else {
526                                         utils.setVendor(_el, 'Transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
527                                     }
528                                 }
529                             }
530                         });
531                     }
532
533                     for (var k = 0; k < _this.core.___slide.length; k++) {
534
535                         /*jshint loopfunc: true */
536                         utils.on(_this.core.___slide[k], 'touchend.lg', function () {
537                             if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
538                                 if (isMoved) {
539                                     isMoved = false;
540                                     utils.removeClass(_this.core.outer, 'lg-zoom-dragging');
541                                     _this.touchendZoom(startCoords, endCoords, allowX, allowY, rotateValue);
542                                 }
543                             }
544                         });
545                     }
546                 };
547
548                 Zoom.prototype.zoomDrag = function () {
549
550                     var _this = this;
551                     var startCoords = {};
552                     var endCoords = {};
553                     var isDraging = false;
554                     var isMoved = false;
555
556                     // Allow x direction drag
557                     var allowX = false;
558
559                     // Allow Y direction drag
560                     var allowY = false;
561
562                     var rotateValue = 0;
563                     var rotateEl;
564
565                     for (var i = 0; i < _this.core.___slide.length; i++) {
566
567                         /*jshint loopfunc: true */
568                         utils.on(_this.core.___slide[i], 'mousedown.lgzoom', function (e) {
569
570                             // execute only on .lg-object
571                             var $image = _this.core.___slide[_this.core.index].querySelector('.lg-object');
572
573                             rotateEl = _this.core.___slide[_this.core.index].querySelector('.lg-img-rotate');
574                             rotateValue = _this.getCurrentRotation(rotateEl);
575
576                             var dragAllowedAxises = _this.getDragAllowedAxises($image, Math.abs(rotateValue));
577                             allowY = dragAllowedAxises.allowY;
578                             allowX = dragAllowedAxises.allowX;
579
580                             if (utils.hasClass(_this.core.outer, 'lg-zoomed')) {
581                                 if (utils.hasClass(e.target, 'lg-object') && (allowX || allowY)) {
582                                     e.preventDefault();
583                                     startCoords = _this.getDragCords(e, Math.abs(rotateValue));
584
585                                     isDraging = true;
586
587                                     // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
588                                     _this.core.outer.scrollLeft += 1;
589                                     _this.core.outer.scrollLeft -= 1;
590
591                                     utils.removeClass(_this.core.outer, 'lg-grab');
592                                     utils.addClass(_this.core.outer, 'lg-grabbing');
593                                 }
594                             }
595                         });
596                     }
597
598                     utils.on(window, 'mousemove.lgzoom', function (e) {
599                         if (isDraging) {
600                             var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap');
601                             var distanceX;
602                             var distanceY;
603
604                             isMoved = true;
605                             endCoords = _this.getDragCords(e, Math.abs(rotateValue));
606
607                             // reset opacity and transition duration
608                             utils.addClass(_this.core.outer, 'lg-zoom-dragging');
609
610                             if (allowY) {
611                                 distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y) * _this.getModifier(rotateValue, 'Y', rotateEl);
612                             } else {
613                                 distanceY = -Math.abs(_el.getAttribute('data-y'));
614                             }
615
616                             if (allowX) {
617                                 distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x) * _this.getModifier(rotateValue, 'X', rotateEl);
618                             } else {
619                                 distanceX = -Math.abs(_el.getAttribute('data-x'));
620                             }
621
622                             if (_this.core.s.useLeftForZoom) {
623                                 _el.style.left = distanceX + 'px';
624                                 _el.style.top = distanceY + 'px';
625                             } else {
626                                 utils.setVendor(_el, 'Transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
627                             }
628                         }
629                     });
630
631                     utils.on(window, 'mouseup.lgzoom', function (e) {
632
633                         if (isDraging) {
634                             isDraging = false;
635                             utils.removeClass(_this.core.outer, 'lg-zoom-dragging');
636
637                             // Fix for chrome mouse move on click
638                             if (isMoved && (startCoords.x !== endCoords.x || startCoords.y !== endCoords.y)) {
639                                 endCoords = _this.getDragCords(e, Math.abs(rotateValue));
640                                 _this.touchendZoom(startCoords, endCoords, allowX, allowY, rotateValue);
641                             }
642
643                             isMoved = false;
644                         }
645
646                         utils.removeClass(_this.core.outer, 'lg-grabbing');
647                         utils.addClass(_this.core.outer, 'lg-grab');
648                     });
649                 };
650
651                 Zoom.prototype.touchendZoom = function (startCoords, endCoords, allowX, allowY, rotateValue) {
652
653                     var _this = this;
654                     var _el = _this.core.___slide[_this.core.index].querySelector('.lg-img-wrap');
655                     var image = _this.core.___slide[_this.core.index].querySelector('.lg-object');
656                     var rotateEl = _this.core.___slide[_this.core.index].querySelector('.lg-img-rotate');
657                     var distanceX = -Math.abs(_el.getAttribute('data-x')) + (endCoords.x - startCoords.x) * _this.getModifier(rotateValue, 'X', rotateEl);
658                     var distanceY = -Math.abs(_el.getAttribute('data-y')) + (endCoords.y - startCoords.y) * _this.getModifier(rotateValue, 'Y', rotateEl);
659                     var possibleDragCords = _this.getPossibleDragCords(image, Math.abs(rotateValue));
660
661                     if (Math.abs(endCoords.x - startCoords.x) > 15 || Math.abs(endCoords.y - startCoords.y) > 15) {
662                         if (allowY) {
663                             if (distanceY <= -possibleDragCords.maxY) {
664                                 distanceY = -possibleDragCords.maxY;
665                             } else if (distanceY >= -possibleDragCords.minY) {
666                                 distanceY = -possibleDragCords.minY;
667                             }
668                         }
669
670                         if (allowX) {
671                             if (distanceX <= -possibleDragCords.maxX) {
672                                 distanceX = -possibleDragCords.maxX;
673                             } else if (distanceX >= -possibleDragCords.minX) {
674                                 distanceX = -possibleDragCords.minX;
675                             }
676                         }
677
678                         if (allowY) {
679                             _el.setAttribute('data-y', Math.abs(distanceY));
680                         } else {
681                             distanceY = -Math.abs(_el.getAttribute('data-y'));
682                         }
683
684                         if (allowX) {
685                             _el.setAttribute('data-x', Math.abs(distanceX));
686                         } else {
687                             distanceX = -Math.abs(_el.getAttribute('data-x'));
688                         }
689
690                         if (_this.core.s.useLeftForZoom) {
691                             _el.style.left = distanceX + 'px';
692                             _el.style.top = distanceY + 'px';
693                         } else {
694                             utils.setVendor(_el, 'Transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)');
695                         }
696                     }
697                 };
698
699                 Zoom.prototype.destroy = function () {
700
701                     var _this = this;
702
703                     // Unbind all events added by lightGallery zoom plugin
704                     utils.off(_this.core.el, '.lgzoom');
705                     utils.off(window, '.lgzoom');
706                     for (var i = 0; i < _this.core.___slide.length; i++) {
707                         utils.off(_this.core.___slide[i], '.lgzoom');
708                     }
709
710                     utils.off(_this.core.el, '.lgtmzoom');
711                     _this.resetZoom();
712                     clearTimeout(_this.zoomabletimeout);
713                     _this.zoomabletimeout = false;
714                 };
715
716
717                 window.lgModules.zoom = Zoom;
718             });
719
720         }, {}]
721     }, {}, [1])(1)
722 });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.