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

@pixi/canvas-mesh

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-mesh - npm Package Compare versions

Comparing version 5.2.1 to 5.2.2

65

dist/canvas-mesh.js
/*!
* @pixi/canvas-mesh - v5.2.1
* Compiled Tue, 28 Jan 2020 23:33:11 UTC
* @pixi/canvas-mesh - v5.2.2
* Compiled Tue, 21 Apr 2020 03:53:51 UTC
*

@@ -32,32 +32,7 @@ * @pixi/canvas-mesh is licensed under the MIT License.

var renderer = this.renderer;
var context = renderer.context;
var transform = mesh.worldTransform;
var res = renderer.resolution;
if (mesh.roundPixels)
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
(transform.tx * res) | 0,
(transform.ty * res) | 0
);
}
else
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
transform.tx * res,
transform.ty * res
);
}
renderer.context.globalAlpha = mesh.worldAlpha;
renderer.setBlendMode(mesh.blendMode);
renderer.setContextTransform(transform, mesh.roundPixels);

@@ -347,6 +322,10 @@ if (mesh.drawMode !== constants.DRAW_MODES.TRIANGLES)

var transform = this.worldTransform;
var res = renderer.resolution;
var isTinted = this.tint !== 0xFFFFFF;
var texture = this.texture;
if (!texture.valid)
{
return;
}
// Work out tinting

@@ -395,26 +374,4 @@ if (isTinted)

renderer.setBlendMode(this.blendMode);
renderer.setContextTransform(transform, this.roundPixels);
if (this.roundPixels)
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
(transform.tx * res) | 0,
(transform.ty * res) | 0
);
}
else
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
transform.tx * res,
transform.ty * res
);
}
for (var row = 0; row < 3; row++)

@@ -525,5 +482,5 @@ {

if (this.autoUpdate
|| this.geometry.width !== this.shader.texture.height)
|| this.geometry._width !== this.shader.texture.height)
{
this.geometry.width = this.shader.texture.height;
this.geometry._width = this.shader.texture.height;
this.geometry.update();

@@ -530,0 +487,0 @@ }

6

dist/canvas-mesh.min.js
/*!
* @pixi/canvas-mesh - v5.2.1
* Compiled Tue, 28 Jan 2020 23:33:11 UTC
* @pixi/canvas-mesh - v5.2.2
* Compiled Tue, 21 Apr 2020 03:53:51 UTC
*

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

*/
this.PIXI=this.PIXI||{};var _pixi_canvas_mesh=function(t,e,r,a,i,s){"use strict";var n=function(t){this.renderer=t};return n.prototype.render=function(t){var r=this.renderer,a=r.context,i=t.worldTransform,s=r.resolution;t.roundPixels?a.setTransform(i.a*s,i.b*s,i.c*s,i.d*s,i.tx*s|0,i.ty*s|0):a.setTransform(i.a*s,i.b*s,i.c*s,i.d*s,i.tx*s,i.ty*s),r.context.globalAlpha=t.worldAlpha,r.setBlendMode(t.blendMode),t.drawMode!==e.DRAW_MODES.TRIANGLES?this._renderTriangleMesh(t):this._renderTriangles(t)},n.prototype._renderTriangleMesh=function(t){for(var e=t.geometry.buffers[0].data.length,r=0;r<e-2;r++){var a=2*r;this._renderDrawTriangle(t,a,a+2,a+4)}},n.prototype._renderTriangles=function(t){for(var e=t.geometry.getIndex().data,r=e.length,a=0;a<r;a+=3){var i=2*e[a],s=2*e[a+1],n=2*e[a+2];this._renderDrawTriangle(t,i,s,n)}},n.prototype._renderDrawTriangle=function(t,e,r,a){var i=this.renderer.context,s=t.geometry.buffers[0].data,n=t.uvs,h=t.texture;if(h.valid){var o=h.baseTexture,d=o.getDrawableSource(),l=o.width,v=o.height,c=n[e]*o.width,u=n[r]*o.width,p=n[a]*o.width,g=n[e+1]*o.height,f=n[r+1]*o.height,_=n[a+1]*o.height,m=s[e],y=s[r],x=s[a],M=s[e+1],P=s[r+1],T=s[a+1],b=t.canvasPadding/this.renderer.resolution;if(b>0){var I=b/Math.abs(t.worldTransform.a),w=b/Math.abs(t.worldTransform.d),C=(m+y+x)/3,S=(M+P+T)/3,A=m-C,D=M-S,U=Math.sqrt(A*A+D*D);m=C+A/U*(U+I),M=S+D/U*(U+w),D=P-S,y=C+(A=y-C)/(U=Math.sqrt(A*A+D*D))*(U+I),P=S+D/U*(U+w),D=T-S,x=C+(A=x-C)/(U=Math.sqrt(A*A+D*D))*(U+I),T=S+D/U*(U+w)}i.save(),i.beginPath(),i.moveTo(m,M),i.lineTo(y,P),i.lineTo(x,T),i.closePath(),i.clip();var N=c*f+g*p+u*_-f*p-g*u-c*_,X=m*f+g*x+y*_-f*x-g*y-m*_,B=c*y+m*p+u*x-y*p-m*u-c*x,E=c*f*x+g*y*p+m*u*_-m*f*p-g*u*x-c*y*_,H=M*f+g*T+P*_-f*T-g*P-M*_,R=c*P+M*p+u*T-P*p-M*u-c*T,V=c*f*T+g*P*p+M*u*_-M*f*p-g*u*T-c*P*_;i.transform(X/N,H/N,B/N,R/N,E/N,V/N),i.drawImage(d,0,0,l*o.resolution,v*o.resolution,0,0,l,v),i.restore(),this.renderer.invalidateBlendMode()}},n.prototype.renderMeshFlat=function(t){var e=this.renderer.context,r=t.geometry.getBuffer("aVertexPosition").data,a=r.length/2;e.beginPath();for(var i=1;i<a-2;++i){var s=2*i,n=r[s],h=r[s+1],o=r[s+2],d=r[s+3],l=r[s+4],v=r[s+5];e.moveTo(n,h),e.lineTo(o,d),e.lineTo(l,v)}e.fillStyle="#FF0000",e.fill(),e.closePath()},n.prototype.destroy=function(){this.renderer=null},r.settings.MESH_CANVAS_PADDING=0,a.MeshMaterial.prototype._renderCanvas=function(t,e){t.plugins.mesh.render(e)},s.NineSlicePlane.prototype._cachedTint=16777215,s.NineSlicePlane.prototype._tintedCanvas=null,s.NineSlicePlane.prototype._canvasUvs=null,s.NineSlicePlane.prototype._renderCanvas=function(t){var e=t.context,r=this.worldTransform,a=t.resolution,s=16777215!==this.tint,n=this.texture;s&&this._cachedTint!==this.tint&&(this._cachedTint=this.tint,this._tintedCanvas=i.canvasUtils.getTintedCanvas(this,this.tint));var h=s?this._tintedCanvas:n.baseTexture.getDrawableSource();this._canvasUvs||(this._canvasUvs=[0,0,0,0,0,0,0,0]);var o=this.vertices,d=this._canvasUvs,l=s?0:n.frame.x,v=s?0:n.frame.y,c=l+n.frame.width,u=v+n.frame.height;d[0]=l,d[1]=l+this._leftWidth,d[2]=c-this._rightWidth,d[3]=c,d[4]=v,d[5]=v+this._topHeight,d[6]=u-this._bottomHeight,d[7]=u;for(var p=0;p<8;p++)d[p]*=n.baseTexture.resolution;e.globalAlpha=this.worldAlpha,t.setBlendMode(this.blendMode),this.roundPixels?e.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*a|0,r.ty*a|0):e.setTransform(r.a*a,r.b*a,r.c*a,r.d*a,r.tx*a,r.ty*a);for(var g=0;g<3;g++)for(var f=0;f<3;f++){var _=2*f+8*g,m=Math.max(1,d[f+1]-d[f]),y=Math.max(1,d[g+5]-d[g+4]),x=Math.max(1,o[_+10]-o[_]),M=Math.max(1,o[_+11]-o[_+1]);e.drawImage(h,d[f],d[g+4],m,y,o[_],o[_+1],x,M)}},a.Mesh.prototype._renderCanvas=function(t){this.shader.uvMatrix&&(this.shader.uvMatrix.update(),this.calculateUvs()),this.material._renderCanvas(t,this)},a.Mesh.prototype._canvasPadding=null,Object.defineProperty(a.Mesh.prototype,"canvasPadding",{get:function(){return null!==this._canvasPadding?this._canvasPadding:r.settings.MESH_CANVAS_PADDING},set:function(t){this._canvasPadding=t}}),s.SimpleMesh.prototype._renderCanvas=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(t,this)},s.SimpleRope.prototype._renderCanvas=function(t){(this.autoUpdate||this.geometry.width!==this.shader.texture.height)&&(this.geometry.width=this.shader.texture.height,this.geometry.update()),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(t,this)},t.CanvasMeshRenderer=n,t}({},PIXI,PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_mesh);
this.PIXI=this.PIXI||{};var _pixi_canvas_mesh=function(e,t,r,a,i,s){"use strict";var n=function(e){this.renderer=e};return n.prototype.render=function(e){var r=this.renderer,a=e.worldTransform;r.context.globalAlpha=e.worldAlpha,r.setBlendMode(e.blendMode),r.setContextTransform(a,e.roundPixels),e.drawMode!==t.DRAW_MODES.TRIANGLES?this._renderTriangleMesh(e):this._renderTriangles(e)},n.prototype._renderTriangleMesh=function(e){for(var t=e.geometry.buffers[0].data.length,r=0;r<t-2;r++){var a=2*r;this._renderDrawTriangle(e,a,a+2,a+4)}},n.prototype._renderTriangles=function(e){for(var t=e.geometry.getIndex().data,r=t.length,a=0;a<r;a+=3){var i=2*t[a],s=2*t[a+1],n=2*t[a+2];this._renderDrawTriangle(e,i,s,n)}},n.prototype._renderDrawTriangle=function(e,t,r,a){var i=this.renderer.context,s=e.geometry.buffers[0].data,n=e.uvs,h=e.texture;if(h.valid){var o=h.baseTexture,d=o.getDrawableSource(),l=o.width,v=o.height,u=n[t]*o.width,c=n[r]*o.width,p=n[a]*o.width,g=n[t+1]*o.height,f=n[r+1]*o.height,_=n[a+1]*o.height,m=s[t],M=s[r],P=s[a],y=s[t+1],x=s[r+1],T=s[a+1],I=e.canvasPadding/this.renderer.resolution;if(I>0){var w=I/Math.abs(e.worldTransform.a),b=I/Math.abs(e.worldTransform.d),C=(m+M+P)/3,S=(y+x+T)/3,A=m-C,D=y-S,U=Math.sqrt(A*A+D*D);m=C+A/U*(U+w),y=S+D/U*(U+b),D=x-S,M=C+(A=M-C)/(U=Math.sqrt(A*A+D*D))*(U+w),x=S+D/U*(U+b),D=T-S,P=C+(A=P-C)/(U=Math.sqrt(A*A+D*D))*(U+w),T=S+D/U*(U+b)}i.save(),i.beginPath(),i.moveTo(m,y),i.lineTo(M,x),i.lineTo(P,T),i.closePath(),i.clip();var N=u*f+g*p+c*_-f*p-g*c-u*_,X=m*f+g*P+M*_-f*P-g*M-m*_,B=u*M+m*p+c*P-M*p-m*c-u*P,E=u*f*P+g*M*p+m*c*_-m*f*p-g*c*P-u*M*_,H=y*f+g*T+x*_-f*T-g*x-y*_,R=u*x+y*p+c*T-x*p-y*c-u*T,V=u*f*T+g*x*p+y*c*_-y*f*p-g*c*T-u*x*_;i.transform(X/N,H/N,B/N,R/N,E/N,V/N),i.drawImage(d,0,0,l*o.resolution,v*o.resolution,0,0,l,v),i.restore(),this.renderer.invalidateBlendMode()}},n.prototype.renderMeshFlat=function(e){var t=this.renderer.context,r=e.geometry.getBuffer("aVertexPosition").data,a=r.length/2;t.beginPath();for(var i=1;i<a-2;++i){var s=2*i,n=r[s],h=r[s+1],o=r[s+2],d=r[s+3],l=r[s+4],v=r[s+5];t.moveTo(n,h),t.lineTo(o,d),t.lineTo(l,v)}t.fillStyle="#FF0000",t.fill(),t.closePath()},n.prototype.destroy=function(){this.renderer=null},r.settings.MESH_CANVAS_PADDING=0,a.MeshMaterial.prototype._renderCanvas=function(e,t){e.plugins.mesh.render(t)},s.NineSlicePlane.prototype._cachedTint=16777215,s.NineSlicePlane.prototype._tintedCanvas=null,s.NineSlicePlane.prototype._canvasUvs=null,s.NineSlicePlane.prototype._renderCanvas=function(e){var t=e.context,r=this.worldTransform,a=16777215!==this.tint,s=this.texture;if(s.valid){a&&this._cachedTint!==this.tint&&(this._cachedTint=this.tint,this._tintedCanvas=i.canvasUtils.getTintedCanvas(this,this.tint));var n=a?this._tintedCanvas:s.baseTexture.getDrawableSource();this._canvasUvs||(this._canvasUvs=[0,0,0,0,0,0,0,0]);var h=this.vertices,o=this._canvasUvs,d=a?0:s.frame.x,l=a?0:s.frame.y,v=d+s.frame.width,u=l+s.frame.height;o[0]=d,o[1]=d+this._leftWidth,o[2]=v-this._rightWidth,o[3]=v,o[4]=l,o[5]=l+this._topHeight,o[6]=u-this._bottomHeight,o[7]=u;for(var c=0;c<8;c++)o[c]*=s.baseTexture.resolution;t.globalAlpha=this.worldAlpha,e.setBlendMode(this.blendMode),e.setContextTransform(r,this.roundPixels);for(var p=0;p<3;p++)for(var g=0;g<3;g++){var f=2*g+8*p,_=Math.max(1,o[g+1]-o[g]),m=Math.max(1,o[p+5]-o[p+4]),M=Math.max(1,h[f+10]-h[f]),P=Math.max(1,h[f+11]-h[f+1]);t.drawImage(n,o[g],o[p+4],_,m,h[f],h[f+1],M,P)}}},a.Mesh.prototype._renderCanvas=function(e){this.shader.uvMatrix&&(this.shader.uvMatrix.update(),this.calculateUvs()),this.material._renderCanvas(e,this)},a.Mesh.prototype._canvasPadding=null,Object.defineProperty(a.Mesh.prototype,"canvasPadding",{get:function(){return null!==this._canvasPadding?this._canvasPadding:r.settings.MESH_CANVAS_PADDING},set:function(e){this._canvasPadding=e}}),s.SimpleMesh.prototype._renderCanvas=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(e,this)},s.SimpleRope.prototype._renderCanvas=function(e){(this.autoUpdate||this.geometry._width!==this.shader.texture.height)&&(this.geometry._width=this.shader.texture.height,this.geometry.update()),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(e,this)},e.CanvasMeshRenderer=n,e}({},PIXI,PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_canvas_mesh);
//# sourceMappingURL=canvas-mesh.min.js.map
/*!
* @pixi/canvas-mesh - v5.2.1
* Compiled Tue, 28 Jan 2020 23:33:11 UTC
* @pixi/canvas-mesh - v5.2.2
* Compiled Tue, 21 Apr 2020 03:53:51 UTC
*

@@ -34,32 +34,7 @@ * @pixi/canvas-mesh is licensed under the MIT License.

var renderer = this.renderer;
var context = renderer.context;
var transform = mesh.worldTransform;
var res = renderer.resolution;
if (mesh.roundPixels)
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
(transform.tx * res) | 0,
(transform.ty * res) | 0
);
}
else
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
transform.tx * res,
transform.ty * res
);
}
renderer.context.globalAlpha = mesh.worldAlpha;
renderer.setBlendMode(mesh.blendMode);
renderer.setContextTransform(transform, mesh.roundPixels);

@@ -349,6 +324,10 @@ if (mesh.drawMode !== DRAW_MODES.TRIANGLES)

var transform = this.worldTransform;
var res = renderer.resolution;
var isTinted = this.tint !== 0xFFFFFF;
var texture = this.texture;
if (!texture.valid)
{
return;
}
// Work out tinting

@@ -397,26 +376,4 @@ if (isTinted)

renderer.setBlendMode(this.blendMode);
renderer.setContextTransform(transform, this.roundPixels);
if (this.roundPixels)
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
(transform.tx * res) | 0,
(transform.ty * res) | 0
);
}
else
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
transform.tx * res,
transform.ty * res
);
}
for (var row = 0; row < 3; row++)

@@ -527,5 +484,5 @@ {

if (this.autoUpdate
|| this.geometry.width !== this.shader.texture.height)
|| this.geometry._width !== this.shader.texture.height)
{
this.geometry.width = this.shader.texture.height;
this.geometry._width = this.shader.texture.height;
this.geometry.update();

@@ -532,0 +489,0 @@ }

/*!
* @pixi/canvas-mesh - v5.2.1
* Compiled Tue, 28 Jan 2020 23:33:11 UTC
* @pixi/canvas-mesh - v5.2.2
* Compiled Tue, 21 Apr 2020 03:53:51 UTC
*

@@ -38,32 +38,7 @@ * @pixi/canvas-mesh is licensed under the MIT License.

var renderer = this.renderer;
var context = renderer.context;
var transform = mesh.worldTransform;
var res = renderer.resolution;
if (mesh.roundPixels)
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
(transform.tx * res) | 0,
(transform.ty * res) | 0
);
}
else
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
transform.tx * res,
transform.ty * res
);
}
renderer.context.globalAlpha = mesh.worldAlpha;
renderer.setBlendMode(mesh.blendMode);
renderer.setContextTransform(transform, mesh.roundPixels);

@@ -353,6 +328,10 @@ if (mesh.drawMode !== constants.DRAW_MODES.TRIANGLES)

var transform = this.worldTransform;
var res = renderer.resolution;
var isTinted = this.tint !== 0xFFFFFF;
var texture = this.texture;
if (!texture.valid)
{
return;
}
// Work out tinting

@@ -401,26 +380,4 @@ if (isTinted)

renderer.setBlendMode(this.blendMode);
renderer.setContextTransform(transform, this.roundPixels);
if (this.roundPixels)
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
(transform.tx * res) | 0,
(transform.ty * res) | 0
);
}
else
{
context.setTransform(
transform.a * res,
transform.b * res,
transform.c * res,
transform.d * res,
transform.tx * res,
transform.ty * res
);
}
for (var row = 0; row < 3; row++)

@@ -531,5 +488,5 @@ {

if (this.autoUpdate
|| this.geometry.width !== this.shader.texture.height)
|| this.geometry._width !== this.shader.texture.height)
{
this.geometry.width = this.shader.texture.height;
this.geometry._width = this.shader.texture.height;
this.geometry.update();

@@ -536,0 +493,0 @@ }

{
"name": "@pixi/canvas-mesh",
"version": "5.2.1",
"version": "5.2.2",
"main": "lib/canvas-mesh.js",

@@ -27,13 +27,13 @@ "module": "lib/canvas-mesh.es.js",

"dependencies": {
"@pixi/canvas-renderer": "5.2.1",
"@pixi/constants": "5.2.1",
"@pixi/mesh": "5.2.1",
"@pixi/mesh-extras": "5.2.1",
"@pixi/settings": "5.2.1"
"@pixi/canvas-renderer": "5.2.2",
"@pixi/constants": "5.2.2",
"@pixi/mesh": "5.2.2",
"@pixi/mesh-extras": "5.2.2",
"@pixi/settings": "5.2.2"
},
"devDependencies": {
"@pixi/core": "5.2.1",
"@pixi/sprite": "5.2.1"
"@pixi/core": "5.2.2",
"@pixi/sprite": "5.2.2"
},
"gitHead": "b56b4fca1c169f0e6d2a0472251ba1f7399bb4a3"
"gitHead": "c163c466c20f2286b6e41ab90d68a03aad2051d4"
}

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