@thednp/dommatrix 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/dommatrix.cjs +1 -1
- package/dist/dommatrix.cjs.map +1 -1
- package/dist/dommatrix.d.ts +3 -3
- package/dist/dommatrix.js +1 -1
- package/dist/dommatrix.js.map +1 -1
- package/dist/dommatrix.mjs +112 -118
- package/dist/dommatrix.mjs.map +1 -1
- package/package.json +1 -1
package/dist/dommatrix.mjs
CHANGED
|
@@ -23,8 +23,8 @@ const I = {
|
|
|
23
23
|
m44: 1,
|
|
24
24
|
is2D: !0,
|
|
25
25
|
isIdentity: !0
|
|
26
|
-
}, T = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == "number")) && [6, 16].some((t) => s.length === t), E = (s) => s instanceof DOMMatrix || s instanceof
|
|
27
|
-
const t = new
|
|
26
|
+
}, T = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == "number")) && [6, 16].some((t) => s.length === t), E = (s) => s instanceof DOMMatrix || s instanceof M || typeof s == "object" && Object.keys(I).every((t) => s && t in s), b = (s) => {
|
|
27
|
+
const t = new M(), e = Array.from(s);
|
|
28
28
|
if (!T(e))
|
|
29
29
|
throw TypeError(
|
|
30
30
|
`CSSMatrix: "${e.join(",")}" must be an array with 6/16 numbers.`
|
|
@@ -33,10 +33,10 @@ const I = {
|
|
|
33
33
|
const [
|
|
34
34
|
i,
|
|
35
35
|
n,
|
|
36
|
-
|
|
36
|
+
m,
|
|
37
37
|
a,
|
|
38
38
|
h,
|
|
39
|
-
|
|
39
|
+
r,
|
|
40
40
|
l,
|
|
41
41
|
c,
|
|
42
42
|
u,
|
|
@@ -44,19 +44,19 @@ const I = {
|
|
|
44
44
|
p,
|
|
45
45
|
o,
|
|
46
46
|
y,
|
|
47
|
-
d,
|
|
48
47
|
S,
|
|
49
|
-
|
|
48
|
+
d,
|
|
49
|
+
w
|
|
50
50
|
] = e;
|
|
51
|
-
t.m11 = i, t.a = i, t.m21 = h, t.c = h, t.m31 = u, t.m41 = y, t.e = y, t.m12 = n, t.b = n, t.m22 =
|
|
51
|
+
t.m11 = i, t.a = i, t.m21 = h, t.c = h, t.m31 = u, t.m41 = y, t.e = y, t.m12 = n, t.b = n, t.m22 = r, t.d = r, t.m32 = f, t.m42 = S, t.f = S, t.m13 = m, t.m23 = l, t.m33 = p, t.m43 = d, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = w;
|
|
52
52
|
} else if (e.length === 6) {
|
|
53
|
-
const [i, n,
|
|
54
|
-
t.m11 = i, t.a = i, t.m12 = n, t.b = n, t.m21 =
|
|
53
|
+
const [i, n, m, a, h, r] = e;
|
|
54
|
+
t.m11 = i, t.a = i, t.m12 = n, t.b = n, t.m21 = m, t.c = m, t.m22 = a, t.d = a, t.m41 = h, t.e = h, t.m42 = r, t.f = r;
|
|
55
55
|
}
|
|
56
56
|
return t;
|
|
57
|
-
},
|
|
57
|
+
}, N = (s) => {
|
|
58
58
|
if (E(s))
|
|
59
|
-
return
|
|
59
|
+
return b([
|
|
60
60
|
s.m11,
|
|
61
61
|
s.m12,
|
|
62
62
|
s.m13,
|
|
@@ -82,56 +82,54 @@ const I = {
|
|
|
82
82
|
}, R = (s) => {
|
|
83
83
|
if (typeof s != "string")
|
|
84
84
|
throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);
|
|
85
|
-
const t = String(s).replace(/\s/g, "")
|
|
86
|
-
let e = new w();
|
|
87
|
-
const i = `CSSMatrix: invalid transform string "${s}"`;
|
|
85
|
+
const t = String(s).replace(/\s/g, ""), e = new M(), i = `CSSMatrix: invalid transform string "${s}"`;
|
|
88
86
|
return t.split(")").filter((n) => n).forEach((n) => {
|
|
89
|
-
const [
|
|
87
|
+
const [m, a] = n.split("(");
|
|
90
88
|
if (!a) throw TypeError(i);
|
|
91
89
|
const h = a.split(",").map(
|
|
92
90
|
(o) => o.includes("rad") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)
|
|
93
|
-
), [
|
|
94
|
-
if (
|
|
95
|
-
e.m34 = -1 /
|
|
96
|
-
else if (
|
|
91
|
+
), [r, l, c, u] = h, f = [r, l, c], p = [r, l, c, u];
|
|
92
|
+
if (m === "perspective" && r && [l, c].every((o) => o === void 0))
|
|
93
|
+
e.m34 = -1 / r;
|
|
94
|
+
else if (m.includes("matrix") && [6, 16].includes(h.length) && h.every((o) => !Number.isNaN(+o))) {
|
|
97
95
|
const o = h.map((y) => Math.abs(y) < 1e-6 ? 0 : y);
|
|
98
|
-
e
|
|
99
|
-
} else if (
|
|
100
|
-
e
|
|
101
|
-
else if (
|
|
102
|
-
e
|
|
103
|
-
else if (
|
|
104
|
-
e
|
|
105
|
-
else if (
|
|
106
|
-
e
|
|
107
|
-
else if (
|
|
108
|
-
e
|
|
96
|
+
e.multiplySelf(b(o));
|
|
97
|
+
} else if (m === "translate3d" && f.every((o) => !Number.isNaN(+o)))
|
|
98
|
+
e.translateSelf(r, l, c);
|
|
99
|
+
else if (m === "translate" && r && c === void 0)
|
|
100
|
+
e.translateSelf(r, l || 0, 0);
|
|
101
|
+
else if (m === "rotate3d" && p.every((o) => !Number.isNaN(+o)) && u)
|
|
102
|
+
e.rotateAxisAngleSelf(r, l, c, u);
|
|
103
|
+
else if (m === "rotate" && r && [l, c].every((o) => o === void 0))
|
|
104
|
+
e.rotateSelf(0, 0, r);
|
|
105
|
+
else if (m === "scale3d" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))
|
|
106
|
+
e.scaleSelf(r, l, c);
|
|
109
107
|
else if (
|
|
110
108
|
// prop === "scale" && !Number.isNaN(x) && x !== 1 && z === undefined
|
|
111
109
|
// prop === "scale" && !Number.isNaN(x) && [x, y].some((n) => n !== 1) &&
|
|
112
|
-
|
|
110
|
+
m === "scale" && !Number.isNaN(r) && (r !== 1 || l !== 1) && c === void 0
|
|
113
111
|
) {
|
|
114
|
-
const y = Number.isNaN(+l) ?
|
|
115
|
-
e
|
|
116
|
-
} else if (
|
|
117
|
-
e
|
|
112
|
+
const y = Number.isNaN(+l) ? r : l;
|
|
113
|
+
e.scaleSelf(r, y, 1);
|
|
114
|
+
} else if (m === "skew" && (r || !Number.isNaN(r) && l) && c === void 0)
|
|
115
|
+
e.skewSelf(r, l || 0);
|
|
118
116
|
else if (["translate", "rotate", "scale", "skew"].some(
|
|
119
|
-
(o) =>
|
|
120
|
-
) && /[XYZ]/.test(
|
|
121
|
-
if (
|
|
122
|
-
e
|
|
117
|
+
(o) => m.includes(o)
|
|
118
|
+
) && /[XYZ]/.test(m) && r && [l, c].every((o) => o === void 0))
|
|
119
|
+
if (m === "skewX" || m === "skewY")
|
|
120
|
+
e[m === "skewX" ? "skewXSelf" : "skewYSelf"](r);
|
|
123
121
|
else {
|
|
124
|
-
const o =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
const o = m.replace(/[XYZ]/, ""), y = m.replace(o, ""), S = ["X", "Y", "Z"].indexOf(y), d = o === "scale" ? 1 : 0, w = o + "Self", g = [
|
|
123
|
+
S === 0 ? r : d,
|
|
124
|
+
S === 1 ? r : d,
|
|
125
|
+
S === 2 ? r : d
|
|
128
126
|
];
|
|
129
|
-
e
|
|
127
|
+
e[w](...g);
|
|
130
128
|
}
|
|
131
129
|
else
|
|
132
130
|
throw TypeError(i);
|
|
133
131
|
}), e;
|
|
134
|
-
},
|
|
132
|
+
}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [
|
|
135
133
|
s.m11,
|
|
136
134
|
s.m12,
|
|
137
135
|
s.m13,
|
|
@@ -148,33 +146,33 @@ const I = {
|
|
|
148
146
|
s.m42,
|
|
149
147
|
s.m43,
|
|
150
148
|
s.m44
|
|
151
|
-
],
|
|
152
|
-
const i = new
|
|
149
|
+
], v = (s, t, e) => {
|
|
150
|
+
const i = new M();
|
|
153
151
|
return i.m41 = s, i.e = s, i.m42 = t, i.f = t, i.m43 = e, i;
|
|
154
|
-
},
|
|
155
|
-
const i = new
|
|
152
|
+
}, k = (s, t, e) => {
|
|
153
|
+
const i = new M(), n = Math.PI / 180, m = s * n, a = t * n, h = e * n, r = Math.cos(m), l = -Math.sin(m), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(h), p = -Math.sin(h), o = c * f, y = -c * p;
|
|
156
154
|
i.m11 = o, i.a = o, i.m12 = y, i.b = y, i.m13 = u;
|
|
157
|
-
const
|
|
158
|
-
i.m21 =
|
|
159
|
-
const
|
|
160
|
-
return i.m22 =
|
|
161
|
-
},
|
|
162
|
-
const n = new
|
|
163
|
-
if (
|
|
155
|
+
const S = l * u * f + r * p;
|
|
156
|
+
i.m21 = S, i.c = S;
|
|
157
|
+
const d = r * f - l * u * p;
|
|
158
|
+
return i.m22 = d, i.d = d, i.m23 = -l * c, i.m31 = l * p - r * u * f, i.m32 = l * f + r * u * p, i.m33 = r * c, i;
|
|
159
|
+
}, X = (s = 0, t = 0, e = 0, i = 0) => {
|
|
160
|
+
const n = new M(), m = Math.sqrt(s * s + t * t + e * e);
|
|
161
|
+
if (m === 0)
|
|
164
162
|
return n;
|
|
165
|
-
const a = s /
|
|
166
|
-
n.m11 =
|
|
167
|
-
const
|
|
168
|
-
n.m12 =
|
|
169
|
-
const
|
|
170
|
-
n.m21 =
|
|
171
|
-
const
|
|
172
|
-
return n.m22 =
|
|
173
|
-
},
|
|
174
|
-
const i = new
|
|
163
|
+
const a = s / m, h = t / m, r = e / m, l = i * (Math.PI / 360), c = Math.sin(l), u = Math.cos(l), f = c * c, p = a * a, o = h * h, y = r * r, S = 1 - 2 * (o + y) * f;
|
|
164
|
+
n.m11 = S, n.a = S;
|
|
165
|
+
const d = 2 * (a * h * f + r * c * u);
|
|
166
|
+
n.m12 = d, n.b = d, n.m13 = 2 * (a * r * f - h * c * u);
|
|
167
|
+
const w = 2 * (h * a * f - r * c * u);
|
|
168
|
+
n.m21 = w, n.c = w;
|
|
169
|
+
const g = 1 - 2 * (y + p) * f;
|
|
170
|
+
return n.m22 = g, n.d = g, n.m23 = 2 * (h * r * f + a * c * u), n.m31 = 2 * (r * a * f + h * c * u), n.m32 = 2 * (r * h * f - a * c * u), n.m33 = 1 - 2 * (p + o) * f, n;
|
|
171
|
+
}, O = (s, t, e) => {
|
|
172
|
+
const i = new M();
|
|
175
173
|
return i.m11 = s, i.a = s, i.m22 = t, i.d = t, i.m33 = e, i;
|
|
176
|
-
},
|
|
177
|
-
const e = new
|
|
174
|
+
}, A = (s, t) => {
|
|
175
|
+
const e = new M();
|
|
178
176
|
if (s) {
|
|
179
177
|
const i = s * Math.PI / 180, n = Math.tan(i);
|
|
180
178
|
e.m21 = n, e.c = n;
|
|
@@ -184,16 +182,16 @@ const I = {
|
|
|
184
182
|
e.m12 = n, e.b = n;
|
|
185
183
|
}
|
|
186
184
|
return e;
|
|
187
|
-
}, Y = (s) =>
|
|
188
|
-
const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, i = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, n = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43,
|
|
189
|
-
return
|
|
185
|
+
}, Y = (s) => A(s, 0), F = (s) => A(0, s), C = (s, t) => {
|
|
186
|
+
const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, i = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, n = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, m = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, h = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, r = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, l = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, p = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, y = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, S = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, d = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;
|
|
187
|
+
return b([
|
|
190
188
|
e,
|
|
191
189
|
i,
|
|
192
190
|
n,
|
|
193
|
-
|
|
191
|
+
m,
|
|
194
192
|
a,
|
|
195
193
|
h,
|
|
196
|
-
|
|
194
|
+
r,
|
|
197
195
|
l,
|
|
198
196
|
c,
|
|
199
197
|
u,
|
|
@@ -201,23 +199,23 @@ const I = {
|
|
|
201
199
|
p,
|
|
202
200
|
o,
|
|
203
201
|
y,
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
S,
|
|
203
|
+
d
|
|
206
204
|
]);
|
|
207
205
|
};
|
|
208
|
-
class
|
|
209
|
-
static Translate =
|
|
210
|
-
static Rotate =
|
|
211
|
-
static RotateAxisAngle =
|
|
212
|
-
static Scale =
|
|
206
|
+
class M {
|
|
207
|
+
static Translate = v;
|
|
208
|
+
static Rotate = k;
|
|
209
|
+
static RotateAxisAngle = X;
|
|
210
|
+
static Scale = O;
|
|
213
211
|
static SkewX = Y;
|
|
214
|
-
static SkewY =
|
|
215
|
-
static Skew =
|
|
216
|
-
static Multiply =
|
|
217
|
-
static fromArray =
|
|
218
|
-
static fromMatrix =
|
|
212
|
+
static SkewY = F;
|
|
213
|
+
static Skew = A;
|
|
214
|
+
static Multiply = C;
|
|
215
|
+
static fromArray = b;
|
|
216
|
+
static fromMatrix = N;
|
|
219
217
|
static fromString = R;
|
|
220
|
-
static toArray =
|
|
218
|
+
static toArray = x;
|
|
221
219
|
static isCompatibleArray = T;
|
|
222
220
|
static isCompatibleObject = E;
|
|
223
221
|
/**
|
|
@@ -264,7 +262,7 @@ class w {
|
|
|
264
262
|
* @return the matrix instance
|
|
265
263
|
*/
|
|
266
264
|
setMatrixValue(t) {
|
|
267
|
-
return typeof t == "string" && t.length && t !== "none" ? R(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ?
|
|
265
|
+
return typeof t == "string" && t.length && t !== "none" ? R(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? b(t) : typeof t == "object" ? N(t) : this;
|
|
268
266
|
}
|
|
269
267
|
/**
|
|
270
268
|
* Returns a *Float32Array* containing elements which comprise the matrix.
|
|
@@ -275,7 +273,7 @@ class w {
|
|
|
275
273
|
* @return an *Array* representation of the matrix
|
|
276
274
|
*/
|
|
277
275
|
toFloat32Array(t) {
|
|
278
|
-
return Float32Array.from(
|
|
276
|
+
return Float32Array.from(x(this, t));
|
|
279
277
|
}
|
|
280
278
|
/**
|
|
281
279
|
* Returns a *Float64Array* containing elements which comprise the matrix.
|
|
@@ -286,7 +284,7 @@ class w {
|
|
|
286
284
|
* @return an *Array* representation of the matrix
|
|
287
285
|
*/
|
|
288
286
|
toFloat64Array(t) {
|
|
289
|
-
return Float64Array.from(
|
|
287
|
+
return Float64Array.from(x(this, t));
|
|
290
288
|
}
|
|
291
289
|
/**
|
|
292
290
|
* Creates and returns a string representation of the matrix in `CSS` matrix syntax,
|
|
@@ -324,7 +322,7 @@ class w {
|
|
|
324
322
|
* @return The resulted matrix.
|
|
325
323
|
*/
|
|
326
324
|
multiply(t) {
|
|
327
|
-
return
|
|
325
|
+
return C(this, t);
|
|
328
326
|
}
|
|
329
327
|
/**
|
|
330
328
|
* The translate method returns a new matrix which is this matrix post
|
|
@@ -338,9 +336,7 @@ class w {
|
|
|
338
336
|
* @return The resulted matrix
|
|
339
337
|
*/
|
|
340
338
|
translate(t, e, i) {
|
|
341
|
-
|
|
342
|
-
let r = e, a = i;
|
|
343
|
-
return typeof r > "u" && (r = 0), typeof a > "u" && (a = 0), M(this, g(n, r, a));
|
|
339
|
+
return this.multiply(v(t, e ?? 0, i ?? 0));
|
|
344
340
|
}
|
|
345
341
|
/**
|
|
346
342
|
* The scale method returns a new matrix which is this matrix post multiplied by
|
|
@@ -354,9 +350,7 @@ class w {
|
|
|
354
350
|
* @return The resulted matrix
|
|
355
351
|
*/
|
|
356
352
|
scale(t, e, i) {
|
|
357
|
-
|
|
358
|
-
let r = e, a = i;
|
|
359
|
-
return typeof r > "u" && (r = t), typeof a > "u" && (a = 1), M(this, X(n, r, a));
|
|
353
|
+
return this.multiply(O(t, e ?? t, i ?? 1));
|
|
360
354
|
}
|
|
361
355
|
/**
|
|
362
356
|
* The rotate method returns a new matrix which is this matrix post multiplied
|
|
@@ -371,8 +365,8 @@ class w {
|
|
|
371
365
|
* @return The resulted matrix
|
|
372
366
|
*/
|
|
373
367
|
rotate(t, e, i) {
|
|
374
|
-
let n = t,
|
|
375
|
-
return typeof t == "number" && typeof e > "u" && typeof i > "u" && (a = n, n = 0,
|
|
368
|
+
let n = t, m = e || 0, a = i || 0;
|
|
369
|
+
return typeof t == "number" && typeof e > "u" && typeof i > "u" && (a = n, n = 0, m = 0), this.multiply(k(n, m, a));
|
|
376
370
|
}
|
|
377
371
|
/**
|
|
378
372
|
* The rotateAxisAngle method returns a new matrix which is this matrix post
|
|
@@ -386,10 +380,10 @@ class w {
|
|
|
386
380
|
* @param angle The angle of rotation about the axis vector, in degrees.
|
|
387
381
|
* @return The resulted matrix
|
|
388
382
|
*/
|
|
389
|
-
rotateAxisAngle(t, e, i, n) {
|
|
390
|
-
if ([t, e, i, n].some((
|
|
383
|
+
rotateAxisAngle(t = 0, e = 0, i = 0, n = 0) {
|
|
384
|
+
if ([t, e, i, n].some((a) => !Number.isFinite(a)))
|
|
391
385
|
throw new TypeError("CSSMatrix: expecting 4 values");
|
|
392
|
-
return
|
|
386
|
+
return Math.sqrt(t * t + e * e + i * i) === 0 ? N(this) : this.multiply(X(t, e, i, n));
|
|
393
387
|
}
|
|
394
388
|
/**
|
|
395
389
|
* Specifies a skew transformation along the `x-axis` by the given angle.
|
|
@@ -399,7 +393,7 @@ class w {
|
|
|
399
393
|
* @return The resulted matrix
|
|
400
394
|
*/
|
|
401
395
|
skewX(t) {
|
|
402
|
-
return
|
|
396
|
+
return this.multiply(Y(t));
|
|
403
397
|
}
|
|
404
398
|
/**
|
|
405
399
|
* Specifies a skew transformation along the `y-axis` by the given angle.
|
|
@@ -409,7 +403,7 @@ class w {
|
|
|
409
403
|
* @return The resulted matrix
|
|
410
404
|
*/
|
|
411
405
|
skewY(t) {
|
|
412
|
-
return
|
|
406
|
+
return this.multiply(F(t));
|
|
413
407
|
}
|
|
414
408
|
/**
|
|
415
409
|
* Specifies a skew transformation along both the `x-axis` and `y-axis`.
|
|
@@ -420,7 +414,7 @@ class w {
|
|
|
420
414
|
* @return The resulted matrix
|
|
421
415
|
*/
|
|
422
416
|
skew(t, e) {
|
|
423
|
-
return
|
|
417
|
+
return this.multiply(A(t, e));
|
|
424
418
|
}
|
|
425
419
|
/**
|
|
426
420
|
* Modifies the current matrix by post-multiplying it with another matrix.
|
|
@@ -430,7 +424,7 @@ class w {
|
|
|
430
424
|
* @return this matrix (modified)
|
|
431
425
|
*/
|
|
432
426
|
multiplySelf(t) {
|
|
433
|
-
const e =
|
|
427
|
+
const e = C(this, t);
|
|
434
428
|
return Object.assign(this, e), this;
|
|
435
429
|
}
|
|
436
430
|
/**
|
|
@@ -443,7 +437,7 @@ class w {
|
|
|
443
437
|
* @return this matrix (modified)
|
|
444
438
|
*/
|
|
445
439
|
translateSelf(t, e, i) {
|
|
446
|
-
return this.multiplySelf(
|
|
440
|
+
return this.multiplySelf(v(t, e ?? 0, i ?? 0));
|
|
447
441
|
}
|
|
448
442
|
/**
|
|
449
443
|
* Modifies the current matrix by post-multiplying it with a scale matrix.
|
|
@@ -455,7 +449,7 @@ class w {
|
|
|
455
449
|
* @return this matrix (modified)
|
|
456
450
|
*/
|
|
457
451
|
scaleSelf(t, e, i) {
|
|
458
|
-
return this.multiplySelf(
|
|
452
|
+
return this.multiplySelf(O(t, e ?? t, i ?? 1));
|
|
459
453
|
}
|
|
460
454
|
/**
|
|
461
455
|
* Modifies the current matrix by post-multiplying it with a rotation matrix.
|
|
@@ -467,8 +461,8 @@ class w {
|
|
|
467
461
|
* @return this matrix (modified)
|
|
468
462
|
*/
|
|
469
463
|
rotateSelf(t, e, i) {
|
|
470
|
-
let n = t,
|
|
471
|
-
return typeof t == "number" && typeof e > "u" && typeof i > "u" && (a = n, n = 0,
|
|
464
|
+
let n = t, m = e || 0, a = i || 0;
|
|
465
|
+
return typeof t == "number" && typeof e > "u" && typeof i > "u" && (a = n, n = 0, m = 0), this.multiplySelf(k(n, m, a));
|
|
472
466
|
}
|
|
473
467
|
/**
|
|
474
468
|
* Modifies the current matrix by post-multiplying it with a rotation matrix
|
|
@@ -481,10 +475,10 @@ class w {
|
|
|
481
475
|
* @param angle The angle of rotation about the axis vector, in degrees.
|
|
482
476
|
* @return this matrix (modified)
|
|
483
477
|
*/
|
|
484
|
-
rotateAxisAngleSelf(t, e, i, n) {
|
|
485
|
-
if ([t, e, i, n].some((
|
|
478
|
+
rotateAxisAngleSelf(t = 0, e = 0, i = 0, n = 0) {
|
|
479
|
+
if ([t, e, i, n].some((a) => !Number.isFinite(a)))
|
|
486
480
|
throw new TypeError("CSSMatrix: expecting 4 values");
|
|
487
|
-
return this.multiplySelf(
|
|
481
|
+
return Math.sqrt(t * t + e * e + i * i) === 0 ? this : this.multiplySelf(X(t, e, i, n));
|
|
488
482
|
}
|
|
489
483
|
/**
|
|
490
484
|
* Modifies the current matrix by post-multiplying it with a skewX matrix.
|
|
@@ -504,7 +498,7 @@ class w {
|
|
|
504
498
|
* @return this matrix (modified)
|
|
505
499
|
*/
|
|
506
500
|
skewYSelf(t) {
|
|
507
|
-
return this.multiplySelf(
|
|
501
|
+
return this.multiplySelf(F(t));
|
|
508
502
|
}
|
|
509
503
|
/**
|
|
510
504
|
* Modifies the current matrix by post-multiplying it with a skew matrix.
|
|
@@ -515,7 +509,7 @@ class w {
|
|
|
515
509
|
* @return this matrix (modified)
|
|
516
510
|
*/
|
|
517
511
|
skewSelf(t, e) {
|
|
518
|
-
return this.multiplySelf(
|
|
512
|
+
return this.multiplySelf(A(t, e));
|
|
519
513
|
}
|
|
520
514
|
/**
|
|
521
515
|
* Transforms a specified vector using the matrix, returning a new
|
|
@@ -529,16 +523,16 @@ class w {
|
|
|
529
523
|
* @return the resulting Tuple
|
|
530
524
|
*/
|
|
531
525
|
transformPoint(t) {
|
|
532
|
-
const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, i = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, n = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w,
|
|
533
|
-
return t instanceof DOMPoint ? new DOMPoint(e, i, n,
|
|
526
|
+
const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, i = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, n = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, m = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;
|
|
527
|
+
return t instanceof DOMPoint ? new DOMPoint(e, i, n, m) : {
|
|
534
528
|
x: e,
|
|
535
529
|
y: i,
|
|
536
530
|
z: n,
|
|
537
|
-
w:
|
|
531
|
+
w: m
|
|
538
532
|
};
|
|
539
533
|
}
|
|
540
534
|
}
|
|
541
535
|
export {
|
|
542
|
-
|
|
536
|
+
M as default
|
|
543
537
|
};
|
|
544
538
|
//# sourceMappingURL=dommatrix.mjs.map
|