@pixi/graphics
Advanced tools
Comparing version 5.2.4 to 5.3.0
/*! | ||
* @pixi/graphics - v5.2.4 | ||
* Compiled Sun, 03 May 2020 22:38:52 UTC | ||
* @pixi/graphics - v5.3.0 | ||
* Compiled Thu, 18 Jun 2020 23:27:40 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/graphics is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,e,i,r,s,n){"use strict";var h={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},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=e.Texture.WHITE,this.matrix=null,this.visible=!1},a.prototype.destroy=function(){this.texture=null,this.matrix=null};var o={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,s=t.holes,n=e.points,h=e.indices;if(i.length>=6){for(var a=[],o=0;o<s.length;o++){var l=s[o];a.push(i.length/2),i=i.concat(l.points)}var u=r.earcut(i,a,2);if(!u)return;for(var c=n.length/2,p=0;p<u.length;p+=3)h.push(u[p]+c),h.push(u[p+1]+c),h.push(u[p+2]+c);for(var d=0;d<i.length;d++)n.push(i[d])}}},l={build:function(t){var e,r,s=t.shape,n=t.points,h=s.x,a=s.y;if(n.length=0,t.type===i.SHAPES.CIRC?(e=s.radius,r=s.radius):(e=s.width,r=s.height),0!==e&&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-.5;u++)n.push(h+Math.sin(-l*u)*e,a+Math.cos(-l*u)*r);n.push(n[0],n[1])}},triangulate:function(t,e){var i=t.points,r=e.points,s=e.indices,n=r.length/2,h=n,a=t.shape,o=t.matrix,l=a.x,u=a.y;r.push(t.matrix?o.a*l+o.c*u+o.tx:l,t.matrix?o.b*l+o.d*u+o.ty:u);for(var c=0;c<i.length;c+=2)r.push(i[c],i[c+1]),s.push(n++,h,n)}},u={build:function(t){var e=t.shape,i=e.x,r=e.y,s=e.width,n=e.height,h=t.points;h.length=0,h.push(i,r,i+s,r,i+s,r+n,i,r+n)},triangulate:function(t,e){var i=t.points,r=e.points,s=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},c={build:function(t){var e=t.shape,i=t.points,r=e.x,s=e.y,n=e.width,h=e.height,a=Math.max(0,Math.min(e.radius,Math.min(n,h)/2));i.length=0,a?(d(r,s+a,r,s,r+a,s,i),d(r+n-a,s,r+n,s,r+n,s+a,i),d(r+n,s+h-a,r+n,s+h,r+n-a,s+h,i),d(r+a,s+h,r,s+h,r,s+h-a,i)):i.push(r,s,r+n,s,r+n,s+h,r,s+h)},triangulate:function(t,e){for(var i=t.points,s=e.points,n=e.indices,h=s.length/2,a=r.earcut(i,null,2),o=0,l=a.length;o<l;o+=3)n.push(a[o]+h),n.push(a[o+1]+h),n.push(a[o+2]+h);for(var u=0,c=i.length;u<c;u++)s.push(i[u],i[++u])}};function p(t,e,i){return t+(e-t)*i}function d(t,e,i,r,s,n,h){void 0===h&&(h=[]);for(var a=h,o=0,l=0,u=0,c=0,d=0,f=0,y=0,g=0;y<=20;++y)o=p(t,i,g=y/20),l=p(e,r,g),u=p(i,s,g),c=p(r,n,g),d=p(o,u,g),f=p(l,c,g),a.push(d,f);return a}function f(t,e){t.lineStyle.native?function(t,e){var r=0,s=t.shape,n=t.points||s.points,h=s.type!==i.SHAPES.POLY||s.closeStroke;if(0===n.length)return;var a=e.points,o=e.indices,l=n.length/2,u=a.length/2,c=u;for(a.push(n[0],n[1]),r=1;r<l;r++)a.push(n[2*r],n[2*r+1]),o.push(c,c+1),c++;h&&o.push(c,u)}(t,e):function(t,e){var r=t.shape,s=t.points||r.points.slice(),n=e.closePointEps;if(0===s.length)return;var h=t.lineStyle,a=new i.Point(s[0],s[1]),o=new i.Point(s[s.length-2],s[s.length-1]),l=r.type!==i.SHAPES.POLY||r.closeStroke,u=Math.abs(a.x-o.x)<n&&Math.abs(a.y-o.y)<n;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=e.points,f=s.length/2,y=s.length,g=d.length/2,v=h.width/2,b=s[0],x=s[1],m=s[2],S=s[3],P=0,_=0,w=-(x-S),M=b-m,D=0,T=0,I=0,A=0,C=Math.sqrt(w*w+M*M);w/=C,M/=C,w*=v,M*=v;var E=h.alignment,B=2*(1-E),R=2*E;d.push(b-w*B,x-M*B),d.push(b+w*R,x+M*R);for(var O=1;O<f-1;++O){b=s[2*(O-1)],x=s[2*(O-1)+1],m=s[2*O],S=s[2*O+1],P=s[2*(O+1)],_=s[2*(O+1)+1],w=-(x-S),M=b-m,C=Math.sqrt(w*w+M*M),w/=C,M/=C,w*=v,M*=v,D=-(S-_),T=m-P,C=Math.sqrt(D*D+T*T),D/=C,T/=C;var L=-M+x-(-M+S),H=-w+m-(-w+b),F=(-w+b)*(-M+S)-(-w+m)*(-M+x),z=-(T*=v)+_-(-T+S),U=-(D*=v)+m-(-D+P),j=(-D+P)*(-T+S)-(-D+m)*(-T+_),N=L*U-z*H;if(Math.abs(N)<.1)N+=10.1,d.push(m-w*B,S-M*B),d.push(m+w*R,S+M*R);else{var k=(H*j-U*F)/N,G=(z*F-L*j)/N,q=(k-m)*(k-m)+(G-S)*(G-S);q>196*v*v?(I=w-D,A=M-T,C=Math.sqrt(I*I+A*A),I/=C,A/=C,I*=v,A*=v,d.push(m-I*B,S-A*B),d.push(m+I*R,S+A*R),d.push(m-I*R*B,S-A*B),y++):(d.push(m+(k-m)*B,S+(G-S)*B),d.push(m-(k-m)*R,S-(G-S)*R))}}b=s[2*(f-2)],x=s[2*(f-2)+1],m=s[2*(f-1)],S=s[2*(f-1)+1],w=-(x-S),M=b-m,C=Math.sqrt(w*w+M*M),w/=C,M/=C,w*=v,M*=v,d.push(m-w*B,S-M*B),d.push(m+w*R,S+M*R);for(var W=e.indices,X=0;X<y-2;++X)W.push(g,g+1,g+2),g++}(t,e)}var y=function(t){function e(e,r,s,n,h,a){h=h||n/2;for(var o=-1*Math.PI/2+a,l=2*s,u=i.PI_2/l,c=[],p=0;p<l;p++){var d=p%2?h:n,f=p*u+o;c.push(e+d*Math.cos(f),r+d*Math.sin(f))}t.call(this,c)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(i.Polygon),g=function(){};g.curveTo=function(t,e,i,r,s,n){var h=n[n.length-2],a=n[n.length-1]-e,o=h-t,l=r-e,u=i-t,c=Math.abs(a*u-o*l);if(c<1e-8||0===s)return n[n.length-2]===t&&n[n.length-1]===e||n.push(t,e),null;var p=a*a+o*o,d=l*l+u*u,f=a*l+o*u,y=s*Math.sqrt(p)/c,g=s*Math.sqrt(d)/c,v=y*f/p,b=g*f/d,x=y*u+g*o,m=y*l+g*a,S=o*(g+v),P=a*(g+v),_=u*(y+b),w=l*(y+b);return{cx:x+t,cy:m+e,radius:s,startAngle:Math.atan2(P-m,S-x),endAngle:Math.atan2(w-m,_-x),anticlockwise:o*l>u*a}},g.arc=function(t,e,r,s,n,a,o,l,u){for(var c=o-a,p=h._segmentsCount(Math.abs(c)*n,40*Math.ceil(Math.abs(c)/i.PI_2)),d=c/(2*p),f=2*d,y=Math.cos(d),g=Math.sin(d),v=p-1,b=v%1/v,x=0;x<=v;++x){var m=d+a+f*(x+b*x),S=Math.cos(m),P=-Math.sin(m);u.push((y*S+g*P)*n+r,(y*-P+g*S)*n+s)}};var v=function(){};v.curveLength=function(t,e,i,r,s,n,h,a){for(var o=0,l=0,u=0,c=0,p=0,d=0,f=0,y=0,g=0,v=0,b=0,x=t,m=e,S=1;S<=10;++S)v=x-(y=(f=(d=(p=1-(l=S/10))*p)*p)*t+3*d*l*i+3*p*(u=l*l)*s+(c=u*l)*h),b=m-(g=f*e+3*d*l*r+3*p*u*n+c*a),x=y,m=g,o+=Math.sqrt(v*v+b*b);return o},v.curveTo=function(t,e,i,r,s,n,a){var o=a[a.length-2],l=a[a.length-1];a.length-=2;var u=h._segmentsCount(v.curveLength(o,l,t,e,i,r,s,n)),c=0,p=0,d=0,f=0,y=0;a.push(o,l);for(var g=1,b=0;g<=u;++g)d=(p=(c=1-(b=g/u))*c)*c,y=(f=b*b)*b,a.push(d*o+3*p*b*t+3*c*f*i+y*s,d*l+3*p*b*e+3*c*f*r+y*n)};var b=function(){};b.curveLength=function(t,e,i,r,s,n){var h=t-2*i+s,a=e-2*r+n,o=2*i-2*t,l=2*r-2*e,u=4*(h*h+a*a),c=4*(h*o+a*l),p=o*o+l*l,d=2*Math.sqrt(u+c+p),f=Math.sqrt(u),y=2*u*f,g=2*Math.sqrt(p),v=c/f;return(y*d+f*c*(d-g)+(4*p*u-c*c)*Math.log((2*f+v+d)/(v+g)))/(4*y)},b.curveTo=function(t,e,i,r,s){for(var n=s[s.length-2],a=s[s.length-1],o=h._segmentsCount(b.curveLength(n,a,t,e,i,r)),l=0,u=0,c=1;c<=o;++c){var p=c/o;l=n+(t-n)*p,u=a+(e-a)*p,s.push(l+(t+(i-t)*p-l)*p,u+(e+(r-e)*p-u)*p)}};var x=function(){this.reset()};x.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},x.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},x.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0};var m={};m[i.SHAPES.POLY]=o,m[i.SHAPES.CIRC]=l,m[i.SHAPES.ELIP]=l,m[i.SHAPES.RECT]=u,m[i.SHAPES.RREC]=c;var S=[],P=[],_={buildPoly:o,buildCircle:l,buildRectangle:u,buildRoundedRectangle:c,FILL_COMMANDS:m,BATCH_POOL:S,DRAW_CALL_POOL:P,buildLine:f,buildComplexPoly:function(t,e){var i=t.points.slice();if(!(i.length<6)){var s=e.indices;e.points=i,e.alpha=t.fillAlpha,e.color=r.hex2rgb(t.fillColor);for(var n=1/0,h=-1/0,a=1/0,o=-1/0,l=0,u=0,c=0;c<i.length;c+=2)n=(l=i[c])<n?l:n,h=l>h?l:h,a=(u=i[c+1])<a?u:a,o=u>o?u:o;i.push(n,a,h,a,h,o,n,o);for(var p=i.length/2,d=0;d<p;d++)s.push(d)}},bezierCurveTo:function(t,e,i,r,s,n,h,a,o,l){void 0===l&&(l=[]);var u=0,c=0,p=0,d=0,f=0;l.push(t,e);for(var y=1,g=0;y<=o;++y)p=(c=(u=1-(g=y/o))*u)*u,f=(d=g*g)*g,l.push(p*t+3*c*g*i+3*u*d*s+f*h,p*e+3*c*g*r+3*u*d*n+f*a);return l},Star:y,ArcUtils:g,BezierUtils:v,QuadraticUtils:b,BatchPart:x},w=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]};w.prototype.clone=function(){return new w(this.shape,this.fillStyle,this.lineStyle,this.matrix)},w.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 M=new i.Point,D=new n.Bounds,T=function(t){function h(){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 n.Bounds,this.boundsDirty=-1,this.boundsPadding=0,this.batchable=!1,this.indicesUint16=null,this.uvsFloat32=null,this.closePointEps=1e-4}t&&(h.__proto__=t),h.prototype=Object.create(t&&t.prototype),h.prototype.constructor=h;var a={bounds:{configurable:!0}};return a.bounds.get=function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},h.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,P.push(this.drawCalls[t]);this.drawCalls.length=0;for(var e=0;e<this.batches.length;e++){var i=this.batches[e];i.reset(),S.push(i)}this.batches.length=0},h.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},h.prototype.drawShape=function(t,e,i,r){var s=new w(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this},h.prototype.drawHole=function(t,e){if(!this.graphicsData.length)return null;var i=new w(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},h.prototype.destroy=function(e){t.prototype.destroy.call(this,e);for(var i=0;i<this.graphicsData.length;++i)this.graphicsData[i].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},h.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,M):M.copyFrom(t),r.shape.contains(M.x,M.y)))){var s=!1;if(r.holes)for(var n=0;n<r.holes.length;n++){if(r.holes[n].shape.contains(M.x,M.y)){s=!0;break}}if(!s)return!0}}return!1},h.prototype.updateBatches=function(){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var t=this.uvs,e=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(var n=this.shapeIndex;n<e.length;n++){this.shapeIndex++;var h=e[n],a=h.fillStyle,o=h.lineStyle;m[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix);for(var l=0;l<2;l++){var u=0===l?a:o;if(u.visible){var c=u.texture.baseTexture,p=this.indices.length,d=this.points.length/2;c.wrapMode=s.WRAP_MODES.REPEAT,0===l?this.processFill(h):this.processLine(h);var f=this.points.length/2-d;0!==f&&(i&&!this._compareStyles(r,u)&&(i.end(p,d),i=null),i||((i=S.pop()||new x).begin(u,p,d),this.batches.push(i),r=u),this.addUvs(this.points,t,u.texture,d,f,u.matrix))}}}if(i){var y=this.indices.length,g=this.points.length/2;i.end(y,g)}0!==this.batches.length?(this.indicesUint16=new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()):this.batchable=!0}}else this.batchable=!0},h.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},h.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,s=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(s&&!s.texture.baseTexture.valid)return!1}return!0},h.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],s=0;s<r.size;s++){var n=r.start+s;this.indicesUint16[n]=this.indicesUint16[n]-r.attribStart}},h.prototype.isBatchable=function(){for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*h.BATCHABLE_SIZE},h.prototype.buildDrawCalls=function(){for(var t=++e.BaseTexture._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].textures.length=0,P.push(this.drawCalls[i]);this.drawCalls.length=0;var r=this.colors,n=this.textureIds,h=P.pop();h||((h=new e.BatchDrawCall).textures=new e.BatchTextureArray),h.textures.count=0,h.start=0,h.size=0,h.type=s.DRAW_MODES.TRIANGLES;var a=0,o=null,l=0,u=!1,c=s.DRAW_MODES.TRIANGLES,p=0;this.drawCalls.push(h);for(var d=0;d<this.batches.length;d++){var f=this.batches[d],y=f.style,g=y.texture.baseTexture;u!==!!y.native&&(c=(u=!!y.native)?s.DRAW_MODES.LINES:s.DRAW_MODES.TRIANGLES,o=null,a=8,t++),o!==g&&(o=g,g._batchEnabled!==t&&(8===a&&(t++,a=0,h.size>0&&((h=P.pop())||((h=new e.BatchDrawCall).textures=new e.BatchTextureArray),this.drawCalls.push(h)),h.start=p,h.size=0,h.textures.count=0,h.type=c),g.touched=1,g._batchEnabled=t,g._batchLocation=a,g.wrapMode=10497,h.textures.elements[h.textures.count++]=g,a++)),h.size+=f.size,p+=f.size,l=g._batchLocation,this.addColors(r,y.color,y.alpha,f.attribSize),this.addTextureIds(n,l,f.attribSize)}e.BaseTexture._globalBatch=t,this.packAttributes()},h.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,s=new ArrayBuffer(3*t.length*4),n=new Float32Array(s),h=new Uint32Array(s),a=0,o=0;o<t.length/2;o++)n[a++]=t[2*o],n[a++]=t[2*o+1],n[a++]=e[2*o],n[a++]=e[2*o+1],h[a++]=i[o],n[a++]=r[o];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)},h.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),o.triangulate(t,this)):m[t.type].triangulate(t,this)},h.prototype.processLine=function(t){f(t,this);for(var e=0;e<t.holes.length;e++)f(t.holes[e],this)},h.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];m[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},h.prototype.calculateBounds=function(){var t=this._bounds,e=D,r=i.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var s=0;s<this.graphicsData.length;s++){var n=this.graphicsData[s],h=n.shape,a=n.type,o=n.lineStyle,l=n.matrix||i.Matrix.IDENTITY,u=0;if(o&&o.visible){var c=o.alignment;u=o.width,a===i.SHAPES.POLY?u*=.5+Math.abs(.5-c):u*=Math.max(0,c)}r!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,r),e.clear()),r=l),a===i.SHAPES.RECT||a===i.SHAPES.RREC?e.addFramePad(h.x,h.y,h.x+h.width,h.y+h.height,u,u):a===i.SHAPES.CIRC?e.addFramePad(h.x,h.y,h.x,h.y,h.radius+u,h.radius+u):a===i.SHAPES.ELIP?e.addFramePad(h.x,h.y,h.x,h.y,h.width+u,h.height+u):t.addVerticesMatrix(r,h.points,0,h.points.length,u,u)}e.isEmpty()||t.addBoundsMatrix(e,r),t.pad(this.boundsPadding,this.boundsPadding)},h.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],s=t[2*i+1];t[2*i]=e.a*r+e.c*s+e.tx,t[2*i+1]=e.b*r+e.d*s+e.ty}},h.prototype.addColors=function(t,e,i,s){for(var n=(e>>16)+(65280&e)+((255&e)<<16),h=r.premultiplyTint(n,i);s-- >0;)t.push(h)},h.prototype.addTextureIds=function(t,e,i){for(;i-- >0;)t.push(e)},h.prototype.addUvs=function(t,e,i,r,s,n){for(var h=0,a=e.length,o=i.frame;h<s;){var l=t[2*(r+h)],u=t[2*(r+h)+1];if(n){var c=n.a*l+n.c*u+n.tx;u=n.b*l+n.d*u+n.ty,l=c}h++,e.push(l/o.width,u/o.height)}var p=i.baseTexture;(o.width<p.width||o.height<p.height)&&this.adjustUvs(e,i,a,s)},h.prototype.adjustUvs=function(t,e,i,r){for(var s=e.baseTexture,n=i+2*r,h=e.frame,a=h.width/s.width,o=h.height/s.height,l=h.x/h.width,u=h.y/h.height,c=Math.floor(t[i]+1e-6),p=Math.floor(t[i+1]+1e-6),d=i+2;d<n;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=i;f<n;f+=2)t[f]=(t[f]+l)*a,t[f+1]=(t[f+1]+u)*o},Object.defineProperties(h.prototype,a),h}(e.BatchGeometry);T.BATCHABLE_SIZE=100;var I=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){var t=new e;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},e.prototype.reset=function(){t.prototype.reset.call(this),this.color=0,this.width=0,this.alignment=.5,this.native=!1},e}(a),A=new Float32Array(3),C={},E=function(t){function n(i){void 0===i&&(i=null),t.call(this),this.geometry=i||new T,this.geometry.refCount++,this.shader=null,this.state=e.State.for2d(),this._fillStyle=new a,this._lineStyle=new I,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=s.BLEND_MODES.NORMAL}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var h={blendMode:{configurable:!0},tint:{configurable:!0},fill:{configurable:!0},line:{configurable:!0}};return n.prototype.clone=function(){return this.finishPoly(),new n(this.geometry)},h.blendMode.set=function(t){this.state.blendMode=t},h.blendMode.get=function(){return this.state.blendMode},h.tint.get=function(){return this._tint},h.tint.set=function(t){this._tint=t},h.fill.get=function(){return this._fillStyle},h.line.get=function(){return this._lineStyle},n.prototype.lineStyle=function(t){if("number"==typeof t){var e=arguments;t={width:e[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}}return this.lineTextureStyle(t)},n.prototype.lineTextureStyle=function(t){if("number"==typeof t){r.deprecation("v5.2.0","Please use object-based options for Graphics#lineTextureStyle");var i=arguments[0],s=arguments[1],n=arguments[2],h=arguments[3],a=arguments[4],o=arguments[5],l=arguments[6];t={width:i,texture:s,color:n,alpha:h,matrix:a,alignment:o,native:l},Object.keys(t).forEach(function(e){return void 0===t[e]&&delete t[e]})}t=Object.assign({width:0,texture:e.Texture.WHITE,color:t&&t.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1},t),this.currentPath&&this.startPoly();var u=t.width>0&&t.alpha>0;return u?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:u},t)):this._lineStyle.reset(),this},n.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1},n.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},n.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},n.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],s=i[i.length-1];return r===t&&s===e||i.push(t,e),this},n.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},n.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),b.curveTo(t,e,i,r,s),this},n.prototype.bezierCurveTo=function(t,e,i,r,s,n){return this._initCurve(),v.curveTo(t,e,i,r,s,n,this.currentPath.points),this},n.prototype.arcTo=function(t,e,i,r,s){this._initCurve(t,e);var n=this.currentPath.points,h=g.curveTo(t,e,i,r,s,n);if(h){var a=h.cx,o=h.cy,l=h.radius,u=h.startAngle,c=h.endAngle,p=h.anticlockwise;this.arc(a,o,l,u,c,p)}return this},n.prototype.arc=function(t,e,r,s,n,h){if(void 0===h&&(h=!1),s===n)return this;if(!h&&n<=s?n+=i.PI_2:h&&s<=n&&(s+=i.PI_2),0===n-s)return this;var a=t+Math.cos(s)*r,o=e+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 g.arc(a,o,t,e,r,s,n,h,u),this},n.prototype.beginFill=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=1),this.beginTextureFill({texture:e.Texture.WHITE,color:t,alpha:i})},n.prototype.beginTextureFill=function(t){if(t instanceof e.Texture){r.deprecation("v5.2.0","Please use object-based options for Graphics#beginTextureFill");var i=arguments[0],s=arguments[1],n=arguments[2],h=arguments[3];t={texture:i,color:s,alpha:n,matrix:h},Object.keys(t).forEach(function(e){return void 0===t[e]&&delete t[e]})}t=Object.assign({texture:e.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var a=t.alpha>0;return a?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:a},t)):this._fillStyle.reset(),this},n.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},n.prototype.drawRect=function(t,e,r,s){return this.drawShape(new i.Rectangle(t,e,r,s))},n.prototype.drawRoundedRect=function(t,e,r,s,n){return this.drawShape(new i.RoundedRectangle(t,e,r,s,n))},n.prototype.drawCircle=function(t,e,r){return this.drawShape(new i.Circle(t,e,r))},n.prototype.drawEllipse=function(t,e,r,s){return this.drawShape(new i.Ellipse(t,e,r,s))},n.prototype.drawPolygon=function(t){var e=arguments,r=t,s=!0;if(r.points&&(s=r.closeStroke,r=r.points),!Array.isArray(r)){r=new Array(arguments.length);for(var n=0;n<r.length;++n)r[n]=e[n]}var h=new i.Polygon(r);return h.closeStroke=s,this.drawShape(h),this},n.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},n.prototype.drawStar=function(t,e,i,r,s,n){return void 0===n&&(n=0),this.drawPolygon(new y(t,e,i,r,s,n))},n.prototype.clear=function(){return this.geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._matrix=null,this._holeMode=!1,this.currentPath=null,this},n.prototype.isFastRect=function(){return 1===this.geometry.graphicsData.length&&this.geometry.graphicsData[0].shape.type===i.SHAPES.RECT&&!this.geometry.graphicsData[0].lineWidth},n.prototype._render=function(t){this.finishPoly();var e=this.geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},n.prototype._populateBatches=function(){var t=this.geometry,e=this.blendMode;this.batches=[],this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.vertexData=new Float32Array(t.points);for(var i=0,s=t.batches.length;i<s;i++){var n=t.batches[i],h=n.style.color,a=new Float32Array(this.vertexData.buffer,4*n.attribStart*2,2*n.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*n.attribStart*2,2*n.attribSize),l={vertexData:a,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*n.start,n.size),uvs:o,_batchRGB:r.hex2rgb(h),_tintRGB:h,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[i]=l}},n.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},n.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this.geometry,r=this.tint,s=this.worldAlpha,n=e.uniforms,h=i.drawCalls;n.translationMatrix=this.transform.worldTransform,n.tint[0]=(r>>16&255)/255*s,n.tint[1]=(r>>8&255)/255*s,n.tint[2]=(255&r)/255*s,n.tint[3]=s,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var a=0,o=h.length;a<o;a++)this._renderDrawCallDirect(t,i.drawCalls[a])},n.prototype._renderDrawCallDirect=function(t,e){for(var i=e.textures,r=e.type,s=e.size,n=e.start,h=i.count,a=0;a<h;a++)t.texture.bind(i.elements[a],a);t.geometry.draw(r,s,n)},n.prototype._resolveDirectShader=function(t){var r=this.shader,s=this.pluginName;if(!r){if(!C[s]){for(var n=new Int32Array(16),h=0;h<16;h++)n[h]=h;var a={tint:new Float32Array([1,1,1,1]),translationMatrix:new i.Matrix,default:e.UniformGroup.from({uSamplers:n},!0)},o=t.plugins[s]._shader.program;C[s]=new e.Shader(o,a)}r=C[s]}return r},n.prototype._calculateBounds=function(){this.finishPoly();var t=this.geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,s=e.maxX,n=e.maxY;this._bounds.addFrame(this.transform,i,r,s,n)}},n.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,n._TEMP_POINT),this.geometry.containsPoint(n._TEMP_POINT)},n.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=r.hex2rgb(this.tint,A),e=0;e<this.batches.length;e++){var i=this.batches[e],s=i._batchRGB,n=(t[0]*s[0]*255<<16)+(t[1]*s[1]*255<<8)+(0|t[2]*s[2]*255);i._tintRGB=(n>>16)+(65280&n)+((255&n)<<16)}}},n.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID;for(var t=this.transform.worldTransform,e=t.a,i=t.b,r=t.c,s=t.d,n=t.tx,h=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++]=e*c+r*p+n,o[l++]=s*p+i*c+h}}},n.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},n.prototype.setMatrix=function(t){return this._matrix=t,this},n.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},n.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},n.prototype.destroy=function(e){t.prototype.destroy.call(this,e),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,e)},Object.defineProperties(n.prototype,h),n}(n.Container);return E._TEMP_POINT=new i.Point,t.FillStyle=a,t.GRAPHICS_CURVES=h,t.Graphics=E,t.GraphicsData=w,t.GraphicsGeometry=T,t.LineStyle=I,t.graphicsUtils=_,t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_graphics); | ||
this.PIXI=this.PIXI||{};var _pixi_graphics=function(t,e,i,r,n,s){"use strict";var a,h;(a=t.LINE_JOIN||(t.LINE_JOIN={})).MITER="miter",a.BEVEL="bevel",a.ROUND="round",(h=t.LINE_CAP||(t.LINE_CAP={})).BUTT="butt",h.ROUND="round",h.SQUARE="square";var o={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},l=function(){function t(){this.color=16777215,this.alpha=1,this.texture=e.Texture.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=e.Texture.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),u=function(t,e){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function c(t,e){function i(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var p={build:function(t){t.points=t.shape.points.slice()},triangulate:function(t,e){var i=t.points,n=t.holes,s=e.points,a=e.indices;if(i.length>=6){for(var h=[],o=0;o<n.length;o++){var l=n[o];h.push(i.length/2),i=i.concat(l.points)}var u=r.earcut(i,h,2);if(!u)return;var c=s.length/2;for(o=0;o<u.length;o+=3)a.push(u[o]+c),a.push(u[o+1]+c),a.push(u[o+2]+c);for(o=0;o<i.length;o++)s.push(i[o])}}},d={build:function(t){var e,r,n=t.shape,s=t.points,a=n.x,h=n.y;if(s.length=0,t.type===i.SHAPES.CIRC)e=n.radius,r=n.radius;else{var o=t.shape;e=o.width,r=o.height}if(0!==e&&0!==r){var l=Math.floor(30*Math.sqrt(n.radius))||Math.floor(15*Math.sqrt(e+r));l/=2.3;for(var u=2*Math.PI/l,c=0;c<l-.5;c++)s.push(a+Math.sin(-u*c)*e,h+Math.cos(-u*c)*r);s.push(s[0],s[1])}},triangulate:function(t,e){var i=t.points,r=e.points,n=e.indices,s=r.length/2,a=s,h=t.shape,o=t.matrix,l=h.x,u=h.y;r.push(t.matrix?o.a*l+o.c*u+o.tx:l,t.matrix?o.b*l+o.d*u+o.ty:u);for(var c=0;c<i.length;c+=2)r.push(i[c],i[c+1]),n.push(s++,a,s)}},f={build:function(t){var e=t.shape,i=e.x,r=e.y,n=e.width,s=e.height,a=t.points;a.length=0,a.push(i,r,i+n,r,i+n,r+s,i,r+s)},triangulate:function(t,e){var i=t.points,r=e.points,n=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}};function y(t,e,i){return t+(e-t)*i}function g(t,e,i,r,n,s,a){void 0===a&&(a=[]);for(var h=a,o=0,l=0,u=0,c=0,p=0,d=0,f=0,g=0;f<=20;++f)o=y(t,i,g=f/20),l=y(e,r,g),u=y(i,n,g),c=y(r,s,g),p=y(o,u,g),d=y(l,c,g),h.push(p,d);return h}var v={build:function(t){var e=t.shape,i=t.points,r=e.x,n=e.y,s=e.width,a=e.height,h=Math.max(0,Math.min(e.radius,Math.min(s,a)/2));i.length=0,h?(g(r,n+h,r,n,r+h,n,i),g(r+s-h,n,r+s,n,r+s,n+h,i),g(r+s,n+a-h,r+s,n+a,r+s-h,n+a,i),g(r+h,n+a,r,n+a,r,n+a-h,i)):i.push(r,n,r+s,n,r+s,n+a,r,n+a)},triangulate:function(t,e){for(var i=t.points,n=e.points,s=e.indices,a=n.length/2,h=r.earcut(i,null,2),o=0,l=h.length;o<l;o+=3)s.push(h[o]+a),s.push(h[o+1]+a),s.push(h[o+2]+a);for(o=0,l=i.length;o<l;o++)n.push(i[o],i[++o])}};function b(t,e,i,r,n,s,a,h){var o,l;a?(o=r,l=-i):(o=-r,l=i);var u=t-i*n+o,c=e-r*n+l,p=t+i*s+o,d=e+r*s+l;return h.push(u,c),h.push(p,d),2}function m(t,e,i,r,n,s,a,h){var o=i-t,l=r-e,u=Math.atan2(o,l),c=Math.atan2(n-t,s-e);h&&u<c?u+=2*Math.PI:!h&&u>c&&(c+=2*Math.PI);var p=u,d=c-u,f=Math.abs(d),y=Math.sqrt(o*o+l*l),g=1+(15*f*Math.sqrt(y)/Math.PI>>0),v=d/g;if(p+=v,h){a.push(t,e),a.push(i,r);for(var b=1,m=p;b<g;b++,m+=v)a.push(t,e),a.push(t+Math.sin(m)*y,e+Math.cos(m)*y);a.push(t,e),a.push(n,s)}else{a.push(i,r),a.push(t,e);for(b=1,m=p;b<g;b++,m+=v)a.push(t+Math.sin(m)*y,e+Math.cos(m)*y),a.push(t,e);a.push(n,s),a.push(t,e)}return 2*g}function x(e,r){e.lineStyle.native?function(t,e){var r=0,n=t.shape,s=t.points||n.points,a=n.type!==i.SHAPES.POLY||n.closeStroke;if(0!==s.length){var h=e.points,o=e.indices,l=s.length/2,u=h.length/2,c=u;for(h.push(s[0],s[1]),r=1;r<l;r++)h.push(s[2*r],s[2*r+1]),o.push(c,c+1),c++;a&&o.push(c,u)}}(e,r):function(e,r){var n=e.shape,s=e.points||n.points.slice(),a=r.closePointEps;if(0!==s.length){var h=e.lineStyle,l=new i.Point(s[0],s[1]),u=new i.Point(s[s.length-2],s[s.length-1]),c=n.type!==i.SHAPES.POLY||n.closeStroke,p=Math.abs(l.x-u.x)<a&&Math.abs(l.y-u.y)<a;if(c){s=s.slice(),p&&(s.pop(),s.pop(),u.set(s[s.length-2],s[s.length-1]));var d=.5*(l.x+u.x),f=.5*(u.y+l.y);s.unshift(d,f),s.push(d,f)}var y=r.points,g=s.length/2,v=s.length,x=y.length/2,_=h.width/2,P=_*_,S=h.miterLimit*h.miterLimit,w=s[0],M=s[1],I=s[2],T=s[3],E=0,D=0,A=-(M-T),C=w-I,L=0,B=0,R=Math.sqrt(A*A+C*C);A/=R,C/=R,A*=_,C*=_;var O=h.alignment,N=2*(1-O),U=2*O;c||(h.cap===t.LINE_CAP.ROUND?v+=m(w-A*(N-U)*.5,M-C*(N-U)*.5,w-A*N,M-C*N,w+A*U,M+C*U,y,!0)+2:h.cap===t.LINE_CAP.SQUARE&&(v+=b(w,M,A,C,N,U,!0,y))),y.push(w-A*N,M-C*N),y.push(w+A*U,M+C*U);for(var H=1;H<g-1;++H){w=s[2*(H-1)],M=s[2*(H-1)+1],I=s[2*H],T=s[2*H+1],E=s[2*(H+1)],D=s[2*(H+1)+1],A=-(M-T),C=w-I,A/=R=Math.sqrt(A*A+C*C),C/=R,A*=_,C*=_,L=-(T-D),B=I-E,L/=R=Math.sqrt(L*L+B*B),B/=R,L*=_,B*=_;var j=I-w,F=M-T,z=I-E,k=D-T,q=F*z-k*j,G=q<0;if(Math.abs(q)<.1)y.push(I-A*N,T-C*N),y.push(I+A*U,T+C*U);else{var W=(-A+w)*(-C+T)-(-A+I)*(-C+M),X=(-L+E)*(-B+T)-(-L+I)*(-B+D),Y=(j*X-z*W)/q,J=(k*W-F*X)/q,V=(Y-I)*(Y-I)+(J-T)*(J-T),Q=I+(Y-I)*N,Z=T+(J-T)*N,K=I-(Y-I)*U,$=T-(J-T)*U,tt=w-A*N,et=M-C*N,it=E-L*N,rt=D-B*N,nt=w+A*U,st=M+C*U,at=E+L*U,ht=D+B*U,ot=D-M,lt=-(E-w),ut=ot*(I-tt)+lt*(T-et);if(G){var ct=ot*(Q-tt)+lt*(Z-et);Math.abs(ut-ct)>.1&&Math.sign(ut)!==Math.sign(ct)&&(Q=.5*(tt+it),Z=.5*(et+rt))}else{var pt=ot*(K-tt)+lt*($-et);Math.abs(ut-pt)>.1&&Math.sign(ut)!==Math.sign(pt)&&(K=.5*(nt+at),$=.5*(st+ht))}h.join===t.LINE_JOIN.BEVEL||V/P>S?(G?(y.push(Q,Z),y.push(I+A*U,T+C*U),y.push(Q,Z),y.push(I+L*U,T+B*U)):(y.push(I-A*N,T-C*N),y.push(K,$),y.push(I-L*N,T-B*N),y.push(K,$)),v+=2):h.join===t.LINE_JOIN.ROUND?G?(y.push(Q,Z),y.push(I+A*U,T+C*U),v+=m(I,T,I+A*U,T+C*U,I+L*U,T+B*U,y,!0)+4,y.push(Q,Z),y.push(I+L*U,T+B*U)):(y.push(I-A*N,T-C*N),y.push(K,$),v+=m(I,T,I-A*N,T-C*N,I-L*N,T-B*N,y,!1)+4,y.push(I-L*N,T-B*N),y.push(K,$)):(y.push(Q,Z),y.push(K,$))}}w=s[2*(g-2)],M=s[2*(g-2)+1],I=s[2*(g-1)],A=-(M-(T=s[2*(g-1)+1])),C=w-I,A/=R=Math.sqrt(A*A+C*C),C/=R,A*=_,C*=_,y.push(I-A*N,T-C*N),y.push(I+A*U,T+C*U),c||(h.cap===t.LINE_CAP.ROUND?v+=m(I-A*(N-U)*.5,T-C*(N-U)*.5,I-A*N,T-C*N,I+A*U,T+C*U,y,!1)+2:h.cap===t.LINE_CAP.SQUARE&&(v+=b(I,T,A,C,N,U,!1,y)));var dt=r.indices,ft=o.epsilon*o.epsilon;for(H=x;H<v+x-2;++H)w=y[2*H],M=y[2*H+1],I=y[2*(H+1)],T=y[2*(H+1)+1],E=y[2*(H+2)],D=y[2*(H+2)+1],Math.abs(w*(T-D)+I*(D-M)+E*(M-T))<ft||dt.push(H,H+1,H+2)}}(e,r)}var _,P=function(t){function e(e,r,n,s,a,h){void 0===h&&(h=0);a=a||s/2;for(var o=-1*Math.PI/2+h,l=2*n,u=i.PI_2/l,c=[],p=0;p<l;p++){var d=p%2?a:s,f=p*u+o;c.push(e+d*Math.cos(f),r+d*Math.sin(f))}return t.call(this,c)||this}return c(e,t),e}(i.Polygon),S=function(){function t(){}return t.curveTo=function(t,e,i,r,n,s){var a=s[s.length-2],h=s[s.length-1]-e,o=a-t,l=r-e,u=i-t,c=Math.abs(h*u-o*l);if(c<1e-8||0===n)return s[s.length-2]===t&&s[s.length-1]===e||s.push(t,e),null;var p=h*h+o*o,d=l*l+u*u,f=h*l+o*u,y=n*Math.sqrt(p)/c,g=n*Math.sqrt(d)/c,v=y*f/p,b=g*f/d,m=y*u+g*o,x=y*l+g*h,_=o*(g+v),P=h*(g+v),S=u*(y+b),w=l*(y+b);return{cx:m+t,cy:x+e,radius:n,startAngle:Math.atan2(P-x,_-m),endAngle:Math.atan2(w-x,S-m),anticlockwise:o*l>u*h}},t.arc=function(t,e,r,n,s,a,h,l,u){for(var c=h-a,p=o._segmentsCount(Math.abs(c)*s,40*Math.ceil(Math.abs(c)/i.PI_2)),d=c/(2*p),f=2*d,y=Math.cos(d),g=Math.sin(d),v=p-1,b=v%1/v,m=0;m<=v;++m){var x=d+a+f*(m+b*m),_=Math.cos(x),P=-Math.sin(x);u.push((y*_+g*P)*s+r,(y*-P+g*_)*s+n)}},t}(),w=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s,a,h){for(var o=0,l=0,u=0,c=0,p=0,d=0,f=0,y=0,g=0,v=0,b=0,m=t,x=e,_=1;_<=10;++_)v=m-(y=(f=(d=(p=1-(l=_/10))*p)*p)*t+3*d*l*i+3*p*(u=l*l)*n+(c=u*l)*a),b=x-(g=f*e+3*d*l*r+3*p*u*s+c*h),m=y,x=g,o+=Math.sqrt(v*v+b*b);return o},t.curveTo=function(e,i,r,n,s,a,h){var l=h[h.length-2],u=h[h.length-1];h.length-=2;var c=o._segmentsCount(t.curveLength(l,u,e,i,r,n,s,a)),p=0,d=0,f=0,y=0,g=0;h.push(l,u);for(var v=1,b=0;v<=c;++v)f=(d=(p=1-(b=v/c))*p)*p,g=(y=b*b)*b,h.push(f*l+3*d*b*e+3*p*y*r+g*s,f*u+3*d*b*i+3*p*y*n+g*a)},t}(),M=function(){function t(){}return t.curveLength=function(t,e,i,r,n,s){var a=t-2*i+n,h=e-2*r+s,o=2*i-2*t,l=2*r-2*e,u=4*(a*a+h*h),c=4*(a*o+h*l),p=o*o+l*l,d=2*Math.sqrt(u+c+p),f=Math.sqrt(u),y=2*u*f,g=2*Math.sqrt(p),v=c/f;return(y*d+f*c*(d-g)+(4*p*u-c*c)*Math.log((2*f+v+d)/(v+g)))/(4*y)},t.curveTo=function(e,i,r,n,s){for(var a=s[s.length-2],h=s[s.length-1],l=o._segmentsCount(t.curveLength(a,h,e,i,r,n)),u=0,c=0,p=1;p<=l;++p){var d=p/l;u=a+(e-a)*d,c=h+(i-h)*d,s.push(u+(e+(r-e)*d-u)*d,c+(i+(n-i)*d-c)*d)}},t}(),I=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),T=((_={})[i.SHAPES.POLY]=p,_[i.SHAPES.CIRC]=d,_[i.SHAPES.ELIP]=d,_[i.SHAPES.RECT]=f,_[i.SHAPES.RREC]=v,_),E=[],D=[],A={buildPoly:p,buildCircle:d,buildRectangle:f,buildRoundedRectangle:v,FILL_COMMANDS:T,BATCH_POOL:E,DRAW_CALL_POOL:D,buildLine:x,Star:P,ArcUtils:S,BezierUtils:w,QuadraticUtils:M,BatchPart:I},C=function(){function t(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null),this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type,this.points=[],this.holes=[]}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.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},t}(),L=new i.Point,B=new s.Bounds,R=function(t){function a(){var e=t.call(this)||this;return e.uvsFloat32=null,e.indicesUint16=null,e.points=[],e.colors=[],e.uvs=[],e.indices=[],e.textureIds=[],e.graphicsData=[],e.dirty=0,e.batchDirty=-1,e.cacheDirty=-1,e.clearDirty=0,e.drawCalls=[],e.batches=[],e.shapeIndex=0,e._bounds=new s.Bounds,e.boundsDirty=-1,e.boundsPadding=0,e.batchable=!1,e.indicesUint16=null,e.uvsFloat32=null,e.closePointEps=1e-4,e}return c(a,t),Object.defineProperty(a.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),a.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].texArray.clear(),D.push(this.drawCalls[t]);this.drawCalls.length=0;for(t=0;t<this.batches.length;t++){var e=this.batches[t];e.reset(),E.push(e)}this.batches.length=0},a.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},a.prototype.drawShape=function(t,e,i,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=null);var n=new C(t,e,i,r);return this.graphicsData.push(n),this.dirty++,this},a.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var i=new C(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this},a.prototype.destroy=function(){t.prototype.destroy.call(this);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},a.prototype.containsPoint=function(t){for(var e=this.graphicsData,i=0;i<e.length;++i){var r=e[i];if(r.fillStyle.visible&&(r.shape&&(r.matrix?r.matrix.applyInverse(t,L):L.copyFrom(t),r.shape.contains(L.x,L.y)))){var n=!1;if(r.holes)for(var s=0;s<r.holes.length;s++){if(r.holes[s].shape.contains(L.x,L.y)){n=!0;break}}if(!n)return!0}}return!1},a.prototype.updateBatches=function(t){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var e=this.uvs,i=this.graphicsData,r=null,s=null;this.batches.length>0&&(s=(r=this.batches[this.batches.length-1]).style);for(var a=this.shapeIndex;a<i.length;a++){this.shapeIndex++;var h=i[a],o=h.fillStyle,l=h.lineStyle;T[h.type].build(h),h.matrix&&this.transformPoints(h.points,h.matrix);for(var u=0;u<2;u++){var c=0===u?o:l;if(c.visible){var p=c.texture.baseTexture,d=this.indices.length,f=this.points.length/2;p.wrapMode=n.WRAP_MODES.REPEAT,0===u?this.processFill(h):this.processLine(h);var y=this.points.length/2-f;0!==y&&(r&&!this._compareStyles(s,c)&&(r.end(d,f),r=null),r||((r=E.pop()||new I).begin(c,d,f),this.batches.push(r),s=c),this.addUvs(this.points,e,c.texture,f,y,c.matrix))}}}var g=this.indices.length,v=this.points.length/2;if(r&&r.end(g,v),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var b=v>65535&&t;this.indicesUint16=b?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},a.prototype._compareStyles=function(t,e){return!(!t||!e)&&(t.texture.baseTexture===e.texture.baseTexture&&(t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native))},a.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t<e;t++){var i=this.graphicsData[t],r=i.fillStyle,n=i.lineStyle;if(r&&!r.texture.baseTexture.valid)return!1;if(n&&!n.texture.baseTexture.valid)return!1}return!0},a.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var t=this.batches,e=0,i=t.length;e<i;e++)for(var r=t[e],n=0;n<r.size;n++){var s=r.start+n;this.indicesUint16[s]=this.indicesUint16[s]-r.attribStart}},a.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var t=this.batches,e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<2*a.BATCHABLE_SIZE},a.prototype.buildDrawCalls=function(){for(var t=++e.BaseTexture._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),D.push(this.drawCalls[i]);this.drawCalls.length=0;var r=this.colors,s=this.textureIds,a=D.pop();a||((a=new e.BatchDrawCall).texArray=new e.BatchTextureArray),a.texArray.count=0,a.start=0,a.size=0,a.type=n.DRAW_MODES.TRIANGLES;var h=0,o=null,l=0,u=!1,c=n.DRAW_MODES.TRIANGLES,p=0;this.drawCalls.push(a);for(i=0;i<this.batches.length;i++){var d=this.batches[i],f=d.style,y=f.texture.baseTexture;u!==!!f.native&&(c=(u=!!f.native)?n.DRAW_MODES.LINES:n.DRAW_MODES.TRIANGLES,o=null,h=8,t++),o!==y&&(o=y,y._batchEnabled!==t&&(8===h&&(t++,h=0,a.size>0&&((a=D.pop())||((a=new e.BatchDrawCall).texArray=new e.BatchTextureArray),this.drawCalls.push(a)),a.start=p,a.size=0,a.texArray.count=0,a.type=c),y.touched=1,y._batchEnabled=t,y._batchLocation=h,y.wrapMode=10497,a.texArray.elements[a.texArray.count++]=y,h++)),a.size+=d.size,p+=d.size,l=y._batchLocation,this.addColors(r,f.color,f.alpha,d.attribSize),this.addTextureIds(s,l,d.attribSize)}e.BaseTexture._globalBatch=t,this.packAttributes()},a.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,n=new ArrayBuffer(3*t.length*4),s=new Float32Array(n),a=new Uint32Array(n),h=0,o=0;o<t.length/2;o++)s[h++]=t[2*o],s[h++]=t[2*o+1],s[h++]=e[2*o],s[h++]=e[2*o+1],a[h++]=i[o],s[h++]=r[o];this._buffer.update(n),this._indexBuffer.update(this.indicesUint16)},a.prototype.processFill=function(t){t.holes.length?(this.processHoles(t.holes),p.triangulate(t,this)):T[t.type].triangulate(t,this)},a.prototype.processLine=function(t){x(t,this);for(var e=0;e<t.holes.length;e++)x(t.holes[e],this)},a.prototype.processHoles=function(t){for(var e=0;e<t.length;e++){var i=t[e];T[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}},a.prototype.calculateBounds=function(){var t=this._bounds,e=B,r=i.Matrix.IDENTITY;this._bounds.clear(),e.clear();for(var n=0;n<this.graphicsData.length;n++){var s=this.graphicsData[n],a=s.shape,h=s.type,o=s.lineStyle,l=s.matrix||i.Matrix.IDENTITY,u=0;if(o&&o.visible){var c=o.alignment;u=o.width,h===i.SHAPES.POLY?u*=.5+Math.abs(.5-c):u*=Math.max(0,c)}if(r!==l&&(e.isEmpty()||(t.addBoundsMatrix(e,r),e.clear()),r=l),h===i.SHAPES.RECT||h===i.SHAPES.RREC){var p=a;e.addFramePad(p.x,p.y,p.x+p.width,p.y+p.height,u,u)}else if(h===i.SHAPES.CIRC){var d=a;e.addFramePad(d.x,d.y,d.x,d.y,d.radius+u,d.radius+u)}else if(h===i.SHAPES.ELIP){var f=a;e.addFramePad(f.x,f.y,f.x,f.y,f.width+u,f.height+u)}else{var y=a;t.addVerticesMatrix(r,y.points,0,y.points.length,u,u)}}e.isEmpty()||t.addBoundsMatrix(e,r),t.pad(this.boundsPadding,this.boundsPadding)},a.prototype.transformPoints=function(t,e){for(var i=0;i<t.length/2;i++){var r=t[2*i],n=t[2*i+1];t[2*i]=e.a*r+e.c*n+e.tx,t[2*i+1]=e.b*r+e.d*n+e.ty}},a.prototype.addColors=function(t,e,i,n){for(var s=(e>>16)+(65280&e)+((255&e)<<16),a=r.premultiplyTint(s,i);n-- >0;)t.push(a)},a.prototype.addTextureIds=function(t,e,i){for(;i-- >0;)t.push(e)},a.prototype.addUvs=function(t,e,i,r,n,s){void 0===s&&(s=null);for(var a=0,h=e.length,o=i.frame;a<n;){var l=t[2*(r+a)],u=t[2*(r+a)+1];if(s){var c=s.a*l+s.c*u+s.tx;u=s.b*l+s.d*u+s.ty,l=c}a++,e.push(l/o.width,u/o.height)}var p=i.baseTexture;(o.width<p.width||o.height<p.height)&&this.adjustUvs(e,i,h,n)},a.prototype.adjustUvs=function(t,e,i,r){for(var n=e.baseTexture,s=i+2*r,a=e.frame,h=a.width/n.width,o=a.height/n.height,l=a.x/a.width,u=a.y/a.height,c=Math.floor(t[i]+1e-6),p=Math.floor(t[i+1]+1e-6),d=i+2;d<s;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(d=i;d<s;d+=2)t[d]=(t[d]+l)*h,t[d+1]=(t[d+1]+u)*o},a.BATCHABLE_SIZE=100,a}(e.BatchGeometry),O=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.width=0,i.alignment=.5,i.native=!1,i.cap=t.LINE_CAP.BUTT,i.join=t.LINE_JOIN.MITER,i.miterLimit=10,i}return c(i,e),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.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t},i.prototype.reset=function(){e.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},i}(l),N=new Float32Array(3),U={},H=function(s){function a(t){void 0===t&&(t=null);var i=s.call(this)||this;return i._geometry=t||new R,i._geometry.refCount++,i.shader=null,i.state=e.State.for2d(),i._fillStyle=new l,i._lineStyle=new O,i._matrix=null,i._holeMode=!1,i.currentPath=null,i.batches=[],i.batchTint=-1,i.batchDirty=-1,i.vertexData=null,i.pluginName="batch",i._transformID=-1,i.tint=16777215,i.blendMode=n.BLEND_MODES.NORMAL,i}return c(a,s),Object.defineProperty(a.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),a.prototype.clone=function(){return this.finishPoly(),new a(this._geometry)},Object.defineProperty(a.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),a.prototype.lineStyle=function(t){if(void 0===t&&(t=null),"number"==typeof t){var e=arguments;t={width:e[0]||0,color:e[1]||0,alpha:void 0!==e[2]?e[2]:1,alignment:void 0!==e[3]?e[3]:.5,native:!!e[4]}}return this.lineTextureStyle(t)},a.prototype.lineTextureStyle=function(i){if("number"==typeof i){r.deprecation("v5.2.0","Please use object-based options for Graphics#lineTextureStyle");var n=arguments,s=n[0],a=n[1],h=n[2],o=n[3],l=n[4],u=n[5],c=n[6];i={width:s,texture:a,color:h,alpha:o,matrix:l,alignment:u,native:c},Object.keys(i).forEach(function(t){return void 0===i[t]&&delete i[t]})}i=Object.assign({width:0,texture:e.Texture.WHITE,color:i&&i.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:t.LINE_CAP.BUTT,join:t.LINE_JOIN.MITER,miterLimit:10},i),this.currentPath&&this.startPoly();var p=i.width>0&&i.alpha>0;return p?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._lineStyle,{visible:p},i)):this._lineStyle.reset(),this},a.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new i.Polygon,this.currentPath.closeStroke=!1},a.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},a.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},a.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var i=this.currentPath.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},a.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},a.prototype.quadraticCurveTo=function(t,e,i,r){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),M.curveTo(t,e,i,r,n),this},a.prototype.bezierCurveTo=function(t,e,i,r,n,s){return this._initCurve(),w.curveTo(t,e,i,r,n,s,this.currentPath.points),this},a.prototype.arcTo=function(t,e,i,r,n){this._initCurve(t,e);var s=this.currentPath.points,a=S.curveTo(t,e,i,r,n,s);if(a){var h=a.cx,o=a.cy,l=a.radius,u=a.startAngle,c=a.endAngle,p=a.anticlockwise;this.arc(h,o,l,u,c,p)}return this},a.prototype.arc=function(t,e,r,n,s,a){if(void 0===a&&(a=!1),n===s)return this;if(!a&&s<=n?s+=i.PI_2:a&&n<=s&&(n+=i.PI_2),0===s-n)return this;var h=t+Math.cos(n)*r,o=e+Math.sin(n)*r,l=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var c=Math.abs(u[u.length-2]-h),p=Math.abs(u[u.length-1]-o);c<l&&p<l||u.push(h,o)}else this.moveTo(h,o),u=this.currentPath.points;return S.arc(h,o,t,e,r,n,s,a,u),this},a.prototype.beginFill=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=1),this.beginTextureFill({texture:e.Texture.WHITE,color:t,alpha:i})},a.prototype.beginTextureFill=function(t){if(t instanceof e.Texture){r.deprecation("v5.2.0","Please use object-based options for Graphics#beginTextureFill");var i=arguments,n=i[0],s=i[1],a=i[2],h=i[3];t={texture:n,color:s,alpha:a,matrix:h},Object.keys(t).forEach(function(e){return void 0===t[e]&&delete t[e]})}t=Object.assign({texture:e.Texture.WHITE,color:16777215,alpha:1,matrix:null},t),this.currentPath&&this.startPoly();var o=t.alpha>0;return o?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:o},t)):this._fillStyle.reset(),this},a.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},a.prototype.drawRect=function(t,e,r,n){return this.drawShape(new i.Rectangle(t,e,r,n))},a.prototype.drawRoundedRect=function(t,e,r,n,s){return this.drawShape(new i.RoundedRectangle(t,e,r,n,s))},a.prototype.drawCircle=function(t,e,r){return this.drawShape(new i.Circle(t,e,r))},a.prototype.drawEllipse=function(t,e,r,n){return this.drawShape(new i.Ellipse(t,e,r,n))},a.prototype.drawPolygon=function(){for(var t,e=arguments,r=[],n=0;n<arguments.length;n++)r[n]=e[n];var s=!0,a=r[0];a.points?(s=a.closeStroke,t=a.points):t=Array.isArray(r[0])?r[0]:r;var h=new i.Polygon(t);return h.closeStroke=s,this.drawShape(h),this},a.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},a.prototype.drawStar=function(t,e,i,r,n,s){return void 0===s&&(s=0),this.drawPolygon(new P(t,e,i,r,n,s))},a.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},a.prototype.isFastRect=function(){var t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===i.SHAPES.RECT&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)},a.prototype._render=function(t){this.finishPoly();var e=this._geometry,i=t.context.supports.uint32Indices;e.updateBatches(i),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))},a.prototype._populateBatches=function(){var t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(var n=0;n<i;n++){var s=t.batches[n],a=s.style.color,h=new Float32Array(this.vertexData.buffer,4*s.attribStart*2,2*s.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*s.attribStart*2,2*s.attribSize),l={vertexData:h,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*s.start,s.size),uvs:o,_batchRGB:r.hex2rgb(a),_tintRGB:a,_texture:s.style.texture,alpha:s.style.alpha,worldAlpha:1};this.batches[n]=l}},a.prototype._renderBatched=function(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var e=0,i=this.batches.length;e<i;e++){var r=this.batches[e];r.worldAlpha=this.worldAlpha*r.alpha,t.plugins[this.pluginName].render(r)}}},a.prototype._renderDirect=function(t){var e=this._resolveDirectShader(t),i=this._geometry,r=this.tint,n=this.worldAlpha,s=e.uniforms,a=i.drawCalls;s.translationMatrix=this.transform.worldTransform,s.tint[0]=(r>>16&255)/255*n,s.tint[1]=(r>>8&255)/255*n,s.tint[2]=(255&r)/255*n,s.tint[3]=n,t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(var h=0,o=a.length;h<o;h++)this._renderDrawCallDirect(t,i.drawCalls[h])},a.prototype._renderDrawCallDirect=function(t,e){for(var i=e.texArray,r=e.type,n=e.size,s=e.start,a=i.count,h=0;h<a;h++)t.texture.bind(i.elements[h],h);t.geometry.draw(r,n,s)},a.prototype._resolveDirectShader=function(t){var r=this.shader,n=this.pluginName;if(!r){if(!U[n]){for(var s=new Int32Array(16),a=0;a<16;a++)s[a]=a;var h={tint:new Float32Array([1,1,1,1]),translationMatrix:new i.Matrix,default:e.UniformGroup.from({uSamplers:s},!0)},o=t.plugins[n]._shader.program;U[n]=new e.Shader(o,h)}r=U[n]}return r},a.prototype._calculateBounds=function(){this.finishPoly();var t=this._geometry;if(t.graphicsData.length){var e=t.bounds,i=e.minX,r=e.minY,n=e.maxX,s=e.maxY;this._bounds.addFrame(this.transform,i,r,n,s)}},a.prototype.containsPoint=function(t){return this.worldTransform.applyInverse(t,a._TEMP_POINT),this._geometry.containsPoint(a._TEMP_POINT)},a.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var t=r.hex2rgb(this.tint,N),e=0;e<this.batches.length;e++){var i=this.batches[e],n=i._batchRGB,s=(t[0]*n[0]*255<<16)+(t[1]*n[1]*255<<8)+(0|t[2]*n[2]*255);i._tintRGB=(s>>16)+(65280&s)+((255&s)<<16)}}},a.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,i=e.a,r=e.b,n=e.c,s=e.d,a=e.tx,h=e.ty,o=this._geometry.points,l=this.vertexData,u=0,c=0;c<o.length;c+=2){var p=o[c],d=o[c+1];l[u++]=i*p+n*d+a,l[u++]=s*d+r*p+h}}},a.prototype.closePath=function(){var t=this.currentPath;return t&&(t.closeStroke=!0),this},a.prototype.setMatrix=function(t){return this._matrix=t,this},a.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},a.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},a.prototype.destroy=function(t){s.prototype.destroy.call(this,t),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,s.prototype.destroy.call(this,t)},a._TEMP_POINT=new i.Point,a}(s.Container);return t.FillStyle=l,t.GRAPHICS_CURVES=o,t.Graphics=H,t.GraphicsData=C,t.GraphicsGeometry=R,t.LineStyle=O,t.graphicsUtils=A,t}({},PIXI,PIXI,PIXI.utils,PIXI,PIXI);Object.assign(this.PIXI,_pixi_graphics); | ||
//# sourceMappingURL=graphics.min.js.map |
{ | ||
"name": "@pixi/graphics", | ||
"version": "5.2.4", | ||
"version": "5.3.0", | ||
"main": "lib/graphics.js", | ||
@@ -27,10 +27,10 @@ "module": "lib/graphics.es.js", | ||
"dependencies": { | ||
"@pixi/constants": "5.2.4", | ||
"@pixi/core": "5.2.4", | ||
"@pixi/display": "5.2.4", | ||
"@pixi/math": "5.2.4", | ||
"@pixi/sprite": "5.2.4", | ||
"@pixi/utils": "5.2.4" | ||
"@pixi/constants": "5.3.0", | ||
"@pixi/core": "5.3.0", | ||
"@pixi/display": "5.3.0", | ||
"@pixi/math": "5.3.0", | ||
"@pixi/sprite": "5.3.0", | ||
"@pixi/utils": "5.3.0" | ||
}, | ||
"gitHead": "71c6b3b2061af4a4f3a95a265d46e933b8befc2c" | ||
"gitHead": "a9b7b32a9c0aeb3d9c42ef04b2c2a39be1cd0880" | ||
} |
@@ -12,6 +12,5 @@ # @pixi/graphics | ||
```js | ||
import { GraphicsRenderer } from '@pixi/graphics'; | ||
import { Renderer } from '@pixi/core'; | ||
import { Graphics } from '@pixi/graphics'; | ||
Renderer.registerPlugin('graphics', GraphicsRenderer); | ||
``` | ||
const shapes = new Graphics(); | ||
``` |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1265532
9942
+ Added@pixi/constants@5.3.0(transitive)
+ Added@pixi/core@5.3.0(transitive)
+ Added@pixi/display@5.3.0(transitive)
+ Added@pixi/math@5.3.0(transitive)
+ Added@pixi/runner@5.3.0(transitive)
+ Added@pixi/settings@5.3.0(transitive)
+ Added@pixi/sprite@5.3.0(transitive)
+ Added@pixi/ticker@5.3.0(transitive)
+ Added@pixi/utils@5.3.0(transitive)
- Removed@pixi/constants@5.2.4(transitive)
- Removed@pixi/core@5.2.4(transitive)
- Removed@pixi/display@5.2.4(transitive)
- Removed@pixi/math@5.2.4(transitive)
- Removed@pixi/runner@5.2.4(transitive)
- Removed@pixi/settings@5.2.4(transitive)
- Removed@pixi/sprite@5.2.4(transitive)
- Removed@pixi/ticker@5.2.4(transitive)
- Removed@pixi/utils@5.2.4(transitive)
Updated@pixi/constants@5.3.0
Updated@pixi/core@5.3.0
Updated@pixi/display@5.3.0
Updated@pixi/math@5.3.0
Updated@pixi/sprite@5.3.0
Updated@pixi/utils@5.3.0