@pixi/canvas-mesh
Advanced tools
Comparing version 5.1.5 to 5.2.0
/*! | ||
* @pixi/canvas-mesh - v5.1.5 | ||
* Compiled Tue, 24 Sep 2019 04:07:05 UTC | ||
* @pixi/canvas-mesh - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* | ||
@@ -359,7 +359,7 @@ * @pixi/canvas-mesh is licensed under the MIT License. | ||
this._tintedCanvas = canvasRenderer.CanvasTinter.getTintedCanvas(this, this.tint); | ||
this._tintedCanvas = canvasRenderer.canvasUtils.getTintedCanvas(this, this.tint); | ||
} | ||
} | ||
var textureSource = !isTinted ? texture.baseTexture.source : this._tintedCanvas; | ||
var textureSource = !isTinted ? texture.baseTexture.getDrawableSource() : this._tintedCanvas; | ||
@@ -366,0 +366,0 @@ if (!this._canvasUvs) |
/*! | ||
* @pixi/canvas-mesh - v5.1.5 | ||
* Compiled Tue, 24 Sep 2019 04:07:05 UTC | ||
* @pixi/canvas-mesh - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 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],T=s[r+1],P=s[a+1],I=t.canvasPadding/this.renderer.resolution;if(I>0){var b=I/Math.abs(t.worldTransform.a),w=I/Math.abs(t.worldTransform.d),C=(m+y+x)/3,S=(M+T+P)/3,A=m-C,D=M-S,N=Math.sqrt(A*A+D*D);m=C+A/N*(N+b),M=S+D/N*(N+w),D=T-S,y=C+(A=y-C)/(N=Math.sqrt(A*A+D*D))*(N+b),T=S+D/N*(N+w),D=P-S,x=C+(A=x-C)/(N=Math.sqrt(A*A+D*D))*(N+b),P=S+D/N*(N+w)}i.save(),i.beginPath(),i.moveTo(m,M),i.lineTo(y,T),i.lineTo(x,P),i.closePath(),i.clip();var U=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*P+T*_-f*P-g*T-M*_,R=c*T+M*p+u*P-T*p-M*u-c*P,V=c*f*P+g*T*p+M*u*_-M*f*p-g*u*P-c*T*_;i.transform(X/U,H/U,B/U,R/U,E/U,V/U),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.CanvasTinter.getTintedCanvas(this,this.tint));var h=s?this._tintedCanvas:n.baseTexture.source;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(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); | ||
//# sourceMappingURL=canvas-mesh.min.js.map |
/*! | ||
* @pixi/canvas-mesh - v5.1.5 | ||
* Compiled Tue, 24 Sep 2019 04:07:05 UTC | ||
* @pixi/canvas-mesh - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* | ||
@@ -11,3 +11,3 @@ * @pixi/canvas-mesh is licensed under the MIT License. | ||
import { MeshMaterial, Mesh } from '@pixi/mesh'; | ||
import { CanvasTinter } from '@pixi/canvas-renderer'; | ||
import { canvasUtils } from '@pixi/canvas-renderer'; | ||
import { NineSlicePlane, SimpleMesh, SimpleRope } from '@pixi/mesh-extras'; | ||
@@ -362,7 +362,7 @@ | ||
this._tintedCanvas = CanvasTinter.getTintedCanvas(this, this.tint); | ||
this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint); | ||
} | ||
} | ||
var textureSource = !isTinted ? texture.baseTexture.source : this._tintedCanvas; | ||
var textureSource = !isTinted ? texture.baseTexture.getDrawableSource() : this._tintedCanvas; | ||
@@ -369,0 +369,0 @@ if (!this._canvasUvs) |
/*! | ||
* @pixi/canvas-mesh - v5.1.5 | ||
* Compiled Tue, 24 Sep 2019 04:07:05 UTC | ||
* @pixi/canvas-mesh - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* | ||
@@ -365,7 +365,7 @@ * @pixi/canvas-mesh is licensed under the MIT License. | ||
this._tintedCanvas = canvasRenderer.CanvasTinter.getTintedCanvas(this, this.tint); | ||
this._tintedCanvas = canvasRenderer.canvasUtils.getTintedCanvas(this, this.tint); | ||
} | ||
} | ||
var textureSource = !isTinted ? texture.baseTexture.source : this._tintedCanvas; | ||
var textureSource = !isTinted ? texture.baseTexture.getDrawableSource() : this._tintedCanvas; | ||
@@ -372,0 +372,0 @@ if (!this._canvasUvs) |
{ | ||
"name": "@pixi/canvas-mesh", | ||
"version": "5.1.5", | ||
"version": "5.2.0", | ||
"main": "lib/canvas-mesh.js", | ||
@@ -27,9 +27,13 @@ "module": "lib/canvas-mesh.es.js", | ||
"dependencies": { | ||
"@pixi/canvas-renderer": "^5.1.5", | ||
"@pixi/constants": "^5.1.0", | ||
"@pixi/mesh": "^5.1.5", | ||
"@pixi/mesh-extras": "^5.1.5", | ||
"@pixi/settings": "^5.1.3" | ||
"@pixi/canvas-renderer": "^5.2.0", | ||
"@pixi/constants": "^5.2.0", | ||
"@pixi/mesh": "^5.2.0", | ||
"@pixi/mesh-extras": "^5.2.0", | ||
"@pixi/settings": "^5.2.0" | ||
}, | ||
"gitHead": "8cf3db88d06355cbabea64150cdb0774191e502c" | ||
"devDependencies": { | ||
"@pixi/core": "^5.2.0", | ||
"@pixi/sprite": "^5.2.0" | ||
}, | ||
"gitHead": "aaf96b460582b83a1fa73037ef2dd69dd9e84415" | ||
} |
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
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
158509
2
Updated@pixi/canvas-renderer@^5.2.0
Updated@pixi/constants@^5.2.0
Updated@pixi/mesh@^5.2.0
Updated@pixi/mesh-extras@^5.2.0
Updated@pixi/settings@^5.2.0