@pixi/mesh-extras
Advanced tools
Comparing version 6.3.0 to 6.3.1
/*! | ||
* @pixi/mesh-extras - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/mesh-extras - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -812,6 +812,8 @@ * @pixi/mesh-extras is licensed under the MIT License. | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
return exports; | ||
}({}, PIXI, PIXI, PIXI)); | ||
})({}, PIXI, PIXI, PIXI); | ||
Object.assign(this.PIXI, _pixi_mesh_extras); | ||
//# sourceMappingURL=mesh-extras.js.map |
/*! | ||
* @pixi/mesh-extras - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/mesh-extras - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/mesh-extras is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{};var _pixi_mesh_extras=function(t,e,i,r){"use strict";var h=function(t,e){return(h=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 o(t,e){function i(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var s=function(t){function e(e,i,r,h){void 0===e&&(e=100),void 0===i&&(i=100),void 0===r&&(r=10),void 0===h&&(h=10);var o=t.call(this)||this;return o.segWidth=r,o.segHeight=h,o.width=e,o.height=i,o.build(),o}return o(e,t),e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],i=[],r=[],h=this.segWidth-1,o=this.segHeight-1,s=this.width/h,n=this.height/o,a=0;a<t;a++){var u=a%this.segWidth,d=a/this.segWidth|0;e.push(u*s,d*n),i.push(u/h,d/o)}var f=h*o;for(a=0;a<f;a++){var p=a%h,g=a/h|0,c=g*this.segWidth+p,l=g*this.segWidth+p+1,_=(g+1)*this.segWidth+p,y=(g+1)*this.segWidth+p+1;r.push(c,l,_,l,y,_)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(e.MeshGeometry),n=function(t){function e(e,i,r){void 0===e&&(e=200),void 0===r&&(r=0);var h=t.call(this,new Float32Array(4*i.length),new Float32Array(4*i.length),new Uint16Array(6*(i.length-1)))||this;return h.points=i,h._width=e,h.textureScale=r,h.build(),h}return o(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array(6*(t.length-1)));var h=i.data,o=r.data;h[0]=0,h[1]=0,h[2]=0,h[3]=1;for(var s=0,n=t[0],a=this._width*this.textureScale,u=t.length,d=0;d<u;d++){var f=4*d;if(this.textureScale>0){var p=n.x-t[d].x,g=n.y-t[d].y,c=Math.sqrt(p*p+g*g);n=t[d],s+=c/a}else s=d/(u-1);h[f]=s,h[f+1]=0,h[f+2]=s,h[f+3]=1}var l=0;for(d=0;d<u-1;d++){f=2*d;o[l++]=f,o[l++]=f+1,o[l++]=f+2,o[l++]=f+2,o[l++]=f+1,o[l++]=f+3}i.update(),r.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var e,i=t[0],r=0,h=0,o=this.buffers[0].data,s=t.length,n=0;n<s;n++){var a=t[n],u=4*n;h=-((e=n<t.length-1?t[n+1]:a).x-i.x),r=e.y-i.y;var d=10*(1-n/(s-1));d>1&&(d=1);var f=Math.sqrt(r*r+h*h),p=this.textureScale>0?this.textureScale*this._width/2:this._width/2;r/=f,h/=f,r*=p,h*=p,o[u]=a.x+r,o[u+1]=a.y+h,o[u+2]=a.x-r,o[u+3]=a.y-h,i=a}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(e.MeshGeometry),a=function(t){function r(r,h,o){void 0===o&&(o=0);var s=this,a=new n(r.height,h,o),u=new e.MeshMaterial(r);return o>0&&(r.baseTexture.wrapMode=i.WRAP_MODES.REPEAT),(s=t.call(this,a,u)||this).autoUpdate=!0,s}return o(r,t),r.prototype._render=function(e){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),t.prototype._render.call(this,e)},r}(e.Mesh),u=function(t){function i(i,h,o){var n=this,a=new s(i.width,i.height,h,o),u=new e.MeshMaterial(r.Texture.WHITE);return(n=t.call(this,a,u)||this).texture=i,n.autoResize=!0,n}return o(i,t),i.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,e=this.shader.texture,i=e.width,r=e.height;!this.autoResize||t.width===i&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(i.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),i.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},i.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},i}(e.Mesh),d=function(t){function i(i,h,o,s,n){void 0===i&&(i=r.Texture.EMPTY);var a=this,u=new e.MeshGeometry(h,o,s);u.getBuffer("aVertexPosition").static=!1;var d=new e.MeshMaterial(i);return(a=t.call(this,u,d,null,n)||this).autoUpdate=!0,a}return o(i,t),Object.defineProperty(i.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),i.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),t.prototype._render.call(this,e)},i}(e.Mesh),f=10,p=function(t){function e(e,i,h,o,s){void 0===i&&(i=f),void 0===h&&(h=f),void 0===o&&(o=f),void 0===s&&(s=f);var n=t.call(this,r.Texture.WHITE,4,4)||this;return n._origWidth=e.orig.width,n._origHeight=e.orig.height,n._width=n._origWidth,n._height=n._origHeight,n._leftWidth=i,n._rightWidth=o,n._topHeight=h,n._bottomHeight=s,n.texture=e,n}return o(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight,r=this._height>i?1:this._height/i;return Math.min(e,r)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var i=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(u);return t.NineSlicePlane=p,t.PlaneGeometry=s,t.RopeGeometry=n,t.SimpleMesh=d,t.SimplePlane=u,t.SimpleRope=a,t}({},PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_mesh_extras); | ||
this.PIXI=this.PIXI||{};var _pixi_mesh_extras=function(t,e,i,r){"use strict";var h=function(t,e){return h=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])},h(t,e)};function o(t,e){function i(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var s=function(t){function e(e,i,r,h){void 0===e&&(e=100),void 0===i&&(i=100),void 0===r&&(r=10),void 0===h&&(h=10);var o=t.call(this)||this;return o.segWidth=r,o.segHeight=h,o.width=e,o.height=i,o.build(),o}return o(e,t),e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],i=[],r=[],h=this.segWidth-1,o=this.segHeight-1,s=this.width/h,n=this.height/o,a=0;a<t;a++){var u=a%this.segWidth,d=a/this.segWidth|0;e.push(u*s,d*n),i.push(u/h,d/o)}var f=h*o;for(a=0;a<f;a++){var p=a%h,g=a/h|0,c=g*this.segWidth+p,l=g*this.segWidth+p+1,_=(g+1)*this.segWidth+p,y=(g+1)*this.segWidth+p+1;r.push(c,l,_,l,y,_)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(e.MeshGeometry),n=function(t){function e(e,i,r){void 0===e&&(e=200),void 0===r&&(r=0);var h=t.call(this,new Float32Array(4*i.length),new Float32Array(4*i.length),new Uint16Array(6*(i.length-1)))||this;return h.points=i,h._width=e,h.textureScale=r,h.build(),h}return o(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array(6*(t.length-1)));var h=i.data,o=r.data;h[0]=0,h[1]=0,h[2]=0,h[3]=1;for(var s=0,n=t[0],a=this._width*this.textureScale,u=t.length,d=0;d<u;d++){var f=4*d;if(this.textureScale>0){var p=n.x-t[d].x,g=n.y-t[d].y,c=Math.sqrt(p*p+g*g);n=t[d],s+=c/a}else s=d/(u-1);h[f]=s,h[f+1]=0,h[f+2]=s,h[f+3]=1}var l=0;for(d=0;d<u-1;d++){f=2*d;o[l++]=f,o[l++]=f+1,o[l++]=f+2,o[l++]=f+2,o[l++]=f+1,o[l++]=f+3}i.update(),r.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var e,i=t[0],r=0,h=0,o=this.buffers[0].data,s=t.length,n=0;n<s;n++){var a=t[n],u=4*n;h=-((e=n<t.length-1?t[n+1]:a).x-i.x),r=e.y-i.y;var d=10*(1-n/(s-1));d>1&&(d=1);var f=Math.sqrt(r*r+h*h),p=this.textureScale>0?this.textureScale*this._width/2:this._width/2;r/=f,h/=f,r*=p,h*=p,o[u]=a.x+r,o[u+1]=a.y+h,o[u+2]=a.x-r,o[u+3]=a.y-h,i=a}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(e.MeshGeometry),a=function(t){function r(r,h,o){void 0===o&&(o=0);var s=this,a=new n(r.height,h,o),u=new e.MeshMaterial(r);return o>0&&(r.baseTexture.wrapMode=i.WRAP_MODES.REPEAT),(s=t.call(this,a,u)||this).autoUpdate=!0,s}return o(r,t),r.prototype._render=function(e){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),t.prototype._render.call(this,e)},r}(e.Mesh),u=function(t){function i(i,h,o){var n=this,a=new s(i.width,i.height,h,o),u=new e.MeshMaterial(r.Texture.WHITE);return(n=t.call(this,a,u)||this).texture=i,n.autoResize=!0,n}return o(i,t),i.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,e=this.shader.texture,i=e.width,r=e.height;!this.autoResize||t.width===i&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(i.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),i.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},i.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},i}(e.Mesh),d=function(t){function i(i,h,o,s,n){void 0===i&&(i=r.Texture.EMPTY);var a=this,u=new e.MeshGeometry(h,o,s);u.getBuffer("aVertexPosition").static=!1;var d=new e.MeshMaterial(i);return(a=t.call(this,u,d,null,n)||this).autoUpdate=!0,a}return o(i,t),Object.defineProperty(i.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),i.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),t.prototype._render.call(this,e)},i}(e.Mesh),f=function(t){function e(e,i,h,o,s){void 0===i&&(i=10),void 0===h&&(h=10),void 0===o&&(o=10),void 0===s&&(s=10);var n=t.call(this,r.Texture.WHITE,4,4)||this;return n._origWidth=e.orig.width,n._origHeight=e.orig.height,n._width=n._origWidth,n._height=n._origHeight,n._leftWidth=i,n._rightWidth=o,n._topHeight=h,n._bottomHeight=s,n.texture=e,n}return o(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight,r=this._height>i?1:this._height/i;return Math.min(e,r)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var i=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(u);return t.NineSlicePlane=f,t.PlaneGeometry=s,t.RopeGeometry=n,t.SimpleMesh=d,t.SimplePlane=u,t.SimpleRope=a,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_mesh_extras); | ||
//# sourceMappingURL=mesh-extras.min.js.map |
/*! | ||
* @pixi/mesh-extras - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/mesh-extras - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -5,0 +5,0 @@ * @pixi/mesh-extras is licensed under the MIT License. |
/*! | ||
* @pixi/mesh-extras - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/mesh-extras - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/mesh-extras is licensed under the MIT License. | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var mesh=require("@pixi/mesh"),constants=require("@pixi/constants"),core=require("@pixi/core"),extendStatics=function(t,e){return(extendStatics=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 __extends(t,e){function i(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var PlaneGeometry=function(t){function e(e,i,r,h){void 0===e&&(e=100),void 0===i&&(i=100),void 0===r&&(r=10),void 0===h&&(h=10);var s=t.call(this)||this;return s.segWidth=r,s.segHeight=h,s.width=e,s.height=i,s.build(),s}return __extends(e,t),e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],i=[],r=[],h=this.segWidth-1,s=this.segHeight-1,o=this.width/h,n=this.height/s,a=0;a<t;a++){var u=a%this.segWidth,d=a/this.segWidth|0;e.push(u*o,d*n),i.push(u/h,d/s)}var p=h*s;for(a=0;a<p;a++){var f=a%h,g=a/h|0,c=g*this.segWidth+f,l=g*this.segWidth+f+1,_=(g+1)*this.segWidth+f,y=(g+1)*this.segWidth+f+1;r.push(c,l,_,l,y,_)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(mesh.MeshGeometry),RopeGeometry=function(t){function e(e,i,r){void 0===e&&(e=200),void 0===r&&(r=0);var h=t.call(this,new Float32Array(4*i.length),new Float32Array(4*i.length),new Uint16Array(6*(i.length-1)))||this;return h.points=i,h._width=e,h.textureScale=r,h.build(),h}return __extends(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array(6*(t.length-1)));var h=i.data,s=r.data;h[0]=0,h[1]=0,h[2]=0,h[3]=1;for(var o=0,n=t[0],a=this._width*this.textureScale,u=t.length,d=0;d<u;d++){var p=4*d;if(this.textureScale>0){var f=n.x-t[d].x,g=n.y-t[d].y,c=Math.sqrt(f*f+g*g);n=t[d],o+=c/a}else o=d/(u-1);h[p]=o,h[p+1]=0,h[p+2]=o,h[p+3]=1}var l=0;for(d=0;d<u-1;d++){p=2*d;s[l++]=p,s[l++]=p+1,s[l++]=p+2,s[l++]=p+2,s[l++]=p+1,s[l++]=p+3}i.update(),r.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var e,i=t[0],r=0,h=0,s=this.buffers[0].data,o=t.length,n=0;n<o;n++){var a=t[n],u=4*n;h=-((e=n<t.length-1?t[n+1]:a).x-i.x),r=e.y-i.y;var d=Math.sqrt(r*r+h*h),p=this.textureScale>0?this.textureScale*this._width/2:this._width/2;r/=d,h/=d,r*=p,h*=p,s[u]=a.x+r,s[u+1]=a.y+h,s[u+2]=a.x-r,s[u+3]=a.y-h,i=a}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(mesh.MeshGeometry),SimpleRope=function(t){function e(e,i,r){void 0===r&&(r=0);var h=this,s=new RopeGeometry(e.height,i,r),o=new mesh.MeshMaterial(e);return r>0&&(e.baseTexture.wrapMode=constants.WRAP_MODES.REPEAT),(h=t.call(this,s,o)||this).autoUpdate=!0,h}return __extends(e,t),e.prototype._render=function(e){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),t.prototype._render.call(this,e)},e}(mesh.Mesh),SimplePlane=function(t){function e(e,i,r){var h=this,s=new PlaneGeometry(e.width,e.height,i,r),o=new mesh.MeshMaterial(core.Texture.WHITE);return(h=t.call(this,s,o)||this).texture=e,h.autoResize=!0,h}return __extends(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,e=this.shader.texture,i=e.width,r=e.height;!this.autoResize||t.width===i&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},e.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},e}(mesh.Mesh),SimpleMesh=function(t){function e(e,i,r,h,s){void 0===e&&(e=core.Texture.EMPTY);var o=this,n=new mesh.MeshGeometry(i,r,h);n.getBuffer("aVertexPosition").static=!1;var a=new mesh.MeshMaterial(e);return(o=t.call(this,n,a,null,s)||this).autoUpdate=!0,o}return __extends(e,t),Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),t.prototype._render.call(this,e)},e}(mesh.Mesh),DEFAULT_BORDER_SIZE=10,NineSlicePlane=function(t){function e(e,i,r,h,s){void 0===i&&(i=DEFAULT_BORDER_SIZE),void 0===r&&(r=DEFAULT_BORDER_SIZE),void 0===h&&(h=DEFAULT_BORDER_SIZE),void 0===s&&(s=DEFAULT_BORDER_SIZE);var o=t.call(this,core.Texture.WHITE,4,4)||this;return o._origWidth=e.orig.width,o._origHeight=e.orig.height,o._width=o._origWidth,o._height=o._origHeight,o._leftWidth=i,o._rightWidth=h,o._topHeight=r,o._bottomHeight=s,o.texture=e,o}return __extends(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight,r=this._height>i?1:this._height/i;return Math.min(e,r)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var i=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(SimplePlane);exports.NineSlicePlane=NineSlicePlane,exports.PlaneGeometry=PlaneGeometry,exports.RopeGeometry=RopeGeometry,exports.SimpleMesh=SimpleMesh,exports.SimplePlane=SimplePlane,exports.SimpleRope=SimpleRope; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@pixi/mesh"),e=require("@pixi/constants"),i=require("@pixi/core"),r=function(t,e){return r=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])},r(t,e)};function h(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var o=function(t){function e(e,i,r,h){void 0===e&&(e=100),void 0===i&&(i=100),void 0===r&&(r=10),void 0===h&&(h=10);var o=t.call(this)||this;return o.segWidth=r,o.segHeight=h,o.width=e,o.height=i,o.build(),o}return h(e,t),e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],i=[],r=[],h=this.segWidth-1,o=this.segHeight-1,s=this.width/h,n=this.height/o,a=0;a<t;a++){var u=a%this.segWidth,d=a/this.segWidth|0;e.push(u*s,d*n),i.push(u/h,d/o)}var p=h*o;for(a=0;a<p;a++){var f=a%h,g=a/h|0,c=g*this.segWidth+f,l=g*this.segWidth+f+1,_=(g+1)*this.segWidth+f,y=(g+1)*this.segWidth+f+1;r.push(c,l,_,l,y,_)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(t.MeshGeometry),s=function(t){function e(e,i,r){void 0===e&&(e=200),void 0===r&&(r=0);var h=t.call(this,new Float32Array(4*i.length),new Float32Array(4*i.length),new Uint16Array(6*(i.length-1)))||this;return h.points=i,h._width=e,h.textureScale=r,h.build(),h}return h(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array(6*(t.length-1)));var h=i.data,o=r.data;h[0]=0,h[1]=0,h[2]=0,h[3]=1;for(var s=0,n=t[0],a=this._width*this.textureScale,u=t.length,d=0;d<u;d++){var p=4*d;if(this.textureScale>0){var f=n.x-t[d].x,g=n.y-t[d].y,c=Math.sqrt(f*f+g*g);n=t[d],s+=c/a}else s=d/(u-1);h[p]=s,h[p+1]=0,h[p+2]=s,h[p+3]=1}var l=0;for(d=0;d<u-1;d++){p=2*d;o[l++]=p,o[l++]=p+1,o[l++]=p+2,o[l++]=p+2,o[l++]=p+1,o[l++]=p+3}i.update(),r.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var e,i=t[0],r=0,h=0,o=this.buffers[0].data,s=t.length,n=0;n<s;n++){var a=t[n],u=4*n;h=-((e=n<t.length-1?t[n+1]:a).x-i.x),r=e.y-i.y;var d=Math.sqrt(r*r+h*h),p=this.textureScale>0?this.textureScale*this._width/2:this._width/2;r/=d,h/=d,r*=p,h*=p,o[u]=a.x+r,o[u+1]=a.y+h,o[u+2]=a.x-r,o[u+3]=a.y-h,i=a}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(t.MeshGeometry),n=function(i){function r(r,h,o){void 0===o&&(o=0);var n=this,a=new s(r.height,h,o),u=new t.MeshMaterial(r);return o>0&&(r.baseTexture.wrapMode=e.WRAP_MODES.REPEAT),(n=i.call(this,a,u)||this).autoUpdate=!0,n}return h(r,i),r.prototype._render=function(t){var e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),i.prototype._render.call(this,t)},r}(t.Mesh),a=function(e){function r(r,h,s){var n=this,a=new o(r.width,r.height,h,s),u=new t.MeshMaterial(i.Texture.WHITE);return(n=e.call(this,a,u)||this).texture=r,n.autoResize=!0,n}return h(r,e),r.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,e=this.shader.texture,i=e.width,r=e.height;!this.autoResize||t.width===i&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(r.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),r.prototype._render=function(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),e.prototype._render.call(this,t)},r.prototype.destroy=function(t){this.shader.texture.off("update",this.textureUpdated,this),e.prototype.destroy.call(this,t)},r}(t.Mesh),u=function(e){function r(r,h,o,s,n){void 0===r&&(r=i.Texture.EMPTY);var a=this,u=new t.MeshGeometry(h,o,s);u.getBuffer("aVertexPosition").static=!1;var d=new t.MeshMaterial(r);return(a=e.call(this,u,d,null,n)||this).autoUpdate=!0,a}return h(r,e),Object.defineProperty(r.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),r.prototype._render=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),e.prototype._render.call(this,t)},r}(t.Mesh),d=function(t){function e(e,r,h,o,s){void 0===r&&(r=10),void 0===h&&(h=10),void 0===o&&(o=10),void 0===s&&(s=10);var n=t.call(this,i.Texture.WHITE,4,4)||this;return n._origWidth=e.orig.width,n._origHeight=e.orig.height,n._width=n._origWidth,n._height=n._origHeight,n._leftWidth=r,n._rightWidth=o,n._topHeight=h,n._bottomHeight=s,n.texture=e,n}return h(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight,r=this._height>i?1:this._height/i;return Math.min(e,r)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var i=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(a);exports.NineSlicePlane=d,exports.PlaneGeometry=o,exports.RopeGeometry=s,exports.SimpleMesh=u,exports.SimplePlane=a,exports.SimpleRope=n; | ||
//# sourceMappingURL=mesh-extras.min.js.map |
/*! | ||
* @pixi/mesh-extras - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/mesh-extras - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -5,0 +5,0 @@ * @pixi/mesh-extras is licensed under the MIT License. |
/*! | ||
* @pixi/mesh-extras - v6.3.0 | ||
* Compiled Wed, 23 Mar 2022 18:58:56 UTC | ||
* @pixi/mesh-extras - v6.3.1 | ||
* Compiled Tue, 03 May 2022 13:21:19 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/mesh-extras is licensed under the MIT License. | ||
*/ | ||
import{MeshGeometry as t,Mesh as e,MeshMaterial as i}from"@pixi/mesh";import{WRAP_MODES as r}from"@pixi/constants";import{Texture as h}from"@pixi/core";var o=function(t,e){return(o=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 s(t,e){function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var n=function(t){function e(e,i,r,h){void 0===e&&(e=100),void 0===i&&(i=100),void 0===r&&(r=10),void 0===h&&(h=10);var o=t.call(this)||this;return o.segWidth=r,o.segHeight=h,o.width=e,o.height=i,o.build(),o}return s(e,t),e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],i=[],r=[],h=this.segWidth-1,o=this.segHeight-1,s=this.width/h,n=this.height/o,a=0;a<t;a++){var u=a%this.segWidth,d=a/this.segWidth|0;e.push(u*s,d*n),i.push(u/h,d/o)}var f=h*o;for(a=0;a<f;a++){var p=a%h,g=a/h|0,c=g*this.segWidth+p,l=g*this.segWidth+p+1,_=(g+1)*this.segWidth+p,y=(g+1)*this.segWidth+p+1;r.push(c,l,_,l,y,_)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(t),a=function(t){function e(e,i,r){void 0===e&&(e=200),void 0===r&&(r=0);var h=t.call(this,new Float32Array(4*i.length),new Float32Array(4*i.length),new Uint16Array(6*(i.length-1)))||this;return h.points=i,h._width=e,h.textureScale=r,h.build(),h}return s(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array(6*(t.length-1)));var h=i.data,o=r.data;h[0]=0,h[1]=0,h[2]=0,h[3]=1;for(var s=0,n=t[0],a=this._width*this.textureScale,u=t.length,d=0;d<u;d++){var f=4*d;if(this.textureScale>0){var p=n.x-t[d].x,g=n.y-t[d].y,c=Math.sqrt(p*p+g*g);n=t[d],s+=c/a}else s=d/(u-1);h[f]=s,h[f+1]=0,h[f+2]=s,h[f+3]=1}var l=0;for(d=0;d<u-1;d++){f=2*d;o[l++]=f,o[l++]=f+1,o[l++]=f+2,o[l++]=f+2,o[l++]=f+1,o[l++]=f+3}i.update(),r.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var e,i=t[0],r=0,h=0,o=this.buffers[0].data,s=t.length,n=0;n<s;n++){var a=t[n],u=4*n;h=-((e=n<t.length-1?t[n+1]:a).x-i.x),r=e.y-i.y;var d=Math.sqrt(r*r+h*h),f=this.textureScale>0?this.textureScale*this._width/2:this._width/2;r/=d,h/=d,r*=f,h*=f,o[u]=a.x+r,o[u+1]=a.y+h,o[u+2]=a.x-r,o[u+3]=a.y-h,i=a}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(t),u=function(t){function e(e,h,o){void 0===o&&(o=0);var s=this,n=new a(e.height,h,o),u=new i(e);return o>0&&(e.baseTexture.wrapMode=r.REPEAT),(s=t.call(this,n,u)||this).autoUpdate=!0,s}return s(e,t),e.prototype._render=function(e){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),t.prototype._render.call(this,e)},e}(e),d=function(t){function e(e,r,o){var s=this,a=new n(e.width,e.height,r,o),u=new i(h.WHITE);return(s=t.call(this,a,u)||this).texture=e,s.autoResize=!0,s}return s(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,e=this.shader.texture,i=e.width,r=e.height;!this.autoResize||t.width===i&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},e.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},e}(e),f=function(e){function r(r,o,s,n,a){void 0===r&&(r=h.EMPTY);var u=this,d=new t(o,s,n);d.getBuffer("aVertexPosition").static=!1;var f=new i(r);return(u=e.call(this,d,f,null,a)||this).autoUpdate=!0,u}return s(r,e),Object.defineProperty(r.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),r.prototype._render=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),e.prototype._render.call(this,t)},r}(e),p=10,g=function(t){function e(e,i,r,o,s){void 0===i&&(i=p),void 0===r&&(r=p),void 0===o&&(o=p),void 0===s&&(s=p);var n=t.call(this,h.WHITE,4,4)||this;return n._origWidth=e.orig.width,n._origHeight=e.orig.height,n._width=n._origWidth,n._height=n._origHeight,n._leftWidth=i,n._rightWidth=o,n._topHeight=r,n._bottomHeight=s,n.texture=e,n}return s(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight,r=this._height>i?1:this._height/i;return Math.min(e,r)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var i=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(d);export{g as NineSlicePlane,n as PlaneGeometry,a as RopeGeometry,f as SimpleMesh,d as SimplePlane,u as SimpleRope}; | ||
import{MeshGeometry as t,Mesh as e,MeshMaterial as i}from"@pixi/mesh";import{WRAP_MODES as r}from"@pixi/constants";import{Texture as h}from"@pixi/core";var o=function(t,e){return o=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])},o(t,e)};function s(t,e){function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var n=function(t){function e(e,i,r,h){void 0===e&&(e=100),void 0===i&&(i=100),void 0===r&&(r=10),void 0===h&&(h=10);var o=t.call(this)||this;return o.segWidth=r,o.segHeight=h,o.width=e,o.height=i,o.build(),o}return s(e,t),e.prototype.build=function(){for(var t=this.segWidth*this.segHeight,e=[],i=[],r=[],h=this.segWidth-1,o=this.segHeight-1,s=this.width/h,n=this.height/o,a=0;a<t;a++){var u=a%this.segWidth,d=a/this.segWidth|0;e.push(u*s,d*n),i.push(u/h,d/o)}var f=h*o;for(a=0;a<f;a++){var p=a%h,g=a/h|0,c=g*this.segWidth+p,l=g*this.segWidth+p+1,_=(g+1)*this.segWidth+p,y=(g+1)*this.segWidth+p+1;r.push(c,l,_,l,y,_)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},e}(t),a=function(t){function e(e,i,r){void 0===e&&(e=200),void 0===r&&(r=0);var h=t.call(this,new Float32Array(4*i.length),new Float32Array(4*i.length),new Uint16Array(6*(i.length-1)))||this;return h.points=i,h._width=e,h.textureScale=r,h.build(),h}return s(e,t),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),e.prototype.build=function(){var t=this.points;if(t){var e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array(6*(t.length-1)));var h=i.data,o=r.data;h[0]=0,h[1]=0,h[2]=0,h[3]=1;for(var s=0,n=t[0],a=this._width*this.textureScale,u=t.length,d=0;d<u;d++){var f=4*d;if(this.textureScale>0){var p=n.x-t[d].x,g=n.y-t[d].y,c=Math.sqrt(p*p+g*g);n=t[d],s+=c/a}else s=d/(u-1);h[f]=s,h[f+1]=0,h[f+2]=s,h[f+3]=1}var l=0;for(d=0;d<u-1;d++){f=2*d;o[l++]=f,o[l++]=f+1,o[l++]=f+2,o[l++]=f+2,o[l++]=f+1,o[l++]=f+3}i.update(),r.update(),this.updateVertices()}}},e.prototype.updateVertices=function(){var t=this.points;if(!(t.length<1)){for(var e,i=t[0],r=0,h=0,o=this.buffers[0].data,s=t.length,n=0;n<s;n++){var a=t[n],u=4*n;h=-((e=n<t.length-1?t[n+1]:a).x-i.x),r=e.y-i.y;var d=Math.sqrt(r*r+h*h),f=this.textureScale>0?this.textureScale*this._width/2:this._width/2;r/=d,h/=d,r*=f,h*=f,o[u]=a.x+r,o[u+1]=a.y+h,o[u+2]=a.x-r,o[u+3]=a.y-h,i=a}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(t),u=function(t){function e(e,h,o){void 0===o&&(o=0);var s=this,n=new a(e.height,h,o),u=new i(e);return o>0&&(e.baseTexture.wrapMode=r.REPEAT),(s=t.call(this,n,u)||this).autoUpdate=!0,s}return s(e,t),e.prototype._render=function(e){var i=this.geometry;(this.autoUpdate||i._width!==this.shader.texture.height)&&(i._width=this.shader.texture.height,i.update()),t.prototype._render.call(this,e)},e}(e),d=function(t){function e(e,r,o){var s=this,a=new n(e.width,e.height,r,o),u=new i(h.WHITE);return(s=t.call(this,a,u)||this).texture=e,s.autoResize=!0,s}return s(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,e=this.shader.texture,i=e.width,r=e.height;!this.autoResize||t.width===i&&t.height===r||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},e.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},e}(e),f=function(e){function r(r,o,s,n,a){void 0===r&&(r=h.EMPTY);var u=this,d=new t(o,s,n);d.getBuffer("aVertexPosition").static=!1;var f=new i(r);return(u=e.call(this,d,f,null,a)||this).autoUpdate=!0,u}return s(r,e),Object.defineProperty(r.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),r.prototype._render=function(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),e.prototype._render.call(this,t)},r}(e),p=function(t){function e(e,i,r,o,s){void 0===i&&(i=10),void 0===r&&(r=10),void 0===o&&(o=10),void 0===s&&(s=10);var n=t.call(this,h.WHITE,4,4)||this;return n._origWidth=e.orig.width,n._origHeight=e.orig.height,n._width=n._origWidth,n._height=n._origHeight,n._leftWidth=i,n._rightWidth=o,n._topHeight=r,n._bottomHeight=s,n.texture=e,n}return s(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight,r=this._height>i?1:this._height/i;return Math.min(e,r)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var i=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(d);export{p as NineSlicePlane,n as PlaneGeometry,a as RopeGeometry,f as SimpleMesh,d as SimplePlane,u as SimpleRope}; | ||
//# sourceMappingURL=mesh-extras.min.js.map |
{ | ||
"name": "@pixi/mesh-extras", | ||
"version": "6.3.0", | ||
"version": "6.3.1", | ||
"main": "dist/cjs/mesh-extras.js", | ||
@@ -28,9 +28,9 @@ "module": "dist/esm/mesh-extras.js", | ||
"peerDependencies": { | ||
"@pixi/constants": "6.3.0", | ||
"@pixi/core": "6.3.0", | ||
"@pixi/math": "6.3.0", | ||
"@pixi/mesh": "6.3.0", | ||
"@pixi/utils": "6.3.0" | ||
"@pixi/constants": "6.3.1", | ||
"@pixi/core": "6.3.1", | ||
"@pixi/math": "6.3.1", | ||
"@pixi/mesh": "6.3.1", | ||
"@pixi/utils": "6.3.1" | ||
}, | ||
"gitHead": "dc311cdd7a28e6817556cdc674fd15ef71069467" | ||
"gitHead": "a520915d81f307c40fcbad5d877b0f2de465c4bf" | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
430705