39.1d22cfba.js 4.8 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([[39],{439:function(e,t,i){"use strict";var o=i(435),s=function(){function e(e){this.scroll=e,this.wheelEndTimer=0,this.wheelMoveTimer=0,this.wheelStart=!1,this.init()}return e.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.registerEvent()},e.prototype.handleBScroll=function(){this.scroll.registerType(["alterOptions","mousewheelStart","mousewheelMove","mousewheelEnd"])},e.prototype.handleOptions=function(){var e=!0===this.scroll.options.mouseWheel?{}:this.scroll.options.mouseWheel;this.mouseWheelOpt=Object(o.t)({speed:20,invert:!1,easeTime:300,discreteTime:400,throttleTime:0,dampingFactor:.1},e)},e.prototype.handleHooks=function(){this.hooksFn=[],this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},e.prototype.registerEvent=function(){this.eventRegister=new o.f(this.scroll.scroller.wrapper,[{name:"wheel",handler:this.wheelHandler.bind(this)},{name:"mousewheel",handler:this.wheelHandler.bind(this)},{name:"DOMMouseScroll",handler:this.wheelHandler.bind(this)}])},e.prototype.registerHooks=function(e,t,i){e.on(t,i,this),this.hooksFn.push([e,t,i])},e.prototype.wheelHandler=function(e){if(this.scroll.enabled){this.beforeHandler(e),this.wheelStart||(this.wheelStartHandler(e),this.wheelStart=!0);var t=this.getWheelDelta(e);this.wheelMoveHandler(t),this.wheelEndDetector(t)}},e.prototype.wheelStartHandler=function(e){this.cleanCache();var t=this.scroll.scroller,i=t.scrollBehaviorX,s=t.scrollBehaviorY;i.setMovingDirection(o.b.Default),s.setMovingDirection(o.b.Default),i.setDirection(o.b.Default),s.setDirection(o.b.Default),this.scroll.trigger(this.scroll.eventTypes.alterOptions,this.mouseWheelOpt),this.scroll.trigger(this.scroll.eventTypes.mousewheelStart)},e.prototype.cleanCache=function(){this.deltaCache=[]},e.prototype.wheelMoveHandler=function(e){var t=this,i=this.mouseWheelOpt,o=i.throttleTime,s=i.dampingFactor;if(o&&this.wheelMoveTimer)this.deltaCache.push(e);else{var l=this.deltaCache.reduce((function(e,t){return{x:e.x+t.x,y:e.y+t.y}}),{x:0,y:0});this.cleanCache();var r=this.scroll.scroller,n=r.scrollBehaviorX,h=r.scrollBehaviorY;n.setMovingDirection(-e.directionX),h.setMovingDirection(-e.directionY),n.setDirection(e.x),h.setDirection(e.y);var a=n.performDampingAlgorithm(Math.round(e.x)+l.x,s),c=h.performDampingAlgorithm(Math.round(e.y)+l.x,s);if(!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:a,y:c})){var u=this.getEaseTime();a===this.scroll.x&&c===this.scroll.y||this.scroll.scrollTo(a,c,u)}o&&(this.wheelMoveTimer=window.setTimeout((function(){t.wheelMoveTimer=0}),o))}},e.prototype.wheelEndDetector=function(e){var t=this;window.clearTimeout(this.wheelEndTimer),this.wheelEndTimer=window.setTimeout((function(){t.wheelStart=!1,window.clearTimeout(t.wheelMoveTimer),t.wheelMoveTimer=0,t.scroll.trigger(t.scroll.eventTypes.mousewheelEnd,e)}),this.mouseWheelOpt.discreteTime)},e.prototype.getWheelDelta=function(e){var t=this.mouseWheelOpt,i=t.speed,s=0,l=0,r=t.invert?o.b.Negative:o.b.Positive;switch(!0){case"deltaX"in e:1===e.deltaMode?(s=-e.deltaX*i,l=-e.deltaY*i):(s=-e.deltaX,l=-e.deltaY);break;case"wheelDeltaX"in e:s=e.wheelDeltaX/120*i,l=e.wheelDeltaY/120*i;break;case"wheelDelta"in e:s=l=e.wheelDelta/120*i;break;case"detail"in e:s=l=-e.detail/3*i}return s*=r,l*=r,this.scroll.hasVerticalScroll||(Math.abs(l)>Math.abs(s)&&(s=l),l=0),this.scroll.hasHorizontalScroll||(s=0),{x:s,y:l,directionX:s>0?o.b.Negative:s<0?o.b.Positive:o.b.Default,directionY:l>0?o.b.Negative:l<0?o.b.Positive:o.b.Default}},e.prototype.beforeHandler=function(e){var t=this.scroll.options,i=t.preventDefault,s=t.stopPropagation,l=t.preventDefaultException;i&&!Object(o.L)(e.target,l)&&Object(o.H)(e),s&&e.stopPropagation()},e.prototype.getEaseTime=function(){var e=this.mouseWheelOpt.easeTime;return e<100&&Object(o.S)("easeTime should be greater than 100.If mouseWheel easeTime is too small,scrollEnd will be triggered many times."),Math.max(e,100)},e.prototype.destroy=function(){this.eventRegister.destroy(),window.clearTimeout(this.wheelEndTimer),window.clearTimeout(this.wheelMoveTimer),this.hooksFn.forEach((function(e){var t=e[0],i=e[1],o=e[2];t.off(i,o)}))},e.pluginName="mouseWheel",e.applyOrder=o.a.Pre,e}();t.a=s},523:function(e,t,i){},682:function(e,t,i){"use strict";i(523)},747:function(e,t,i){"use strict";i.r(t);var o=i(436),s=i(439);o.a.use(s.a);var l={mounted:function(){this.init()},methods:{init:function(){this.bs=new o.a(this.$refs.scroll,{scrollX:!0,scrollY:!1,mouseWheel:!0})}}},r=(i(682),i(41)),n=Object(r.a)(l,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"mouse-wheel-horizontal-scroll"},[t("div",{ref:"scroll",staticClass:"mouse-wheel-wrapper"},[t("div",{staticClass:"mouse-wheel-content"},e._l(100,(function(i){return t("div",{key:i,staticClass:"mouse-wheel-item"},[e._v(e._s(i))])})),0)])])}),[],!1,null,"3a7e7e4e",null);t.default=n.exports}}]);