From 5b1a31bda288ce6aafc9308146a0193c8bd703af Mon Sep 17 00:00:00 2001 From: farzanuddin Date: Sun, 22 Dec 2019 17:29:08 +0400 Subject: [PATCH] Built the dist file --- dist/build.js | 2 +- dist/build.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/build.js b/dist/build.js index 8e726b0..c829796 100644 --- a/dist/build.js +++ b/dist/build.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("hammerjs")):"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PhotoView=t(require("hammerjs")):e.PhotoView=t(e.Hammer)}(this,function(e){return function(e){function t(i){if(n[i])return n[i].exports;var a=n[i]={exports:{},id:i,loaded:!1};return e[i].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n={maxScale:2,enableMultiZoom:!1,snapToGrid:!0,tapToZoom:!1};return this.options=Object.assign(n,t),this}return o(e,[{key:"init",value:function(e){var t="string"==typeof e?document.querySelectorAll(e)[0]:e;return t?(this.image=t.querySelectorAll("img")[0],this.image?(this._manager=new r["default"].Manager(this.image,{touchAction:"pan-y"}),this._registerGestures(),this._registerEvents(),this.scale=1,this.deltaX=0,this.deltaY=0,this):void console.warn("You must have a valid img tag inside your container")):void console.warn('You must provide a valid container for PhotoView (selector "'+e+'" did not match any element)')}},{key:"_dispatchEvent",value:function(e,t){var n=new u["default"](e,{bubbles:!0,cancelable:!0,detail:t});document.dispatchEvent(n)}},{key:"_registerGestures",value:function(){var e=new r["default"].Tap({event:"zoom",taps:1}),t=new r["default"].Tap({event:"zoom",taps:2}),n=new r["default"].Pan({direction:r["default"].DIRECTION_ALL,threshold:10}),i=new r["default"].Pinch,a=[i,t,n];this.options.tapToZoom&&(t.recognizeWith(e),e.requireFailure(t),a.splice(2,-1,e)),this._manager.add(a)}},{key:"_getZoomLevel",value:function(){var e=void 0;if(this.options.enableMultiZoom){var t=this.options.maxScale/2;e=1===this.scale?t:this.scale===t?this.options.maxScale:1}else e=this.scale>1?1:this.options.maxScale;return e}},{key:"handleTouchEvent",value:function(){this._dispatchEvent("photoview.scale.changed",{scale:this.scale})}},{key:"_registerEvents",value:function(){var e=this;this._manager.on("zoom",function(t){var n=t.center,i=n.x,a=n.y,o=e._getZoomLevel();e._setTransition(!0),e._transform(i,a,o),e.handleTouchEvent()}),this._manager.on("pinchstart",function(t){clearTimeout(e.panTimer),e._enableGesture("pan",!1);var n=t.center,i=n.x,a=n.y;e._setTransition(!0),1===e.scale&&(e.pinchX=i,e.pinchY=a)}),this._manager.on("pinch",function(t){"pinchout"===t.additionalEvent?e._transform(e.pinchX,e.pinchY,e.options.maxScale):"pinchin"===t.additionalEvent&&e._transform(0,0,1),e.handleTouchEvent()}),this._manager.on("pinchend",function(t){e.panTimer=setTimeout(function(t){return e._enableGesture("pan",!0)},1e3)}),this._manager.on("panstart",function(t){e._setTransition(!1)}),this._manager.on("pan",function(t){1!==e.scale&&(t.srcEvent.stopPropagation(),e.currentDeltaX=(isNaN(e.deltaX)?0:e.deltaX)+t.deltaX,e.currentDeltaY=(isNaN(e.deltaY)?0:e.deltaY)+t.deltaY,e.options.snapToGrid&&e._adjustSnapPositions(),e._setTransition(!1),e.image.style.transform="translate3d("+e.currentDeltaX+"px, "+e.currentDeltaY+"px, 0px) scale("+e.scale+")")}),this._manager.on("panend",function(t){e.deltaX=e.currentDeltaX,e.deltaY=e.currentDeltaY})}},{key:"_adjustSnapPositions",value:function(){var e=this.image.offsetLeft,t=this.image.offsetTop;if(this.currentDeltaX+e>this.x)this.currentDeltaX=this.x-e;else if(this.x-this.currentDeltaX+e>this.image.width){var n=this.x-this.currentDeltaX+e-this.image.width;this.currentDeltaX=this.currentDeltaX+n}if(this.currentDeltaY+t>this.y)this.currentDeltaY=this.y-t;else if(this.y-this.currentDeltaY+t>this.image.height){var i=this.y-this.currentDeltaY+t-this.image.height;this.currentDeltaY=this.currentDeltaY+i}}},{key:"_transform",value:function(e,t,n){1===n?(e=this.x,t=this.y):(e-=this.image.offsetLeft,t-=this.image.offsetTop),this.image.style.transformOrigin=e+"px "+t+"px",this.image.style.transform="scale3d("+n+","+n+",1)",this.x=e,this.y=t,this.scale=n,this._onTransformEnd()}},{key:"_onTransformEnd",value:function(){this.scale<=1&&(this.deltaX=this.deltaY=0)}},{key:"_enableGesture",value:function(e,t){this._manager.get(e).set({enable:t})}},{key:"_setTransition",value:function(e){this.image.style.transition=e?"transform 0.5s":"none"}},{key:"_unregisterEvents",value:function(){this._manager.off("pan"),this._manager.off("pinch"),this._manager.off("zoom")}},{key:"reset",value:function(){this.image.style.transform="none"}},{key:"destroy",value:function(){this._unregisterEvents(),this._manager=null}}]),e}(),h=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,e),this.instances=[];var o=Array.prototype.slice,s=o.call(document.querySelectorAll(t));s.forEach(function(e){n.instances.push(new l(i).init(e))})}return o(e,[{key:"reset",value:function(){this.instances.forEach(function(e){e.reset()})}},{key:"destroy",value:function(){this.instances.forEach(function(e){e.destroy()}),this.instances=null}}]),e}();t["default"]=h,e.exports=t["default"]},function(e,t,n){function i(){try{var e=new a("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(t){}return!1}var a={}.CustomEvent;e.exports=i()?a:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=Boolean(t.bubbles),n.cancelable=Boolean(t.cancelable),n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}},function(t,n){t.exports=e}])}); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("hammerjs")):"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PhotoView=t(require("hammerjs")):e.PhotoView=t(e.Hammer)}(this,function(e){return function(e){function t(i){if(n[i])return n[i].exports;var a=n[i]={exports:{},id:i,loaded:!1};return e[i].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n={maxScale:2,enableMultiZoom:!1,snapToGrid:!0,tapToZoom:!1};return this.options=Object.assign(n,t),this}return s(e,[{key:"init",value:function(e){var t="string"==typeof e?document.querySelectorAll(e)[0]:e;return t?(this.image=t.querySelectorAll("img")[0],this.image?(this._manager=new r["default"].Manager(this.image,{touchAction:"pan-y"}),this._registerGestures(),this._registerEvents(),this.scale=1,this.deltaX=0,this.deltaY=0,this):void console.warn("You must have a valid img tag inside your container")):void console.warn('You must provide a valid container for PhotoView (selector "'+e+'" did not match any element)')}},{key:"_dispatchEvent",value:function(e,t){var n=new l["default"](e,{bubbles:!0,cancelable:!0,detail:t});document.dispatchEvent(n)}},{key:"_registerGestures",value:function(){var e=new r["default"].Tap({event:"zoom",taps:1}),t=new r["default"].Tap({event:"zoom",taps:2}),n=new r["default"].Pan({direction:r["default"].DIRECTION_ALL,threshold:10}),i=new r["default"].Pinch,a=[i,t,n];this.options.tapToZoom&&(t.recognizeWith(e),e.requireFailure(t),a.splice(2,-1,e)),this._manager.add(a)}},{key:"_getZoomLevel",value:function(){var e=void 0;if(this.options.enableMultiZoom){var t=this.options.maxScale/2;e=1===this.scale?t:this.scale===t?this.options.maxScale:1}else e=this.scale>1?1:this.options.maxScale;return e}},{key:"handleTouchEvent",value:function(){this._dispatchEvent("photoview.scale.changed",{scale:this.scale})}},{key:"_registerEvents",value:function(){var e=this;this._manager.on("zoom",function(t){var n=t.center,i=n.x,a=n.y,s=e._getZoomLevel();e._setTransition(!0),e._transform(i,a,s),e.handleTouchEvent()}),this._manager.on("pinchstart",function(t){clearTimeout(e.panTimer),e._enableGesture("pan",!1);var n=t.center,i=n.x,a=n.y;e._setTransition(!0),1===e.scale&&(e.pinchX=i,e.pinchY=a)}),this._manager.on("pinch",function(t){"pinchout"===t.additionalEvent?e._transform(e.pinchX,e.pinchY,e.options.maxScale):"pinchin"===t.additionalEvent&&e._transform(0,0,1),e.handleTouchEvent()}),this._manager.on("pinchend",function(t){e.panTimer=setTimeout(function(t){return e._enableGesture("pan",!0)},1e3)}),this._manager.on("panstart",function(t){e._setTransition(!1)}),this._manager.on("pan",function(t){1!==e.scale&&(t.srcEvent.stopPropagation(),e.currentDeltaX=(isNaN(e.deltaX)?0:e.deltaX)+t.deltaX,e.currentDeltaY=(isNaN(e.deltaY)?0:e.deltaY)+t.deltaY,e.options.snapToGrid&&e._adjustSnapPositions(),e._setTransition(!1),e.image.style.transform="translate3d("+e.currentDeltaX+"px, "+e.currentDeltaY+"px, 0px) scale("+e.scale+")")}),this._manager.on("panend",function(t){e.deltaX=e.currentDeltaX,e.deltaY=e.currentDeltaY})}},{key:"_adjustSnapPositions",value:function(){var e=this.image.offsetLeft,t=this.image.offsetTop;if(this.currentDeltaX+e>this.x)this.currentDeltaX=this.x-e;else if(this.x-this.currentDeltaX+e>this.image.width){var n=this.x-this.currentDeltaX+e-this.image.width;this.currentDeltaX=this.currentDeltaX+n}if(this.currentDeltaY+t>this.y)this.currentDeltaY=this.y-t;else if(this.y-this.currentDeltaY+t>this.image.height){var i=this.y-this.currentDeltaY+t-this.image.height;this.currentDeltaY=this.currentDeltaY+i}}},{key:"_transform",value:function(e,t,n){1===n?(e=this.x,t=this.y):(e-=this.image.offsetLeft,t-=this.image.offsetTop),this.image.style.transformOrigin=e+"px "+t+"px",this.image.style.transform="scale3d("+n+","+n+",1)",this.x=e,this.y=t,this.scale=n,this._onTransformEnd()}},{key:"_onTransformEnd",value:function(){this.scale<=1&&(this.deltaX=this.deltaY=0)}},{key:"_enableGesture",value:function(e,t){this._manager.get(e).set({enable:t})}},{key:"_setTransition",value:function(e){this.image.style.transition=e?"transform 0.5s":"none"}},{key:"_unregisterEvents",value:function(){this._manager.off("pan"),this._manager.off("pinch"),this._manager.off("zoom")}},{key:"reset",value:function(e){e?(this._setTransition(!0),this._transform(0,0,1),this._setTransition(!1)):this.image.style.transform="none",this.resetScale()}},{key:"resetScale",value:function(){this.scale=1,this._dispatchEvent("photoview.scale.changed",{scale:this.scale})}},{key:"destroy",value:function(){this._unregisterEvents(),this._manager=null}}]),e}(),h=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,e),this.instances=[];var s=Array.prototype.slice,o=s.call(document.querySelectorAll(t));o.forEach(function(e){n.instances.push(new u(i).init(e))})}return s(e,[{key:"reset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.animate,n=void 0!==t&&t;this.instances.forEach(function(e){e.reset(n)})}},{key:"destroy",value:function(){this.instances.forEach(function(e){e.destroy()}),this.instances=null}}]),e}();t["default"]=h,e.exports=t["default"]},function(e,t,n){function i(){try{var e=new a("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(t){}return!1}var a={}.CustomEvent;e.exports=i()?a:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=Boolean(t.bubbles),n.cancelable=Boolean(t.cancelable),n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}},function(t,n){t.exports=e}])}); //# sourceMappingURL=build.js.map \ No newline at end of file diff --git a/dist/build.js.map b/dist/build.js.map index bd9d89a..38a6cf5 100644 --- a/dist/build.js.map +++ b/dist/build.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///build.js","webpack:///webpack/bootstrap ef767fcb077d9cdd5111","webpack:///./index.js","webpack:///./~/custom-event/index.js","webpack:///external {\"commonjs\":\"hammerjs\",\"commonjs2\":\"hammerjs\",\"root\":\"Hammer\"}"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_3__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","_classCallCheck","instance","Constructor","TypeError","Object","defineProperty","value","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","key","protoProps","staticProps","prototype","_hammerjs","_hammerjs2","_customEvent","_customEvent2","PhotoViewManager","options","arguments","undefined","defaultOptions","maxScale","enableMultiZoom","snapToGrid","tapToZoom","assign","selector","container","document","querySelectorAll","image","_manager","Manager","touchAction","_registerGestures","_registerEvents","scale","deltaX","deltaY","console","warn","type","detail","event","bubbles","cancelable","dispatchEvent","tap","Tap","taps","doubleTap","pan","Pan","direction","DIRECTION_ALL","threshold","pinch","Pinch","gestures","recognizeWith","requireFailure","splice","add","midScale","_dispatchEvent","_this","on","e","_e$center","center","x","y","_getZoomLevel","_setTransition","_transform","handleTouchEvent","clearTimeout","panTimer","_enableGesture","_e$center2","pinchX","pinchY","additionalEvent","setTimeout","_","srcEvent","stopPropagation","currentDeltaX","isNaN","currentDeltaY","_adjustSnapPositions","style","transform","imageOffsetLeft","offsetLeft","imageOffsetTop","offsetTop","width","adjustWidth","height","adjustHeight","_onTransformEnd","gesture","get","set","enable","transition","off","_unregisterEvents","PhotoView","_this2","instances","slice","Array","elements","forEach","item","push","init","photoViewInstance","reset","destroy","useNative","NativeCustomEvent","foo","CustomEvent","createEvent","params","initCustomEvent","createEventObject","Boolean"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,aACA,kBAAAC,gBAAAC,IACAD,UAAAJ,GACA,gBAAAC,SACAA,QAAA,UAAAD,EAAAG,QAAA,aAEAJ,EAAA,UAAAC,EAAAD,EAAA,SACCO,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAT,WACAW,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAW,QAAA,EAGAX,EAAAD,QAvBA,GAAAU,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASP,EAAQD,EAASQ,GAE/BP,EAAOD,QAAUQ,EAAoB,IAKhC,SAASP,EAAQD,EAASQ,GE7DhC,YF+EC,SAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAASF,GAEvF,QAASG,GAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCAhBhHC,OAAOC,eAAe1B,EAAS,cAC7B2B,OAAO,GAGT,IAAIC,GAAe,WAAc,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMZ,OAAOC,eAAeI,EAAQI,EAAWI,IAAKJ,I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vB,QAAAsF,QAAAH,EAAAnF,SACAuB,EAAAtB,WAAAqF,QAAAH,EAAAlF,YACAsB,EAAAzB,OAAAqF,EAAArF,SAEAyB,EAAAvB,SAAA,EACAuB,EAAAtB,YAAA,EACAsB,EAAAzB,OAAA,QAEAyB,IH8WM,SAAShG,EAAQD,GI5ZvBC,EAAAD,QAAAM","file":"build.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"hammerjs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PhotoView\"] = factory(require(\"hammerjs\"));\n\telse\n\t\troot[\"PhotoView\"] = factory(root[\"Hammer\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"hammerjs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PhotoView\"] = factory(require(\"hammerjs\"));\n\telse\n\t\troot[\"PhotoView\"] = factory(root[\"Hammer\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = __webpack_require__(1);\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _hammerjs = __webpack_require__(3);\n\t\n\tvar _hammerjs2 = _interopRequireDefault(_hammerjs);\n\t\n\tvar _customEvent = __webpack_require__(2);\n\t\n\tvar _customEvent2 = _interopRequireDefault(_customEvent);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar PhotoViewManager = function () {\n\t function PhotoViewManager() {\n\t var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\t\n\t _classCallCheck(this, PhotoViewManager);\n\t\n\t var defaultOptions = {\n\t maxScale: 2,\n\t enableMultiZoom: false,\n\t snapToGrid: true,\n\t tapToZoom: false\n\t };\n\t\n\t this.options = Object.assign(defaultOptions, options);\n\t return this;\n\t }\n\t\n\t _createClass(PhotoViewManager, [{\n\t key: 'init',\n\t value: function init(selector) {\n\t var container = typeof selector === 'string' ? document.querySelectorAll(selector)[0] : selector;\n\t if (!container) {\n\t console.warn('You must provide a valid container for PhotoView (selector \"' + selector + '\" did not match any element)');\n\t return;\n\t }\n\t\n\t this.image = container.querySelectorAll('img')[0];\n\t if (!this.image) {\n\t console.warn('You must have a valid img tag inside your container');\n\t return;\n\t }\n\t\n\t this._manager = new _hammerjs2.default.Manager(this.image, { touchAction: 'pan-y' });\n\t this._registerGestures();\n\t this._registerEvents();\n\t this.scale = 1;\n\t this.deltaX = 0;\n\t this.deltaY = 0;\n\t return this;\n\t }\n\t }, {\n\t key: '_dispatchEvent',\n\t value: function _dispatchEvent(type, detail) {\n\t var event = new _customEvent2.default(type, {\n\t bubbles: true,\n\t cancelable: true,\n\t detail: detail\n\t });\n\t\n\t document.dispatchEvent(event);\n\t }\n\t }, {\n\t key: '_registerGestures',\n\t value: function _registerGestures() {\n\t var tap = new _hammerjs2.default.Tap({ event: 'zoom', taps: 1 });\n\t var doubleTap = new _hammerjs2.default.Tap({ event: 'zoom', taps: 2 });\n\t var pan = new _hammerjs2.default.Pan({ direction: _hammerjs2.default.DIRECTION_ALL, threshold: 10 });\n\t var pinch = new _hammerjs2.default.Pinch();\n\t var gestures = [pinch, doubleTap, pan];\n\t if (this.options.tapToZoom) {\n\t doubleTap.recognizeWith(tap);\n\t tap.requireFailure(doubleTap);\n\t gestures.splice(2, -1, tap);\n\t }\n\t\n\t this._manager.add(gestures);\n\t }\n\t }, {\n\t key: '_getZoomLevel',\n\t value: function _getZoomLevel() {\n\t var scale = void 0;\n\t if (this.options.enableMultiZoom) {\n\t var midScale = this.options.maxScale / 2;\n\t scale = this.scale === 1 ? midScale : this.scale === midScale ? this.options.maxScale : 1;\n\t } else {\n\t scale = this.scale > 1 ? 1 : this.options.maxScale;\n\t }\n\t\n\t return scale;\n\t }\n\t }, {\n\t key: 'handleTouchEvent',\n\t value: function handleTouchEvent() {\n\t this._dispatchEvent('photoview.scale.changed', { scale: this.scale });\n\t }\n\t }, {\n\t key: '_registerEvents',\n\t value: function _registerEvents() {\n\t var _this = this;\n\t\n\t this._manager.on('zoom', function (e) {\n\t var _e$center = e.center;\n\t var x = _e$center.x;\n\t var y = _e$center.y;\n\t\n\t var scale = _this._getZoomLevel();\n\t _this._setTransition(true);\n\t _this._transform(x, y, scale);\n\t _this.handleTouchEvent();\n\t });\n\t\n\t this._manager.on('pinchstart', function (e) {\n\t clearTimeout(_this.panTimer);\n\t _this._enableGesture('pan', false);\n\t var _e$center2 = e.center;\n\t var x = _e$center2.x;\n\t var y = _e$center2.y;\n\t\n\t _this._setTransition(true);\n\t\n\t if (_this.scale === 1) {\n\t _this.pinchX = x;\n\t _this.pinchY = y;\n\t }\n\t });\n\t\n\t this._manager.on('pinch', function (e) {\n\t if (e.additionalEvent === 'pinchout') {\n\t _this._transform(_this.pinchX, _this.pinchY, _this.options.maxScale);\n\t } else if (e.additionalEvent === 'pinchin') {\n\t _this._transform(0, 0, 1);\n\t }\n\t\n\t _this.handleTouchEvent();\n\t });\n\t\n\t this._manager.on('pinchend', function (e) {\n\t _this.panTimer = setTimeout(function (_) {\n\t return _this._enableGesture('pan', true);\n\t }, 1000);\n\t });\n\t\n\t this._manager.on('panstart', function (e) {\n\t _this._setTransition(false);\n\t });\n\t\n\t this._manager.on('pan', function (e) {\n\t if (_this.scale === 1) {\n\t return;\n\t }\n\t\n\t e.srcEvent.stopPropagation();\n\t _this.currentDeltaX = (isNaN(_this.deltaX) ? 0 : _this.deltaX) + e.deltaX;\n\t _this.currentDeltaY = (isNaN(_this.deltaY) ? 0 : _this.deltaY) + e.deltaY;\n\t if (_this.options.snapToGrid) {\n\t _this._adjustSnapPositions();\n\t }\n\t\n\t _this._setTransition(false);\n\t _this.image.style.transform = 'translate3d(' + _this.currentDeltaX + 'px, ' + _this.currentDeltaY + 'px, 0px) scale(' + _this.scale + ')';\n\t });\n\t\n\t this._manager.on('panend', function (e) {\n\t _this.deltaX = _this.currentDeltaX;\n\t _this.deltaY = _this.currentDeltaY;\n\t });\n\t }\n\t }, {\n\t key: '_adjustSnapPositions',\n\t value: function _adjustSnapPositions() {\n\t var imageOffsetLeft = this.image.offsetLeft;\n\t var imageOffsetTop = this.image.offsetTop;\n\t if (this.currentDeltaX + imageOffsetLeft > this.x) {\n\t this.currentDeltaX = this.x - imageOffsetLeft;\n\t } else if (this.x - this.currentDeltaX + imageOffsetLeft > this.image.width) {\n\t var adjustWidth = this.x - this.currentDeltaX + imageOffsetLeft - this.image.width;\n\t this.currentDeltaX = this.currentDeltaX + adjustWidth;\n\t }\n\t\n\t if (this.currentDeltaY + imageOffsetTop > this.y) {\n\t this.currentDeltaY = this.y - imageOffsetTop;\n\t } else if (this.y - this.currentDeltaY + imageOffsetTop > this.image.height) {\n\t var adjustHeight = this.y - this.currentDeltaY + imageOffsetTop - this.image.height;\n\t this.currentDeltaY = this.currentDeltaY + adjustHeight;\n\t }\n\t }\n\t }, {\n\t key: '_transform',\n\t value: function _transform(x, y, scale) {\n\t if (scale === 1) {\n\t x = this.x;y = this.y;\n\t } else {\n\t x -= this.image.offsetLeft;\n\t y -= this.image.offsetTop;\n\t }\n\t\n\t this.image.style['transformOrigin'] = x + 'px ' + y + 'px';\n\t this.image.style.transform = 'scale3d(' + scale + ',' + scale + ',1)';\n\t this.x = x;\n\t this.y = y;\n\t this.scale = scale;\n\t this._onTransformEnd();\n\t }\n\t }, {\n\t key: '_onTransformEnd',\n\t value: function _onTransformEnd() {\n\t if (this.scale <= 1) {\n\t this.deltaX = this.deltaY = 0;\n\t }\n\t }\n\t }, {\n\t key: '_enableGesture',\n\t value: function _enableGesture(gesture, value) {\n\t this._manager.get(gesture).set({ enable: value });\n\t }\n\t }, {\n\t key: '_setTransition',\n\t value: function _setTransition(value) {\n\t this.image.style.transition = value ? 'transform 0.5s' : 'none';\n\t }\n\t }, {\n\t key: '_unregisterEvents',\n\t value: function _unregisterEvents() {\n\t this._manager.off('pan');\n\t this._manager.off('pinch');\n\t this._manager.off('zoom');\n\t }\n\t }, {\n\t key: 'reset',\n\t value: function reset() {\n\t this.image.style.transform = 'none';\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._unregisterEvents();\n\t this._manager = null;\n\t }\n\t }]);\n\t\n\t return PhotoViewManager;\n\t}();\n\t\n\tvar PhotoView = function () {\n\t function PhotoView(selector) {\n\t var _this2 = this;\n\t\n\t var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\n\t _classCallCheck(this, PhotoView);\n\t\n\t this.instances = [];\n\t var slice = Array.prototype.slice;\n\t var elements = slice.call(document.querySelectorAll(selector));\n\t elements.forEach(function (item) {\n\t _this2.instances.push(new PhotoViewManager(options).init(item));\n\t });\n\t }\n\t\n\t _createClass(PhotoView, [{\n\t key: 'reset',\n\t value: function reset() {\n\t this.instances.forEach(function (photoViewInstance) {\n\t photoViewInstance.reset();\n\t });\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this.instances.forEach(function (photoViewInstance) {\n\t photoViewInstance.destroy();\n\t });\n\t\n\t this.instances = null;\n\t }\n\t }]);\n\t\n\t return PhotoView;\n\t}();\n\t\n\texports.default = PhotoView;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\tvar NativeCustomEvent = ({}).CustomEvent;\n\t\n\tfunction useNative () {\n\t try {\n\t var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });\n\t return 'cat' === p.type && 'bar' === p.detail.foo;\n\t } catch (e) {\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Cross-browser `CustomEvent` constructor.\n\t *\n\t * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent\n\t *\n\t * @public\n\t */\n\t\n\tmodule.exports = useNative() ? NativeCustomEvent :\n\t\n\t// IE >= 9\n\t'undefined' !== typeof document && 'function' === typeof document.createEvent ? function CustomEvent (type, params) {\n\t var e = document.createEvent('CustomEvent');\n\t if (params) {\n\t e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);\n\t } else {\n\t e.initCustomEvent(type, false, false, void 0);\n\t }\n\t return e;\n\t} :\n\t\n\t// IE <= 8\n\tfunction CustomEvent (type, params) {\n\t var e = document.createEventObject();\n\t e.type = type;\n\t if (params) {\n\t e.bubbles = Boolean(params.bubbles);\n\t e.cancelable = Boolean(params.cancelable);\n\t e.detail = params.detail;\n\t } else {\n\t e.bubbles = false;\n\t e.cancelable = false;\n\t e.detail = void 0;\n\t }\n\t return e;\n\t}\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** build.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap ef767fcb077d9cdd5111\n **/","'use strict';\n\nimport Hammer from 'hammerjs';\nimport CustomEvent from 'custom-event';\n\nclass PhotoViewManager {\n constructor(options = {}) {\n const defaultOptions = {\n maxScale: 2,\n enableMultiZoom: false,\n snapToGrid: true,\n tapToZoom: false\n };\n\n this.options = Object.assign(defaultOptions, options);\n return this;\n }\n\n init(selector) {\n let container = typeof selector === 'string' ? document.querySelectorAll(selector)[0] : selector;\n if (!container) {\n console.warn(`You must provide a valid container for PhotoView (selector \"${selector}\" did not match any element)`);\n return;\n }\n\n this.image = container.querySelectorAll('img')[0];\n if (!this.image) {\n console.warn(`You must have a valid img tag inside your container`);\n return;\n }\n\n this._manager = new Hammer.Manager(this.image, { touchAction: 'pan-y' });\n this._registerGestures();\n this._registerEvents();\n this.scale = 1;\n this.deltaX = 0;\n this.deltaY = 0;\n return this;\n }\n _dispatchEvent(type, detail) {\n let event = new CustomEvent(\n type,\n {\n bubbles: true,\n cancelable: true,\n detail: detail\n }\n );\n\n document.dispatchEvent(event);\n }\n _registerGestures() {\n const tap = new Hammer.Tap({ event: 'zoom', taps: 1 });\n const doubleTap = new Hammer.Tap({ event: 'zoom', taps: 2 });\n const pan = new Hammer.Pan({ direction: Hammer.DIRECTION_ALL, threshold: 10 });\n const pinch = new Hammer.Pinch();\n let gestures = [pinch, doubleTap, pan];\n if(this.options.tapToZoom){\n doubleTap.recognizeWith(tap);\n tap.requireFailure(doubleTap);\n gestures.splice(2,-1, tap);\n }\n\n this._manager.add(gestures);\n }\n\n _getZoomLevel() {\n let scale;\n if (this.options.enableMultiZoom) {\n let midScale = this.options.maxScale / 2;\n scale = this.scale === 1 ? midScale : (this.scale === midScale) ? this.options.maxScale : 1;\n } else {\n scale = this.scale > 1 ? 1 : this.options.maxScale;\n }\n\n return scale;\n }\n\n handleTouchEvent() {\n this._dispatchEvent('photoview.scale.changed', {scale : this.scale})\n }\n\n _registerEvents() {\n this._manager.on('zoom', e => {\n let {x, y} = e.center;\n let scale = this._getZoomLevel();\n this._setTransition(true);\n this._transform(x, y, scale);\n this.handleTouchEvent();\n });\n\n this._manager.on('pinchstart', e => {\n clearTimeout(this.panTimer);\n this._enableGesture('pan', false);\n let {x, y} = e.center;\n this._setTransition(true);\n\n if (this.scale === 1) {\n this.pinchX = x;\n this.pinchY = y;\n }\n\n });\n\n this._manager.on('pinch', e => {\n if (e.additionalEvent === 'pinchout') {\n this._transform(this.pinchX, this.pinchY, this.options.maxScale);\n } else if (e.additionalEvent === 'pinchin') {\n this._transform(0, 0, 1);\n }\n\n this.handleTouchEvent();\n });\n\n this._manager.on('pinchend', e => {\n this.panTimer = setTimeout(_ => this._enableGesture('pan', true), 1000);\n });\n\n this._manager.on('panstart', e => {\n this._setTransition(false);\n });\n\n this._manager.on('pan', e => {\n if (this.scale === 1) {\n return;\n }\n\n e.srcEvent.stopPropagation();\n this.currentDeltaX = (isNaN(this.deltaX) ? 0 : this.deltaX) + e.deltaX;\n this.currentDeltaY = (isNaN(this.deltaY) ? 0 : this.deltaY) + e.deltaY;\n if (this.options.snapToGrid) {\n this._adjustSnapPositions();\n }\n\n this._setTransition(false);\n this.image.style.transform = `translate3d(${this.currentDeltaX}px, ${this.currentDeltaY}px, 0px) scale(${this.scale})`;\n });\n\n this._manager.on('panend', e => {\n this.deltaX = this.currentDeltaX;\n this.deltaY = this.currentDeltaY;\n });\n }\n\n _adjustSnapPositions() {\n let imageOffsetLeft = this.image.offsetLeft;\n let imageOffsetTop = this.image.offsetTop;\n if (this.currentDeltaX + imageOffsetLeft > this.x) {\n this.currentDeltaX = this.x - imageOffsetLeft;\n } else if (this.x - this.currentDeltaX + imageOffsetLeft > this.image.width) {\n let adjustWidth = (this.x - this.currentDeltaX + imageOffsetLeft) - this.image.width;\n this.currentDeltaX = (this.currentDeltaX + adjustWidth);\n }\n\n if (this.currentDeltaY + imageOffsetTop > this.y) {\n this.currentDeltaY = (this.y - imageOffsetTop);\n } else if (this.y - this.currentDeltaY + imageOffsetTop > this.image.height) {\n let adjustHeight = (this.y - this.currentDeltaY + imageOffsetTop) - this.image.height;\n this.currentDeltaY = this.currentDeltaY + adjustHeight;\n }\n\n }\n\n _transform(x, y, scale) {\n if (scale === 1) {\n x = this.x; y = this.y;\n } else {\n x -= this.image.offsetLeft;\n y -= this.image.offsetTop;\n }\n\n this.image.style['transformOrigin'] = `${x}px ${y}px`;\n this.image.style.transform = `scale3d(${scale},${scale},1)`;\n this.x = x;\n this.y = y;\n this.scale = scale;\n this._onTransformEnd();\n }\n\n _onTransformEnd() {\n if (this.scale <= 1) {\n this.deltaX = this.deltaY = 0;\n }\n }\n\n _enableGesture(gesture, value) {\n this._manager.get(gesture).set({ enable: value });\n }\n\n _setTransition(value) {\n this.image.style.transition = value ? 'transform 0.5s' : 'none';\n }\n\n _unregisterEvents() {\n this._manager.off('pan');\n this._manager.off('pinch');\n this._manager.off('zoom');\n }\n\n reset() {\n this.image.style.transform = 'none';\n }\n\n destroy() {\n this._unregisterEvents();\n this._manager = null;\n }\n}\n\nclass PhotoView {\n constructor(selector, options = {}) {\n this.instances = [];\n let slice = Array.prototype.slice;\n let elements = slice.call(document.querySelectorAll(selector));\n elements.forEach(item => {\n this.instances.push(\n new PhotoViewManager(options).init(item)\n );\n });\n\n }\n\n reset() {\n this.instances.forEach(photoViewInstance => {\n photoViewInstance.reset();\n });\n }\n\n destroy() {\n this.instances.forEach(photoViewInstance => {\n photoViewInstance.destroy();\n });\n\n this.instances = null;\n }\n}\n\nexport default PhotoView;\n\n\n\n/** WEBPACK FOOTER **\n ** ./index.js\n **/","\nvar NativeCustomEvent = global.CustomEvent;\n\nfunction useNative () {\n try {\n var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });\n return 'cat' === p.type && 'bar' === p.detail.foo;\n } catch (e) {\n }\n return false;\n}\n\n/**\n * Cross-browser `CustomEvent` constructor.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent\n *\n * @public\n */\n\nmodule.exports = useNative() ? NativeCustomEvent :\n\n// IE >= 9\n'undefined' !== typeof document && 'function' === typeof document.createEvent ? function CustomEvent (type, params) {\n var e = document.createEvent('CustomEvent');\n if (params) {\n e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);\n } else {\n e.initCustomEvent(type, false, false, void 0);\n }\n return e;\n} :\n\n// IE <= 8\nfunction CustomEvent (type, params) {\n var e = document.createEventObject();\n e.type = type;\n if (params) {\n e.bubbles = Boolean(params.bubbles);\n e.cancelable = Boolean(params.cancelable);\n e.detail = params.detail;\n } else {\n e.bubbles = false;\n e.cancelable = false;\n e.detail = void 0;\n }\n return e;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/custom-event/index.js\n ** module id = 2\n ** module chunks = 0\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external {\"commonjs\":\"hammerjs\",\"commonjs2\":\"hammerjs\",\"root\":\"Hammer\"}\n ** module id = 3\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///build.js","webpack:///webpack/bootstrap 68773c613c8fae061c56","webpack:///./index.js","webpack:///./~/custom-event/index.js","webpack:///external {\"commonjs\":\"hammerjs\",\"commonjs2\":\"hammerjs\",\"root\":\"Hammer\"}"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_3__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","_classCallCheck","instance","Constructor","TypeError","Object","defineProperty","value","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","key","protoProps","staticProps","prototype","_hammerjs","_hammerjs2","_customEvent","_customEvent2","PhotoViewManager","options","arguments","undefined","defaultOptions","maxScale","enableMultiZoom","snapToGrid","tapToZoom","assign","selector","container","document","querySelectorAll","image","_manager","Manager","touchAction","_registerGestures","_registerEvents","scale","deltaX","deltaY","console","warn","type","detail","event","bubbles","cancelable","dispatchEvent","tap","Tap","taps","doubleTap","pan","Pan","direction","DIRECTION_ALL","threshold","pinch","Pinch","gestures","recognizeWith","requireFailure","splice","add","midScale","_dispatchEvent","_this","on","e","_e$center","center","x","y","_getZoomLevel","_setTransition","_transform","handleTouchEvent","clearTimeout","panTimer","_enableGesture","_e$center2","pinchX","pinchY","additionalEvent","setTimeout","_","srcEvent","stopPropagation","currentDeltaX","isNaN","currentDeltaY","_adjustSnapPositions","style","transform","imageOffsetLeft","offsetLeft","imageOffsetTop","offsetTop","width","adjustWidth","height","adjustHeight","_onTransformEnd","gesture","get","set","enable","transition","off","animate","resetScale","_unregisterEvents","PhotoView","_this2","instances","slice","Array","elements","forEach","item","push","init","_ref","_ref$animate","photoViewInstance","reset","destroy","useNative","NativeCustomEvent","foo","CustomEvent","createEvent","params","initCustomEvent","createEventObject","Boolean"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,aACA,kBAAAC,gBAAAC,IACAD,UAAAJ,GACA,gBAAAC,SACAA,QAAA,UAAAD,EAAAG,QAAA,aAEAJ,EAAA,UAAAC,EAAAD,EAAA,SACCO,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAT,WACAW,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAW,QAAA,EAGAX,EAAAD,QAvBA,GAAAU,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASP,EAAQD,EA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G,UAAAf,OAAA,GAAAgB,SAAAD,UAAA,GAAAA,UAAA,MAAAwG,EAAAD,EAAxBb,UAAwBzF,SAAAuG,IAC9BnJ,MAAK0I,UAAUI,QAAQ,SAAAM,GACrBA,EAAkBC,MAAMhB,QF2HzBpG,IAAK,UACLX,MAAO,WEvHRtB,KAAK0I,UAAUI,QAAQ,SAAAM,GACrBA,EAAkBE,YAGpBtJ,KAAK0I,UAAY,SF4HXF,IAGT7I,cE3Hc6I,EF4Hd5I,EAAOD,QAAUA,EAAQ,YAIpB,SAASC,EAAQD,EAASQ,GGrXhC,QAAAoJ,KACA,IACA,GAAA5I,GAAA,GAAA6I,GAAA,OAA0CrF,QAAUsF,IAAA,QACpD,eAAA9I,EAAAuD,MAAA,QAAAvD,EAAAwD,OAAAsF,IACG,MAAA7D,IAEH,SARA,GAAA4D,MAAAE,WAmBA9J,GAAAD,QAAA4J,IAAAC,EAGA,mBAAAnG,WAAA,kBAAAA,UAAAsG,YAAA,SAAAzF,EAAA0F,GACA,GAAAhE,GAAAvC,SAAAsG,YAAA,cAMA,OALAC,GACAhE,EAAAiE,gBAAA3F,EAAA0F,EAAAvF,QAAAuF,EAAAtF,WAAAsF,EAAAzF,QAEAyB,EAAAiE,gBAAA3F,GAAA,aAEA0B,GAIA,SAAA1B,EAAA0F,GACA,GAAAhE,GAAAvC,SAAAyG,mBAWA,OAVAlE,GAAA1B,OACA0F,GACAhE,EAAAvB,QAAA0F,QAAAH,EAAAvF,SACAuB,EAAAtB,WAAAyF,QAAAH,EAAAtF,YACAsB,EAAAzB,OAAAyF,EAAAzF,SAEAyB,EAAAvB,SAAA,EACAuB,EAAAtB,YAAA,EACAsB,EAAAzB,OAAA,QAEAyB,IHgYM,SAAShG,EAAQD,GI9avBC,EAAAD,QAAAM","file":"build.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"hammerjs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PhotoView\"] = factory(require(\"hammerjs\"));\n\telse\n\t\troot[\"PhotoView\"] = factory(root[\"Hammer\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"hammerjs\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"PhotoView\"] = factory(require(\"hammerjs\"));\n\telse\n\t\troot[\"PhotoView\"] = factory(root[\"Hammer\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = __webpack_require__(1);\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tvar _hammerjs = __webpack_require__(3);\n\t\n\tvar _hammerjs2 = _interopRequireDefault(_hammerjs);\n\t\n\tvar _customEvent = __webpack_require__(2);\n\t\n\tvar _customEvent2 = _interopRequireDefault(_customEvent);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar PhotoViewManager = function () {\n\t function PhotoViewManager() {\n\t var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\t\n\t _classCallCheck(this, PhotoViewManager);\n\t\n\t var defaultOptions = {\n\t maxScale: 2,\n\t enableMultiZoom: false,\n\t snapToGrid: true,\n\t tapToZoom: false\n\t };\n\t\n\t this.options = Object.assign(defaultOptions, options);\n\t return this;\n\t }\n\t\n\t _createClass(PhotoViewManager, [{\n\t key: 'init',\n\t value: function init(selector) {\n\t var container = typeof selector === 'string' ? document.querySelectorAll(selector)[0] : selector;\n\t if (!container) {\n\t console.warn('You must provide a valid container for PhotoView (selector \"' + selector + '\" did not match any element)');\n\t return;\n\t }\n\t\n\t this.image = container.querySelectorAll('img')[0];\n\t if (!this.image) {\n\t console.warn('You must have a valid img tag inside your container');\n\t return;\n\t }\n\t\n\t this._manager = new _hammerjs2.default.Manager(this.image, { touchAction: 'pan-y' });\n\t this._registerGestures();\n\t this._registerEvents();\n\t this.scale = 1;\n\t this.deltaX = 0;\n\t this.deltaY = 0;\n\t return this;\n\t }\n\t }, {\n\t key: '_dispatchEvent',\n\t value: function _dispatchEvent(type, detail) {\n\t var event = new _customEvent2.default(type, {\n\t bubbles: true,\n\t cancelable: true,\n\t detail: detail\n\t });\n\t\n\t document.dispatchEvent(event);\n\t }\n\t }, {\n\t key: '_registerGestures',\n\t value: function _registerGestures() {\n\t var tap = new _hammerjs2.default.Tap({ event: 'zoom', taps: 1 });\n\t var doubleTap = new _hammerjs2.default.Tap({ event: 'zoom', taps: 2 });\n\t var pan = new _hammerjs2.default.Pan({ direction: _hammerjs2.default.DIRECTION_ALL, threshold: 10 });\n\t var pinch = new _hammerjs2.default.Pinch();\n\t var gestures = [pinch, doubleTap, pan];\n\t if (this.options.tapToZoom) {\n\t doubleTap.recognizeWith(tap);\n\t tap.requireFailure(doubleTap);\n\t gestures.splice(2, -1, tap);\n\t }\n\t\n\t this._manager.add(gestures);\n\t }\n\t }, {\n\t key: '_getZoomLevel',\n\t value: function _getZoomLevel() {\n\t var scale = void 0;\n\t if (this.options.enableMultiZoom) {\n\t var midScale = this.options.maxScale / 2;\n\t scale = this.scale === 1 ? midScale : this.scale === midScale ? this.options.maxScale : 1;\n\t } else {\n\t scale = this.scale > 1 ? 1 : this.options.maxScale;\n\t }\n\t\n\t return scale;\n\t }\n\t }, {\n\t key: 'handleTouchEvent',\n\t value: function handleTouchEvent() {\n\t this._dispatchEvent('photoview.scale.changed', { scale: this.scale });\n\t }\n\t }, {\n\t key: '_registerEvents',\n\t value: function _registerEvents() {\n\t var _this = this;\n\t\n\t this._manager.on('zoom', function (e) {\n\t var _e$center = e.center;\n\t var x = _e$center.x;\n\t var y = _e$center.y;\n\t\n\t var scale = _this._getZoomLevel();\n\t _this._setTransition(true);\n\t _this._transform(x, y, scale);\n\t _this.handleTouchEvent();\n\t });\n\t\n\t this._manager.on('pinchstart', function (e) {\n\t clearTimeout(_this.panTimer);\n\t _this._enableGesture('pan', false);\n\t var _e$center2 = e.center;\n\t var x = _e$center2.x;\n\t var y = _e$center2.y;\n\t\n\t _this._setTransition(true);\n\t\n\t if (_this.scale === 1) {\n\t _this.pinchX = x;\n\t _this.pinchY = y;\n\t }\n\t });\n\t\n\t this._manager.on('pinch', function (e) {\n\t if (e.additionalEvent === 'pinchout') {\n\t _this._transform(_this.pinchX, _this.pinchY, _this.options.maxScale);\n\t } else if (e.additionalEvent === 'pinchin') {\n\t _this._transform(0, 0, 1);\n\t }\n\t\n\t _this.handleTouchEvent();\n\t });\n\t\n\t this._manager.on('pinchend', function (e) {\n\t _this.panTimer = setTimeout(function (_) {\n\t return _this._enableGesture('pan', true);\n\t }, 1000);\n\t });\n\t\n\t this._manager.on('panstart', function (e) {\n\t _this._setTransition(false);\n\t });\n\t\n\t this._manager.on('pan', function (e) {\n\t if (_this.scale === 1) {\n\t return;\n\t }\n\t\n\t e.srcEvent.stopPropagation();\n\t _this.currentDeltaX = (isNaN(_this.deltaX) ? 0 : _this.deltaX) + e.deltaX;\n\t _this.currentDeltaY = (isNaN(_this.deltaY) ? 0 : _this.deltaY) + e.deltaY;\n\t if (_this.options.snapToGrid) {\n\t _this._adjustSnapPositions();\n\t }\n\t\n\t _this._setTransition(false);\n\t _this.image.style.transform = 'translate3d(' + _this.currentDeltaX + 'px, ' + _this.currentDeltaY + 'px, 0px) scale(' + _this.scale + ')';\n\t });\n\t\n\t this._manager.on('panend', function (e) {\n\t _this.deltaX = _this.currentDeltaX;\n\t _this.deltaY = _this.currentDeltaY;\n\t });\n\t }\n\t }, {\n\t key: '_adjustSnapPositions',\n\t value: function _adjustSnapPositions() {\n\t var imageOffsetLeft = this.image.offsetLeft;\n\t var imageOffsetTop = this.image.offsetTop;\n\t if (this.currentDeltaX + imageOffsetLeft > this.x) {\n\t this.currentDeltaX = this.x - imageOffsetLeft;\n\t } else if (this.x - this.currentDeltaX + imageOffsetLeft > this.image.width) {\n\t var adjustWidth = this.x - this.currentDeltaX + imageOffsetLeft - this.image.width;\n\t this.currentDeltaX = this.currentDeltaX + adjustWidth;\n\t }\n\t\n\t if (this.currentDeltaY + imageOffsetTop > this.y) {\n\t this.currentDeltaY = this.y - imageOffsetTop;\n\t } else if (this.y - this.currentDeltaY + imageOffsetTop > this.image.height) {\n\t var adjustHeight = this.y - this.currentDeltaY + imageOffsetTop - this.image.height;\n\t this.currentDeltaY = this.currentDeltaY + adjustHeight;\n\t }\n\t }\n\t }, {\n\t key: '_transform',\n\t value: function _transform(x, y, scale) {\n\t if (scale === 1) {\n\t x = this.x;y = this.y;\n\t } else {\n\t x -= this.image.offsetLeft;\n\t y -= this.image.offsetTop;\n\t }\n\t\n\t this.image.style['transformOrigin'] = x + 'px ' + y + 'px';\n\t this.image.style.transform = 'scale3d(' + scale + ',' + scale + ',1)';\n\t this.x = x;\n\t this.y = y;\n\t this.scale = scale;\n\t this._onTransformEnd();\n\t }\n\t }, {\n\t key: '_onTransformEnd',\n\t value: function _onTransformEnd() {\n\t if (this.scale <= 1) {\n\t this.deltaX = this.deltaY = 0;\n\t }\n\t }\n\t }, {\n\t key: '_enableGesture',\n\t value: function _enableGesture(gesture, value) {\n\t this._manager.get(gesture).set({ enable: value });\n\t }\n\t }, {\n\t key: '_setTransition',\n\t value: function _setTransition(value) {\n\t this.image.style.transition = value ? 'transform 0.5s' : 'none';\n\t }\n\t }, {\n\t key: '_unregisterEvents',\n\t value: function _unregisterEvents() {\n\t this._manager.off('pan');\n\t this._manager.off('pinch');\n\t this._manager.off('zoom');\n\t }\n\t }, {\n\t key: 'reset',\n\t value: function reset(animate) {\n\t if (animate) {\n\t this._setTransition(true);\n\t this._transform(0, 0, 1);\n\t this._setTransition(false);\n\t } else {\n\t this.image.style.transform = 'none';\n\t }\n\t this.resetScale();\n\t }\n\t }, {\n\t key: 'resetScale',\n\t value: function resetScale() {\n\t this.scale = 1;\n\t this._dispatchEvent('photoview.scale.changed', { scale: this.scale });\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._unregisterEvents();\n\t this._manager = null;\n\t }\n\t }]);\n\t\n\t return PhotoViewManager;\n\t}();\n\t\n\tvar PhotoView = function () {\n\t function PhotoView(selector) {\n\t var _this2 = this;\n\t\n\t var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\n\t _classCallCheck(this, PhotoView);\n\t\n\t this.instances = [];\n\t var slice = Array.prototype.slice;\n\t var elements = slice.call(document.querySelectorAll(selector));\n\t elements.forEach(function (item) {\n\t _this2.instances.push(new PhotoViewManager(options).init(item));\n\t });\n\t }\n\t\n\t _createClass(PhotoView, [{\n\t key: 'reset',\n\t value: function reset() {\n\t var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\t\n\t var _ref$animate = _ref.animate;\n\t var animate = _ref$animate === undefined ? false : _ref$animate;\n\t\n\t this.instances.forEach(function (photoViewInstance) {\n\t photoViewInstance.reset(animate);\n\t });\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this.instances.forEach(function (photoViewInstance) {\n\t photoViewInstance.destroy();\n\t });\n\t\n\t this.instances = null;\n\t }\n\t }]);\n\t\n\t return PhotoView;\n\t}();\n\t\n\texports.default = PhotoView;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\tvar NativeCustomEvent = ({}).CustomEvent;\n\t\n\tfunction useNative () {\n\t try {\n\t var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });\n\t return 'cat' === p.type && 'bar' === p.detail.foo;\n\t } catch (e) {\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Cross-browser `CustomEvent` constructor.\n\t *\n\t * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent\n\t *\n\t * @public\n\t */\n\t\n\tmodule.exports = useNative() ? NativeCustomEvent :\n\t\n\t// IE >= 9\n\t'undefined' !== typeof document && 'function' === typeof document.createEvent ? function CustomEvent (type, params) {\n\t var e = document.createEvent('CustomEvent');\n\t if (params) {\n\t e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);\n\t } else {\n\t e.initCustomEvent(type, false, false, void 0);\n\t }\n\t return e;\n\t} :\n\t\n\t// IE <= 8\n\tfunction CustomEvent (type, params) {\n\t var e = document.createEventObject();\n\t e.type = type;\n\t if (params) {\n\t e.bubbles = Boolean(params.bubbles);\n\t e.cancelable = Boolean(params.cancelable);\n\t e.detail = params.detail;\n\t } else {\n\t e.bubbles = false;\n\t e.cancelable = false;\n\t e.detail = void 0;\n\t }\n\t return e;\n\t}\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** build.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 68773c613c8fae061c56\n **/","'use strict';\n\nimport Hammer from 'hammerjs';\nimport CustomEvent from 'custom-event';\n\nclass PhotoViewManager {\n constructor(options = {}) {\n const defaultOptions = {\n maxScale: 2,\n enableMultiZoom: false,\n snapToGrid: true,\n tapToZoom: false\n };\n\n this.options = Object.assign(defaultOptions, options);\n return this;\n }\n\n init(selector) {\n let container = typeof selector === 'string' ? document.querySelectorAll(selector)[0] : selector;\n if (!container) {\n console.warn(`You must provide a valid container for PhotoView (selector \"${selector}\" did not match any element)`);\n return;\n }\n\n this.image = container.querySelectorAll('img')[0];\n if (!this.image) {\n console.warn(`You must have a valid img tag inside your container`);\n return;\n }\n\n this._manager = new Hammer.Manager(this.image, { touchAction: 'pan-y' });\n this._registerGestures();\n this._registerEvents();\n this.scale = 1;\n this.deltaX = 0;\n this.deltaY = 0;\n return this;\n }\n _dispatchEvent(type, detail) {\n let event = new CustomEvent(\n type,\n {\n bubbles: true,\n cancelable: true,\n detail: detail\n }\n );\n\n document.dispatchEvent(event);\n }\n _registerGestures() {\n const tap = new Hammer.Tap({ event: 'zoom', taps: 1 });\n const doubleTap = new Hammer.Tap({ event: 'zoom', taps: 2 });\n const pan = new Hammer.Pan({ direction: Hammer.DIRECTION_ALL, threshold: 10 });\n const pinch = new Hammer.Pinch();\n let gestures = [pinch, doubleTap, pan];\n if(this.options.tapToZoom){\n doubleTap.recognizeWith(tap);\n tap.requireFailure(doubleTap);\n gestures.splice(2,-1, tap);\n }\n\n this._manager.add(gestures);\n }\n\n _getZoomLevel() {\n let scale;\n if (this.options.enableMultiZoom) {\n let midScale = this.options.maxScale / 2;\n scale = this.scale === 1 ? midScale : (this.scale === midScale) ? this.options.maxScale : 1;\n } else {\n scale = this.scale > 1 ? 1 : this.options.maxScale;\n }\n\n return scale;\n }\n\n handleTouchEvent() {\n this._dispatchEvent('photoview.scale.changed', {scale : this.scale})\n }\n\n _registerEvents() {\n this._manager.on('zoom', e => {\n let {x, y} = e.center;\n let scale = this._getZoomLevel();\n this._setTransition(true);\n this._transform(x, y, scale);\n this.handleTouchEvent();\n });\n\n this._manager.on('pinchstart', e => {\n clearTimeout(this.panTimer);\n this._enableGesture('pan', false);\n let {x, y} = e.center;\n this._setTransition(true);\n\n if (this.scale === 1) {\n this.pinchX = x;\n this.pinchY = y;\n }\n\n });\n\n this._manager.on('pinch', e => {\n if (e.additionalEvent === 'pinchout') {\n this._transform(this.pinchX, this.pinchY, this.options.maxScale);\n } else if (e.additionalEvent === 'pinchin') {\n this._transform(0, 0, 1);\n }\n\n this.handleTouchEvent();\n });\n\n this._manager.on('pinchend', e => {\n this.panTimer = setTimeout(_ => this._enableGesture('pan', true), 1000);\n });\n\n this._manager.on('panstart', e => {\n this._setTransition(false);\n });\n\n this._manager.on('pan', e => {\n if (this.scale === 1) {\n return;\n }\n\n e.srcEvent.stopPropagation();\n this.currentDeltaX = (isNaN(this.deltaX) ? 0 : this.deltaX) + e.deltaX;\n this.currentDeltaY = (isNaN(this.deltaY) ? 0 : this.deltaY) + e.deltaY;\n if (this.options.snapToGrid) {\n this._adjustSnapPositions();\n }\n\n this._setTransition(false);\n this.image.style.transform = `translate3d(${this.currentDeltaX}px, ${this.currentDeltaY}px, 0px) scale(${this.scale})`;\n });\n\n this._manager.on('panend', e => {\n this.deltaX = this.currentDeltaX;\n this.deltaY = this.currentDeltaY;\n });\n }\n\n _adjustSnapPositions() {\n let imageOffsetLeft = this.image.offsetLeft;\n let imageOffsetTop = this.image.offsetTop;\n if (this.currentDeltaX + imageOffsetLeft > this.x) {\n this.currentDeltaX = this.x - imageOffsetLeft;\n } else if (this.x - this.currentDeltaX + imageOffsetLeft > this.image.width) {\n let adjustWidth = (this.x - this.currentDeltaX + imageOffsetLeft) - this.image.width;\n this.currentDeltaX = (this.currentDeltaX + adjustWidth);\n }\n\n if (this.currentDeltaY + imageOffsetTop > this.y) {\n this.currentDeltaY = (this.y - imageOffsetTop);\n } else if (this.y - this.currentDeltaY + imageOffsetTop > this.image.height) {\n let adjustHeight = (this.y - this.currentDeltaY + imageOffsetTop) - this.image.height;\n this.currentDeltaY = this.currentDeltaY + adjustHeight;\n }\n\n }\n\n _transform(x, y, scale) {\n if (scale === 1) {\n x = this.x; y = this.y;\n } else {\n x -= this.image.offsetLeft;\n y -= this.image.offsetTop;\n }\n\n this.image.style['transformOrigin'] = `${x}px ${y}px`;\n this.image.style.transform = `scale3d(${scale},${scale},1)`;\n this.x = x;\n this.y = y;\n this.scale = scale;\n this._onTransformEnd();\n }\n\n _onTransformEnd() {\n if (this.scale <= 1) {\n this.deltaX = this.deltaY = 0;\n }\n }\n\n _enableGesture(gesture, value) {\n this._manager.get(gesture).set({ enable: value });\n }\n\n _setTransition(value) {\n this.image.style.transition = value ? 'transform 0.5s' : 'none';\n }\n\n _unregisterEvents() {\n this._manager.off('pan');\n this._manager.off('pinch');\n this._manager.off('zoom');\n }\n\n reset(animate) {\n if(animate) {\n this._setTransition(true);\n this._transform(0, 0, 1);\n this._setTransition(false);\n } else {\n this.image.style.transform = 'none';\t\n } \n this.resetScale();\n }\n\n resetScale() {\n this.scale = 1;\n this._dispatchEvent('photoview.scale.changed', {scale : this.scale})\n }\n\n destroy() {\n this._unregisterEvents();\n this._manager = null;\n }\n}\n\nclass PhotoView {\n constructor(selector, options = {}) {\n this.instances = [];\n let slice = Array.prototype.slice;\n let elements = slice.call(document.querySelectorAll(selector));\n elements.forEach(item => {\n this.instances.push(\n new PhotoViewManager(options).init(item)\n );\n });\n }\n\n reset({ animate = false } = {}) {\n this.instances.forEach(photoViewInstance => {\n photoViewInstance.reset(animate);\n });\n }\n\n destroy() {\n this.instances.forEach(photoViewInstance => {\n photoViewInstance.destroy();\n });\n\n this.instances = null;\n }\n}\n\nexport default PhotoView;\n\n\n\n/** WEBPACK FOOTER **\n ** ./index.js\n **/","\nvar NativeCustomEvent = global.CustomEvent;\n\nfunction useNative () {\n try {\n var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });\n return 'cat' === p.type && 'bar' === p.detail.foo;\n } catch (e) {\n }\n return false;\n}\n\n/**\n * Cross-browser `CustomEvent` constructor.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent\n *\n * @public\n */\n\nmodule.exports = useNative() ? NativeCustomEvent :\n\n// IE >= 9\n'undefined' !== typeof document && 'function' === typeof document.createEvent ? function CustomEvent (type, params) {\n var e = document.createEvent('CustomEvent');\n if (params) {\n e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);\n } else {\n e.initCustomEvent(type, false, false, void 0);\n }\n return e;\n} :\n\n// IE <= 8\nfunction CustomEvent (type, params) {\n var e = document.createEventObject();\n e.type = type;\n if (params) {\n e.bubbles = Boolean(params.bubbles);\n e.cancelable = Boolean(params.cancelable);\n e.detail = params.detail;\n } else {\n e.bubbles = false;\n e.cancelable = false;\n e.detail = void 0;\n }\n return e;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/custom-event/index.js\n ** module id = 2\n ** module chunks = 0\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external {\"commonjs\":\"hammerjs\",\"commonjs2\":\"hammerjs\",\"root\":\"Hammer\"}\n ** module id = 3\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file