UNPKG

pinch-slider

Version:

a slider for images which can be zoomed or pinched

2 lines 21.1 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.PinchSlider=e():t.PinchSlider=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}([function(t,e,i){var n,s;i(5),n=i(6);var r=i(4);s=n=n||{},"object"!=typeof n.default&&"function"!=typeof n.default||(s=n=n.default),"function"==typeof s&&(s=s.options),s.render=r.render,s.staticRenderFns=r.staticRenderFns,s._scopeId="data-v-b2c10f7a",t.exports=n},function(t,e,i){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(){function i(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function s(t,e){return t.x*e.x+t.y*e.y}function r(t,e){var n=i(t)*i(e);if(0===n)return 0;var r=s(t,e)/n;return r>1&&(r=1),Math.acos(r)}function a(t,e){return t.x*e.y-e.x*t.y}function o(t,e){var i=r(t,e);return a(t,e)>0&&(i*=-1),180*i/Math.PI}function h(t,e){var i=new l(t);return i.add(e),i}var l=function(t){this.handlers=[],this.el=t};l.prototype.add=function(t){this.handlers.push(t)},l.prototype.del=function(t){for(var e=this.handlers.length;e>=0;e--)this.handlers[e]===t&&this.handlers.splice(e,1)},l.prototype.dispatch=function(){for(var t=0,e=this.handlers.length;t<e;t++)this.handlers[t].apply(this.el,arguments)};var c=function(t,e){this.element="string"==typeof t?document.querySelector(t):t,this.element.addEventListener("touchstart",this.start.bind(this),!1),this.element.addEventListener("touchmove",this.move.bind(this),!1),this.element.addEventListener("touchend",this.end.bind(this),!1),this.element.addEventListener("touchcancel",this.cancel.bind(this),!1),this.preV={x:null,y:null},this.pinchStartLen=null,this.scale=1,this.isDoubleTap=!1;var i=function(){};this.rotate=h(this.element,e.rotate||i),this.touchStart=h(this.element,e.touchStart||i),this.multipointStart=h(this.element,e.multipointStart||i),this.multipointEnd=h(this.element,e.multipointEnd||i),this.pinch=h(this.element,e.pinch||i),this.swipe=h(this.element,e.swipe||i),this.tap=h(this.element,e.tap||i),this.doubleTap=h(this.element,e.doubleTap||i),this.longTap=h(this.element,e.longTap||i),this.singleTap=h(this.element,e.singleTap||i),this.pressMove=h(this.element,e.pressMove||i),this.touchMove=h(this.element,e.touchMove||i),this.touchEnd=h(this.element,e.touchEnd||i),this.touchCancel=h(this.element,e.touchCancel||i),this.delta=null,this.last=null,this.now=null,this.tapTimeout=null,this.touchTimeout=null,this.longTapTimeout=null,this.swipeTimeout=null,this.x1=this.x2=this.y1=this.y2=null,this.preTapPosition={x:null,y:null}};c.prototype={start:function(t){if(t.touches){this.now=Date.now(),this.x1=t.touches[0].pageX,this.y1=t.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(t),null!==this.preTapPosition.x&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;var e=this.preV,n=t.touches.length;if(n>1){this._cancelLongTap();var s={x:t.touches[1].pageX-this.x1,y:t.touches[1].pageY-this.y1};e.x=s.x,e.y=s.y,this.pinchStartLen=i(e),this.multipointStart.dispatch(t)}this.longTapTimeout=setTimeout(function(){this.longTap.dispatch(t)}.bind(this),750)}},move:function(t){if(t.touches){var e=this.preV,n=t.touches.length,s=t.touches[0].pageX,r=t.touches[0].pageY;if(this.isDoubleTap=!1,n>1){var a={x:t.touches[1].pageX-s,y:t.touches[1].pageY-r};null!==e.x&&(this.pinchStartLen>0&&(t.scale=i(a)/this.pinchStartLen,this.pinch.dispatch(t)),t.angle=o(a,e),this.rotate.dispatch(t)),e.x=a.x,e.y=a.y}else null!==this.x2?(t.deltaX=s-this.x2,t.deltaY=r-this.y2):(t.deltaX=0,t.deltaY=0),this.pressMove.dispatch(t);this.touchMove.dispatch(t),this._cancelLongTap(),this.x2=s,this.y2=r,t.touches.length>1&&(this._cancelLongTap(),t.preventDefault())}},end:function(t){if(t.changedTouches){this._cancelLongTap();var e=this;t.touches.length<2&&this.multipointEnd.dispatch(t),this.touchEnd.dispatch(t),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.preV.y-this.y2)>30?(t.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout(function(){e.swipe.dispatch(t)},0)):this.tapTimeout=setTimeout(function(){e.tap.dispatch(t),e.isDoubleTap?(e.doubleTap.dispatch(t),clearTimeout(e.touchTimeout),e.isDoubleTap=!1):e.touchTimeout=setTimeout(function(){e.singleTap.dispatch(t)},250)},0),this.preV.x=0,this.preV.y=0,this.scale=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}},cancel:function(t){clearTimeout(this.touchTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout),this.touchCancel.dispatch(t)},_cancelLongTap:function(){clearTimeout(this.longTapTimeout)},_swipeDirection:function(t,e,i,n){return Math.abs(t-e)>=Math.abs(i-n)?t-e>0?"Left":"Right":i-n>0?"Up":"Down"},on:function(t,e){this[t]&&this[t].add(e)},off:function(t,e){this[t]&&this[t].del(e)}},"undefined"!=typeof t&&"object"===n(e)?t.exports=c:window.AlloyFinger=c}()},function(t,e,i){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(){var i={install:function(t,e){e=e||{};var i=window.AlloyFinger||e.AlloyFinger,n=!(2!=t.version.substr(0,1));if(!i)throw new Error("you need include the AlloyFinger!");var s={"touch-start":"touchStart","touch-move":"touchMove","touch-end":"touchEnd","touch-cancel":"touchCancel","multipoint-start":"multipointStart","multipoint-end":"multipointEnd",tap:"tap","double-tap":"doubleTap","long-tap":"longTap","single-tap":"singleTap",rotate:"rotate",pinch:"pinch","press-move":"pressMove",swipe:"swipe"},r=[],a={},o=function(t){for(var e=0,i=r.length;e<i;e++)if(r[e].elem===t)return e;return null},h=function(t,e){var n=e.eventName,s=e.elem,a=e.func,o=e.oldFunc;t&&t.alloyFinger?(t.alloyFinger.off&&o&&t.alloyFinger.off(n,o),t.alloyFinger.on&&a&&t.alloyFinger.on(n,a)):(e={},e[n]=a,r.push({elem:s,alloyFinger:new i(s,e)}))},l=function(t,e){var i=e.value,n=e.oldValue,a=e.arg;a=s[a];var l=r[o(t)];h(l,{elem:t,func:i,oldFunc:n,eventName:a})},c=function(t){var e=o(t);isNaN(e)||r.splice(e,1)};a=n?{bind:l,update:l,unbind:c}:{update:function(t,e){var i={value:t,arg:this.arg},n=this.el;l.call(this,n,i)},unbind:function(){var t=this.el;c.call(this,t)}},t.directive("finger",a)}};"undefined"!=typeof t&&"object"===n(e)?t.exports=i:window.AlloyFingerVue=i}()},function(t,e){!function(){function t(t,i,n){for(var s=0,r=i.length;s<r;s++){var a=i[s];e(t,a,n)}}function e(t,e,i){Object.defineProperty(t,e,{get:function(){return this["__"+e]},set:function(t){t!==this["__"+e]&&(this["__"+e]=t,i())}})}var i=function(t,e,i,n,s,r,a,o,h,l,c,u,d,p,m,f){this.elements=window.Float32Array?new Float32Array(16):[];var g=this.elements;g[0]=void 0!==t?t:1,g[4]=e||0,g[8]=i||0,g[12]=n||0,g[1]=s||0,g[5]=void 0!==r?r:1,g[9]=a||0,g[13]=o||0,g[2]=h||0,g[6]=l||0,g[10]=void 0!==c?c:1,g[14]=u||0,g[3]=d||0,g[7]=p||0,g[11]=m||0,g[15]=void 0!==f?f:1};i.DEG_TO_RAD=Math.PI/180,i.prototype={set:function(t,e,i,n,s,r,a,o,h,l,c,u,d,p,m,f){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=o,g[2]=h,g[6]=l,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=m,g[15]=f,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},multiplyMatrices:function(t,e){var i=t.elements,n=this.elements,s=i[0],r=i[4],a=i[8],o=i[12],h=i[1],l=i[5],c=i[9],u=i[13],d=i[2],p=i[6],m=i[10],f=i[14],g=i[3],w=i[7],v=i[11],y=i[15],x=e[0],S=e[1],I=e[2],T=e[3],b=e[4],M=e[5],_=e[6],D=e[7],F=e[8],A=e[9],C=e[10],X=e[11],L=e[12],Y=e[13],E=e[14],N=e[15];return n[0]=s*x+r*b+a*F+o*L,n[4]=s*S+r*M+a*A+o*Y,n[8]=s*I+r*_+a*C+o*E,n[12]=s*T+r*D+a*X+o*N,n[1]=h*x+l*b+c*F+u*L,n[5]=h*S+l*M+c*A+u*Y,n[9]=h*I+l*_+c*C+u*E,n[13]=h*T+l*D+c*X+u*N,n[2]=d*x+p*b+m*F+f*L,n[6]=d*S+p*M+m*A+f*Y,n[10]=d*I+p*_+m*C+f*E,n[14]=d*T+p*D+m*X+f*N,n[3]=g*x+w*b+v*F+y*L,n[7]=g*S+w*M+v*A+y*Y,n[11]=g*I+w*_+v*C+y*E,n[15]=g*T+w*D+v*X+y*N,this},_rounded:function(t,e){return e=Math.pow(10,e||15),Math.round(t*e)/e},appendTransform:function(t,e,n,s,r,a,o,h,l,c,u,d,p,m){var f=o*i.DEG_TO_RAD,g=this._rounded(Math.cos(f)),w=this._rounded(Math.sin(f)),v=h*i.DEG_TO_RAD,y=this._rounded(Math.cos(v)),x=this._rounded(Math.sin(v)),S=l*i.DEG_TO_RAD,I=this._rounded(Math.cos(S*-1)),T=this._rounded(Math.sin(S*-1));return this.multiplyMatrices(this,[1,0,0,t,0,g,w,e,0,-w,g,n,0,0,0,1]),this.multiplyMatrices(this,[y,0,x,0,0,1,0,0,-x,0,y,0,0,0,0,1]),this.multiplyMatrices(this,[I*s,T*r,0,0,-T*s,I*r,0,0,0,0,1*a,0,0,0,0,1]),(c||u)&&this.multiplyMatrices(this,[this._rounded(Math.cos(c*i.DEG_TO_RAD)),this._rounded(Math.sin(c*i.DEG_TO_RAD)),0,0,-1*this._rounded(Math.sin(u*i.DEG_TO_RAD)),this._rounded(Math.cos(u*i.DEG_TO_RAD)),0,0,0,0,1,0,0,0,0,1]),(d||p||m)&&(this.elements[12]-=d*this.elements[0]+p*this.elements[4]+m*this.elements[8],this.elements[13]-=d*this.elements[1]+p*this.elements[5]+m*this.elements[9],this.elements[14]-=d*this.elements[2]+p*this.elements[6]+m*this.elements[10]),this}},window.Transform=function(e,n){t(e,["translateX","translateY","translateZ","scaleX","scaleY","scaleZ","rotateX","rotateY","rotateZ","skewX","skewY","originX","originY","originZ"],function(){var t=e.matrix3D.identity().appendTransform(e.translateX,e.translateY,e.translateZ,e.scaleX,e.scaleY,e.scaleZ,e.rotateX,e.rotateY,e.rotateZ,e.skewX,e.skewY,e.originX,e.originY,e.originZ);e.style.transform=e.style.msTransform=e.style.OTransform=e.style.MozTransform=e.style.webkitTransform=(n?"":"perspective("+(void 0===e.perspective?500:e.perspective)+"px) ")+"matrix3d("+Array.prototype.slice.call(t.elements).join(",")+")"}),e.matrix3D=new i,n||(t(e,["perspective"],function(){e.style.transform=e.style.msTransform=e.style.OTransform=e.style.MozTransform=e.style.webkitTransform="perspective("+e.perspective+"px) matrix3d("+Array.prototype.slice.call(e.matrix3D.elements).join(",")+")"}),e.perspective=500),e.scaleX=e.scaleY=e.scaleZ=1,e.translateX=e.translateY=e.translateZ=e.rotateX=e.rotateY=e.rotateZ=e.skewX=e.skewY=e.originX=e.originY=e.originZ=0}}()},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{directives:[{name:"finger",rawName:"v-finger:tap",value:t.tap,expression:"tap",arg:"tap"},{name:"finger",rawName:"v-finger:long-tap",value:t.longTap,expression:"longTap",arg:"long-tap"},{name:"finger",rawName:"v-finger:rotate",value:t.rotate,expression:"rotate",arg:"rotate"},{name:"finger",rawName:"v-finger:swipe",value:t.swipe,expression:"swipe",arg:"swipe"},{name:"finger",rawName:"v-finger:touch-start",value:t.touchStart,expression:"touchStart",arg:"touch-start"},{name:"finger",rawName:"v-finger:touch-move",value:t.touchMove,expression:"touchMove",arg:"touch-move"},{name:"finger",rawName:"v-finger:touch-end",value:t.touchEnd,expression:"touchEnd",arg:"touch-end"},{name:"finger",rawName:"v-finger:touch-cancel",value:t.touchCancel,expression:"touchCancel",arg:"touch-cancel"}],staticClass:"ps-slider"},t._l(t.domSlides,function(e,n){return i("div",{staticClass:"ps-img-wrapper"},[i("img",{directives:[{name:"finger",rawName:"v-finger:multipoint-start",value:t.multipointStart,expression:"multipointStart",arg:"multipoint-start"},{name:"finger",rawName:"v-finger:multipoint-end",value:t.multipointEnd,expression:"multipointEnd",arg:"multipoint-end"},{name:"finger",rawName:"v-finger:pinch",value:t.pinch,expression:"pinch",arg:"pinch"},{name:"finger",rawName:"v-finger:swipe.stop.prevent",value:t.imageSwipe,expression:"imageSwipe",arg:"swipe",modifiers:{stop:!0,prevent:!0}},{name:"finger",rawName:"v-finger:press-move",value:t.pressMove,expression:"pressMove",arg:"press-move"},{name:"finger",rawName:"v-finger:double-tap",value:t.doubleTap,expression:"doubleTap",arg:"double-tap"},{name:"finger",rawName:"v-finger:single-tap",value:t.singleTap,expression:"singleTap",arg:"single-tap"}],attrs:{width:t.windowWidth,src:0!==n&&t.lazyLoad?t.loadingImgUrl:e[t.srcAtr]},on:{click:t.click}})])}))},staticRenderFns:[]}},function(t,e){},function(t,e,i){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var s=i(7),r=n(s);e.default={name:"pinch-slider",props:{slides:Array,srcAtr:{type:String,default:"src"},enablePinch:{type:Boolean,default:!0},currentIndex:{type:Number,default:0},lazyLoad:{type:Boolean,default:!1},loadingImgUrl:{type:String,default:""}},data:function(){return{cachedSize:15,currentCacheStartIndex:0,currentScale:1,slidesDoms:[],curSlideImg:{},ratio:1,lastIndex:-100,lazyLoadMap:[],swipeFlag:!1,windowWidth:window.innerWidth,multipointFlag:0}},watch:{slides:function(){this.cachedSize=Math.min(this.slides.length,15),this.bindTransform()},currentCacheStartIndex:function(){this.bindTransform()},currentIndex:function(){this.processCurrentIndexChange()},domSlides:function(){this.processCurrentIndexChange()}},computed:{domSlides:function(){return this.lazyLoadMap=new Array(Math.min(this.cachedSize,this.slides.length)),this.slides.slice(this.currentCacheStartIndex,Math.min(this.slides.length,this.currentCacheStartIndex+this.cachedSize))}},mounted:function(){this.bindTransform()},methods:{bindTransform:function(){this.slides.length>0&&("undefined"==typeof this.$el.translateX&&Transform(this.$el),setTimeout(function(){this.slidesDoms=[].slice.call(this.$el.children),this.slidesDoms.map(function(t,e){var i=t.childNodes[0];i.translateX||Transform(i)}),this.slidesDoms[this.currentIndex-this.currentCacheStartIndex]&&(this.curSlideImg=this.slidesDoms[this.currentIndex-this.currentCacheStartIndex].childNodes[0],this.ratio=this.curSlideImg.naturalHeight/this.curSlideImg.naturalWidth),this.$emit("on-slide-change",{id:this.$el.id,index:this.currentIndex,slides:this.slides}),this.processCurrentIndexChange()}.bind(this),0))},resetCurrentImg:function(){this.curSlideImg.width=window.innerWidth,this.curSlideImg.translateX=0,this.curSlideImg.translateY=0},processCurrentIndexChange:function(){if(!(this.currentIndex<0)){var t=document.body.clientWidth,e=(this.lastIndex<this.currentIndex?"next":"previous",this.lastIndex===this.currentIndex-1?"next":this.lastIndex===this.currentIndex+1?"previous":"jump");if((this.currentIndex<this.currentCacheStartIndex+2||this.currentIndex>this.currentCacheStartIndex+(this.cachedSize-2))&&(this.cachedSize=Math.min(this.slides.length,15),this.currentCacheStartIndex=Math.min(this.slides.length-this.cachedSize,Math.max(0,this.currentIndex-Math.floor(this.cachedSize/2))),"next"===e&&(this.$el.translateX=-t*(this.currentIndex-this.currentCacheStartIndex-1)),"previous"===e&&(this.$el.translateX=-t*(this.currentIndex-this.currentCacheStartIndex+1))),this.slidesDoms[this.currentIndex-this.currentCacheStartIndex]&&(this.curSlideImg=this.slidesDoms[this.currentIndex-this.currentCacheStartIndex].childNodes[0],this.ratio=this.curSlideImg.naturalHeight/this.curSlideImg.naturalWidth),this.resetCurrentImg(),this.slidesDoms[this.lastIndex-this.currentCacheStartIndex]){var i=this.slidesDoms[this.lastIndex-this.currentCacheStartIndex].childNodes[0];i.width=window.innerWidth,i.height=window.innerWidth*this.ratio,this.curSlideImg.width=window.innerWidth,i.translateX=0}this.lazyLoad&&this._lazyLoad(),this.swipeFlag?(this.swipeFlag=!1,new r.default(this.$el,"translateX",-t*(this.currentIndex-this.currentCacheStartIndex),500,this.ease,function(){})):this.$el.translateX=-t*(this.currentIndex-this.currentCacheStartIndex),this.$emit("on-slide-change",{index:this.currentIndex,slides:this.slides}),this.lastIndex=this.currentIndex}},_lazyLoad:function(){function t(t,i){if(i.slidesDoms[t]&&!isNaN(t))return(!i.lazyLoadMap||!i.lazyLoadMap[t])&&(e(i.slides[t+i.currentCacheStartIndex][i.srcAtr],function(){i.slidesDoms[t].childNodes[0].setAttribute("src",i.slides[t+i.currentCacheStartIndex][i.srcAtr]),i.ratio=i.curSlideImg.naturalHeight/i.curSlideImg.naturalWidth,i.lazyLoadMap[t]=1}),!0)}function e(t,e){var i=new Image;i.src=t,i.complete?(e(),i.onload=function(){}):i.onload=function(){e(),i.onload=function(){}}}t(this.currentIndex-this.currentCacheStartIndex,this)},tap:function(){},multipointStart:function(t){this.curSlideImg=this.slidesDoms[this.currentIndex-this.currentCacheStartIndex].childNodes[0],this.ratio=this.curSlideImg.naturalHeight/this.curSlideImg.naturalWidth,t.cancelBubble=!0},longTap:function(){},swipe:function(t){this.currentScale>1||(this.swipeFlag=!0,"Left"===t.direction?this.currentIndex<this.slides.length-1&&this.currentIndex++:"Right"===t.direction&&this.currentIndex>0&&this.currentIndex--)},imageSwipe:function(t){t.cancelBubble=!0,t.preventDefault()},pinch:function(t){var e=this;this.multipointFlag?(clearTimeout(this.multipointFlag),this.multipointFlag=setTimeout(function(){e.multipointFlag=0},500)):this.multipointFlag=setTimeout(function(){e.multipointFlag=0},500),this.enablePinch&&(this.currentScale*t.scale<1?(this.curSlideImg.width=window.innerWidth,this.curSlideImg.height=window.innerWidth*this.ratio):this.currentScale*t.scale<10&&(this.curSlideImg.width=this.currentScale*t.scale*window.innerWidth,this.curSlideImg.height=this.currentScale*t.scale*window.innerWidth*this.ratio),t.scale<1&&(this.curSlideImg.translateX=0,this.curSlideImg.translateY=0),t.cancelBubble=!0,t.preventDefault())},rotate:function(t){},pressMove:function(t){var e=(this.currentScale-1)/2*window.innerWidth,i=this.currentScale*window.innerWidth*this.ratio/2-window.innerHeight/2;if(this.curSlideImg.translateX+t.deltaX>e||this.curSlideImg.translateX+t.deltaX<-e){if(!(this.currentScale>=1&&Math.abs(t.deltaX)<25))return this.curSlideImg.width=window.innerWidth,this.curSlideImg.translateX=0,void(this.curSlideImg.translateY=0)}else this.curSlideImg.translateX+=t.deltaX;i>0&&this.curSlideImg.translateY+t.deltaY<=i&&this.curSlideImg.translateY+t.deltaY>=-i&&(this.curSlideImg.translateY+=t.deltaY),t.cancelBubble=!0,t.preventDefault()},multipointEnd:function(){this.currentScale=this.curSlideImg.width/window.innerWidth},doubleTap:function(){this.curSlideImg.width==window.innerWidth?(new r.default(this.curSlideImg,"width",2*window.innerWidth,200,this.ease),new r.default(this.curSlideImg,"height",window.innerWidth*this.ratio*2,200,this.ease,function(){}),new r.default(this.curSlideImg,"translateX",0,200,this.ease,function(){}),this.currentScale=2):(new r.default(this.curSlideImg,"width",window.innerWidth,200,this.ease),new r.default(this.curSlideImg,"height",window.innerWidth*this.ratio,200,this.ease,function(){}),new r.default(this.curSlideImg,"translateX",0,200,this.ease,function(){}),new r.default(this.curSlideImg,"translateY",0,200,this.ease,function(){}),this.currentScale=1)},singleTap:function(t){this.multipointFlag||(t.cancelBubble=!0,t.preventDefault(),this.$emit("on-img-tap"))},click:function(t){this.multipointFlag||(this.$emit("on-img-click"),t.cancelBubble=!0,t.preventDefault())},touchStart:function(){},touchMove:function(t){},touchEnd:function(){},touchCancel:function(){},ease:function(t){return Math.sqrt(1-Math.pow(t-1,2))}}}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0});for(var i=0,n=["webkit","moz"],s=0;s<n.length&&!window.requestAnimationFrame;++s)window.requestAnimationFrame=window[n[s]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[n[s]+"CancelAnimationFrame"]||window[n[s]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-i)),s=window.setTimeout(function(){t(e+n)},n);return i=e+n,s}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)});var r=function t(e,i,n,s,r,a,o){var h=e[i],l=n-h,c=new Date,u=this,d=r||function(t){return t};this.tickID=null;var p=function t(){var r=new Date-c;return r>=s?(e[i]=n,o&&o(n),a&&a(n),cancelAnimationFrame(u.tickID),void(u.toTick=null)):(e[i]=l*d(r/s)+h,u.tickID=requestAnimationFrame(t),void(o&&o(e[i])))};p(),t.List.push(this)};r.List=[],r.stopAll=function(){for(var t=0,e=r.List.length;t<e;t++)cancelAnimationFrame(r.List[t].tickID);r.List.length=0},r.stop=function(t){cancelAnimationFrame(t.tickID)},e.default=r},function(t,e,i){function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.AlloyFingerVue=e.AlloyFinger=e.PinchSlider=void 0;var s=i(1),r=n(s),a=i(2),o=n(a),h=i(0),l=n(h);i(3),e.PinchSlider=l.default,e.AlloyFinger=r.default,e.AlloyFingerVue=o.default}])}); //# sourceMappingURL=pinchSlider.min.js.map