(window.webpackJsonp=window.webpackJsonp||[]).push([[55],{479:function(o,t,e){"use strict";var s=[{key:"zoomTo",name:"zoomTo"}].map((function(o){return{key:o.key,sourceKey:"plugins.zoom."+o.name}})),r=e(435),i=function(){function o(o){this.scroll=o,this.scale=1,this.prevScale=1,this.init()}return o.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.tryInitialZoomTo(this.zoomOpt)},o.prototype.zoomTo=function(o,t,e,s){var r=this.resolveOrigin(t,e),i={x:r.originX,y:r.originY,baseScale:this.scale};this._doZoomTo(o,i,s,!0)},o.prototype.handleBScroll=function(){this.scroll.proxy(s),this.scroll.registerType(["beforeZoomStart","zoomStart","zooming","zoomEnd"])},o.prototype.handleOptions=function(){var o=!0===this.scroll.options.zoom?{}:this.scroll.options.zoom;this.zoomOpt=Object(r.t)({start:1,min:1,max:4,initialOrigin:[0,0],minimalZoomDistance:5,bounceTime:800},o)},o.prototype.handleHooks=function(){var o=this,t=this.scroll,e=this.scroll.scroller;this.wrapper=this.scroll.scroller.wrapper,this.setTransformOrigin(this.scroll.scroller.content);var s=e.scrollBehaviorX,i=e.scrollBehaviorY;this.hooksFn=[],this.registerHooks(t.hooks,t.hooks.eventTypes.contentChanged,(function(t){o.setTransformOrigin(t),o.scale=1,o.tryInitialZoomTo(o.zoomOpt)})),this.registerHooks(t.hooks,t.hooks.eventTypes.beforeInitialScrollTo,(function(){if(1!==o.zoomOpt.start)return!0})),this.registerHooks(s.hooks,s.hooks.eventTypes.beforeComputeBoundary,(function(){var t=Object(r.z)(o.scroll.scroller.content);s.contentSize=Math.floor(t.width*o.scale)})),this.registerHooks(i.hooks,i.hooks.eventTypes.beforeComputeBoundary,(function(){var t=Object(r.z)(o.scroll.scroller.content);i.contentSize=Math.floor(t.height*o.scale)})),this.registerHooks(e.actions.hooks,e.actions.hooks.eventTypes.start,(function(t){var e=t.touches&&t.touches.length||0;o.fingersOperation(e),2===e&&o.zoomStart(t)})),this.registerHooks(e.actions.hooks,e.actions.hooks.eventTypes.beforeMove,(function(t){var e=t.touches&&t.touches.length||0;if(o.fingersOperation(e),2===e)return o.zoom(t),!0})),this.registerHooks(e.actions.hooks,e.actions.hooks.eventTypes.beforeEnd,(function(t){if(2===o.fingersOperation())return o.zoomEnd(),!0})),this.registerHooks(e.translater.hooks,e.translater.hooks.eventTypes.beforeTranslate,(function(t,e){var s=e.scale?e.scale:o.prevScale;o.prevScale=s,t.push("scale("+s+")")})),this.registerHooks(e.hooks,e.hooks.eventTypes.scrollEnd,(function(){2===o.fingersOperation()&&o.scroll.trigger(o.scroll.eventTypes.zoomEnd,{scale:o.scale})})),this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},o.prototype.setTransformOrigin=function(o){o.style[r.P.transformOrigin]="0 0"},o.prototype.tryInitialZoomTo=function(o){var t=o.start,e=o.initialOrigin,s=this.scroll.scroller,r=s.scrollBehaviorX,i=s.scrollBehaviorY;1!==t&&(this.resetBoundaries([r,i]),this.zoomTo(t,e[0],e[1],0))},o.prototype.fingersOperation=function(o){if("number"!=typeof o)return this.numberOfFingers;this.numberOfFingers=o},o.prototype._doZoomTo=function(o,t,e,s){var i=this;void 0===e&&(e=this.zoomOpt.bounceTime),void 0===s&&(s=!1);var n=this.zoomOpt,a=n.min,c=n.max,l=this.scale,h=Object(r.m)(o,a,c);!function(){if(0!==e){if(e>0){var o,t=Object(r.y)(),s=t+e,n=function(){var a=Object(r.y)();if(a>=s)return i.scroll.trigger(i.scroll.eventTypes.zooming,{scale:h}),void Object(r.n)(o);var c=r.r.bounce.fn((a-t)/e)*(h-l)+l;i.scroll.trigger(i.scroll.eventTypes.zooming,{scale:c}),o=Object(r.O)(n)};n()}}else i.scroll.trigger(i.scroll.eventTypes.zooming,{scale:h})}(),this.fingersOperation(2),this._zoomTo(h,l,t,e,s)},o.prototype._zoomTo=function(o,t,e,s,i){void 0===i&&(i=!1);var n=o/e.baseScale;this.setScale(o);var a=this.scroll.scroller,c=a.scrollBehaviorX,l=a.scrollBehaviorY;this.resetBoundaries([c,l]);var h=this.getNewPos(e.x,n,c,!0,i),u=this.getNewPos(e.y,n,l,!0,i);c.currentPos===Math.round(h)&&l.currentPos===Math.round(u)&&o===t||a.scrollTo(h,u,s,r.r.bounce,{start:{scale:t},end:{scale:o}})},o.prototype.resolveOrigin=function(o,t){var e=this.scroll.scroller,s=e.scrollBehaviorX,r=e.scrollBehaviorY,i={left:function(){return 0},top:function(){return 0},right:function(){return s.contentSize},bottom:function(){return r.contentSize},center:function(o){return(0===o?s.contentSize:r.contentSize)/2}};return{originX:"number"==typeof o?o:i[o](0),originY:"number"==typeof t?t:i[t](1)}},o.prototype.zoomStart=function(o){var t=o.touches[0],e=o.touches[1];this.startDistance=this.getFingerDistance(o),this.startScale=this.scale;var s=Object(r.J)(this.wrapper),i=s.left,n=s.top;this.origin={x:Math.abs(t.pageX+e.pageX)/2+i-this.scroll.x,y:Math.abs(t.pageY+e.pageY)/2+n-this.scroll.y,baseScale:this.startScale},this.scroll.trigger(this.scroll.eventTypes.beforeZoomStart)},o.prototype.zoom=function(o){var t=this.getFingerDistance(o);if(this.zoomed||!(Math.abs(t-this.startDistance)s&&(o=2*s*Math.pow(.5,s/o)),o},o.prototype.setScale=function(o){this.scale=o},o.prototype.resetBoundaries=function(o){o.forEach((function(o){return o.computeBoundary()}))},o.prototype.getNewPos=function(o,t,e,s,i){void 0===i&&(i=!1);var n=o-o*t+(i?e.currentPos:e.startPos);return s&&(n=Object(r.m)(n,e.maxScrollPos,e.minScrollPos)),n>0?Math.floor(n):Math.ceil(n)},o.prototype.registerHooks=function(o,t,e){o.on(t,e,this),this.hooksFn.push([o,t,e])},o.prototype.destroy=function(){this.hooksFn.forEach((function(o){var t=o[0],e=o[1],s=o[2];t.off(e,s)})),this.hooksFn.length=0},o.pluginName="zoom",o}();t.a=i},555:function(o,t,e){},721:function(o,t,e){"use strict";e(555)},777:function(o,t,e){"use strict";e.r(t);var s=e(436),r=e(479);s.a.use(r.a);var i={name:"zoom",data:function(){return{nums:16,linkworkTransform:"scale(1)"}},mounted:function(){this.init()},methods:{init:function(){var o=this;this.zoom=new s.a(this.$refs.zoom,{freeScroll:!0,scrollX:!0,scrollY:!0,disableMouse:!0,useTransition:!0,zoom:{start:1.5,min:.5,max:3,initialOrigin:["center","center"]}}),this.zoom.on("zooming",(function(t){var e=t.scale;o.linkworkTransform="scale(".concat(e,")")})),this.zoom.on("zoomEnd",(function(o){var t=o.scale;console.log(t)}))},zoomTo:function(o){this.zoom.zoomTo(o,"center","center")}}},n=(e(721),e(41)),a=Object(n.a)(i,(function(){var o=this,t=o._self._c;return t("div",{staticClass:"zoom-default"},[t("div",{ref:"zoom",staticClass:"zoom-wrapper"},[t("div",{staticClass:"zoom-items"},o._l(o.nums,(function(e){return t("div",{key:e,staticClass:"grid-item"},[o._v(o._s(e))])})),0)]),o._v(" "),t("div",{staticClass:"btn-wrap"},[t("button",{staticClass:"zoom-half",on:{click:function(t){return o.zoomTo(.5)}}},[o._v("zoomTo:0.5")]),o._v(" "),t("button",{staticClass:"zoom-original",on:{click:function(t){return o.zoomTo(1)}}},[o._v("zoomTo:1")]),o._v(" "),t("button",{staticClass:"zoom-double",on:{click:function(t){return o.zoomTo(2)}}},[o._v("zoomTo:2")])]),o._v(" "),t("div",{staticClass:"linkwork-wrap"},[t("p",[o._v("changing with zooming action")]),o._v(" "),t("div",{staticClass:"linkwork-block",style:{transform:o.linkworkTransform}})])])}),[],!1,null,null,null);t.default=a.exports}}]);