Files
game-cards-poker-design/frontend/node_modules/fabric/dist-extensions/fabric-extensions.min.js

2 lines
21 KiB
JavaScript
Raw Normal View History

(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`fabric`),require(`westures`)):typeof define==`function`&&define.amd?define([`exports`,`fabric`,`westures`],t):t((e=typeof globalThis<`u`?globalThis:e||self).fabricExtensions={},e.fabric,e.westures)})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r,i,a,o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;function f(e,t){return Math.abs(e-t)}function p(e,t,n){let r=1/0,i=[];for(let a of t){let t=f(e[n],a[n]);r>t&&(i=[],r=t),r==t&&i.push(a)}return{dis:r,arr:i}}function m(e){let{target:t,isScale:n,isUniform:r,corner:i,point:a,diagonalPoint:o,list:s,isCenter:c}=e,{dis:l,arr:u}=p(a,s,`x`);if(l>this.margin/this.canvas.getZoom())return[];let d=u[u.length-1].x-a.x;d*=i.includes(`l`)?-1:1;let{width:f,height:m,scaleX:h,scaleY:g}=t,_=h*f+(t.strokeUniform?0:t.strokeWidth),v=(d+_)/_;if(v==0)return[];if(n?(t.set(`scaleX`,h*v),r&&t.set(`scaleY`,g*v)):(t.set(`width`,f*v),r&&t.set(`height`,m*v)),c)t.setRelativeXY(o,`center`,`center`);else{let e=this.contraryOriginMap;t.setRelativeXY(o,...e[i])}return t.setCoords(),u.map(e=>({origin:a,target:e}))}function h(e){let{target:t,isScale:n,isUniform:r,corner:i,point:a,diagonalPoint:o,list:s,isCenter:c}=e,{dis:l,arr:u}=p(a,s,`y`);if(l>this.margin/this.canvas.getZoom())return[];let d=u[u.length-1].y-a.y;d*=i.includes(`t`)?-1:1;let{width:f,height:m,scaleX:h,scaleY:g}=t,_=g*m+(t.strokeUniform?0:t.strokeWidth),v=(d+_)/_;if(v==0)return[];if(n?(t.set(`scaleY`,g*v),r&&t.set(`scaleX`,h*v)):(t.set(`height`,m*v),r&&t.set(`width`,f*v)),c)t.setRelativeXY(o,`center`,`center`);else{let e=this.contraryOriginMap;t.setRelativeXY(o,...e[i])}return t.setCoords(),u.map(e=>({origin:a,target:e}))}function g(e,t){let n=this.canvas.getTopContext(),r=this.canvas.viewportTransform,i=this.canvas.getZoom();n.save(),n.transform(...r),n.lineWidth=this.width/i,this.lineDash&&n.setLineDash(this.lineDash),n.strokeStyle=this.color,n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(t.x,t.y),n.stroke(),this.lineDash&&n.setLineDash([]),this.drawX(e,-1),this.drawX(t,1),n.restore()}function _(e,t){let n=this.canvas.getTopContext(),r=this.canvas.getZoom(),i=this.xSize/r;n.save(),n.translate(e.x,e.y),n.beginPath(),n.moveTo(-i,-i),n.lineTo(i,i),n.moveTo(i,-i),n.lineTo(-i,i),n.stroke(),n.restore()}function v(e){let t=this.canvas.getTopContext(),n=this.canvas.viewportTransform,r=this.canvas.getZoom();t.save(),t.transform(...n),t.lineWidth=this.width/r,t.strokeStyle=this.color;for(let t of e)this.drawX(t,0);t.restore()}function y(){let e=[];if(!this.closeVLine)for(let t of this.verticalLines)e.push(JSON.parse(t));if(!this.closeHLine)for(let t of this.horizontalLines)e.push(JSON.parse(t));let t=e.map(e=>e.target);v.call(this,t)}function b(){if(!this.closeVLine)for(let e of this.verticalLines){let{origin:n,target:r}=JSON.parse(e),i=new t.Point(r.x,n.y);this.drawLine(i,r)}}function x(){if(!this.closeHLine)for(let e of this.horizontalLines){let{origin:n,target:r}=JSON.parse(e),i=new t.Point(n.x,r.y);this.drawLine(i,r)}}function S(e,t){let n=e.getCoords();n.push(e.getCenterPoint());let r={target:e,list:n,points:t,margin:this.margin/this.canvas.getZoom()};return{vLines:w({...r,type:`x`}),hLines:w({...r,type:`y`})}}a=(r=n)==null?{}:o(u(r)),n=((e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i,a=l(t),o=0,u=a.length;o<u;o++)i=a[o],d.call(e,i)||i===n||s(e,i,{get:(e=>t[e]).bind(null,i),enumerable:!(r=c(t,i))||r.enumerable});return e})(!i&&r&&r.__esModule?a:s(a,`default`,{value:r,enumerable:!0}),r);let C=[[`left`,`top`],[`right`,`top`],[`right`,`bottom`],[`left`,`bottom`],[`center`,`center`]];function w(e){let{target:t,list:n,points:r,margin:i,type:a}=e,o=[],s=[],c=1/0;for(let e of n){let t=p(e,r,a);s.push(t),c>t.dis&&(c=t.dis)}if(c>i)return o;let l=!1;for(let e=0;e<n.length;e++){if(s[e].dis!=c)continue;for(let t of s[e].arr)o.push({origin:n[e],target:t});if(l)continue;l=!0;let r=s[e].arr[0][a]-n[e][a];n.forEach(e=>{e[a]+=
//# sourceMappingURL=fabric-extensions.min.js.map