Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/graphics

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/graphics - npm Package Compare versions

Comparing version 5.1.0 to 5.1.1

6

dist/graphics.min.js
/*!
* @pixi/graphics - v5.1.0
* Compiled Fri, 19 Jul 2019 21:54:36 UTC
* @pixi/graphics - v5.1.1
* Compiled Fri, 02 Aug 2019 23:20:23 UTC
*

@@ -8,3 +8,3 @@ * @pixi/graphics is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,i,e,r,s,h){"use strict";var n={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,_segmentsCount:function(t,i){if(void 0===i&&(i=20),!this.adaptive)return i;var e=Math.ceil(t/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}},a=function(){this.reset()};a.prototype.clone=function(){var t=new a;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},a.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=i.Texture.WHITE,this.matrix=null,this.visible=!1},a.prototype.destroy=function(){this.texture=null,this.matrix=null};var o=function(t,i,e,r){void 0===i&&(i=null),void 0===e&&(e=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=e,this.fillStyle=i,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]};o.prototype.clone=function(){return new o(this.shape,this.fillStyle,this.lineStyle,this.matrix)},o.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null};var l={build:function(t){var i,r,s=t.shape,h=t.points,n=s.x,a=s.y;if(h.length=0,t.type===e.SHAPES.CIRC?(i=s.radius,r=s.radius):(i=s.width,r=s.height),0!==i&&0!==r){var o=Math.floor(30*Math.sqrt(s.radius))||Math.floor(15*Math.sqrt(s.width+s.height));o/=2.3;for(var l=2*Math.PI/o,u=0;u<o;u++)h.push(n+Math.sin(-l*u)*i,a+Math.cos(-l*u)*r);h.push(h[0],h[1])}},triangulate:function(t,i){var e=t.points,r=i.points,s=i.indices,h=r.length/2,n=h;r.push(t.shape.x,t.shape.y);for(var a=0;a<e.length;a+=2)r.push(e[a],e[a+1]),s.push(h++,n,h)}};function u(t,i){t.lineStyle.native?function(t,i){var r=0,s=t.shape,h=t.points||s.points,n=s.type!==e.SHAPES.POLY||s.closeStroke;if(0===h.length)return;var a=i.points,o=i.indices,l=h.length/2,u=a.length/2,c=u;for(a.push(h[0],h[1]),r=1;r<l;r++)a.push(h[2*r],h[2*r+1]),o.push(c,c+1),c++;n&&o.push(c,u)}(t,i):function(t,i){var r=t.shape,s=t.points||r.points.slice();if(0===s.length)return;var h=t.lineStyle,n=new e.Point(s[0],s[1]),a=new e.Point(s[s.length-2],s[s.length-1]),o=r.type!==e.SHAPES.POLY||r.closeStroke,l=n.x===a.x&&n.y===a.y;if(o){s=s.slice(),l&&(s.pop(),s.pop(),a.set(s[s.length-2],s[s.length-1]));var u=a.x+.5*(n.x-a.x),c=a.y+.5*(n.y-a.y);s.unshift(u,c),s.push(u,c)}var p=i.points,f=s.length/2,d=s.length,y=p.length/2,v=h.width/2,g=s[0],b=s[1],S=s[2],x=s[3],w=0,_=0,m=-(b-x),P=g-S,M=0,D=0,T=0,I=0,C=Math.sqrt(m*m+P*P);m/=C,P/=C,m*=v,P*=v;var A=h.alignment,E=2*(1-A),R=2*A;p.push(g-m*E,b-P*E),p.push(g+m*R,b+P*R);for(var B=1;B<f-1;++B){g=s[2*(B-1)],b=s[2*(B-1)+1],S=s[2*B],x=s[2*B+1],w=s[2*(B+1)],_=s[2*(B+1)+1],m=-(b-x),P=g-S,C=Math.sqrt(m*m+P*P),m/=C,P/=C,m*=v,P*=v,M=-(x-_),D=S-w,C=Math.sqrt(M*M+D*D),M/=C,D/=C;var H=-P+b-(-P+x),O=-m+S-(-m+g),z=(-m+g)*(-P+x)-(-m+S)*(-P+b),L=-(D*=v)+_-(-D+x),F=-(M*=v)+S-(-M+w),q=(-M+w)*(-D+x)-(-M+S)*(-D+_),U=H*F-L*O;if(Math.abs(U)<.1)U+=10.1,p.push(S-m*E,x-P*E),p.push(S+m*R,x+P*R);else{var G=(O*q-F*z)/U,j=(L*z-H*q)/U,N=(G-S)*(G-S)+(j-x)*(j-x);N>196*v*v?(T=m-M,I=P-D,C=Math.sqrt(T*T+I*I),T/=C,I/=C,T*=v,I*=v,p.push(S-T*E,x-I*E),p.push(S+T*R,x+I*R),p.push(S-T*R*E,x-I*E),d++):(p.push(S+(G-S)*E,x+(j-x)*E),p.push(S-(G-S)*R,x-(j-x)*R))}}g=s[2*(f-2)],b=s[2*(f-2)+1],S=s[2*(f-1)],x=s[2*(f-1)+1],m=-(b-x),P=g-S,C=Math.sqrt(m*m+P*P),m/=C,P/=C,m*=v,P*=v,p.push(S-m*E,x-P*E),p.push(S+m*R,x+P*R);for(var X=i.indices,W=0;W<d-2;++W)X.push(y,y+1,y+2),y++}(t,i)}var c={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,i){var e=t.points,s=t.holes,h=i.points,n=i.indices;if(e.length>=6){for(var a=[],o=0;o<s.length;o++){var l=s[o];a.push(e.length/2),e=e.concat(l.points)}var u=r.earcut(e,a,2);if(!u)return;for(var c=h.length/2,p=0;p<u.length;p+=3)n.push(u[p]+c),n.push(u[p+1]+c),n.push(u[p+2]+c);for(var f=0;f<e.length;f++)h.push(e[f])}}},p={build:function(t){var i=t.shape,e=t.points,r=i.x,s=i.y,h=i.width,n=i.height,a=i.radius;e.length=0,d(r,s+a,r,s,r+a,s,e),d(r+h-a,s,r+h,s,r+h,s+a,e),d(r+h,s+n-a,r+h,s+n,r+h-a,s+n,e),d(r+a,s+n,r,s+n,r,s+n-a,e)},triangulate:function(t,i){for(var e=t.points,s=i.points,h=i.indices,n=s.length/2,a=r.earcut(e,null,2),o=0,l=a.length;o<l;o+=3)h.push(a[o]+n),h.push(a[o+1]+n),h.push(a[o+2]+n);for(var u=0,c=e.length;u<c;u++)s.push(e[u],e[++u])}};function f(t,i,e){return t+(i-t)*e}function d(t,i,e,r,s,h,n){void 0===n&&(n=[]);for(var a=n,o=0,l=0,u=0,c=0,p=0,d=0,y=0,v=0;y<=20;++y)o=f(t,e,v=y/20),l=f(i,r,v),u=f(e,s,v),c=f(r,h,v),p=f(o,u,v),d=f(l,c,v),a.push(p,d);return a}var y=[],v=[],g={};g[e.SHAPES.POLY]=c,g[e.SHAPES.CIRC]=l,g[e.SHAPES.ELIP]=l,g[e.SHAPES.RECT]={build:function(t){var i=t.shape,e=i.x,r=i.y,s=i.width,h=i.height,n=t.points;n.length=0,n.push(e,r,e+s,r,e+s,r+h,e,r+h)},triangulate:function(t,i){var e=t.points,r=i.points,s=r.length/2;r.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),i.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},g[e.SHAPES.RREC]=p;var b=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},S=function(t){function n(){t.call(this),this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.dirty=0,this.batchDirty=-1,this.cacheDirty=-1,this.clearDirty=0,this.drawCalls=[],this.batches=[],this.shapeIndex=0,this._bounds=new s.Bounds,this.boundsDirty=-1,this.boundsPadding=0,this.batchable=!1,this.indicesUint16=null,this.uvsFloat32=null}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var a={bounds:{configurable:!0}};return a.bounds.get=function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},n.prototype.clear=function(){if(this.graphicsData.length>0){this.boundsDirty=-1,this.dirty++,this.clearDirty++,this.batchDirty++,this.graphicsData.length=0,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].textures.length=0,v.push(this.drawCalls[t]);this.drawCalls.length=0;for(var i=0;i<this.batches.length;i++){var e=this.batches[i];e.start=0,e.attribStart=0,e.style=null,y.push(e)}this.batches.length=0}return this},n.prototype.drawShape=function(t,i,e,r){var s=new o(t,i,e,r);return this.graphicsData.push(s),this.dirty++,this},n.prototype.drawHole=function(t,i){if(!this.graphicsData.length)return null;var e=new o(t,null,null,i),r=this.graphicsData[this.graphicsData.length-1];return e.lineStyle=r.lineStyle,r.holes.push(e),this.dirty++,e},n.prototype.destroy=function(i){t.prototype.destroy.call(this,i);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},n.prototype.containsPoint=function(t){for(var i=this.graphicsData,e=0;e<i.length;++e){var r=i[e];if(r.fillStyle.visible&&(r.shape&&r.shape.contains(t.x,t.y))){if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(t.x,t.y))return!1}return!0}}return!1},n.prototype.updateBatches=function(){if(this.dirty!==this.cacheDirty)if(0!==this.graphicsData.length){if(this.dirty!==this.cacheDirty)for(var t=0;t<this.graphicsData.length;t++){var i=this.graphicsData[t];if(i.fillStyle&&!i.fillStyle.texture.baseTexture.valid)return;if(i.lineStyle&&!i.lineStyle.texture.baseTexture.valid)return}this.cacheDirty=this.dirty;var e=this.uvs,r=null,s=null,n=0,a=!1;if(this.batches.length>0){var o=(r=this.batches[this.batches.length-1]).style;s=o.texture.baseTexture,n=o.color+o.alpha,a=o.native}for(var l=this.shapeIndex;l<this.graphicsData.length;l++){this.shapeIndex++;var p=this.graphicsData[l],f=g[p.type],d=p.fillStyle,v=p.lineStyle;f.build(p),p.matrix&&this.transformPoints(p.points,p.matrix);for(var S=0;S<2;S++){var x=0===S?d:v;if(x.visible){var w=x.texture.baseTexture,_=this.indices.length,m=this.points.length/2;!r||s===w&&n===x.color+x.alpha&&a===x.native||(r.size=_-r.start,r.attribSize=m-r.attribStart,r.size>0&&(r=null)),r||(r=y.pop()||new b,this.batches.push(r),w.wrapMode=h.WRAP_MODES.REPEAT,s=w,n=x.color+x.alpha,a=x.native,r.style=x,r.start=_,r.attribStart=m);var P=this.points.length/2;if(0===S)p.holes.length?(this.processHoles(p.holes),c.triangulate(p,this)):f.triangulate(p,this);else{u(p,this);for(var M=0;M<p.holes.length;M++)u(p.holes[M],this)}var D=this.points.length/2-P;this.addUvs(this.points,e,x.texture,P,D,x.matrix)}}}var T=this.indices.length,I=this.points.length/2;if(r)if(r.size=T-r.start,r.attribSize=I-r.attribStart,this.indicesUint16=new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var C=0;C<this.batches.length;C++)for(var A=this.batches[C],E=0;E<A.size;E++){var R=A.start+E;this.indicesUint16[R]=this.indicesUint16[R]-A.attribStart}}else this.buildDrawCalls();else this.batchable=!0}else this.batchable=!0},n.prototype.isBatchable=function(){for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*n.BATCHABLE_SIZE},n.prototype.buildDrawCalls=function(){for(var t=++i.BaseTexture._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].textures.length=0,v.push(this.drawCalls[e]);this.drawCalls.length=0;var r=this.uvs,s=this.colors,n=this.textureIds,a=v.pop()||new i.BatchDrawCall;a.textureCount=0,a.start=0,a.size=0,a.type=h.DRAW_MODES.TRIANGLES;var o=0,l=null,u=0,c=!1,p=h.DRAW_MODES.TRIANGLES,f=0;this.drawCalls.push(a);for(var d=0;d<this.batches.length;d++){var y=this.batches[d],g=y.style,b=g.texture.baseTexture;c!==g.native&&(p=(c=g.native)?h.DRAW_MODES.LINES:h.DRAW_MODES.TRIANGLES,l=null,o=8,t++),l!==b&&(l=b,b._batchEnabled!==t&&(8===o&&(t++,o=0,a.size>0&&(a=v.pop()||new i.BatchDrawCall,this.drawCalls.push(a)),a.start=f,a.size=0,a.textureCount=0,a.type=p),b.touched=1,b._batchEnabled=t,b._id=o,b.wrapMode=10497,a.textures[a.textureCount++]=b,o++)),a.size+=y.size,f+=y.size,u=b._id,this.addColors(s,g.color,g.alpha,y.attribSize),this.addTextureIds(n,u,y.attribSize)}i.BaseTexture._globalBatch=t;for(var S=this.points,x=new ArrayBuffer(3*S.length*4),w=new Float32Array(x),_=new Uint32Array(x),m=0,P=0;P<S.length/2;P++)w[m++]=S[2*P],w[m++]=S[2*P+1],w[m++]=r[2*P],w[m++]=r[2*P+1],_[m++]=s[P],w[m++]=n[P];this._buffer.update(x),this._indexBuffer.update(this.indicesUint16)},n.prototype.processHoles=function(t){for(var i=0;i<t.length;i++){var e=t[i];g[e.type].build(e),e.matrix&&this.transformPoints(e.points,e.matrix)}},n.prototype.calculateBounds=function(){var t=1/0,i=-1/0,r=1/0,s=-1/0;if(this.graphicsData.length)for(var h=null,n=0,a=0,o=0,l=0,u=0;u<this.graphicsData.length;u++){var c=this.graphicsData[u],p=c.type,f=c.lineStyle?c.lineStyle.width:0;if(h=c.shape,p===e.SHAPES.RECT||p===e.SHAPES.RREC)n=h.x-f/2,a=h.y-f/2,t=n<t?n:t,i=n+(o=h.width+f)>i?n+o:i,r=a<r?a:r,s=a+(l=h.height+f)>s?a+l:s;else if(p===e.SHAPES.CIRC)n=h.x,a=h.y,t=n-(o=h.radius+f/2)<t?n-o:t,i=n+o>i?n+o:i,r=a-(l=h.radius+f/2)<r?a-l:r,s=a+l>s?a+l:s;else if(p===e.SHAPES.ELIP)n=h.x,a=h.y,t=n-(o=h.width+f/2)<t?n-o:t,i=n+o>i?n+o:i,r=a-(l=h.height+f/2)<r?a-l:r,s=a+l>s?a+l:s;else for(var d=h.points,y=0,v=0,g=0,b=0,S=0,x=0,w=0,_=0,m=0;m+2<d.length;m+=2)n=d[m],a=d[m+1],y=d[m+2],v=d[m+3],g=Math.abs(y-n),b=Math.abs(v-a),l=f,(o=Math.sqrt(g*g+b*b))<1e-9||(t=(w=(y+n)/2)-(S=(l/o*b+g)/2)<t?w-S:t,i=w+S>i?w+S:i,r=(_=(v+a)/2)-(x=(l/o*g+b)/2)<r?_-x:r,s=_+x>s?_+x:s)}else t=0,i=0,r=0,s=0;var P=this.boundsPadding;this._bounds.minX=t-P,this._bounds.maxX=i+P,this._bounds.minY=r-P,this._bounds.maxY=s+P},n.prototype.transformPoints=function(t,i){for(var e=0;e<t.length/2;e++){var r=t[2*e],s=t[2*e+1];t[2*e]=i.a*r+i.c*s+i.tx,t[2*e+1]=i.b*r+i.d*s+i.ty}},n.prototype.addColors=function(t,i,e,s){for(var h=(i>>16)+(65280&i)+((255&i)<<16),n=r.premultiplyTint(h,e);s-- >0;)t.push(n)},n.prototype.addTextureIds=function(t,i,e){for(;e-- >0;)t.push(i)},n.prototype.addUvs=function(t,i,e,r,s,h){for(var n=0,a=i.length,o=e.frame;n<s;){var l=t[2*(r+n)],u=t[2*(r+n)+1];if(h){var c=h.a*l+h.c*u+h.tx;u=h.b*l+h.d*u+h.ty,l=c}n++,i.push(l/o.width,u/o.height)}var p=e.baseTexture;(o.width<p.width||o.height<p.height)&&this.adjustUvs(i,e,a,s)},n.prototype.adjustUvs=function(t,i,e,r){for(var s=i.baseTexture,h=e+2*r,n=i.frame,a=n.width/s.width,o=n.height/s.height,l=n.x/n.width,u=n.y/n.height,c=Math.floor(t[e]+1e-6),p=Math.floor(t[e+1]+1e-6),f=e+2;f<h;f+=2)c=Math.min(c,Math.floor(t[f]+1e-6)),p=Math.min(p,Math.floor(t[f+1]+1e-6));l-=c,u-=p;for(var d=e;d<h;d+=2)t[d]=(t[d]+l)*a,t[d+1]=(t[d+1]+u)*o},Object.defineProperties(n.prototype,a),n}(i.BatchGeometry);S.BATCHABLE_SIZE=100;var x=function(t){function i(){t.apply(this,arguments)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.clone=function(){var t=new i;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t},i.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.width=0,this.alignment=.5,this.native=!1},i}(a),w=function(){};w.curveLength=function(t,i,e,r,s,h,n,a){for(var o=0,l=0,u=0,c=0,p=0,f=0,d=0,y=0,v=0,g=0,b=0,S=t,x=i,w=1;w<=10;++w)g=S-(y=(d=(f=(p=1-(l=w/10))*p)*p)*t+3*f*l*e+3*p*(u=l*l)*s+(c=u*l)*n),b=x-(v=d*i+3*f*l*r+3*p*u*h+c*a),S=y,x=v,o+=Math.sqrt(g*g+b*b);return o},w.curveTo=function(t,i,e,r,s,h,a){var o=a[a.length-2],l=a[a.length-1];a.length-=2;var u=n._segmentsCount(w.curveLength(o,l,t,i,e,r,s,h)),c=0,p=0,f=0,d=0,y=0;a.push(o,l);for(var v=1,g=0;v<=u;++v)f=(p=(c=1-(g=v/u))*c)*c,y=(d=g*g)*g,a.push(f*o+3*p*g*t+3*c*d*e+y*s,f*l+3*p*g*i+3*c*d*r+y*h)};var _=function(){};_.curveLength=function(t,i,e,r,s,h){var n=t-2*e+s,a=i-2*r+h,o=2*e-2*t,l=2*r-2*i,u=4*(n*n+a*a),c=4*(n*o+a*l),p=o*o+l*l,f=2*Math.sqrt(u+c+p),d=Math.sqrt(u),y=2*u*d,v=2*Math.sqrt(p),g=c/d;return(y*f+d*c*(f-v)+(4*p*u-c*c)*Math.log((2*d+g+f)/(g+v)))/(4*y)},_.curveTo=function(t,i,e,r,s){for(var h=s[s.length-2],a=s[s.length-1],o=n._segmentsCount(_.curveLength(h,a,t,i,e,r)),l=0,u=0,c=1;c<=o;++c){var p=c/o;l=h+(t-h)*p,u=a+(i-a)*p,s.push(l+(t+(e-t)*p-l)*p,u+(i+(r-i)*p-u)*p)}};var m=function(){};m.curveTo=function(t,i,e,r,s,h){var n=h[h.length-2],a=h[h.length-1]-i,o=n-t,l=r-i,u=e-t,c=Math.abs(a*u-o*l);if(c<1e-8||0===s)return h[h.length-2]===t&&h[h.length-1]===i||h.push(t,i),null;var p=a*a+o*o,f=l*l+u*u,d=a*l+o*u,y=s*Math.sqrt(p)/c,v=s*Math.sqrt(f)/c,g=y*d/p,b=v*d/f,S=y*u+v*o,x=y*l+v*a,w=o*(v+g),_=a*(v+g),m=u*(y+b),P=l*(y+b);return{cx:S+t,cy:x+i,radius:s,startAngle:Math.atan2(_-x,w-S),endAngle:Math.atan2(P-x,m-S),anticlockwise:o*l>u*a}},m.arc=function(t,i,r,s,h,a,o,l,u){for(var c=o-a,p=n._segmentsCount(Math.abs(c)*h,40*Math.ceil(Math.abs(c)/e.PI_2)),f=c/(2*p),d=2*f,y=Math.cos(f),v=Math.sin(f),g=p-1,b=g%1/g,S=0;S<=g;++S){var x=f+a+d*(S+b*S),w=Math.cos(x),_=-Math.sin(x);u.push((y*w+v*_)*h+r,(y*-_+v*w)*h+s)}};var P=function(t){function i(i,r,s,h,n,a){n=n||h/2;for(var o=-1*Math.PI/2+a,l=2*s,u=e.PI_2/l,c=[],p=0;p<l;p++){var f=p%2?n:h,d=p*u+o;c.push(i+f*Math.cos(d),r+f*Math.sin(d))}t.call(this,c)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i}(e.Polygon),M=new Float32Array(3),D=null,T=function(t){function s(e){void 0===e&&(e=null),t.call(this),this.geometry=e||new S,this.geometry.refCount++,this.shader=null,this.state=i.State.for2d(),this._fillStyle=new a,this._lineStyle=new x,this._matrix=null,this._holeMode=!1,this.currentPath=null,this.batches=[],this.batchTint=-1,this.vertexData=null,this._transformID=-1,this.batchDirty=-1,this.pluginName="batch",this.tint=16777215,this.blendMode=h.BLEND_MODES.NORMAL}t&&(s.__proto__=t),s.prototype=Object.create(t&&t.prototype),s.prototype.constructor=s;var n={blendMode:{configurable:!0},tint:{configurable:!0},fill:{configurable:!0},line:{configurable:!0}};return s.prototype.clone=function(){return this.finishPoly(),new s(this.geometry)},n.blendMode.set=function(t){this.state.blendMode=t},n.blendMode.get=function(){return this.state.blendMode},n.tint.get=function(){return this._tint},n.tint.set=function(t){this._tint=t},n.fill.get=function(){return this._fillStyle},n.line.get=function(){return this._lineStyle},s.prototype.lineStyle=function(t,e,r,s,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=1),void 0===s&&(s=.5),void 0===h&&(h=!1),this.lineTextureStyle(t,i.Texture.WHITE,e,r,null,s,h),this},s.prototype.lineTextureStyle=function(t,e,r,s,h,n,a){void 0===t&&(t=0),void 0===e&&(e=i.Texture.WHITE),void 0===r&&(r=16777215),void 0===s&&(s=1),void 0===h&&(h=null),void 0===n&&(n=.5),void 0===a&&(a=!1),this.currentPath&&this.startPoly();var o=t>0&&s>0;return o?(h&&(h=h.clone()).invert(),Object.assign(this._lineStyle,{color:r,width:t,alpha:s,matrix:h,texture:e,alignment:n,native:a,visible:o})):this._lineStyle.reset(),this},s.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,i=this.currentPath.points.length;i>2&&(this.drawShape(this.currentPath),this.currentPath=new e.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[i-2],t[i-1]))}else this.currentPath=new e.Polygon,this.currentPath.closeStroke=!1},s.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},s.prototype.moveTo=function(t,i){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=i,this},s.prototype.lineTo=function(t,i){this.currentPath||this.moveTo(0,0);var e=this.currentPath.points,r=e[e.length-2],s=e[e.length-1];return r===t&&s===i||e.push(t,i),this},s.prototype._initCurve=function(t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,i]):this.moveTo(t,i)},s.prototype.quadraticCurveTo=function(t,i,e,r){this._initCurve();var s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),_.curveTo(t,i,e,r,s),this},s.prototype.bezierCurveTo=function(t,i,e,r,s,h){return this._initCurve(),w.curveTo(t,i,e,r,s,h,this.currentPath.points),this},s.prototype.arcTo=function(t,i,e,r,s){this._initCurve(t,i);var h=this.currentPath.points,n=m.curveTo(t,i,e,r,s,h);if(n){var a=n.cx,o=n.cy,l=n.radius,u=n.startAngle,c=n.endAngle,p=n.anticlockwise;this.arc(a,o,l,u,c,p)}return this},s.prototype.arc=function(t,i,r,s,h,n){if(void 0===n&&(n=!1),s===h)return this;if(!n&&h<=s?h+=e.PI_2:n&&s<=h&&(s+=e.PI_2),0===h-s)return this;var a=t+Math.cos(s)*r,o=i+Math.sin(s)*r,l=this.currentPath?this.currentPath.points:null;if(l){var u=Math.abs(l[l.length-2]-a),c=Math.abs(l[l.length-1]-o);u<.001&&c<.001||l.push(a,o)}else this.moveTo(a,o),l=this.currentPath.points;return m.arc(a,o,t,i,r,s,h,n,l),this},s.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill(i.Texture.WHITE,t,e)},s.prototype.beginTextureFill=function(t,e,r,s){void 0===t&&(t=i.Texture.WHITE),void 0===e&&(e=16777215),void 0===r&&(r=1),void 0===s&&(s=null),this.currentPath&&this.startPoly();var h=r>0;return h?(s&&(s=s.clone()).invert(),Object.assign(this._fillStyle,{color:e,alpha:r,texture:t,matrix:s,visible:h})):this._fillStyle.reset(),this},s.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},s.prototype.drawRect=function(t,i,r,s){return this.drawShape(new e.Rectangle(t,i,r,s))},s.prototype.drawRoundedRect=function(t,i,r,s,h){return this.drawShape(new e.RoundedRectangle(t,i,r,s,h))},s.prototype.drawCircle=function(t,i,r){return this.drawShape(new e.Circle(t,i,r))},s.prototype.drawEllipse=function(t,i,r,s){return this.drawShape(new e.Ellipse(t,i,r,s))},s.prototype.drawPolygon=function(t){var i=arguments,r=t,s=!0;if(r.points&&(s=r.closeStroke,r=r.points),!Array.isArray(r)){r=new Array(arguments.length);for(var h=0;h<r.length;++h)r[h]=i[h]}var n=new e.Polygon(r);return n.closeStroke=s,this.drawShape(n),this},s.prototype.drawShape=function(t){return this._holeMode?this.geometry.drawHole(t,this._matrix):this.geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},s.prototype.drawStar=function(t,i,e,r,s,h){return void 0===h&&(h=0),this.drawPolygon(new P(t,i,e,r,s,h))},s.prototype.clear=function(){return this.geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._matrix=null,this._holeMode=!1,this.currentPath=null,this},s.prototype.isFastRect=function(){return!1},s.prototype._render=function(t){this.finishPoly();var s=this.geometry;if(s.updateBatches(),s.batchable){if(this.batchDirty!==s.batchDirty){this.batches=[],this.batchTint=-1,this._transformID=-1,this.batchDirty=s.batchDirty,this.vertexData=new Float32Array(s.points);for(var h=this.blendMode,n=0;n<s.batches.length;n++){var a=s.batches[n],o=a.style.color,l=new Float32Array(this.vertexData.buffer,4*a.attribStart*2,2*a.attribSize),u=new Float32Array(s.uvsFloat32.buffer,4*a.attribStart*2,2*a.attribSize),c={vertexData:l,blendMode:h,indices:new Uint16Array(s.indicesUint16.buffer,2*a.start,a.size),uvs:u,_batchRGB:r.hex2rgb(o),_tintRGB:o,_texture:a.style.texture,alpha:a.style.alpha,worldAlpha:1};this.batches[n]=c}}if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var p=0;p<this.batches.length;p++){var f=this.batches[p];f.worldAlpha=this.worldAlpha*f.alpha,t.plugins[this.pluginName].render(f)}}}else{if(t.batch.flush(),!this.shader){if(!D){for(var d=new Int32Array(16),y=0;y<16;y++)d[y]=y;var v={tint:new Float32Array([1,1,1,1]),translationMatrix:new e.Matrix,default:i.UniformGroup.from({uSamplers:d},!0)},g=t.plugins.batch._shader.program;D=new i.Shader(g,v)}this.shader=D}var b=this.shader.uniforms;b.translationMatrix=this.transform.worldTransform;var S=this.tint,x=this.worldAlpha;b.tint[0]=(S>>16&255)/255*x,b.tint[1]=(S>>8&255)/255*x,b.tint[2]=(255&S)/255*x,b.tint[3]=x,t.shader.bind(this.shader),t.geometry.bind(s,this.shader),t.state.set(this.state);for(var w=0;w<s.drawCalls.length;w++){for(var _=s.drawCalls[w],m=_.textureCount,P=0;P<m;P++)t.texture.bind(_.textures[P],P);t.geometry.draw(_.type,_.size,_.start)}}},s.prototype._calculateBounds=function(){this.finishPoly();var t=this.geometry.bounds;this._bounds.addFrame(this.transform,t.minX,t.minY,t.maxX,t.maxY)},s.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,s._TEMP_POINT),this.geometry.containsPoint(s._TEMP_POINT)},s.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=r.hex2rgb(this.tint,M),i=0;i<this.batches.length;i++){var e=this.batches[i],s=e._batchRGB,h=(t[0]*s[0]*255<<16)+(t[1]*s[1]*255<<8)+(0|t[2]*s[2]*255);e._tintRGB=(h>>16)+(65280&h)+((255&h)<<16)}}},s.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID;for(var t=this.transform.worldTransform,i=t.a,e=t.b,r=t.c,s=t.d,h=t.tx,n=t.ty,a=this.geometry.points,o=this.vertexData,l=0,u=0;u<a.length;u+=2){var c=a[u],p=a[u+1];o[l++]=i*c+r*p+h,o[l++]=s*p+e*c+n}}},s.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},s.prototype.setMatrix=function(t){return this._matrix=t,this},s.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},s.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},s.prototype.destroy=function(i){t.prototype.destroy.call(this,i),this.geometry.refCount--,0===this.geometry.refCount&&this.geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this.geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,i)},Object.defineProperties(s.prototype,n),s}(s.Container);return T._TEMP_POINT=new e.Point,t.FillStyle=a,t.GRAPHICS_CURVES=n,t.Graphics=T,t.GraphicsData=o,t.GraphicsGeometry=S,t.LineStyle=x,t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_graphics);
this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,i,e,r,s,h){"use strict";var n={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,_segmentsCount:function(t,i){if(void 0===i&&(i=20),!this.adaptive)return i;var e=Math.ceil(t/this.maxLength);return e<this.minSegments?e=this.minSegments:e>this.maxSegments&&(e=this.maxSegments),e}},a=function(){this.reset()};a.prototype.clone=function(){var t=new a;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t},a.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=i.Texture.WHITE,this.matrix=null,this.visible=!1},a.prototype.destroy=function(){this.texture=null,this.matrix=null};var o=function(t,i,e,r){void 0===i&&(i=null),void 0===e&&(e=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=e,this.fillStyle=i,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]};o.prototype.clone=function(){return new o(this.shape,this.fillStyle,this.lineStyle,this.matrix)},o.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null};var l={build:function(t){var i,r,s=t.shape,h=t.points,n=s.x,a=s.y;if(h.length=0,t.type===e.SHAPES.CIRC?(i=s.radius,r=s.radius):(i=s.width,r=s.height),0!==i&&0!==r){var o=Math.floor(30*Math.sqrt(s.radius))||Math.floor(15*Math.sqrt(s.width+s.height));o/=2.3;for(var l=2*Math.PI/o,u=0;u<o;u++)h.push(n+Math.sin(-l*u)*i,a+Math.cos(-l*u)*r);h.push(h[0],h[1])}},triangulate:function(t,i){var e=t.points,r=i.points,s=i.indices,h=r.length/2,n=h;r.push(t.shape.x,t.shape.y);for(var a=0;a<e.length;a+=2)r.push(e[a],e[a+1]),s.push(h++,n,h)}};function u(t,i){t.lineStyle.native?function(t,i){var r=0,s=t.shape,h=t.points||s.points,n=s.type!==e.SHAPES.POLY||s.closeStroke;if(0===h.length)return;var a=i.points,o=i.indices,l=h.length/2,u=a.length/2,c=u;for(a.push(h[0],h[1]),r=1;r<l;r++)a.push(h[2*r],h[2*r+1]),o.push(c,c+1),c++;n&&o.push(c,u)}(t,i):function(t,i){var r=t.shape,s=t.points||r.points.slice(),h=i.closePointEps;if(0===s.length)return;var n=t.lineStyle,a=new e.Point(s[0],s[1]),o=new e.Point(s[s.length-2],s[s.length-1]),l=r.type!==e.SHAPES.POLY||r.closeStroke,u=Math.abs(a.x-o.x)<h&&Math.abs(a.y-o.y)<h;if(l){s=s.slice(),u&&(s.pop(),s.pop(),o.set(s[s.length-2],s[s.length-1]));var c=o.x+.5*(a.x-o.x),p=o.y+.5*(a.y-o.y);s.unshift(c,p),s.push(c,p)}var d=i.points,f=s.length/2,y=s.length,v=d.length/2,g=n.width/2,b=s[0],x=s[1],S=s[2],w=s[3],m=0,P=0,_=-(x-w),M=b-S,D=0,T=0,I=0,C=0,E=Math.sqrt(_*_+M*M);_/=E,M/=E,_*=g,M*=g;var A=n.alignment,R=2*(1-A),B=2*A;d.push(b-_*R,x-M*R),d.push(b+_*B,x+M*B);for(var H=1;H<f-1;++H){b=s[2*(H-1)],x=s[2*(H-1)+1],S=s[2*H],w=s[2*H+1],m=s[2*(H+1)],P=s[2*(H+1)+1],_=-(x-w),M=b-S,E=Math.sqrt(_*_+M*M),_/=E,M/=E,_*=g,M*=g,D=-(w-P),T=S-m,E=Math.sqrt(D*D+T*T),D/=E,T/=E;var O=-M+x-(-M+w),z=-_+S-(-_+b),L=(-_+b)*(-M+w)-(-_+S)*(-M+x),F=-(T*=g)+P-(-T+w),q=-(D*=g)+S-(-D+m),U=(-D+m)*(-T+w)-(-D+S)*(-T+P),G=O*q-F*z;if(Math.abs(G)<.1)G+=10.1,d.push(S-_*R,w-M*R),d.push(S+_*B,w+M*B);else{var j=(z*U-q*L)/G,N=(F*L-O*U)/G,X=(j-S)*(j-S)+(N-w)*(N-w);X>196*g*g?(I=_-D,C=M-T,E=Math.sqrt(I*I+C*C),I/=E,C/=E,I*=g,C*=g,d.push(S-I*R,w-C*R),d.push(S+I*B,w+C*B),d.push(S-I*B*R,w-C*R),y++):(d.push(S+(j-S)*R,w+(N-w)*R),d.push(S-(j-S)*B,w-(N-w)*B))}}b=s[2*(f-2)],x=s[2*(f-2)+1],S=s[2*(f-1)],w=s[2*(f-1)+1],_=-(x-w),M=b-S,E=Math.sqrt(_*_+M*M),_/=E,M/=E,_*=g,M*=g,d.push(S-_*R,w-M*R),d.push(S+_*B,w+M*B);for(var W=i.indices,k=0;k<y-2;++k)W.push(v,v+1,v+2),v++}(t,i)}var c={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,i){var e=t.points,s=t.holes,h=i.points,n=i.indices;if(e.length>=6){for(var a=[],o=0;o<s.length;o++){var l=s[o];a.push(e.length/2),e=e.concat(l.points)}var u=r.earcut(e,a,2);if(!u)return;for(var c=h.length/2,p=0;p<u.length;p+=3)n.push(u[p]+c),n.push(u[p+1]+c),n.push(u[p+2]+c);for(var d=0;d<e.length;d++)h.push(e[d])}}},p={build:function(t){var i=t.shape,e=t.points,r=i.x,s=i.y,h=i.width,n=i.height,a=i.radius;e.length=0,f(r,s+a,r,s,r+a,s,e),f(r+h-a,s,r+h,s,r+h,s+a,e),f(r+h,s+n-a,r+h,s+n,r+h-a,s+n,e),f(r+a,s+n,r,s+n,r,s+n-a,e)},triangulate:function(t,i){for(var e=t.points,s=i.points,h=i.indices,n=s.length/2,a=r.earcut(e,null,2),o=0,l=a.length;o<l;o+=3)h.push(a[o]+n),h.push(a[o+1]+n),h.push(a[o+2]+n);for(var u=0,c=e.length;u<c;u++)s.push(e[u],e[++u])}};function d(t,i,e){return t+(i-t)*e}function f(t,i,e,r,s,h,n){void 0===n&&(n=[]);for(var a=n,o=0,l=0,u=0,c=0,p=0,f=0,y=0,v=0;y<=20;++y)o=d(t,e,v=y/20),l=d(i,r,v),u=d(e,s,v),c=d(r,h,v),p=d(o,u,v),f=d(l,c,v),a.push(p,f);return a}var y=[],v=[],g=new e.Point,b={};b[e.SHAPES.POLY]=c,b[e.SHAPES.CIRC]=l,b[e.SHAPES.ELIP]=l,b[e.SHAPES.RECT]={build:function(t){var i=t.shape,e=i.x,r=i.y,s=i.width,h=i.height,n=t.points;n.length=0,n.push(e,r,e+s,r,e+s,r+h,e,r+h)},triangulate:function(t,i){var e=t.points,r=i.points,s=r.length/2;r.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),i.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},b[e.SHAPES.RREC]=p;var x=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},S=function(t){function n(){t.call(this),this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.dirty=0,this.batchDirty=-1,this.cacheDirty=-1,this.clearDirty=0,this.drawCalls=[],this.batches=[],this.shapeIndex=0,this._bounds=new s.Bounds,this.boundsDirty=-1,this.boundsPadding=0,this.batchable=!1,this.indicesUint16=null,this.uvsFloat32=null,this.closePointEps=1e-4}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var a={bounds:{configurable:!0}};return a.bounds.get=function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},n.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t<this.drawCalls.length;t++)this.drawCalls[t].textures.length=0,v.push(this.drawCalls[t]);this.drawCalls.length=0;for(var i=0;i<this.batches.length;i++){var e=this.batches[i];e.start=0,e.attribStart=0,e.style=null,y.push(e)}this.batches.length=0},n.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},n.prototype.drawShape=function(t,i,e,r){var s=new o(t,i,e,r);return this.graphicsData.push(s),this.dirty++,this},n.prototype.drawHole=function(t,i){if(!this.graphicsData.length)return null;var e=new o(t,null,null,i),r=this.graphicsData[this.graphicsData.length-1];return e.lineStyle=r.lineStyle,r.holes.push(e),this.dirty++,this},n.prototype.destroy=function(i){t.prototype.destroy.call(this,i);for(var e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},n.prototype.containsPoint=function(t){for(var i=this.graphicsData,e=0;e<i.length;++e){var r=i[e];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,g):g.copyFrom(t),r.shape.contains(g.x,g.y)))){if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(g.x,g.y))return!1}return!0}}return!1},n.prototype.updateBatches=function(){if(this.dirty!==this.cacheDirty)if(0!==this.graphicsData.length){if(this.dirty!==this.cacheDirty)for(var t=0;t<this.graphicsData.length;t++){var i=this.graphicsData[t];if(i.fillStyle&&!i.fillStyle.texture.baseTexture.valid)return;if(i.lineStyle&&!i.lineStyle.texture.baseTexture.valid)return}this.cacheDirty=this.dirty;var e=this.uvs,r=null,s=null,n=0,a=!1;if(this.batches.length>0){var o=(r=this.batches[this.batches.length-1]).style;s=o.texture.baseTexture,n=o.color+o.alpha,a=!!o.native}for(var l=this.shapeIndex;l<this.graphicsData.length;l++){this.shapeIndex++;var p=this.graphicsData[l],d=b[p.type],f=p.fillStyle,v=p.lineStyle;d.build(p),p.matrix&&this.transformPoints(p.points,p.matrix);for(var g=0;g<2;g++){var S=0===g?f:v;if(S.visible){var w=S.texture.baseTexture,m=this.indices.length,P=this.points.length/2;!r||s===w&&n===S.color+S.alpha&&a===!!S.native||(r.size=m-r.start,r.attribSize=P-r.attribStart,r.size>0&&(r=null)),r||(r=y.pop()||new x,this.batches.push(r),w.wrapMode=h.WRAP_MODES.REPEAT,s=w,n=S.color+S.alpha,a=S.native,r.style=S,r.start=m,r.attribStart=P);var _=this.points.length/2;if(0===g)p.holes.length?(this.processHoles(p.holes),c.triangulate(p,this)):d.triangulate(p,this);else{u(p,this);for(var M=0;M<p.holes.length;M++)u(p.holes[M],this)}var D=this.points.length/2-_;this.addUvs(this.points,e,S.texture,_,D,S.matrix)}}}var T=this.indices.length,I=this.points.length/2;if(r)if(r.size=T-r.start,r.attribSize=I-r.attribStart,this.indicesUint16=new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var C=0;C<this.batches.length;C++)for(var E=this.batches[C],A=0;A<E.size;A++){var R=E.start+A;this.indicesUint16[R]=this.indicesUint16[R]-E.attribStart}}else this.buildDrawCalls();else this.batchable=!0}else this.batchable=!0},n.prototype.isBatchable=function(){for(var t=this.batches,i=0;i<t.length;i++)if(t[i].style.native)return!1;return this.points.length<2*n.BATCHABLE_SIZE},n.prototype.buildDrawCalls=function(){for(var t=++i.BaseTexture._globalBatch,e=0;e<this.drawCalls.length;e++)this.drawCalls[e].textures.length=0,v.push(this.drawCalls[e]);this.drawCalls.length=0;var r=this.uvs,s=this.colors,n=this.textureIds,a=v.pop()||new i.BatchDrawCall;a.textureCount=0,a.start=0,a.size=0,a.type=h.DRAW_MODES.TRIANGLES;var o=0,l=null,u=0,c=!1,p=h.DRAW_MODES.TRIANGLES,d=0;this.drawCalls.push(a);for(var f=0;f<this.batches.length;f++){var y=this.batches[f],g=y.style,b=g.texture.baseTexture;c!==!!g.native&&(p=(c=g.native)?h.DRAW_MODES.LINES:h.DRAW_MODES.TRIANGLES,l=null,o=8,t++),l!==b&&(l=b,b._batchEnabled!==t&&(8===o&&(t++,o=0,a.size>0&&(a=v.pop()||new i.BatchDrawCall,this.drawCalls.push(a)),a.start=d,a.size=0,a.textureCount=0,a.type=p),b.touched=1,b._batchEnabled=t,b._id=o,b.wrapMode=10497,a.textures[a.textureCount++]=b,o++)),a.size+=y.size,d+=y.size,u=b._id,this.addColors(s,g.color,g.alpha,y.attribSize),this.addTextureIds(n,u,y.attribSize)}i.BaseTexture._globalBatch=t;for(var x=this.points,S=new ArrayBuffer(3*x.length*4),w=new Float32Array(S),m=new Uint32Array(S),P=0,_=0;_<x.length/2;_++)w[P++]=x[2*_],w[P++]=x[2*_+1],w[P++]=r[2*_],w[P++]=r[2*_+1],m[P++]=s[_],w[P++]=n[_];this._buffer.update(S),this._indexBuffer.update(this.indicesUint16)},n.prototype.processHoles=function(t){for(var i=0;i<t.length;i++){var e=t[i];b[e.type].build(e),e.matrix&&this.transformPoints(e.points,e.matrix)}},n.prototype.calculateBounds=function(){var t=1/0,i=-1/0,r=1/0,s=-1/0;if(this.graphicsData.length)for(var h=null,n=0,a=0,o=0,l=0,u=0;u<this.graphicsData.length;u++){var c=this.graphicsData[u],p=c.type,d=c.lineStyle?c.lineStyle.width:0;if(h=c.shape,p===e.SHAPES.RECT||p===e.SHAPES.RREC)n=h.x-d/2,a=h.y-d/2,t=n<t?n:t,i=n+(o=h.width+d)>i?n+o:i,r=a<r?a:r,s=a+(l=h.height+d)>s?a+l:s;else if(p===e.SHAPES.CIRC)n=h.x,a=h.y,t=n-(o=h.radius+d/2)<t?n-o:t,i=n+o>i?n+o:i,r=a-(l=h.radius+d/2)<r?a-l:r,s=a+l>s?a+l:s;else if(p===e.SHAPES.ELIP)n=h.x,a=h.y,t=n-(o=h.width+d/2)<t?n-o:t,i=n+o>i?n+o:i,r=a-(l=h.height+d/2)<r?a-l:r,s=a+l>s?a+l:s;else for(var f=h.points,y=0,v=0,g=0,b=0,x=0,S=0,w=0,m=0,P=0;P+2<f.length;P+=2)n=f[P],a=f[P+1],y=f[P+2],v=f[P+3],g=Math.abs(y-n),b=Math.abs(v-a),l=d,(o=Math.sqrt(g*g+b*b))<1e-9||(t=(w=(y+n)/2)-(x=(l/o*b+g)/2)<t?w-x:t,i=w+x>i?w+x:i,r=(m=(v+a)/2)-(S=(l/o*g+b)/2)<r?m-S:r,s=m+S>s?m+S:s)}else t=0,i=0,r=0,s=0;var _=this.boundsPadding;this._bounds.minX=t-_,this._bounds.maxX=i+_,this._bounds.minY=r-_,this._bounds.maxY=s+_},n.prototype.transformPoints=function(t,i){for(var e=0;e<t.length/2;e++){var r=t[2*e],s=t[2*e+1];t[2*e]=i.a*r+i.c*s+i.tx,t[2*e+1]=i.b*r+i.d*s+i.ty}},n.prototype.addColors=function(t,i,e,s){for(var h=(i>>16)+(65280&i)+((255&i)<<16),n=r.premultiplyTint(h,e);s-- >0;)t.push(n)},n.prototype.addTextureIds=function(t,i,e){for(;e-- >0;)t.push(i)},n.prototype.addUvs=function(t,i,e,r,s,h){for(var n=0,a=i.length,o=e.frame;n<s;){var l=t[2*(r+n)],u=t[2*(r+n)+1];if(h){var c=h.a*l+h.c*u+h.tx;u=h.b*l+h.d*u+h.ty,l=c}n++,i.push(l/o.width,u/o.height)}var p=e.baseTexture;(o.width<p.width||o.height<p.height)&&this.adjustUvs(i,e,a,s)},n.prototype.adjustUvs=function(t,i,e,r){for(var s=i.baseTexture,h=e+2*r,n=i.frame,a=n.width/s.width,o=n.height/s.height,l=n.x/n.width,u=n.y/n.height,c=Math.floor(t[e]+1e-6),p=Math.floor(t[e+1]+1e-6),d=e+2;d<h;d+=2)c=Math.min(c,Math.floor(t[d]+1e-6)),p=Math.min(p,Math.floor(t[d+1]+1e-6));l-=c,u-=p;for(var f=e;f<h;f+=2)t[f]=(t[f]+l)*a,t[f+1]=(t[f+1]+u)*o},Object.defineProperties(n.prototype,a),n}(i.BatchGeometry);S.BATCHABLE_SIZE=100;var w=function(t){function i(){t.apply(this,arguments)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.clone=function(){var t=new i;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t},i.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.width=0,this.alignment=.5,this.native=!1},i}(a),m=function(){};m.curveLength=function(t,i,e,r,s,h,n,a){for(var o=0,l=0,u=0,c=0,p=0,d=0,f=0,y=0,v=0,g=0,b=0,x=t,S=i,w=1;w<=10;++w)g=x-(y=(f=(d=(p=1-(l=w/10))*p)*p)*t+3*d*l*e+3*p*(u=l*l)*s+(c=u*l)*n),b=S-(v=f*i+3*d*l*r+3*p*u*h+c*a),x=y,S=v,o+=Math.sqrt(g*g+b*b);return o},m.curveTo=function(t,i,e,r,s,h,a){var o=a[a.length-2],l=a[a.length-1];a.length-=2;var u=n._segmentsCount(m.curveLength(o,l,t,i,e,r,s,h)),c=0,p=0,d=0,f=0,y=0;a.push(o,l);for(var v=1,g=0;v<=u;++v)d=(p=(c=1-(g=v/u))*c)*c,y=(f=g*g)*g,a.push(d*o+3*p*g*t+3*c*f*e+y*s,d*l+3*p*g*i+3*c*f*r+y*h)};var P=function(){};P.curveLength=function(t,i,e,r,s,h){var n=t-2*e+s,a=i-2*r+h,o=2*e-2*t,l=2*r-2*i,u=4*(n*n+a*a),c=4*(n*o+a*l),p=o*o+l*l,d=2*Math.sqrt(u+c+p),f=Math.sqrt(u),y=2*u*f,v=2*Math.sqrt(p),g=c/f;return(y*d+f*c*(d-v)+(4*p*u-c*c)*Math.log((2*f+g+d)/(g+v)))/(4*y)},P.curveTo=function(t,i,e,r,s){for(var h=s[s.length-2],a=s[s.length-1],o=n._segmentsCount(P.curveLength(h,a,t,i,e,r)),l=0,u=0,c=1;c<=o;++c){var p=c/o;l=h+(t-h)*p,u=a+(i-a)*p,s.push(l+(t+(e-t)*p-l)*p,u+(i+(r-i)*p-u)*p)}};var _=function(){};_.curveTo=function(t,i,e,r,s,h){var n=h[h.length-2],a=h[h.length-1]-i,o=n-t,l=r-i,u=e-t,c=Math.abs(a*u-o*l);if(c<1e-8||0===s)return h[h.length-2]===t&&h[h.length-1]===i||h.push(t,i),null;var p=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=s*Math.sqrt(p)/c,v=s*Math.sqrt(d)/c,g=y*f/p,b=v*f/d,x=y*u+v*o,S=y*l+v*a,w=o*(v+g),m=a*(v+g),P=u*(y+b),_=l*(y+b);return{cx:x+t,cy:S+i,radius:s,startAngle:Math.atan2(m-S,w-x),endAngle:Math.atan2(_-S,P-x),anticlockwise:o*l>u*a}},_.arc=function(t,i,r,s,h,a,o,l,u){for(var c=o-a,p=n._segmentsCount(Math.abs(c)*h,40*Math.ceil(Math.abs(c)/e.PI_2)),d=c/(2*p),f=2*d,y=Math.cos(d),v=Math.sin(d),g=p-1,b=g%1/g,x=0;x<=g;++x){var S=d+a+f*(x+b*x),w=Math.cos(S),m=-Math.sin(S);u.push((y*w+v*m)*h+r,(y*-m+v*w)*h+s)}};var M=function(t){function i(i,r,s,h,n,a){n=n||h/2;for(var o=-1*Math.PI/2+a,l=2*s,u=e.PI_2/l,c=[],p=0;p<l;p++){var d=p%2?n:h,f=p*u+o;c.push(i+d*Math.cos(f),r+d*Math.sin(f))}t.call(this,c)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i}(e.Polygon),D=new Float32Array(3),T=null,I=function(t){function s(e){void 0===e&&(e=null),t.call(this),this.geometry=e||new S,this.geometry.refCount++,this.shader=null,this.state=i.State.for2d(),this._fillStyle=new a,this._lineStyle=new w,this._matrix=null,this._holeMode=!1,this.currentPath=null,this.batches=[],this.batchTint=-1,this.vertexData=null,this._transformID=-1,this.batchDirty=-1,this.pluginName="batch",this.tint=16777215,this.blendMode=h.BLEND_MODES.NORMAL}t&&(s.__proto__=t),s.prototype=Object.create(t&&t.prototype),s.prototype.constructor=s;var n={blendMode:{configurable:!0},tint:{configurable:!0},fill:{configurable:!0},line:{configurable:!0}};return s.prototype.clone=function(){return this.finishPoly(),new s(this.geometry)},n.blendMode.set=function(t){this.state.blendMode=t},n.blendMode.get=function(){return this.state.blendMode},n.tint.get=function(){return this._tint},n.tint.set=function(t){this._tint=t},n.fill.get=function(){return this._fillStyle},n.line.get=function(){return this._lineStyle},s.prototype.lineStyle=function(t,e,r,s,h){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=1),void 0===s&&(s=.5),void 0===h&&(h=!1),this.lineTextureStyle(t,i.Texture.WHITE,e,r,null,s,h),this},s.prototype.lineTextureStyle=function(t,e,r,s,h,n,a){void 0===t&&(t=0),void 0===e&&(e=i.Texture.WHITE),void 0===r&&(r=16777215),void 0===s&&(s=1),void 0===h&&(h=null),void 0===n&&(n=.5),void 0===a&&(a=!1),this.currentPath&&this.startPoly();var o=t>0&&s>0;return o?(h&&(h=h.clone()).invert(),Object.assign(this._lineStyle,{color:r,width:t,alpha:s,matrix:h,texture:e,alignment:n,native:a,visible:o})):this._lineStyle.reset(),this},s.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,i=this.currentPath.points.length;i>2&&(this.drawShape(this.currentPath),this.currentPath=new e.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[i-2],t[i-1]))}else this.currentPath=new e.Polygon,this.currentPath.closeStroke=!1},s.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},s.prototype.moveTo=function(t,i){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=i,this},s.prototype.lineTo=function(t,i){this.currentPath||this.moveTo(0,0);var e=this.currentPath.points,r=e[e.length-2],s=e[e.length-1];return r===t&&s===i||e.push(t,i),this},s.prototype._initCurve=function(t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,i]):this.moveTo(t,i)},s.prototype.quadraticCurveTo=function(t,i,e,r){this._initCurve();var s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),P.curveTo(t,i,e,r,s),this},s.prototype.bezierCurveTo=function(t,i,e,r,s,h){return this._initCurve(),m.curveTo(t,i,e,r,s,h,this.currentPath.points),this},s.prototype.arcTo=function(t,i,e,r,s){this._initCurve(t,i);var h=this.currentPath.points,n=_.curveTo(t,i,e,r,s,h);if(n){var a=n.cx,o=n.cy,l=n.radius,u=n.startAngle,c=n.endAngle,p=n.anticlockwise;this.arc(a,o,l,u,c,p)}return this},s.prototype.arc=function(t,i,r,s,h,n){if(void 0===n&&(n=!1),s===h)return this;if(!n&&h<=s?h+=e.PI_2:n&&s<=h&&(s+=e.PI_2),0===h-s)return this;var a=t+Math.cos(s)*r,o=i+Math.sin(s)*r,l=this.geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var c=Math.abs(u[u.length-2]-a),p=Math.abs(u[u.length-1]-o);c<l&&p<l||u.push(a,o)}else this.moveTo(a,o),u=this.currentPath.points;return _.arc(a,o,t,i,r,s,h,n,u),this},s.prototype.beginFill=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=1),this.beginTextureFill(i.Texture.WHITE,t,e)},s.prototype.beginTextureFill=function(t,e,r,s){void 0===t&&(t=i.Texture.WHITE),void 0===e&&(e=16777215),void 0===r&&(r=1),void 0===s&&(s=null),this.currentPath&&this.startPoly();var h=r>0;return h?(s&&(s=s.clone()).invert(),Object.assign(this._fillStyle,{color:e,alpha:r,texture:t,matrix:s,visible:h})):this._fillStyle.reset(),this},s.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},s.prototype.drawRect=function(t,i,r,s){return this.drawShape(new e.Rectangle(t,i,r,s))},s.prototype.drawRoundedRect=function(t,i,r,s,h){return this.drawShape(new e.RoundedRectangle(t,i,r,s,h))},s.prototype.drawCircle=function(t,i,r){return this.drawShape(new e.Circle(t,i,r))},s.prototype.drawEllipse=function(t,i,r,s){return this.drawShape(new e.Ellipse(t,i,r,s))},s.prototype.drawPolygon=function(t){var i=arguments,r=t,s=!0;if(r.points&&(s=r.closeStroke,r=r.points),!Array.isArray(r)){r=new Array(arguments.length);for(var h=0;h<r.length;++h)r[h]=i[h]}var n=new e.Polygon(r);return n.closeStroke=s,this.drawShape(n),this},s.prototype.drawShape=function(t){return this._holeMode?this.geometry.drawHole(t,this._matrix):this.geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},s.prototype.drawStar=function(t,i,e,r,s,h){return void 0===h&&(h=0),this.drawPolygon(new M(t,i,e,r,s,h))},s.prototype.clear=function(){return this.geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._matrix=null,this._holeMode=!1,this.currentPath=null,this},s.prototype.isFastRect=function(){return!1},s.prototype._render=function(t){this.finishPoly();var s=this.geometry;if(s.updateBatches(),s.batchable){if(this.batchDirty!==s.batchDirty){this.batches=[],this.batchTint=-1,this._transformID=-1,this.batchDirty=s.batchDirty,this.vertexData=new Float32Array(s.points);for(var h=this.blendMode,n=0;n<s.batches.length;n++){var a=s.batches[n],o=a.style.color,l=new Float32Array(this.vertexData.buffer,4*a.attribStart*2,2*a.attribSize),u=new Float32Array(s.uvsFloat32.buffer,4*a.attribStart*2,2*a.attribSize),c={vertexData:l,blendMode:h,indices:new Uint16Array(s.indicesUint16.buffer,2*a.start,a.size),uvs:u,_batchRGB:r.hex2rgb(o),_tintRGB:o,_texture:a.style.texture,alpha:a.style.alpha,worldAlpha:1};this.batches[n]=c}}if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var p=0;p<this.batches.length;p++){var d=this.batches[p];d.worldAlpha=this.worldAlpha*d.alpha,t.plugins[this.pluginName].render(d)}}}else{if(t.batch.flush(),!this.shader){if(!T){for(var f=new Int32Array(16),y=0;y<16;y++)f[y]=y;var v={tint:new Float32Array([1,1,1,1]),translationMatrix:new e.Matrix,default:i.UniformGroup.from({uSamplers:f},!0)},g=t.plugins.batch._shader.program;T=new i.Shader(g,v)}this.shader=T}var b=this.shader.uniforms;b.translationMatrix=this.transform.worldTransform;var x=this.tint,S=this.worldAlpha;b.tint[0]=(x>>16&255)/255*S,b.tint[1]=(x>>8&255)/255*S,b.tint[2]=(255&x)/255*S,b.tint[3]=S,t.shader.bind(this.shader),t.geometry.bind(s,this.shader),t.state.set(this.state);for(var w=0;w<s.drawCalls.length;w++){for(var m=s.drawCalls[w],P=m.textureCount,_=0;_<P;_++)t.texture.bind(m.textures[_],_);t.geometry.draw(m.type,m.size,m.start)}}},s.prototype._calculateBounds=function(){this.finishPoly();var t=this.geometry.bounds;this._bounds.addFrame(this.transform,t.minX,t.minY,t.maxX,t.maxY)},s.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,s._TEMP_POINT),this.geometry.containsPoint(s._TEMP_POINT)},s.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=r.hex2rgb(this.tint,D),i=0;i<this.batches.length;i++){var e=this.batches[i],s=e._batchRGB,h=(t[0]*s[0]*255<<16)+(t[1]*s[1]*255<<8)+(0|t[2]*s[2]*255);e._tintRGB=(h>>16)+(65280&h)+((255&h)<<16)}}},s.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID;for(var t=this.transform.worldTransform,i=t.a,e=t.b,r=t.c,s=t.d,h=t.tx,n=t.ty,a=this.geometry.points,o=this.vertexData,l=0,u=0;u<a.length;u+=2){var c=a[u],p=a[u+1];o[l++]=i*c+r*p+h,o[l++]=s*p+e*c+n}}},s.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},s.prototype.setMatrix=function(t){return this._matrix=t,this},s.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},s.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},s.prototype.destroy=function(i){t.prototype.destroy.call(this,i),this.geometry.refCount--,0===this.geometry.refCount&&this.geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this.geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,t.prototype.destroy.call(this,i)},Object.defineProperties(s.prototype,n),s}(s.Container);return I._TEMP_POINT=new e.Point,t.FillStyle=a,t.GRAPHICS_CURVES=n,t.Graphics=I,t.GraphicsData=o,t.GraphicsGeometry=S,t.LineStyle=w,t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_graphics);
//# sourceMappingURL=graphics.min.js.map
{
"name": "@pixi/graphics",
"version": "5.1.0",
"version": "5.1.1",
"main": "lib/graphics.js",

@@ -28,9 +28,9 @@ "module": "lib/graphics.es.js",

"@pixi/constants": "^5.1.0",
"@pixi/core": "^5.1.0",
"@pixi/display": "^5.1.0",
"@pixi/core": "^5.1.1",
"@pixi/display": "^5.1.1",
"@pixi/math": "^5.1.0",
"@pixi/sprite": "^5.1.0",
"@pixi/utils": "^5.1.0"
"@pixi/sprite": "^5.1.1",
"@pixi/utils": "^5.1.1"
},
"gitHead": "05c5e0e0beba56e886c74f201bf7efe576612570"
"gitHead": "40e1e4a12518ee067c6871dcdd930602346197de"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc