Comparing version 0.0.5-alpha1 to 0.0.5-alpha2
/*! | ||
* DOMMatrix v0.0.5-alpha1 (https://github.com/thednp/dommatrix) | ||
* DOMMatrix v0.0.5-alpha2 (https://github.com/thednp/dommatrix) | ||
* Copyright 2021 © thednp | ||
@@ -494,4 +494,5 @@ * Licensed under MIT (https://github.com/thednp/DOMMatrix/blob/master/LICENSE) | ||
} if (source.length && typeof source[0] === 'string' && source[0].length) { // CSS transform String source | ||
var string = String(source[0]).trim(); var type = ''; var | ||
values = []; | ||
var string = String(source[0]).trim(); | ||
var type = ''; | ||
var values = []; | ||
@@ -602,6 +603,6 @@ if (string === 'none') { return m; } | ||
var X = x; | ||
var Y; | ||
var Z; | ||
if (z === null) { Z = 0; } | ||
if (y === null) { Y = 0; } | ||
var Y = y; | ||
var Z = z; | ||
if (Z == null) { Z = 0; } | ||
if (Y == null) { Y = 0; } | ||
return Multiply(this, Translate(X, Y, Z)); | ||
@@ -621,9 +622,8 @@ }; | ||
*/ | ||
CSSMatrixProto.scale = function scale(x, y, z) { | ||
var X = x; | ||
var Y; | ||
var Z; | ||
if (z === null) { Z = x; } | ||
if (y === null) { Y = x; } | ||
var Y = y; | ||
var Z = z; | ||
if (Y == null) { Y = x; } | ||
if (Z == null) { Z = x; } | ||
@@ -645,9 +645,8 @@ return Multiply(this, Scale(X, Y, Z)); | ||
*/ | ||
CSSMatrixProto.rotate = function rotate(rx, ry, rz) { | ||
var RX = rx; | ||
var RY; | ||
var RZ; | ||
if (ry === null) { RY = 0; } | ||
if (rz === null) { RZ = rx; RX = 0; } | ||
var RY = ry; | ||
var RZ = rz; | ||
if (RY == null) { RY = 0; } | ||
if (RZ == null) { RZ = RX; RX = 0; } | ||
return Multiply(this, Rotate(RX, RY, RZ)); | ||
@@ -654,0 +653,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
// DOMMatrix v0.0.5-alpha1 | thednp © 2021 | MIT-License | ||
var m=function(){for(var m=[],t=arguments.length;t--;)m[t]=arguments[t];return this.setIdentity(),m&&m.length&&this.setMatrixValue(m)},t={isIdentity:{configurable:!0},is2D:{configurable:!0}};t.isIdentity.get=function(){var m=this;return 1===m.m11&&0===m.m12&&0===m.m13&&0===m.m14&&0===m.m21&&1===m.m22&&0===m.m23&&0===m.m24&&0===m.m31&&0===m.m32&&1===m.m33&&0===m.m34&&0===m.m41&&0===m.m42&&0===m.m43&&1===m.m44},t.isIdentity.set=function(m){this.isIdentity=m},t.is2D.get=function(){var m=this;return 0===m.m31&&0===m.m32&&1===m.m33&&0===m.m34&&0===m.m43&&1===m.m44},t.is2D.set=function(m){this.is2D=m},Object.defineProperties(m.prototype,t);var r=m.prototype;function n(t,r,n){var e=new m;return e.m41=t,e.e=t,e.m42=r,e.f=r,e.m43=n,e}function e(t,r,n){var e=new m,i=t*Math.PI/180,a=r*Math.PI/180,u=n*Math.PI/180,s=Math.cos(i),o=-Math.sin(i),f=Math.cos(a),c=-Math.sin(a),h=Math.cos(u),l=-Math.sin(u),y=f*h,v=-f*l;e.m11=y,e.a=y,e.m12=v,e.b=v,e.m13=c;var x=o*c*h+s*l;e.m21=x,e.c=x;var w=s*h-o*c*l;return e.m22=w,e.d=w,e.m23=-o*f,e.m31=o*l-s*c*h,e.m32=o*h+s*c*l,e.m33=s*f,e}function i(t,r,n,e){var i=new m,a=e*Math.PI/360,u=Math.sin(a),s=Math.cos(a),o=u*u,f=Math.sqrt(t*t+r*r+n*n),c=0,h=0,l=1;0!==f&&(c=t/f,h=r/f,l=n/f);var y=c*c,v=h*h,x=l*l,w=1-2*(v+x)*o;i.m11=w,i.a=w;var M=2*(t*r*o+n*u*s);i.m12=M,i.b=M,i.m13=2*(t*n*o-r*u*s);var g=2*(r*t*o-n*u*s);i.m21=g,i.c=g;var d=1-2*(x+y)*o;return i.m22=d,i.d=d,i.m23=2*(r*n*o+t*u*s),i.m31=2*(n*t*o+r*u*s),i.m32=2*(n*r*o-t*u*s),i.m33=1-2*(y+v)*o,i.m14=0,i.m24=0,i.m34=0,i.m41=0,i.e=0,i.m42=0,i.f=0,i.m43=0,i.m44=1,i}function a(t,r,n){var e=new m;return e.m11=t,e.a=t,e.m22=r,e.d=r,e.m33=n,e}function u(t){var r=t*Math.PI/180,n=new m,e=Math.tan(r);return n.m21=e,n.c=e,n}function s(t){var r=t*Math.PI/180,n=new m,e=Math.tan(r);return n.m12=e,n.b=e,n}function o(t,r){var n=r.m11*t.m11+r.m12*t.m21+r.m13*t.m31+r.m14*t.m41,e=r.m11*t.m12+r.m12*t.m22+r.m13*t.m32+r.m14*t.m42,i=r.m11*t.m13+r.m12*t.m23+r.m13*t.m33+r.m14*t.m43,a=r.m11*t.m14+r.m12*t.m24+r.m13*t.m34+r.m14*t.m44,u=r.m21*t.m11+r.m22*t.m21+r.m23*t.m31+r.m24*t.m41,s=r.m21*t.m12+r.m22*t.m22+r.m23*t.m32+r.m24*t.m42,o=r.m21*t.m13+r.m22*t.m23+r.m23*t.m33+r.m24*t.m43,f=r.m21*t.m14+r.m22*t.m24+r.m23*t.m34+r.m24*t.m44,c=r.m31*t.m11+r.m32*t.m21+r.m33*t.m31+r.m34*t.m41,h=r.m31*t.m12+r.m32*t.m22+r.m33*t.m32+r.m34*t.m42,l=r.m31*t.m13+r.m32*t.m23+r.m33*t.m33+r.m34*t.m43,y=r.m31*t.m14+r.m32*t.m24+r.m33*t.m34+r.m34*t.m44,v=r.m41*t.m11+r.m42*t.m21+r.m43*t.m31+r.m44*t.m41,x=r.m41*t.m12+r.m42*t.m22+r.m43*t.m32+r.m44*t.m42,w=r.m41*t.m13+r.m42*t.m23+r.m43*t.m33+r.m44*t.m43,M=r.m41*t.m14+r.m42*t.m24+r.m43*t.m34+r.m44*t.m44;return new m([n,u,c,v,e,s,h,x,i,o,l,w,a,f,y,M])}function f(m,t){var r=Array.from(t);if(16===r.length){var n=r[0],e=r[1],i=r[2],a=r[3],u=r[4],s=r[5],o=r[6],f=r[7],c=r[8],h=r[9],l=r[10],y=r[11],v=r[12],x=r[13],w=r[14],M=r[15];m.m11=n,m.a=n,m.m21=e,m.c=e,m.m31=i,m.m41=a,m.e=a,m.m12=u,m.b=u,m.m22=s,m.d=s,m.m32=o,m.m42=f,m.f=f,m.m13=c,m.m23=h,m.m33=l,m.m43=y,m.m14=v,m.m24=x,m.m34=w,m.m44=M}else{if(6!==r.length)throw new TypeError("CSSMatrix: expecting a 6/16 values Array");var g=r[0],d=r[1],p=r[2],A=r[3],S=r[4],I=r[5];m.m11=g,m.a=g,m.m12=d,m.b=d,m.m21=p,m.c=p,m.m22=A,m.d=A,m.m14=S,m.e=S,m.m24=I,m.f=I}return m}r.setMatrixValue=function(t){var r=this;if(!t||!t.length)return r;if(t.length&&"string"==typeof t[0]&&t[0].length){var n,e,i=String(t[0]).trim();if("none"===i)return r;if(n=i.slice(0,i.indexOf("(")),e=i.slice("matrix"===n?7:9,-1).split(",").map((function(m){return Math.abs(m)<1e-6?0:+m})),!([6,16].indexOf(e.length)>-1))throw new TypeError("CSSMatrix: expecting valid CSS matrix() / matrix3d() syntax");f(r,e)}else t[0]instanceof m?f(r,t[0].toArray()):Array.isArray(t[0])?f(r,t[0]):Array.isArray(t)&&f(r,t);return r},r.toString=function(){return(this.is2D?"matrix":"matrix3d")+"("+this.toArray(1).join(",")+")"},r.toArray=function(m){var t=this;return t.is2D?[t.a,t.b,t.c,t.d,t.e,t.f]:m?[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]:[t.m11,t.m21,t.m31,t.m41,t.m12,t.m22,t.m32,t.m42,t.m13,t.m23,t.m33,t.m43,t.m14,t.m24,t.m34,t.m44]},r.multiply=function(m){return o(this,m)},r.translate=function(m,t,r){var e,i;return null===r&&(i=0),null===t&&(e=0),o(this,n(m,e,i))},r.scale=function(m,t,r){var n,e;return null===r&&(e=m),null===t&&(n=m),o(this,a(m,n,e))},r.rotate=function(m,t,r){var n,i,a=m;return null===t&&(n=0),null===r&&(i=m,a=0),o(this,e(a,n,i))},r.rotateAxisAngle=function(m,t,r,n){if(4!==arguments.length)throw new TypeError("CSSMatrix: expecting 4 values");return o(this,i(m,t,r,n))},r.skewX=function(m){return o(this,u(m))},r.skewY=function(m){return o(this,s(m))},r.setIdentity=function(){return f(this,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},r.transformPoint=function(m){var t=n(m.x,m.y,m.z);return t.m44=m.w||1,{x:(t=this.multiply(t)).m41,y:t.m42,z:t.m43,w:t.m44}},r.transform=function(m){var t=this,r=t.m11*m.x+t.m12*m.y+t.m13*m.z+t.m14*m.w,n=t.m21*m.x+t.m22*m.y+t.m23*m.z+t.m24*m.w,e=t.m31*m.x+t.m32*m.y+t.m33*m.z+t.m34*m.w,i=t.m41*m.x+t.m42*m.y+t.m43*m.z+t.m44*m.w;return{x:r/i,y:n/i,z:e/i,w:i}},m.Translate=n,m.Rotate=e,m.RotateAxisAngle=i,m.Scale=a,m.SkewX=u,m.SkewY=s,m.Multiply=o,m.fromMatrix=function(t){return new m([t.m11,t.m21,t.m31,t.m41,t.m12,t.m22,t.m32,t.m42,t.m13,t.m23,t.m33,t.m43,t.m14,t.m24,t.m34,t.m44])},m.fromArray=function(t){return f(new m,t)},m.feedFromArray=f;export default m; | ||
// DOMMatrix v0.0.5-alpha2 | thednp © 2021 | MIT-License | ||
var m=function(){for(var m=[],t=arguments.length;t--;)m[t]=arguments[t];return this.setIdentity(),m&&m.length&&this.setMatrixValue(m)},t={isIdentity:{configurable:!0},is2D:{configurable:!0}};t.isIdentity.get=function(){var m=this;return 1===m.m11&&0===m.m12&&0===m.m13&&0===m.m14&&0===m.m21&&1===m.m22&&0===m.m23&&0===m.m24&&0===m.m31&&0===m.m32&&1===m.m33&&0===m.m34&&0===m.m41&&0===m.m42&&0===m.m43&&1===m.m44},t.isIdentity.set=function(m){this.isIdentity=m},t.is2D.get=function(){var m=this;return 0===m.m31&&0===m.m32&&1===m.m33&&0===m.m34&&0===m.m43&&1===m.m44},t.is2D.set=function(m){this.is2D=m},Object.defineProperties(m.prototype,t);var r=m.prototype;function n(t,r,n){var e=new m;return e.m41=t,e.e=t,e.m42=r,e.f=r,e.m43=n,e}function e(t,r,n){var e=new m,i=t*Math.PI/180,a=r*Math.PI/180,u=n*Math.PI/180,s=Math.cos(i),o=-Math.sin(i),f=Math.cos(a),c=-Math.sin(a),h=Math.cos(u),l=-Math.sin(u),y=f*h,v=-f*l;e.m11=y,e.a=y,e.m12=v,e.b=v,e.m13=c;var x=o*c*h+s*l;e.m21=x,e.c=x;var w=s*h-o*c*l;return e.m22=w,e.d=w,e.m23=-o*f,e.m31=o*l-s*c*h,e.m32=o*h+s*c*l,e.m33=s*f,e}function i(t,r,n,e){var i=new m,a=e*Math.PI/360,u=Math.sin(a),s=Math.cos(a),o=u*u,f=Math.sqrt(t*t+r*r+n*n),c=0,h=0,l=1;0!==f&&(c=t/f,h=r/f,l=n/f);var y=c*c,v=h*h,x=l*l,w=1-2*(v+x)*o;i.m11=w,i.a=w;var M=2*(t*r*o+n*u*s);i.m12=M,i.b=M,i.m13=2*(t*n*o-r*u*s);var g=2*(r*t*o-n*u*s);i.m21=g,i.c=g;var d=1-2*(x+y)*o;return i.m22=d,i.d=d,i.m23=2*(r*n*o+t*u*s),i.m31=2*(n*t*o+r*u*s),i.m32=2*(n*r*o-t*u*s),i.m33=1-2*(y+v)*o,i.m14=0,i.m24=0,i.m34=0,i.m41=0,i.e=0,i.m42=0,i.f=0,i.m43=0,i.m44=1,i}function a(t,r,n){var e=new m;return e.m11=t,e.a=t,e.m22=r,e.d=r,e.m33=n,e}function u(t){var r=t*Math.PI/180,n=new m,e=Math.tan(r);return n.m21=e,n.c=e,n}function s(t){var r=t*Math.PI/180,n=new m,e=Math.tan(r);return n.m12=e,n.b=e,n}function o(t,r){var n=r.m11*t.m11+r.m12*t.m21+r.m13*t.m31+r.m14*t.m41,e=r.m11*t.m12+r.m12*t.m22+r.m13*t.m32+r.m14*t.m42,i=r.m11*t.m13+r.m12*t.m23+r.m13*t.m33+r.m14*t.m43,a=r.m11*t.m14+r.m12*t.m24+r.m13*t.m34+r.m14*t.m44,u=r.m21*t.m11+r.m22*t.m21+r.m23*t.m31+r.m24*t.m41,s=r.m21*t.m12+r.m22*t.m22+r.m23*t.m32+r.m24*t.m42,o=r.m21*t.m13+r.m22*t.m23+r.m23*t.m33+r.m24*t.m43,f=r.m21*t.m14+r.m22*t.m24+r.m23*t.m34+r.m24*t.m44,c=r.m31*t.m11+r.m32*t.m21+r.m33*t.m31+r.m34*t.m41,h=r.m31*t.m12+r.m32*t.m22+r.m33*t.m32+r.m34*t.m42,l=r.m31*t.m13+r.m32*t.m23+r.m33*t.m33+r.m34*t.m43,y=r.m31*t.m14+r.m32*t.m24+r.m33*t.m34+r.m34*t.m44,v=r.m41*t.m11+r.m42*t.m21+r.m43*t.m31+r.m44*t.m41,x=r.m41*t.m12+r.m42*t.m22+r.m43*t.m32+r.m44*t.m42,w=r.m41*t.m13+r.m42*t.m23+r.m43*t.m33+r.m44*t.m43,M=r.m41*t.m14+r.m42*t.m24+r.m43*t.m34+r.m44*t.m44;return new m([n,u,c,v,e,s,h,x,i,o,l,w,a,f,y,M])}function f(m,t){var r=Array.from(t);if(16===r.length){var n=r[0],e=r[1],i=r[2],a=r[3],u=r[4],s=r[5],o=r[6],f=r[7],c=r[8],h=r[9],l=r[10],y=r[11],v=r[12],x=r[13],w=r[14],M=r[15];m.m11=n,m.a=n,m.m21=e,m.c=e,m.m31=i,m.m41=a,m.e=a,m.m12=u,m.b=u,m.m22=s,m.d=s,m.m32=o,m.m42=f,m.f=f,m.m13=c,m.m23=h,m.m33=l,m.m43=y,m.m14=v,m.m24=x,m.m34=w,m.m44=M}else{if(6!==r.length)throw new TypeError("CSSMatrix: expecting a 6/16 values Array");var g=r[0],d=r[1],p=r[2],A=r[3],S=r[4],I=r[5];m.m11=g,m.a=g,m.m12=d,m.b=d,m.m21=p,m.c=p,m.m22=A,m.d=A,m.m14=S,m.e=S,m.m24=I,m.f=I}return m}r.setMatrixValue=function(t){var r=this;if(!t||!t.length)return r;if(t.length&&"string"==typeof t[0]&&t[0].length){var n,e,i=String(t[0]).trim();if("none"===i)return r;if(n=i.slice(0,i.indexOf("(")),e=i.slice("matrix"===n?7:9,-1).split(",").map((function(m){return Math.abs(m)<1e-6?0:+m})),!([6,16].indexOf(e.length)>-1))throw new TypeError("CSSMatrix: expecting valid CSS matrix() / matrix3d() syntax");f(r,e)}else t[0]instanceof m?f(r,t[0].toArray()):Array.isArray(t[0])?f(r,t[0]):Array.isArray(t)&&f(r,t);return r},r.toString=function(){return(this.is2D?"matrix":"matrix3d")+"("+this.toArray(1).join(",")+")"},r.toArray=function(m){var t=this;return t.is2D?[t.a,t.b,t.c,t.d,t.e,t.f]:m?[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]:[t.m11,t.m21,t.m31,t.m41,t.m12,t.m22,t.m32,t.m42,t.m13,t.m23,t.m33,t.m43,t.m14,t.m24,t.m34,t.m44]},r.multiply=function(m){return o(this,m)},r.translate=function(m,t,r){var e=t,i=r;return null==i&&(i=0),null==e&&(e=0),o(this,n(m,e,i))},r.scale=function(m,t,r){var n=t,e=r;return null==n&&(n=m),null==e&&(e=m),o(this,a(m,n,e))},r.rotate=function(m,t,r){var n=m,i=t,a=r;return null==i&&(i=0),null==a&&(a=n,n=0),o(this,e(n,i,a))},r.rotateAxisAngle=function(m,t,r,n){if(4!==arguments.length)throw new TypeError("CSSMatrix: expecting 4 values");return o(this,i(m,t,r,n))},r.skewX=function(m){return o(this,u(m))},r.skewY=function(m){return o(this,s(m))},r.setIdentity=function(){return f(this,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},r.transformPoint=function(m){var t=n(m.x,m.y,m.z);return t.m44=m.w||1,{x:(t=this.multiply(t)).m41,y:t.m42,z:t.m43,w:t.m44}},r.transform=function(m){var t=this,r=t.m11*m.x+t.m12*m.y+t.m13*m.z+t.m14*m.w,n=t.m21*m.x+t.m22*m.y+t.m23*m.z+t.m24*m.w,e=t.m31*m.x+t.m32*m.y+t.m33*m.z+t.m34*m.w,i=t.m41*m.x+t.m42*m.y+t.m43*m.z+t.m44*m.w;return{x:r/i,y:n/i,z:e/i,w:i}},m.Translate=n,m.Rotate=e,m.RotateAxisAngle=i,m.Scale=a,m.SkewX=u,m.SkewY=s,m.Multiply=o,m.fromMatrix=function(t){return new m([t.m11,t.m21,t.m31,t.m41,t.m12,t.m22,t.m32,t.m42,t.m13,t.m23,t.m33,t.m43,t.m14,t.m24,t.m34,t.m44])},m.fromArray=function(t){return f(new m,t)},m.feedFromArray=f;export default m; |
/*! | ||
* DOMMatrix v0.0.5-alpha1 (https://github.com/thednp/dommatrix) | ||
* DOMMatrix v0.0.5-alpha2 (https://github.com/thednp/dommatrix) | ||
* Copyright 2021 © thednp | ||
@@ -500,4 +500,5 @@ * Licensed under MIT (https://github.com/thednp/DOMMatrix/blob/master/LICENSE) | ||
} if (source.length && typeof source[0] === 'string' && source[0].length) { // CSS transform String source | ||
var string = String(source[0]).trim(); var type = ''; var | ||
values = []; | ||
var string = String(source[0]).trim(); | ||
var type = ''; | ||
var values = []; | ||
@@ -608,6 +609,6 @@ if (string === 'none') { return m; } | ||
var X = x; | ||
var Y; | ||
var Z; | ||
if (z === null) { Z = 0; } | ||
if (y === null) { Y = 0; } | ||
var Y = y; | ||
var Z = z; | ||
if (Z == null) { Z = 0; } | ||
if (Y == null) { Y = 0; } | ||
return Multiply(this, Translate(X, Y, Z)); | ||
@@ -627,9 +628,8 @@ }; | ||
*/ | ||
CSSMatrixProto.scale = function scale(x, y, z) { | ||
var X = x; | ||
var Y; | ||
var Z; | ||
if (z === null) { Z = x; } | ||
if (y === null) { Y = x; } | ||
var Y = y; | ||
var Z = z; | ||
if (Y == null) { Y = x; } | ||
if (Z == null) { Z = x; } | ||
@@ -651,9 +651,8 @@ return Multiply(this, Scale(X, Y, Z)); | ||
*/ | ||
CSSMatrixProto.rotate = function rotate(rx, ry, rz) { | ||
var RX = rx; | ||
var RY; | ||
var RZ; | ||
if (ry === null) { RY = 0; } | ||
if (rz === null) { RZ = rx; RX = 0; } | ||
var RY = ry; | ||
var RZ = rz; | ||
if (RY == null) { RY = 0; } | ||
if (RZ == null) { RZ = RX; RX = 0; } | ||
return Multiply(this, Rotate(RX, RY, RZ)); | ||
@@ -660,0 +659,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
// DOMMatrix v0.0.5-alpha1 | thednp © 2021 | MIT-License | ||
!function(m,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(m="undefined"!=typeof globalThis?globalThis:m||self).CSSMatrix=t()}(this,(function(){"use strict";var m=function(){for(var m=[],t=arguments.length;t--;)m[t]=arguments[t];return this.setIdentity(),m&&m.length&&this.setMatrixValue(m)},t={isIdentity:{configurable:!0},is2D:{configurable:!0}};t.isIdentity.get=function(){var m=this;return 1===m.m11&&0===m.m12&&0===m.m13&&0===m.m14&&0===m.m21&&1===m.m22&&0===m.m23&&0===m.m24&&0===m.m31&&0===m.m32&&1===m.m33&&0===m.m34&&0===m.m41&&0===m.m42&&0===m.m43&&1===m.m44},t.isIdentity.set=function(m){this.isIdentity=m},t.is2D.get=function(){var m=this;return 0===m.m31&&0===m.m32&&1===m.m33&&0===m.m34&&0===m.m43&&1===m.m44},t.is2D.set=function(m){this.is2D=m},Object.defineProperties(m.prototype,t);var n=m.prototype;function r(t,n,r){var e=new m;return e.m41=t,e.e=t,e.m42=n,e.f=n,e.m43=r,e}function e(t,n,r){var e=new m,i=t*Math.PI/180,a=n*Math.PI/180,u=r*Math.PI/180,o=Math.cos(i),s=-Math.sin(i),f=Math.cos(a),c=-Math.sin(a),h=Math.cos(u),l=-Math.sin(u),y=f*h,v=-f*l;e.m11=y,e.a=y,e.m12=v,e.b=v,e.m13=c;var d=s*c*h+o*l;e.m21=d,e.c=d;var x=o*h-s*c*l;return e.m22=x,e.d=x,e.m23=-s*f,e.m31=s*l-o*c*h,e.m32=s*h+o*c*l,e.m33=o*f,e}function i(t,n,r,e){var i=new m,a=e*Math.PI/360,u=Math.sin(a),o=Math.cos(a),s=u*u,f=Math.sqrt(t*t+n*n+r*r),c=0,h=0,l=1;0!==f&&(c=t/f,h=n/f,l=r/f);var y=c*c,v=h*h,d=l*l,x=1-2*(v+d)*s;i.m11=x,i.a=x;var w=2*(t*n*s+r*u*o);i.m12=w,i.b=w,i.m13=2*(t*r*s-n*u*o);var M=2*(n*t*s-r*u*o);i.m21=M,i.c=M;var g=1-2*(d+y)*s;return i.m22=g,i.d=g,i.m23=2*(n*r*s+t*u*o),i.m31=2*(r*t*s+n*u*o),i.m32=2*(r*n*s-t*u*o),i.m33=1-2*(y+v)*s,i.m14=0,i.m24=0,i.m34=0,i.m41=0,i.e=0,i.m42=0,i.f=0,i.m43=0,i.m44=1,i}function a(t,n,r){var e=new m;return e.m11=t,e.a=t,e.m22=n,e.d=n,e.m33=r,e}function u(t){var n=t*Math.PI/180,r=new m,e=Math.tan(n);return r.m21=e,r.c=e,r}function o(t){var n=t*Math.PI/180,r=new m,e=Math.tan(n);return r.m12=e,r.b=e,r}function s(t,n){var r=n.m11*t.m11+n.m12*t.m21+n.m13*t.m31+n.m14*t.m41,e=n.m11*t.m12+n.m12*t.m22+n.m13*t.m32+n.m14*t.m42,i=n.m11*t.m13+n.m12*t.m23+n.m13*t.m33+n.m14*t.m43,a=n.m11*t.m14+n.m12*t.m24+n.m13*t.m34+n.m14*t.m44,u=n.m21*t.m11+n.m22*t.m21+n.m23*t.m31+n.m24*t.m41,o=n.m21*t.m12+n.m22*t.m22+n.m23*t.m32+n.m24*t.m42,s=n.m21*t.m13+n.m22*t.m23+n.m23*t.m33+n.m24*t.m43,f=n.m21*t.m14+n.m22*t.m24+n.m23*t.m34+n.m24*t.m44,c=n.m31*t.m11+n.m32*t.m21+n.m33*t.m31+n.m34*t.m41,h=n.m31*t.m12+n.m32*t.m22+n.m33*t.m32+n.m34*t.m42,l=n.m31*t.m13+n.m32*t.m23+n.m33*t.m33+n.m34*t.m43,y=n.m31*t.m14+n.m32*t.m24+n.m33*t.m34+n.m34*t.m44,v=n.m41*t.m11+n.m42*t.m21+n.m43*t.m31+n.m44*t.m41,d=n.m41*t.m12+n.m42*t.m22+n.m43*t.m32+n.m44*t.m42,x=n.m41*t.m13+n.m42*t.m23+n.m43*t.m33+n.m44*t.m43,w=n.m41*t.m14+n.m42*t.m24+n.m43*t.m34+n.m44*t.m44;return new m([r,u,c,v,e,o,h,d,i,s,l,x,a,f,y,w])}function f(m,t){var n=Array.from(t);if(16===n.length){var r=n[0],e=n[1],i=n[2],a=n[3],u=n[4],o=n[5],s=n[6],f=n[7],c=n[8],h=n[9],l=n[10],y=n[11],v=n[12],d=n[13],x=n[14],w=n[15];m.m11=r,m.a=r,m.m21=e,m.c=e,m.m31=i,m.m41=a,m.e=a,m.m12=u,m.b=u,m.m22=o,m.d=o,m.m32=s,m.m42=f,m.f=f,m.m13=c,m.m23=h,m.m33=l,m.m43=y,m.m14=v,m.m24=d,m.m34=x,m.m44=w}else{if(6!==n.length)throw new TypeError("CSSMatrix: expecting a 6/16 values Array");var M=n[0],g=n[1],p=n[2],A=n[3],S=n[4],b=n[5];m.m11=M,m.a=M,m.m12=g,m.b=g,m.m21=p,m.c=p,m.m22=A,m.d=A,m.m14=S,m.e=S,m.m24=b,m.f=b}return m}return n.setMatrixValue=function(t){var n=this;if(!t||!t.length)return n;if(t.length&&"string"==typeof t[0]&&t[0].length){var r,e,i=String(t[0]).trim();if("none"===i)return n;if(r=i.slice(0,i.indexOf("(")),e=i.slice("matrix"===r?7:9,-1).split(",").map((function(m){return Math.abs(m)<1e-6?0:+m})),!([6,16].indexOf(e.length)>-1))throw new TypeError("CSSMatrix: expecting valid CSS matrix() / matrix3d() syntax");f(n,e)}else t[0]instanceof m?f(n,t[0].toArray()):Array.isArray(t[0])?f(n,t[0]):Array.isArray(t)&&f(n,t);return n},n.toString=function(){return(this.is2D?"matrix":"matrix3d")+"("+this.toArray(1).join(",")+")"},n.toArray=function(m){var t=this;return t.is2D?[t.a,t.b,t.c,t.d,t.e,t.f]:m?[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]:[t.m11,t.m21,t.m31,t.m41,t.m12,t.m22,t.m32,t.m42,t.m13,t.m23,t.m33,t.m43,t.m14,t.m24,t.m34,t.m44]},n.multiply=function(m){return s(this,m)},n.translate=function(m,t,n){var e,i;return null===n&&(i=0),null===t&&(e=0),s(this,r(m,e,i))},n.scale=function(m,t,n){var r,e;return null===n&&(e=m),null===t&&(r=m),s(this,a(m,r,e))},n.rotate=function(m,t,n){var r,i,a=m;return null===t&&(r=0),null===n&&(i=m,a=0),s(this,e(a,r,i))},n.rotateAxisAngle=function(m,t,n,r){if(4!==arguments.length)throw new TypeError("CSSMatrix: expecting 4 values");return s(this,i(m,t,n,r))},n.skewX=function(m){return s(this,u(m))},n.skewY=function(m){return s(this,o(m))},n.setIdentity=function(){return f(this,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},n.transformPoint=function(m){var t=r(m.x,m.y,m.z);return t.m44=m.w||1,{x:(t=this.multiply(t)).m41,y:t.m42,z:t.m43,w:t.m44}},n.transform=function(m){var t=this,n=t.m11*m.x+t.m12*m.y+t.m13*m.z+t.m14*m.w,r=t.m21*m.x+t.m22*m.y+t.m23*m.z+t.m24*m.w,e=t.m31*m.x+t.m32*m.y+t.m33*m.z+t.m34*m.w,i=t.m41*m.x+t.m42*m.y+t.m43*m.z+t.m44*m.w;return{x:n/i,y:r/i,z:e/i,w:i}},m.Translate=r,m.Rotate=e,m.RotateAxisAngle=i,m.Scale=a,m.SkewX=u,m.SkewY=o,m.Multiply=s,m.fromMatrix=function(t){return new m([t.m11,t.m21,t.m31,t.m41,t.m12,t.m22,t.m32,t.m42,t.m13,t.m23,t.m33,t.m43,t.m14,t.m24,t.m34,t.m44])},m.fromArray=function(t){return f(new m,t)},m.feedFromArray=f,m})); | ||
// DOMMatrix v0.0.5-alpha2 | thednp © 2021 | MIT-License | ||
!function(m,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(m="undefined"!=typeof globalThis?globalThis:m||self).CSSMatrix=t()}(this,(function(){"use strict";var m=function(){for(var m=[],t=arguments.length;t--;)m[t]=arguments[t];return this.setIdentity(),m&&m.length&&this.setMatrixValue(m)},t={isIdentity:{configurable:!0},is2D:{configurable:!0}};t.isIdentity.get=function(){var m=this;return 1===m.m11&&0===m.m12&&0===m.m13&&0===m.m14&&0===m.m21&&1===m.m22&&0===m.m23&&0===m.m24&&0===m.m31&&0===m.m32&&1===m.m33&&0===m.m34&&0===m.m41&&0===m.m42&&0===m.m43&&1===m.m44},t.isIdentity.set=function(m){this.isIdentity=m},t.is2D.get=function(){var m=this;return 0===m.m31&&0===m.m32&&1===m.m33&&0===m.m34&&0===m.m43&&1===m.m44},t.is2D.set=function(m){this.is2D=m},Object.defineProperties(m.prototype,t);var n=m.prototype;function r(t,n,r){var e=new m;return e.m41=t,e.e=t,e.m42=n,e.f=n,e.m43=r,e}function e(t,n,r){var e=new m,i=t*Math.PI/180,a=n*Math.PI/180,u=r*Math.PI/180,o=Math.cos(i),s=-Math.sin(i),f=Math.cos(a),c=-Math.sin(a),h=Math.cos(u),l=-Math.sin(u),y=f*h,v=-f*l;e.m11=y,e.a=y,e.m12=v,e.b=v,e.m13=c;var d=s*c*h+o*l;e.m21=d,e.c=d;var x=o*h-s*c*l;return e.m22=x,e.d=x,e.m23=-s*f,e.m31=s*l-o*c*h,e.m32=s*h+o*c*l,e.m33=o*f,e}function i(t,n,r,e){var i=new m,a=e*Math.PI/360,u=Math.sin(a),o=Math.cos(a),s=u*u,f=Math.sqrt(t*t+n*n+r*r),c=0,h=0,l=1;0!==f&&(c=t/f,h=n/f,l=r/f);var y=c*c,v=h*h,d=l*l,x=1-2*(v+d)*s;i.m11=x,i.a=x;var w=2*(t*n*s+r*u*o);i.m12=w,i.b=w,i.m13=2*(t*r*s-n*u*o);var M=2*(n*t*s-r*u*o);i.m21=M,i.c=M;var g=1-2*(d+y)*s;return i.m22=g,i.d=g,i.m23=2*(n*r*s+t*u*o),i.m31=2*(r*t*s+n*u*o),i.m32=2*(r*n*s-t*u*o),i.m33=1-2*(y+v)*s,i.m14=0,i.m24=0,i.m34=0,i.m41=0,i.e=0,i.m42=0,i.f=0,i.m43=0,i.m44=1,i}function a(t,n,r){var e=new m;return e.m11=t,e.a=t,e.m22=n,e.d=n,e.m33=r,e}function u(t){var n=t*Math.PI/180,r=new m,e=Math.tan(n);return r.m21=e,r.c=e,r}function o(t){var n=t*Math.PI/180,r=new m,e=Math.tan(n);return r.m12=e,r.b=e,r}function s(t,n){var r=n.m11*t.m11+n.m12*t.m21+n.m13*t.m31+n.m14*t.m41,e=n.m11*t.m12+n.m12*t.m22+n.m13*t.m32+n.m14*t.m42,i=n.m11*t.m13+n.m12*t.m23+n.m13*t.m33+n.m14*t.m43,a=n.m11*t.m14+n.m12*t.m24+n.m13*t.m34+n.m14*t.m44,u=n.m21*t.m11+n.m22*t.m21+n.m23*t.m31+n.m24*t.m41,o=n.m21*t.m12+n.m22*t.m22+n.m23*t.m32+n.m24*t.m42,s=n.m21*t.m13+n.m22*t.m23+n.m23*t.m33+n.m24*t.m43,f=n.m21*t.m14+n.m22*t.m24+n.m23*t.m34+n.m24*t.m44,c=n.m31*t.m11+n.m32*t.m21+n.m33*t.m31+n.m34*t.m41,h=n.m31*t.m12+n.m32*t.m22+n.m33*t.m32+n.m34*t.m42,l=n.m31*t.m13+n.m32*t.m23+n.m33*t.m33+n.m34*t.m43,y=n.m31*t.m14+n.m32*t.m24+n.m33*t.m34+n.m34*t.m44,v=n.m41*t.m11+n.m42*t.m21+n.m43*t.m31+n.m44*t.m41,d=n.m41*t.m12+n.m42*t.m22+n.m43*t.m32+n.m44*t.m42,x=n.m41*t.m13+n.m42*t.m23+n.m43*t.m33+n.m44*t.m43,w=n.m41*t.m14+n.m42*t.m24+n.m43*t.m34+n.m44*t.m44;return new m([r,u,c,v,e,o,h,d,i,s,l,x,a,f,y,w])}function f(m,t){var n=Array.from(t);if(16===n.length){var r=n[0],e=n[1],i=n[2],a=n[3],u=n[4],o=n[5],s=n[6],f=n[7],c=n[8],h=n[9],l=n[10],y=n[11],v=n[12],d=n[13],x=n[14],w=n[15];m.m11=r,m.a=r,m.m21=e,m.c=e,m.m31=i,m.m41=a,m.e=a,m.m12=u,m.b=u,m.m22=o,m.d=o,m.m32=s,m.m42=f,m.f=f,m.m13=c,m.m23=h,m.m33=l,m.m43=y,m.m14=v,m.m24=d,m.m34=x,m.m44=w}else{if(6!==n.length)throw new TypeError("CSSMatrix: expecting a 6/16 values Array");var M=n[0],g=n[1],p=n[2],A=n[3],S=n[4],b=n[5];m.m11=M,m.a=M,m.m12=g,m.b=g,m.m21=p,m.c=p,m.m22=A,m.d=A,m.m14=S,m.e=S,m.m24=b,m.f=b}return m}return n.setMatrixValue=function(t){var n=this;if(!t||!t.length)return n;if(t.length&&"string"==typeof t[0]&&t[0].length){var r,e,i=String(t[0]).trim();if("none"===i)return n;if(r=i.slice(0,i.indexOf("(")),e=i.slice("matrix"===r?7:9,-1).split(",").map((function(m){return Math.abs(m)<1e-6?0:+m})),!([6,16].indexOf(e.length)>-1))throw new TypeError("CSSMatrix: expecting valid CSS matrix() / matrix3d() syntax");f(n,e)}else t[0]instanceof m?f(n,t[0].toArray()):Array.isArray(t[0])?f(n,t[0]):Array.isArray(t)&&f(n,t);return n},n.toString=function(){return(this.is2D?"matrix":"matrix3d")+"("+this.toArray(1).join(",")+")"},n.toArray=function(m){var t=this;return t.is2D?[t.a,t.b,t.c,t.d,t.e,t.f]:m?[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]:[t.m11,t.m21,t.m31,t.m41,t.m12,t.m22,t.m32,t.m42,t.m13,t.m23,t.m33,t.m43,t.m14,t.m24,t.m34,t.m44]},n.multiply=function(m){return s(this,m)},n.translate=function(m,t,n){var e=t,i=n;return null==i&&(i=0),null==e&&(e=0),s(this,r(m,e,i))},n.scale=function(m,t,n){var r=t,e=n;return null==r&&(r=m),null==e&&(e=m),s(this,a(m,r,e))},n.rotate=function(m,t,n){var r=m,i=t,a=n;return null==i&&(i=0),null==a&&(a=r,r=0),s(this,e(r,i,a))},n.rotateAxisAngle=function(m,t,n,r){if(4!==arguments.length)throw new TypeError("CSSMatrix: expecting 4 values");return s(this,i(m,t,n,r))},n.skewX=function(m){return s(this,u(m))},n.skewY=function(m){return s(this,o(m))},n.setIdentity=function(){return f(this,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},n.transformPoint=function(m){var t=r(m.x,m.y,m.z);return t.m44=m.w||1,{x:(t=this.multiply(t)).m41,y:t.m42,z:t.m43,w:t.m44}},n.transform=function(m){var t=this,n=t.m11*m.x+t.m12*m.y+t.m13*m.z+t.m14*m.w,r=t.m21*m.x+t.m22*m.y+t.m23*m.z+t.m24*m.w,e=t.m31*m.x+t.m32*m.y+t.m33*m.z+t.m34*m.w,i=t.m41*m.x+t.m42*m.y+t.m43*m.z+t.m44*m.w;return{x:n/i,y:r/i,z:e/i,w:i}},m.Translate=r,m.Rotate=e,m.RotateAxisAngle=i,m.Scale=a,m.SkewX=u,m.SkewY=o,m.Multiply=s,m.fromMatrix=function(t){return new m([t.m11,t.m21,t.m31,t.m41,t.m12,t.m22,t.m32,t.m42,t.m13,t.m23,t.m33,t.m43,t.m14,t.m24,t.m34,t.m44])},m.fromArray=function(t){return f(new m,t)},m.feedFromArray=f,m})); |
{ | ||
"name": "dommatrix", | ||
"version": "0.0.5-alpha1", | ||
"version": "0.0.5-alpha2", | ||
"description": "ES6+ shim for DOMMatrix", | ||
@@ -5,0 +5,0 @@ "main": "dist/dommatrix.min.js", |
@@ -467,4 +467,5 @@ /** | ||
} if (source.length && typeof source[0] === 'string' && source[0].length) { // CSS transform String source | ||
const string = String(source[0]).trim(); let type = ''; let | ||
values = []; | ||
const string = String(source[0]).trim(); | ||
let type = ''; | ||
let values = []; | ||
@@ -575,6 +576,6 @@ if (string === 'none') return m; | ||
const X = x; | ||
let Y; | ||
let Z; | ||
if (z === null) Z = 0; | ||
if (y === null) Y = 0; | ||
let Y = y; | ||
let Z = z; | ||
if (Z == null) Z = 0; | ||
if (Y == null) Y = 0; | ||
return Multiply(this, Translate(X, Y, Z)); | ||
@@ -594,9 +595,8 @@ }; | ||
*/ | ||
CSSMatrixProto.scale = function scale(x, y, z) { | ||
const X = x; | ||
let Y; | ||
let Z; | ||
if (z === null) Z = x; | ||
if (y === null) Y = x; | ||
let Y = y; | ||
let Z = z; | ||
if (Y == null) Y = x; | ||
if (Z == null) Z = x; | ||
@@ -618,9 +618,8 @@ return Multiply(this, Scale(X, Y, Z)); | ||
*/ | ||
CSSMatrixProto.rotate = function rotate(rx, ry, rz) { | ||
let RX = rx; | ||
let RY; | ||
let RZ; | ||
if (ry === null) RY = 0; | ||
if (rz === null) { RZ = rx; RX = 0; } | ||
let RY = ry; | ||
let RZ = rz; | ||
if (RY == null) RY = 0; | ||
if (RZ == null) { RZ = RX; RX = 0; } | ||
return Multiply(this, Rotate(RX, RY, RZ)); | ||
@@ -627,0 +626,0 @@ }; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
86358
2037
0