seepur/resources/scripts/applications/home/components/flipbook/flipbook.min.js

30 lines
24 KiB
JavaScript
Raw Normal View History

2020-04-14 15:06:09 +00:00
/*!
* @license
* flipbook-vue v0.8.1
* Copyright © 2020 Takeshi Sone.
* Released under the MIT License.
*/
!function(){"use strict";
/*! @license Rematrix v0.4.1
Copyright 2019 Julian Lloyd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/function t(t){if(t.constructor!==Array)throw new TypeError("Expected array.");if(16===t.length)return t;if(6===t.length){var e=i();return e[0]=t[0],e[1]=t[1],e[4]=t[2],e[5]=t[3],e[12]=t[4],e[13]=t[5],e}throw new RangeError("Expected array with either 6 or 16 values.")}function i(){for(var t=[],i=0;i<16;i++)i%5==0?t.push(1):t.push(0);return t}var e,n,r,s,o=function(){function e(t){t?t.m?this.m=[].concat(t.m):this.m=[].concat(t):this.m=i()}return e.prototype.clone=function(){return new e(this)},e.prototype.multiply=function(i){return this.m=function(i,e){for(var n=t(i),r=t(e),s=[],o=0;o<4;o++)for(var a=[n[o],n[o+4],n[o+8],n[o+12]],h=0;h<4;h++){var l=4*h,u=[r[l],r[l+1],r[l+2],r[l+3]],c=a[0]*u[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3];s[o+l]=c}return s}(this.m,i)},e.prototype.perspective=function(t){return this.multiply((e=t,(n=i())[11]=-1/e,n));var e,n},e.prototype.transformX=function(t){return(t*this.m[0]+this.m[12])/(t*this.m[3]+this.m[15])},e.prototype.translate=function(t,e){return this.multiply((n=t,r=e,(s=i())[12]=n,r&&(s[13]=r),s));var n,r,s},e.prototype.translate3d=function(t,e,n){return this.multiply((r=t,s=e,o=n,a=i(),void 0!==r&&void 0!==s&&void 0!==o&&(a[12]=r,a[13]=s,a[14]=o),a));var r,s,o,a},e.prototype.rotateY=function(t){return this.multiply((e=t,n=Math.PI/180*e,(r=i())[0]=r[10]=Math.cos(n),r[2]=r[8]=Math.sin(n),r[2]*=-1,r));var e,n,r},e.prototype.toString=function(){return"matrix3d("+t(this.m).join(", ")+")"},e}();n=function(t){return Math.pow(t,2)},s=function(t){return 1-n(1-t)},r=function(t){return t<.5?n(2*t)/2:.5+s(2*(t-.5))/2},e=/Trident/.test(navigator.userAgent);var a={props:{enabled:{type:Boolean,required:!0},pages:{type:Array,required:!0},pagesHiRes:{type:Array,default:function(){return[]}},flipDuration:{type:Number,default:1e3},zoomDuration:{type:Number,default:500},zooms:{type:Array,default:function(){return[1,2,4]}},perspective:{type:Number,default:2400},nPolygons:{type:Number,default:10},ambient:{type:Number,default:.4},gloss:{type:Number,default:.6},swipeMin:{type:Number,default:3},singlePage:{type:Boolean,default:!1},forwardDirection:{validator:function(t){return"right"===t||"left"===t},default:"right"},centering:{type:Boolean,default:!0},startPage:{type:Number,default:null}},data:function(){return{viewWidth:0,viewHeight:0,imageWidth:null,imageHeight:null,displayedPages:1,nImageLoad:0,nImageLoadTrigger:0,imageLoadCallback:null,currentPage:0,firstPage:0,secondPage:1,zoomIndex:0,zoom:1,zooming:!1,touchStartX:null,touchStartY:null,maxMove:0,activeCursor:null,hasTouchEvents:!1,hasPointerEvents:!1,minX:Infinity,maxX:-Infinity,preloadedImages:{},flip:{progress:0,direction:null,frontImage:null,backImage:null,auto:!1,opacity:1},currentCenterOffset:null,animatingCenter:!1,startScrollLeft:0,startScrollTop:0,scrollLeft:0,scrollTop:0}},computed:{canFlipLeft:function(){return"left"===this.forwardDirection?this.canGoForward:this.canGoBack},canFlipRight:function(){return"right"===this.forwardDirection?this.canGoForward:this.canGoBack},canZoomIn:function(){return!this.zooming&&this.zoomIndex<this.zooms_.length-1},canZoomOut:function(){return!this.zooming&&this.zoomIndex>0},numPages:function(){return null===this.pages[0]?this.pages.length-1:this.pages.length},page:function(){return null!==this.pages[0]?this.currentPage+1:Math.max(1,this.currentPage)},zooms_:function(){return this.zooms||[1]},canGoForward:function(){return!this.flip.direction&&this.currentPage<this.pages.length-this.displayedPages},canGoBack:function(){return!this.flip.direction&&this.currentPage>=this.displayedPages&&!(1===this.displayedPages&&!this.pageUrl(this.firstPage-1))},leftPage:function(){return"right"===this.forwardDirection||1===this.displayedPages?this.firstPage:this.secondPage},rightPage:function(){return"left"===this.forwardDirection?this.firstPage:this.secondPage},showLeftPage:function(){return this.pageUrl(this.leftPage)},showRightPage:function(){return this.pageUrl(this.rightPage)&&2===this.displayedPages},cursor:function(){return this.activeCursor?this.activeCursor:e?"auto":this.canZoomIn?"zoom-in":this.canZoomOut?"zoom-out":"gra