@pixi/math
Advanced tools
Comparing version 5.2.0 to 5.2.1
/*! | ||
* @pixi/math - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* @pixi/math - v5.2.1 | ||
* Compiled Tue, 28 Jan 2020 23:33:11 UTC | ||
* | ||
@@ -8,3 +8,3 @@ * @pixi/math is licensed under the MIT License. | ||
*/ | ||
this.PIXI=this.PIXI||{};var _pixi_math=function(t){"use strict";var i,s=function(){function t(t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.x=t,this.y=i}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,i){void 0===t&&(t=0),void 0===i&&(i=t),this.x=t,this.y=i},t}(),h=function(){function t(t,i,s,h){void 0===s&&(s=0),void 0===h&&(h=0),this._x=s,this._y=h,this.cb=t,this.scope=i}return t.prototype.clone=function(i,s){return void 0===i&&(i=this.cb),void 0===s&&(s=this.scope),new t(i,s,this._x,this._y)},t.prototype.set=function(t,i){void 0===t&&(t=0),void 0===i&&(i=t),this._x===t&&this._y===i||(this._x=t,this._y=i,this.cb.call(this.scope))},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!0,configurable:!0}),t}(),o=2*Math.PI,n=180/Math.PI,r=Math.PI/180;(i=t.SHAPES||(t.SHAPES={}))[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC";var e=function(){function t(t,i,s,h,o,n){void 0===t&&(t=1),void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=1),void 0===o&&(o=0),void 0===n&&(n=0),this.array=null,this.a=t,this.b=i,this.c=s,this.d=h,this.tx=o,this.ty=n}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,i,s,h,o,n){return this.a=t,this.b=i,this.c=s,this.d=h,this.tx=o,this.ty=n,this},t.prototype.toArray=function(t,i){this.array||(this.array=new Float32Array(9));var s=i||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s},t.prototype.apply=function(t,i){i=i||new s;var h=t.x,o=t.y;return i.x=this.a*h+this.c*o+this.tx,i.y=this.b*h+this.d*o+this.ty,i},t.prototype.applyInverse=function(t,i){i=i||new s;var h=1/(this.a*this.d+this.c*-this.b),o=t.x,n=t.y;return i.x=this.d*h*o+-this.c*h*n+(this.ty*this.c-this.tx*this.d)*h,i.y=this.a*h*n+-this.b*h*o+(-this.ty*this.a+this.tx*this.b)*h,i},t.prototype.translate=function(t,i){return this.tx+=t,this.ty+=i,this},t.prototype.scale=function(t,i){return this.a*=t,this.d*=i,this.c*=t,this.b*=i,this.tx*=t,this.ty*=i,this},t.prototype.rotate=function(t){var i=Math.cos(t),s=Math.sin(t),h=this.a,o=this.c,n=this.tx;return this.a=h*i-this.b*s,this.b=h*s+this.b*i,this.c=o*i-this.d*s,this.d=o*s+this.d*i,this.tx=n*i-this.ty*s,this.ty=n*s+this.ty*i,this},t.prototype.append=function(t){var i=this.a,s=this.b,h=this.c,o=this.d;return this.a=t.a*i+t.b*h,this.b=t.a*s+t.b*o,this.c=t.c*i+t.d*h,this.d=t.c*s+t.d*o,this.tx=t.tx*i+t.ty*h+this.tx,this.ty=t.tx*s+t.ty*o+this.ty,this},t.prototype.setTransform=function(t,i,s,h,o,n,r,e,a){return this.a=Math.cos(r+a)*o,this.b=Math.sin(r+a)*o,this.c=-Math.sin(r-e)*n,this.d=Math.cos(r-e)*n,this.tx=t-(s*this.a+h*this.c),this.ty=i-(s*this.b+h*this.d),this},t.prototype.prepend=function(t){var i=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var s=this.a,h=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=h*t.a+this.d*t.c,this.d=h*t.b+this.d*t.d}return this.tx=i*t.a+this.ty*t.c+t.tx,this.ty=i*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var i=this.a,s=this.b,h=this.c,n=this.d,r=-Math.atan2(-h,n),e=Math.atan2(s,i),a=Math.abs(r+e);return a<1e-5||Math.abs(o-a)<1e-5?(t.rotation=e,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=r,t.skew.y=e),t.scale.x=Math.sqrt(i*i+s*s),t.scale.y=Math.sqrt(h*h+n*n),t.position.x=this.tx,t.position.y=this.ty,t},t.prototype.invert=function(){var t=this.a,i=this.b,s=this.c,h=this.d,o=this.tx,n=t*h-i*s;return this.a=h/n,this.b=-i/n,this.c=-s/n,this.d=t/n,this.tx=(s*this.ty-h*o)/n,this.ty=-(t*this.ty-i*o)/n,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var i=new t;return i.a=this.a,i.b=this.b,i.c=this.c,i.d=this.d,i.tx=this.tx,i.ty=this.ty,i},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!0,configurable:!0}),t}(),a=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],c=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],u=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],y=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],p=[],d=[],f=Math.sign;!function(){for(var t=0;t<16;t++){var i=[];p.push(i);for(var s=0;s<16;s++)for(var h=f(a[t]*a[s]+u[t]*c[s]),o=f(c[t]*a[s]+y[t]*c[s]),n=f(a[t]*u[s]+u[t]*y[s]),r=f(c[t]*u[s]+y[t]*y[s]),x=0;x<16;x++)if(a[x]===h&&c[x]===o&&u[x]===n&&y[x]===r){i.push(x);break}}for(t=0;t<16;t++){var l=new e;l.set(a[t],c[t],u[t],y[t],0,0),d.push(l)}}();var x={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return a[t]},uY:function(t){return c[t]},vX:function(t){return u[t]},vY:function(t){return y[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,i){return p[t][i]},sub:function(t,i){return p[t][x.inv(i)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,i){return 2*Math.abs(t)<=Math.abs(i)?i>=0?x.S:x.N:2*Math.abs(i)<=Math.abs(t)?t>0?x.E:x.W:i>0?t>0?x.SE:x.SW:t>0?x.NE:x.NW},matrixAppendRotationInv:function(t,i,s,h){void 0===s&&(s=0),void 0===h&&(h=0);var o=d[x.inv(i)];o.tx=s,o.ty=h,t.append(o)}},l=function(){function t(){this.worldTransform=new e,this.localTransform=new e,this.position=new h(this.onChange,this,0,0),this.scale=new h(this.onChange,this,1,1),this.pivot=new h(this.onChange,this,0,0),this.skew=new h(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var i=this.localTransform;if(this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var s=t.worldTransform,h=this.worldTransform;h.a=i.a*s.a+i.b*s.c,h.b=i.a*s.b+i.b*s.d,h.c=i.c*s.a+i.d*s.c,h.d=i.c*s.b+i.d*s.d,h.tx=i.tx*s.a+i.ty*s.c+s.tx,h.ty=i.tx*s.b+i.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!0,configurable:!0}),t.IDENTITY=new t,t}(),b=function(){function i(i,s,h,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),this.x=Number(i),this.y=Number(s),this.width=Number(h),this.height=Number(o),this.type=t.SHAPES.RECT}return Object.defineProperty(i.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(i,"EMPTY",{get:function(){return new i(0,0,0,0)},enumerable:!0,configurable:!0}),i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},i.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.prototype.contains=function(t,i){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&i>=this.y&&i<this.y+this.height)},i.prototype.pad=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x-=t,this.y-=i,this.width+=2*t,this.height+=2*i,this},i.prototype.fit=function(t){var i=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),h=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=i,this.width=Math.max(s-i,0),this.y=h,this.height=Math.max(o-h,0),this},i.prototype.ceil=function(t,i){void 0===t&&(t=1),void 0===i&&(i=.001);var s=Math.ceil((this.x+this.width-i)*t)/t,h=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=s-this.x,this.height=h-this.y,this},i.prototype.enlarge=function(t){var i=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),h=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=i,this.width=s-i,this.y=h,this.height=o-h,this},i}(),v=function(){function i(i,s,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),this.x=i,this.y=s,this.radius=h,this.type=t.SHAPES.CIRC}return i.prototype.clone=function(){return new i(this.x,this.y,this.radius)},i.prototype.contains=function(t,i){if(this.radius<=0)return!1;var s=this.radius*this.radius,h=this.x-t,o=this.y-i;return(h*=h)+(o*=o)<=s},i.prototype.getBounds=function(){return new b(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},i}(),_=function(){function i(i,s,h,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),this.x=i,this.y=s,this.width=h,this.height=o,this.type=t.SHAPES.ELIP}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;var s=(t-this.x)/this.width,h=(i-this.y)/this.height;return(s*=s)+(h*=h)<=1},i.prototype.getBounds=function(){return new b(this.x-this.width,this.y-this.height,this.width,this.height)},i}(),w=function(){function i(){for(var i=arguments,h=[],o=0;o<arguments.length;o++)h[o]=i[o];if(Array.isArray(h[0])&&(h=h[0]),h[0]instanceof s){for(var n=[],r=0,e=(h=h).length;r<e;r++)n.push(h[r].x,h[r].y);h=n}this.points=h,this.type=t.SHAPES.POLY,this.closeStroke=!0}return i.prototype.clone=function(){var t=new i(this.points.slice());return t.closeStroke=this.closeStroke,t},i.prototype.contains=function(t,i){for(var s=!1,h=this.points.length/2,o=0,n=h-1;o<h;n=o++){var r=this.points[2*o],e=this.points[2*o+1],a=this.points[2*n],c=this.points[2*n+1];e>i!=c>i&&t<(i-e)/(c-e)*(a-r)+r&&(s=!s)}return s},i}(),g=function(){function i(i,s,h,o,n){void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),void 0===n&&(n=20),this.x=i,this.y=s,this.width=h,this.height=o,this.radius=n,this.type=t.SHAPES.RREC}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.radius)},i.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){if(i>=this.y+this.radius&&i<=this.y+this.height-this.radius||t>=this.x+this.radius&&t<=this.x+this.width-this.radius)return!0;var s=t-(this.x+this.radius),h=i-(this.y+this.radius),o=this.radius*this.radius;if(s*s+h*h<=o)return!0;if((s=t-(this.x+this.width-this.radius))*s+h*h<=o)return!0;if(s*s+(h=i-(this.y+this.height-this.radius))*h<=o)return!0;if((s=t-(this.x+this.radius))*s+h*h<=o)return!0}return!1},i}();return t.Circle=v,t.DEG_TO_RAD=r,t.Ellipse=_,t.Matrix=e,t.ObservablePoint=h,t.PI_2=o,t.Point=s,t.Polygon=w,t.RAD_TO_DEG=n,t.Rectangle=b,t.RoundedRectangle=g,t.Transform=l,t.groupD8=x,t}({});Object.assign(this.PIXI,_pixi_math); | ||
this.PIXI=this.PIXI||{};var _pixi_math=function(t){"use strict";var i,s=function(){function t(t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.x=t,this.y=i}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},t.prototype.copyTo=function(t){return t.set(this.x,this.y),t},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},t.prototype.set=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x=t,this.y=i,this},t}(),h=function(){function t(t,i,s,h){void 0===s&&(s=0),void 0===h&&(h=0),this._x=s,this._y=h,this.cb=t,this.scope=i}return t.prototype.clone=function(i,s){return void 0===i&&(i=this.cb),void 0===s&&(s=this.scope),new t(i,s,this._x,this._y)},t.prototype.set=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this._x===t&&this._y===i||(this._x=t,this._y=i,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!0,configurable:!0}),t}(),o=2*Math.PI,n=180/Math.PI,r=Math.PI/180;(i=t.SHAPES||(t.SHAPES={}))[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC";var e=function(){function t(t,i,s,h,o,n){void 0===t&&(t=1),void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=1),void 0===o&&(o=0),void 0===n&&(n=0),this.array=null,this.a=t,this.b=i,this.c=s,this.d=h,this.tx=o,this.ty=n}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,i,s,h,o,n){return this.a=t,this.b=i,this.c=s,this.d=h,this.tx=o,this.ty=n,this},t.prototype.toArray=function(t,i){this.array||(this.array=new Float32Array(9));var s=i||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s},t.prototype.apply=function(t,i){i=i||new s;var h=t.x,o=t.y;return i.x=this.a*h+this.c*o+this.tx,i.y=this.b*h+this.d*o+this.ty,i},t.prototype.applyInverse=function(t,i){i=i||new s;var h=1/(this.a*this.d+this.c*-this.b),o=t.x,n=t.y;return i.x=this.d*h*o+-this.c*h*n+(this.ty*this.c-this.tx*this.d)*h,i.y=this.a*h*n+-this.b*h*o+(-this.ty*this.a+this.tx*this.b)*h,i},t.prototype.translate=function(t,i){return this.tx+=t,this.ty+=i,this},t.prototype.scale=function(t,i){return this.a*=t,this.d*=i,this.c*=t,this.b*=i,this.tx*=t,this.ty*=i,this},t.prototype.rotate=function(t){var i=Math.cos(t),s=Math.sin(t),h=this.a,o=this.c,n=this.tx;return this.a=h*i-this.b*s,this.b=h*s+this.b*i,this.c=o*i-this.d*s,this.d=o*s+this.d*i,this.tx=n*i-this.ty*s,this.ty=n*s+this.ty*i,this},t.prototype.append=function(t){var i=this.a,s=this.b,h=this.c,o=this.d;return this.a=t.a*i+t.b*h,this.b=t.a*s+t.b*o,this.c=t.c*i+t.d*h,this.d=t.c*s+t.d*o,this.tx=t.tx*i+t.ty*h+this.tx,this.ty=t.tx*s+t.ty*o+this.ty,this},t.prototype.setTransform=function(t,i,s,h,o,n,r,e,a){return this.a=Math.cos(r+a)*o,this.b=Math.sin(r+a)*o,this.c=-Math.sin(r-e)*n,this.d=Math.cos(r-e)*n,this.tx=t-(s*this.a+h*this.c),this.ty=i-(s*this.b+h*this.d),this},t.prototype.prepend=function(t){var i=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var s=this.a,h=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=h*t.a+this.d*t.c,this.d=h*t.b+this.d*t.d}return this.tx=i*t.a+this.ty*t.c+t.tx,this.ty=i*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var i=this.a,s=this.b,h=this.c,n=this.d,r=-Math.atan2(-h,n),e=Math.atan2(s,i),a=Math.abs(r+e);return a<1e-5||Math.abs(o-a)<1e-5?(t.rotation=e,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=r,t.skew.y=e),t.scale.x=Math.sqrt(i*i+s*s),t.scale.y=Math.sqrt(h*h+n*n),t.position.x=this.tx,t.position.y=this.ty,t},t.prototype.invert=function(){var t=this.a,i=this.b,s=this.c,h=this.d,o=this.tx,n=t*h-i*s;return this.a=h/n,this.b=-i/n,this.c=-s/n,this.d=t/n,this.tx=(s*this.ty-h*o)/n,this.ty=-(t*this.ty-i*o)/n,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var i=new t;return i.a=this.a,i.b=this.b,i.c=this.c,i.d=this.d,i.tx=this.tx,i.ty=this.ty,i},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!0,configurable:!0}),t}(),a=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],c=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],u=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],y=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],p=[],d=[],f=Math.sign;!function(){for(var t=0;t<16;t++){var i=[];p.push(i);for(var s=0;s<16;s++)for(var h=f(a[t]*a[s]+u[t]*c[s]),o=f(c[t]*a[s]+y[t]*c[s]),n=f(a[t]*u[s]+u[t]*y[s]),r=f(c[t]*u[s]+y[t]*y[s]),x=0;x<16;x++)if(a[x]===h&&c[x]===o&&u[x]===n&&y[x]===r){i.push(x);break}}for(t=0;t<16;t++){var l=new e;l.set(a[t],c[t],u[t],y[t],0,0),d.push(l)}}();var x={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return a[t]},uY:function(t){return c[t]},vX:function(t){return u[t]},vY:function(t){return y[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,i){return p[t][i]},sub:function(t,i){return p[t][x.inv(i)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,i){return 2*Math.abs(t)<=Math.abs(i)?i>=0?x.S:x.N:2*Math.abs(i)<=Math.abs(t)?t>0?x.E:x.W:i>0?t>0?x.SE:x.SW:t>0?x.NE:x.NW},matrixAppendRotationInv:function(t,i,s,h){void 0===s&&(s=0),void 0===h&&(h=0);var o=d[x.inv(i)];o.tx=s,o.ty=h,t.append(o)}},l=function(){function t(){this.worldTransform=new e,this.localTransform=new e,this.position=new h(this.onChange,this,0,0),this.scale=new h(this.onChange,this,1,1),this.pivot=new h(this.onChange,this,0,0),this.skew=new h(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var i=this.localTransform;if(this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var s=t.worldTransform,h=this.worldTransform;h.a=i.a*s.a+i.b*s.c,h.b=i.a*s.b+i.b*s.d,h.c=i.c*s.a+i.d*s.c,h.d=i.c*s.b+i.d*s.d,h.tx=i.tx*s.a+i.ty*s.c+s.tx,h.ty=i.tx*s.b+i.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!0,configurable:!0}),t.IDENTITY=new t,t}(),b=function(){function i(i,s,h,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),this.x=Number(i),this.y=Number(s),this.width=Number(h),this.height=Number(o),this.type=t.SHAPES.RECT}return Object.defineProperty(i.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(i,"EMPTY",{get:function(){return new i(0,0,0,0)},enumerable:!0,configurable:!0}),i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},i.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.prototype.contains=function(t,i){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&i>=this.y&&i<this.y+this.height)},i.prototype.pad=function(t,i){return void 0===t&&(t=0),void 0===i&&(i=t),this.x-=t,this.y-=i,this.width+=2*t,this.height+=2*i,this},i.prototype.fit=function(t){var i=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),h=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=i,this.width=Math.max(s-i,0),this.y=h,this.height=Math.max(o-h,0),this},i.prototype.ceil=function(t,i){void 0===t&&(t=1),void 0===i&&(i=.001);var s=Math.ceil((this.x+this.width-i)*t)/t,h=Math.ceil((this.y+this.height-i)*t)/t;return this.x=Math.floor((this.x+i)*t)/t,this.y=Math.floor((this.y+i)*t)/t,this.width=s-this.x,this.height=h-this.y,this},i.prototype.enlarge=function(t){var i=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),h=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=i,this.width=s-i,this.y=h,this.height=o-h,this},i}(),v=function(){function i(i,s,h){void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),this.x=i,this.y=s,this.radius=h,this.type=t.SHAPES.CIRC}return i.prototype.clone=function(){return new i(this.x,this.y,this.radius)},i.prototype.contains=function(t,i){if(this.radius<=0)return!1;var s=this.radius*this.radius,h=this.x-t,o=this.y-i;return(h*=h)+(o*=o)<=s},i.prototype.getBounds=function(){return new b(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},i}(),_=function(){function i(i,s,h,o){void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),this.x=i,this.y=s,this.width=h,this.height=o,this.type=t.SHAPES.ELIP}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height)},i.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;var s=(t-this.x)/this.width,h=(i-this.y)/this.height;return(s*=s)+(h*=h)<=1},i.prototype.getBounds=function(){return new b(this.x-this.width,this.y-this.height,this.width,this.height)},i}(),w=function(){function i(){for(var i=arguments,h=[],o=0;o<arguments.length;o++)h[o]=i[o];if(Array.isArray(h[0])&&(h=h[0]),h[0]instanceof s){for(var n=[],r=0,e=(h=h).length;r<e;r++)n.push(h[r].x,h[r].y);h=n}this.points=h,this.type=t.SHAPES.POLY,this.closeStroke=!0}return i.prototype.clone=function(){var t=new i(this.points.slice());return t.closeStroke=this.closeStroke,t},i.prototype.contains=function(t,i){for(var s=!1,h=this.points.length/2,o=0,n=h-1;o<h;n=o++){var r=this.points[2*o],e=this.points[2*o+1],a=this.points[2*n],c=this.points[2*n+1];e>i!=c>i&&t<(i-e)/(c-e)*(a-r)+r&&(s=!s)}return s},i}(),g=function(){function i(i,s,h,o,n){void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),void 0===n&&(n=20),this.x=i,this.y=s,this.width=h,this.height=o,this.radius=n,this.type=t.SHAPES.RREC}return i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.radius)},i.prototype.contains=function(t,i){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&i>=this.y&&i<=this.y+this.height){if(i>=this.y+this.radius&&i<=this.y+this.height-this.radius||t>=this.x+this.radius&&t<=this.x+this.width-this.radius)return!0;var s=t-(this.x+this.radius),h=i-(this.y+this.radius),o=this.radius*this.radius;if(s*s+h*h<=o)return!0;if((s=t-(this.x+this.width-this.radius))*s+h*h<=o)return!0;if(s*s+(h=i-(this.y+this.height-this.radius))*h<=o)return!0;if((s=t-(this.x+this.radius))*s+h*h<=o)return!0}return!1},i}();return t.Circle=v,t.DEG_TO_RAD=r,t.Ellipse=_,t.Matrix=e,t.ObservablePoint=h,t.PI_2=o,t.Point=s,t.Polygon=w,t.RAD_TO_DEG=n,t.Rectangle=b,t.RoundedRectangle=g,t.Transform=l,t.groupD8=x,t}({});Object.assign(this.PIXI,_pixi_math); | ||
//# sourceMappingURL=math.min.js.map |
/*! | ||
* @pixi/math - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* @pixi/math - v5.2.1 | ||
* Compiled Tue, 28 Jan 2020 23:33:11 UTC | ||
* | ||
@@ -125,2 +125,3 @@ * @pixi/math is licensed under the MIT License. | ||
* @param {number} [y=x] - position of the point on the y axis | ||
* @returns {this} Returns itself. | ||
*/ | ||
@@ -132,2 +133,3 @@ Point.prototype.set = function (x, y) { | ||
this.y = y; | ||
return this; | ||
}; | ||
@@ -183,2 +185,3 @@ return Point; | ||
* @param {number} [y=x] - position of the point on the y axis | ||
* @returns {this} Returns itself. | ||
*/ | ||
@@ -193,2 +196,3 @@ ObservablePoint.prototype.set = function (x, y) { | ||
} | ||
return this; | ||
}; | ||
@@ -195,0 +199,0 @@ /** |
/*! | ||
* @pixi/math - v5.2.0 | ||
* Compiled Wed, 06 Nov 2019 02:32:43 UTC | ||
* @pixi/math - v5.2.1 | ||
* Compiled Tue, 28 Jan 2020 23:33:11 UTC | ||
* | ||
@@ -129,2 +129,3 @@ * @pixi/math is licensed under the MIT License. | ||
* @param {number} [y=x] - position of the point on the y axis | ||
* @returns {this} Returns itself. | ||
*/ | ||
@@ -136,2 +137,3 @@ Point.prototype.set = function (x, y) { | ||
this.y = y; | ||
return this; | ||
}; | ||
@@ -187,2 +189,3 @@ return Point; | ||
* @param {number} [y=x] - position of the point on the y axis | ||
* @returns {this} Returns itself. | ||
*/ | ||
@@ -197,2 +200,3 @@ ObservablePoint.prototype.set = function (x, y) { | ||
} | ||
return this; | ||
}; | ||
@@ -199,0 +203,0 @@ /** |
{ | ||
"name": "@pixi/math", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"main": "lib/math.js", | ||
@@ -26,3 +26,3 @@ "module": "lib/math.es.js", | ||
], | ||
"gitHead": "aaf96b460582b83a1fa73037ef2dd69dd9e84415" | ||
"gitHead": "b56b4fca1c169f0e6d2a0472251ba1f7399bb4a3" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is 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
570534
5786