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

@pixi/canvas-graphics

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/canvas-graphics - npm Package Compare versions

Comparing version 5.2.3 to 5.2.4

10

dist/canvas-graphics.js
/*!
* @pixi/canvas-graphics - v5.2.3
* Compiled Fri, 24 Apr 2020 00:55:22 UTC
* @pixi/canvas-graphics - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
*

@@ -372,9 +372,11 @@ * @pixi/canvas-graphics is licensed under the MIT License.

if (svg)
if (svg && svg.createSVGMatrix)
{
this._svgMatrix = svg.createSVGMatrix();
}
if (!this._svgMatrix)
if (!this._svgMatrix || !pattern.setTransform)
{
this._svgMatrix = false;
return;
}

@@ -381,0 +383,0 @@ }

6

dist/canvas-graphics.min.js
/*!
* @pixi/canvas-graphics - v5.2.3
* Compiled Fri, 24 Apr 2020 00:55:22 UTC
* @pixi/canvas-graphics - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
*

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

*/
this.PIXI=this.PIXI||{};var _pixi_canvas_graphics=function(t,e,i,a,r){"use strict";var l,s=function(t){this.renderer=t,this._svgMatrix=null};s.prototype._calcCanvasStyle=function(t,a){var r;return t.texture?t.texture.valid?(r=i.canvasUtils.getTintedPattern(t.texture,a),this.setPatternTransform(r,t.matrix||e.Matrix.IDENTITY)):r="#808080":r="#"+("00000"+(0|a).toString(16)).substr(-6),r},s.prototype.render=function(t){var i=this.renderer,a=i.context,r=t.worldAlpha,l=t.transform.worldTransform;i.setContextTransform(l),t.canvasTintDirty===t.geometry.dirty&&t._prevTint===t.tint||this.updateGraphicsTint(t),i.setBlendMode(t.blendMode);for(var s,o,n=t.geometry.graphicsData,h=0;h<n.length;h++){var v=n[h],p=v.shape,c=v.fillStyle,g=v.lineStyle;if(c.visible&&(s=this._calcCanvasStyle(c,v._fillTint)),g.visible&&(o=this._calcCanvasStyle(g,v._lineTint)),a.lineWidth=g.width,v.type===e.SHAPES.POLY){a.beginPath();var f=p.points,d=v.holes,y=void 0,T=void 0,u=void 0,b=void 0;a.moveTo(f[0],f[1]);for(var x=2;x<f.length;x+=2)a.lineTo(f[x],f[x+1]);if(p.closeStroke&&a.closePath(),d.length>0){y=0,u=f[0],b=f[1];for(var S=2;S+2<f.length;S+=2)y+=(f[S]-u)*(f[S+3]-b)-(f[S+2]-u)*(f[S+1]-b);for(var _=0;_<d.length;_++)if(f=d[_].shape.points){T=0,u=f[0],b=f[1];for(var P=2;P+2<f.length;P+=2)T+=(f[P]-u)*(f[P+3]-b)-(f[P+2]-u)*(f[P+1]-b);if(T*y<0){a.moveTo(f[0],f[1]);for(var m=2;m<f.length;m+=2)a.lineTo(f[m],f[m+1])}else{a.moveTo(f[f.length-2],f[f.length-1]);for(var M=f.length-4;M>=0;M-=2)a.lineTo(f[M],f[M+1])}d[_].shape.closeStroke&&a.closePath()}}c.visible&&(a.globalAlpha=c.alpha*r,a.fillStyle=s,a.fill()),g.visible&&(a.globalAlpha=g.alpha*r,a.strokeStyle=o,a.stroke())}else if(v.type===e.SHAPES.RECT)c.visible&&(a.globalAlpha=c.alpha*r,a.fillStyle=s,a.fillRect(p.x,p.y,p.width,p.height)),g.visible&&(a.globalAlpha=g.alpha*r,a.strokeStyle=o,a.strokeRect(p.x,p.y,p.width,p.height));else if(v.type===e.SHAPES.CIRC)a.beginPath(),a.arc(p.x,p.y,p.radius,0,2*Math.PI),a.closePath(),c.visible&&(a.globalAlpha=c.alpha*r,a.fillStyle=s,a.fill()),g.visible&&(a.globalAlpha=g.alpha*r,a.strokeStyle=o,a.stroke());else if(v.type===e.SHAPES.ELIP){var C=2*p.width,I=2*p.height,A=p.x-C/2,w=p.y-I/2;a.beginPath();var k=C/2*.5522848,E=I/2*.5522848,R=A+C,G=w+I,X=A+C/2,D=w+I/2;a.moveTo(A,D),a.bezierCurveTo(A,D-E,X-k,w,X,w),a.bezierCurveTo(X+k,w,R,D-E,R,D),a.bezierCurveTo(R,D+E,X+k,G,X,G),a.bezierCurveTo(X-k,G,A,D+E,A,D),a.closePath(),c.visible&&(a.globalAlpha=c.alpha*r,a.fillStyle=s,a.fill()),g.visible&&(a.globalAlpha=g.alpha*r,a.strokeStyle=o,a.stroke())}else if(v.type===e.SHAPES.RREC){var H=p.x,q=p.y,z=p.width,L=p.height,B=p.radius,N=Math.min(z,L)/2|0;B=B>N?N:B,a.beginPath(),a.moveTo(H,q+B),a.lineTo(H,q+L-B),a.quadraticCurveTo(H,q+L,H+B,q+L),a.lineTo(H+z-B,q+L),a.quadraticCurveTo(H+z,q+L,H+z,q+L-B),a.lineTo(H+z,q+B),a.quadraticCurveTo(H+z,q,H+z-B,q),a.lineTo(H+B,q),a.quadraticCurveTo(H,q,H,q+B),a.closePath(),c.visible&&(a.globalAlpha=c.alpha*r,a.fillStyle=s,a.fill()),g.visible&&(a.globalAlpha=g.alpha*r,a.strokeStyle=o,a.stroke())}}},s.prototype.updateGraphicsTint=function(t){t._prevTint=t.tint,t.canvasTintDirty=t.geometry.dirty;for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,a=(255&t.tint)/255,r=t.geometry.graphicsData,l=0;l<r.length;++l){var s=r[l],o=0|s.fillStyle.color,n=0|s.lineStyle.color;s._fillTint=((o>>16&255)/255*e*255<<16)+((o>>8&255)/255*i*255<<8)+(255&o)/255*a*255,s._lineTint=((n>>16&255)/255*e*255<<16)+((n>>8&255)/255*i*255<<8)+(255&n)/255*a*255}},s.prototype.setPatternTransform=function(t,e){if(!1!==this._svgMatrix){if(!this._svgMatrix){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");i&&(this._svgMatrix=i.createSVGMatrix()),this._svgMatrix||(this._svgMatrix=!1)}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}},s.prototype.destroy=function(){this.renderer=null};var o=new e.Matrix;return a.Graphics.prototype.generateCanvasTexture=function(t,e){void 0===e&&(e=1);var a=this.getLocalBounds(),s=r.RenderTexture.create(a.width,a.height,t,e);l||(l=new i.CanvasRenderer),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(o),o.invert(),o.tx-=a.x,o.ty-=a.y,l.render(this,s,!0,o);var n=r.Texture.from(s.baseTexture._canvasRenderTarget.canvas,{scaleMode:t});return n.baseTexture.resolution=e,n.baseTexture.update(),n},a.Graphics.prototype.cachedGraphicsData=[],a.Graphics.prototype._renderCanvas=function(t){!0!==this.isMask&&(this.finishPoly(),t.plugins.graphics.render(this))},t.CanvasGraphicsRenderer=s,t}({},PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_graphics);
this.PIXI=this.PIXI||{};var _pixi_canvas_graphics=function(t,e,i,r,a){"use strict";var l,s=function(t){this.renderer=t,this._svgMatrix=null};s.prototype._calcCanvasStyle=function(t,r){var a;return t.texture?t.texture.valid?(a=i.canvasUtils.getTintedPattern(t.texture,r),this.setPatternTransform(a,t.matrix||e.Matrix.IDENTITY)):a="#808080":a="#"+("00000"+(0|r).toString(16)).substr(-6),a},s.prototype.render=function(t){var i=this.renderer,r=i.context,a=t.worldAlpha,l=t.transform.worldTransform;i.setContextTransform(l),t.canvasTintDirty===t.geometry.dirty&&t._prevTint===t.tint||this.updateGraphicsTint(t),i.setBlendMode(t.blendMode);for(var s,o,n=t.geometry.graphicsData,h=0;h<n.length;h++){var v=n[h],p=v.shape,c=v.fillStyle,g=v.lineStyle;if(c.visible&&(s=this._calcCanvasStyle(c,v._fillTint)),g.visible&&(o=this._calcCanvasStyle(g,v._lineTint)),r.lineWidth=g.width,v.type===e.SHAPES.POLY){r.beginPath();var f=p.points,d=v.holes,T=void 0,y=void 0,u=void 0,x=void 0;r.moveTo(f[0],f[1]);for(var b=2;b<f.length;b+=2)r.lineTo(f[b],f[b+1]);if(p.closeStroke&&r.closePath(),d.length>0){T=0,u=f[0],x=f[1];for(var S=2;S+2<f.length;S+=2)T+=(f[S]-u)*(f[S+3]-x)-(f[S+2]-u)*(f[S+1]-x);for(var _=0;_<d.length;_++)if(f=d[_].shape.points){y=0,u=f[0],x=f[1];for(var P=2;P+2<f.length;P+=2)y+=(f[P]-u)*(f[P+3]-x)-(f[P+2]-u)*(f[P+1]-x);if(y*T<0){r.moveTo(f[0],f[1]);for(var m=2;m<f.length;m+=2)r.lineTo(f[m],f[m+1])}else{r.moveTo(f[f.length-2],f[f.length-1]);for(var M=f.length-4;M>=0;M-=2)r.lineTo(f[M],f[M+1])}d[_].shape.closeStroke&&r.closePath()}}c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}else if(v.type===e.SHAPES.RECT)c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fillRect(p.x,p.y,p.width,p.height)),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.strokeRect(p.x,p.y,p.width,p.height));else if(v.type===e.SHAPES.CIRC)r.beginPath(),r.arc(p.x,p.y,p.radius,0,2*Math.PI),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke());else if(v.type===e.SHAPES.ELIP){var C=2*p.width,I=2*p.height,A=p.x-C/2,w=p.y-I/2;r.beginPath();var k=C/2*.5522848,E=I/2*.5522848,R=A+C,G=w+I,X=A+C/2,D=w+I/2;r.moveTo(A,D),r.bezierCurveTo(A,D-E,X-k,w,X,w),r.bezierCurveTo(X+k,w,R,D-E,R,D),r.bezierCurveTo(R,D+E,X+k,G,X,G),r.bezierCurveTo(X-k,G,A,D+E,A,D),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}else if(v.type===e.SHAPES.RREC){var H=p.x,q=p.y,z=p.width,L=p.height,B=p.radius,N=Math.min(z,L)/2|0;B=B>N?N:B,r.beginPath(),r.moveTo(H,q+B),r.lineTo(H,q+L-B),r.quadraticCurveTo(H,q+L,H+B,q+L),r.lineTo(H+z-B,q+L),r.quadraticCurveTo(H+z,q+L,H+z,q+L-B),r.lineTo(H+z,q+B),r.quadraticCurveTo(H+z,q,H+z-B,q),r.lineTo(H+B,q),r.quadraticCurveTo(H,q,H,q+B),r.closePath(),c.visible&&(r.globalAlpha=c.alpha*a,r.fillStyle=s,r.fill()),g.visible&&(r.globalAlpha=g.alpha*a,r.strokeStyle=o,r.stroke())}}},s.prototype.updateGraphicsTint=function(t){t._prevTint=t.tint,t.canvasTintDirty=t.geometry.dirty;for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,r=(255&t.tint)/255,a=t.geometry.graphicsData,l=0;l<a.length;++l){var s=a[l],o=0|s.fillStyle.color,n=0|s.lineStyle.color;s._fillTint=((o>>16&255)/255*e*255<<16)+((o>>8&255)/255*i*255<<8)+(255&o)/255*r*255,s._lineTint=((n>>16&255)/255*e*255<<16)+((n>>8&255)/255*i*255<<8)+(255&n)/255*r*255}},s.prototype.setPatternTransform=function(t,e){if(!1!==this._svgMatrix){if(!this._svgMatrix){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i&&i.createSVGMatrix&&(this._svgMatrix=i.createSVGMatrix()),!this._svgMatrix||!t.setTransform)return void(this._svgMatrix=!1)}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}},s.prototype.destroy=function(){this.renderer=null};var o=new e.Matrix;return r.Graphics.prototype.generateCanvasTexture=function(t,e){void 0===e&&(e=1);var r=this.getLocalBounds(),s=a.RenderTexture.create(r.width,r.height,t,e);l||(l=new i.CanvasRenderer),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(o),o.invert(),o.tx-=r.x,o.ty-=r.y,l.render(this,s,!0,o);var n=a.Texture.from(s.baseTexture._canvasRenderTarget.canvas,{scaleMode:t});return n.baseTexture.resolution=e,n.baseTexture.update(),n},r.Graphics.prototype.cachedGraphicsData=[],r.Graphics.prototype._renderCanvas=function(t){!0!==this.isMask&&(this.finishPoly(),t.plugins.graphics.render(this))},t.CanvasGraphicsRenderer=s,t}({},PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_graphics);
//# sourceMappingURL=canvas-graphics.min.js.map
/*!
* @pixi/canvas-graphics - v5.2.3
* Compiled Fri, 24 Apr 2020 00:55:22 UTC
* @pixi/canvas-graphics - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
*

@@ -373,9 +373,11 @@ * @pixi/canvas-graphics is licensed under the MIT License.

if (svg)
if (svg && svg.createSVGMatrix)
{
this._svgMatrix = svg.createSVGMatrix();
}
if (!this._svgMatrix)
if (!this._svgMatrix || !pattern.setTransform)
{
this._svgMatrix = false;
return;
}

@@ -382,0 +384,0 @@ }

/*!
* @pixi/canvas-graphics - v5.2.3
* Compiled Fri, 24 Apr 2020 00:55:22 UTC
* @pixi/canvas-graphics - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
*

@@ -377,9 +377,11 @@ * @pixi/canvas-graphics is licensed under the MIT License.

if (svg)
if (svg && svg.createSVGMatrix)
{
this._svgMatrix = svg.createSVGMatrix();
}
if (!this._svgMatrix)
if (!this._svgMatrix || !pattern.setTransform)
{
this._svgMatrix = false;
return;
}

@@ -386,0 +388,0 @@ }

{
"name": "@pixi/canvas-graphics",
"version": "5.2.3",
"version": "5.2.4",
"main": "lib/canvas-graphics.js",

@@ -27,8 +27,8 @@ "module": "lib/canvas-graphics.es.js",

"dependencies": {
"@pixi/canvas-renderer": "5.2.3",
"@pixi/core": "5.2.3",
"@pixi/graphics": "5.2.3",
"@pixi/math": "5.2.3"
"@pixi/canvas-renderer": "5.2.4",
"@pixi/core": "5.2.4",
"@pixi/graphics": "5.2.4",
"@pixi/math": "5.2.4"
},
"gitHead": "7b93fdba90b1ea54469621c30ff1d6b8849e514c"
"gitHead": "71c6b3b2061af4a4f3a95a265d46e933b8befc2c"
}

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 not supported yet

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