├── .DS_Store
├── .gitignore
├── .npmignore
├── .prettierignore
├── .prettierrc.cjs
├── README.md
├── dist
├── DOMMatrix.d.ts
├── DOMMatrix.d.ts.map
├── DOMMatrix.js
├── DOMMatrix.js.map
├── DOMMatrix.test.d.ts
├── DOMMatrix.test.d.ts.map
├── DOMMatrix.test.js.map
├── DOMPoint.d.ts
├── DOMPoint.d.ts.map
├── DOMPoint.js
├── DOMPoint.js.map
├── DOMQuad.d.ts
├── DOMQuad.d.ts.map
├── DOMQuad.js
├── DOMQuad.js.map
├── DOMRect.d.ts
├── DOMRect.d.ts.map
├── DOMRect.js
├── DOMRect.js.map
├── index.d.ts
├── index.d.ts.map
├── index.js
├── index.js.map
├── test-utils.d.ts
├── test-utils.d.ts.map
├── test-utils.js
├── test-utils.js.map
├── utilities.d.ts
├── utilities.d.ts.map
├── utilities.js
└── utilities.js.map
├── package-lock.json
├── package.json
├── src
├── DOMMatrix.test.ts
├── DOMMatrix.ts
├── DOMPoint.ts
├── DOMQuad.ts
├── DOMRect.ts
├── index.ts
├── test-utils.ts
└── utilities.ts
└── tsconfig.json
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/trusktr/geometry-interfaces/300c4e90b6d300c3c2a25ef10dc309141340662c/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .vscode/
3 | *.log
4 | dist/*.test.js
5 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | # Specificty of the following rules matters.
2 |
3 | # Ignore everything,
4 | /**/*
5 |
6 | # but include these folders
7 | !/dist/**/*
8 | !/src/**/*
9 |
10 | # except for these files in the above folders.
11 | /dist/**/*.test.*
12 | /dist/tests/**/*
13 | /src/**/*.test.*
14 | /src/tests/**/*
15 |
16 | # The following won't work as you think it would.
17 | # /**/*
18 | # !/dist/**/*
19 | # !/src/**/*
20 | # /**/*.test.*
21 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
--------------------------------------------------------------------------------
/.prettierrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = require('@lume/cli/.prettierrc.js')
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Geometry Interfaces
2 |
3 | Let's do some dommetry!
4 |
5 | The W3C [Geometry](http://www.w3.org/TR/cssom-view/#geometry)
6 | [Interfaces](http://www.w3.org/TR/geometry-1/) implemented in JavaScript and
7 | polyfilled.
8 |
9 |
npm install geometry-interfaces
10 |
11 | ## In the box so far
12 |
13 | - [DOMMatrixReadOnly](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrixReadOnly) \*
14 | - [DOMMatrix](https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix) \*
15 | - [DOMPointReadOnly](https://developer.mozilla.org/en-US/docs/Web/API/DOMPointReadOnly) \*
16 | - [DOMPoint](https://developer.mozilla.org/en-US/docs/Web/API/DOMPoint) \*
17 | - [DOMQuad](https://developer.mozilla.org/en-US/docs/Web/API/DOMQuad) \*
18 | - [DOMRectReadOnly](https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly)
19 | - [DOMRect](https://developer.mozilla.org/en-US/docs/Web/API/DOMRect)
20 |
21 | \* Some methods are not implemented yet.
22 |
23 | ## Usage
24 |
25 | Just import the library after installing it [from
26 | NPM](https://www.npmjs.com/package/geometry-interfaces) and it will polyfill the
27 | global APIs:
28 |
29 | ```js
30 | import 'geometry-interfaces' // ES Modules
31 | ```
32 |
33 | If you're not using a build tool, just plain JS in a browser, you can set up an
34 | [importmap](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#importing_modules_using_import_maps):
35 |
36 | ```html
37 |
44 |
45 |
50 | ```
51 |
52 | If you don't want to polyfill the APIs globally, you can import what you need
53 | directly:
54 |
55 | ```js
56 | import {DOMMatrix} from 'geometry-interfaces/dist/DOMMatrix.js'
57 | import {DOMPoint} from 'geometry-interfaces/dist/DOMPoint.js'
58 | ```
59 |
60 | ## TypeScript
61 |
62 | Make sure you have `lib: ["dom"]` in `tsconfig` or DOM types will be missing and
63 | there may be type errors.
64 |
65 | ## Contributing
66 |
67 | To develop the project, run `npm clean-install` after cloning the repo, then
68 | `npm run dev` will build the TS to JS in watch mode, and `npm run build` will
69 | build it without watch mode.
70 |
71 | Any help would be greatly appreciated, as this is a purely free time unpaid
72 | project. If you'd like to contribute, a pull request to add missing features,
73 | APIs, tests, or performance improvements would be awesome. :]
74 |
75 | ## Miscellaneous
76 |
77 | The word "dommetry" is a play on the words "geometry" and "DOMMatrix" put
78 | together. :D
79 |
--------------------------------------------------------------------------------
/dist/DOMMatrix.d.ts:
--------------------------------------------------------------------------------
1 | import { DOMPoint } from './DOMPoint.js';
2 | declare const elements: unique symbol;
3 | declare const is2D: unique symbol;
4 | export declare class DOMMatrixReadOnly {
5 | /** The elements of the matrix, in column-major order. */
6 | [elements]: Float64Array;
7 | [is2D]: boolean;
8 | /**
9 | * @param {string | Array} init An array of numbers, or a CSS
10 | * transform string. If the array has 6 items, then those items set the
11 | * values of m11, m12, m21, m22, m41, m42 in that order (or the values
12 | * a, b, c, d, e, f if you're using those aliases) and this.is2D is
13 | * true. If the array has 16 items (in column-major order), then they
14 | * set all the values of the underlying matrix (m11 to m44) and
15 | * this.is2D is set false. Arrays of other lengths throw an error.
16 | */
17 | constructor(init?: string | ArrayLike);
18 | multiply(other: DOMMatrixReadOnly): DOMMatrix;
19 | translate(tx?: number, ty?: number, tz?: number): DOMMatrix;
20 | scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
21 | scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
22 | /** @deprecated use `matrix.scale()` */
23 | scaleNonUniform(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
24 | rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix;
25 | rotate(angle?: number, originX?: number, originY?: number): DOMMatrix;
26 | rotateFromVector(_x?: number, _y?: number): DOMMatrix;
27 | skewX(_sx?: number): DOMMatrix;
28 | skewY(_sy?: number): DOMMatrix;
29 | flipX(): DOMMatrix;
30 | flipY(): DOMMatrix;
31 | inverse(): DOMMatrix;
32 | transformPoint(_point: DOMPointInit): DOMPoint;
33 | toFloat32Array(): Float32Array;
34 | toFloat64Array(): Float64Array;
35 | toString(): string;
36 | get is2D(): boolean;
37 | get isIdentity(): boolean;
38 | get a(): number;
39 | get b(): number;
40 | get c(): number;
41 | get d(): number;
42 | get e(): number;
43 | get f(): number;
44 | get m11(): number;
45 | get m12(): number;
46 | get m13(): number;
47 | get m14(): number;
48 | get m21(): number;
49 | get m22(): number;
50 | get m23(): number;
51 | get m24(): number;
52 | get m31(): number;
53 | get m32(): number;
54 | get m33(): number;
55 | get m34(): number;
56 | get m41(): number;
57 | get m42(): number;
58 | get m43(): number;
59 | get m44(): number;
60 | toJSON(): {
61 | a: number;
62 | b: number;
63 | c: number;
64 | d: number;
65 | e: number;
66 | f: number;
67 | m11: number;
68 | m12: number;
69 | m13: number;
70 | m14: number;
71 | m21: number;
72 | m22: number;
73 | m23: number;
74 | m24: number;
75 | m31: number;
76 | m32: number;
77 | m33: number;
78 | m34: number;
79 | m41: number;
80 | m42: number;
81 | m43: number;
82 | m44: number;
83 | };
84 | static fromMatrix(other: DOMMatrixReadOnly): DOMMatrixReadOnly;
85 | static fromFloat32Array(array: Float32Array): DOMMatrixReadOnly;
86 | static fromFloat64Array(array: Float64Array): DOMMatrixReadOnly;
87 | }
88 | export declare class DOMMatrix extends DOMMatrixReadOnly {
89 | constructor(arg?: string | ArrayLike);
90 | multiplySelf(other: DOMMatrixInit): this;
91 | preMultiplySelf(other: DOMMatrixReadOnly): this;
92 | translateSelf(tx?: number, ty?: number, tz?: number): this;
93 | scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): this;
94 | scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): this;
95 | rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): this;
96 | rotateSelf(rotX?: number, rotY?: number, rotZ?: number): this;
97 | rotateFromVectorSelf(_x?: number, _y?: number): this;
98 | skewXSelf(_sx?: number): this;
99 | skewYSelf(_sy?: number): this;
100 | invertSelf(): this;
101 | setMatrixValue(_transformList: string): this;
102 | get a(): number;
103 | set a(value: number);
104 | get b(): number;
105 | set b(value: number);
106 | get c(): number;
107 | set c(value: number);
108 | get d(): number;
109 | set d(value: number);
110 | get e(): number;
111 | set e(value: number);
112 | get f(): number;
113 | set f(value: number);
114 | get m11(): number;
115 | set m11(value: number);
116 | get m12(): number;
117 | set m12(value: number);
118 | get m13(): number;
119 | set m13(value: number);
120 | get m14(): number;
121 | set m14(value: number);
122 | get m21(): number;
123 | set m21(value: number);
124 | get m22(): number;
125 | set m22(value: number);
126 | get m23(): number;
127 | set m23(value: number);
128 | get m24(): number;
129 | set m24(value: number);
130 | get m31(): number;
131 | set m31(value: number);
132 | get m32(): number;
133 | set m32(value: number);
134 | get m33(): number;
135 | set m33(value: number);
136 | get m34(): number;
137 | set m34(value: number);
138 | get m41(): number;
139 | set m41(value: number);
140 | get m42(): number;
141 | set m42(value: number);
142 | get m43(): number;
143 | set m43(value: number);
144 | get m44(): number;
145 | set m44(value: number);
146 | static fromMatrix(other: DOMMatrixReadOnly): DOMMatrix;
147 | static fromFloat32Array(array: Float32Array): DOMMatrix;
148 | static fromFloat64Array(array: Float64Array): DOMMatrix;
149 | }
150 | export {};
151 | //# sourceMappingURL=DOMMatrix.d.ts.map
--------------------------------------------------------------------------------
/dist/DOMMatrix.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMMatrix.d.ts","sourceRoot":"","sources":["../src/DOMMatrix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAA;AAMtC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AAC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;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAGrB;IAED,IAAa,GAAG,WAEf;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAGrB;IACD,IAAa,GAAG,WAEf;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAGrB;IACD,IAAa,GAAG,WAEf;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAGrB;IACD,IAAa,GAAG,WAEf;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAGrB;IAED,IAAa,GAAG,WAEf;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAErB;IACD,IAAa,GAAG,WAEf;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAErB;IACD,IAAa,GAAG,WAEf;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAGrB;IACD,IAAa,GAAG,WAEf;IACD,IAAa,GAAG,CAAC,KAAK,QAAA,EAGrB;WAEe,UAAU,CAAC,KAAK,EAAE,iBAAiB;WAKnC,gBAAgB,CAAC,KAAK,EAAE,YAAY;WAIpC,gBAAgB,CAAC,KAAK,EAAE,YAAY;CAGpD"}
--------------------------------------------------------------------------------
/dist/DOMMatrix.js:
--------------------------------------------------------------------------------
1 | import { DOMPoint } from './DOMPoint.js';
2 | import { multiplyAndApply, normalizePoint, toAxisRotation } from './utilities.js';
3 | import { identityValues } from './utilities.js';
4 | const default2DValues = Object.freeze([1, 0, 0, 1, 0, 0]);
5 | const elements = Symbol('elements');
6 | const is2D = Symbol('is2D');
7 | export class DOMMatrixReadOnly {
8 | /** The elements of the matrix, in column-major order. */
9 | [elements] = new Float64Array(identityValues);
10 | [is2D] = true;
11 | /**
12 | * @param {string | Array} init An array of numbers, or a CSS
13 | * transform string. If the array has 6 items, then those items set the
14 | * values of m11, m12, m21, m22, m41, m42 in that order (or the values
15 | * a, b, c, d, e, f if you're using those aliases) and this.is2D is
16 | * true. If the array has 16 items (in column-major order), then they
17 | * set all the values of the underlying matrix (m11 to m44) and
18 | * this.is2D is set false. Arrays of other lengths throw an error.
19 | */
20 | constructor(init = default2DValues) {
21 | if (typeof init === 'string')
22 | throw new Error('CSS transform string not supported yet.');
23 | const { length } = init;
24 | if (length === undefined || (length !== 6 && length !== 16))
25 | throw new TypeError(`Failed to construct '${new.target === DOMMatrixReadOnly ? 'DOMMatrixReadOnly' : 'DOMMatrix'}': The sequence must contain 6 elements for a 2D matrix or 16 elements for a 3D matrix.'`);
26 | this[is2D] = length === 6 ? true : false;
27 | if (this[is2D]) {
28 | this[elements][0] = init[0];
29 | this[elements][1] = init[1];
30 | this[elements][4] = init[2];
31 | this[elements][5] = init[3];
32 | this[elements][12] = init[4];
33 | this[elements][13] = init[5];
34 | }
35 | else {
36 | this[elements].set(init);
37 | }
38 | }
39 | // Immutable transform methods -------------------------------------------
40 | multiply(other) {
41 | return new DOMMatrix(getInit(this)).multiplySelf(other);
42 | }
43 | translate(tx = 0, ty = 0, tz = 0) {
44 | return new DOMMatrix(getInit(this)).translateSelf(tx, ty, tz);
45 | }
46 | scale(scaleX = 1, scaleY = scaleX, scaleZ = 1, originX = 0, originY = 0, originZ = 0) {
47 | return new DOMMatrix(getInit(this)).scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ);
48 | }
49 | scale3d(scale = 1, originX = 0, originY = 0, originZ = 0) {
50 | return new DOMMatrix(getInit(this)).scale3dSelf(scale, originX, originY, originZ);
51 | }
52 | /** @deprecated use `matrix.scale()` */
53 | scaleNonUniform(scaleX = 1, scaleY = scaleX, scaleZ = 1, originX = 0, originY = 0, originZ = 0) {
54 | return this.scale(scaleX, scaleY, scaleZ, originX, originY, originZ);
55 | }
56 | rotateAxisAngle(x = 0, y = 0, z = 0, angle = 0) {
57 | return new DOMMatrix(getInit(this)).rotateAxisAngleSelf(x, y, z, angle);
58 | }
59 | rotate(angle = 0, originX = 0, originY = 0) {
60 | return new DOMMatrix(getInit(this)).rotateSelf(angle, originX, originY);
61 | }
62 | // TODO
63 | rotateFromVector(_x = 0, _y = 0) {
64 | throw new Error('rotateFromVector is not implemented yet.');
65 | }
66 | skewX(_sx = 0) {
67 | throw new Error('skewX is not implemented yet.');
68 | }
69 | skewY(_sy = 0) {
70 | throw new Error('skewY is not implemented yet.');
71 | }
72 | flipX() {
73 | throw new Error('flipX is not implemented yet.');
74 | }
75 | flipY() {
76 | throw new Error('flipY is not implemented yet.');
77 | }
78 | inverse() {
79 | throw new Error('inverse is not implemented yet.');
80 | }
81 | transformPoint(_point) {
82 | throw new Error('transformPoint is not implemented yet.');
83 | }
84 | toFloat32Array() {
85 | return Float32Array.from(this[elements]);
86 | }
87 | toFloat64Array() {
88 | return Float64Array.from(this[elements]);
89 | }
90 | // stringifier
91 | // https://drafts.fxtf.org/geometry/#dommatrixreadonly-stringification-behavior
92 | toString() {
93 | if (this[is2D])
94 | return `matrix(${this[elements][0]}, ${this[elements][1]}, ${this[elements][4]}, ${this[elements][5]}, ${this[elements][12]}, ${this[elements][13]})`;
95 | else
96 | return `matrix3d(${this[elements][0]}, ${this[elements][1]}, ${this[elements][2]}, ${this[elements][3]}, ${this[elements][4]}, ${this[elements][5]}, ${this[elements][6]}, ${this[elements][7]}, ${this[elements][8]}, ${this[elements][9]}, ${this[elements][10]}, ${this[elements][11]}, ${this[elements][12]}, ${this[elements][13]}, ${this[elements][14]}, ${this[elements][15]})`;
97 | }
98 | get is2D() {
99 | return this[is2D];
100 | }
101 | /*
102 | * TODO: make sure this matches the spec.
103 | * TODO: Instead of calculating here, perhaps calculate and set
104 | * this._isIdentity in other operations, and simply return the internal one
105 | * here.
106 | */
107 | get isIdentity() {
108 | for (var i = 0, len = this[elements].length; i < len; i += 1) {
109 | if (this[elements][i] !== identityValues[i])
110 | return false;
111 | }
112 | return true;
113 | }
114 | get a() {
115 | return this.m11; // elements[0]
116 | }
117 | get b() {
118 | return this.m12; // elements[1]
119 | }
120 | get c() {
121 | return this.m21; // elements[4]
122 | }
123 | get d() {
124 | return this.m22; // elements[5]
125 | }
126 | get e() {
127 | return this.m41; // elements[12]
128 | }
129 | get f() {
130 | return this.m42; // elements[13]
131 | }
132 | get m11() {
133 | return this[elements][0];
134 | }
135 | get m12() {
136 | return this[elements][1];
137 | }
138 | get m13() {
139 | return this[elements][2];
140 | }
141 | get m14() {
142 | return this[elements][3];
143 | }
144 | get m21() {
145 | return this[elements][4];
146 | }
147 | get m22() {
148 | return this[elements][5];
149 | }
150 | get m23() {
151 | return this[elements][6];
152 | }
153 | get m24() {
154 | return this[elements][7];
155 | }
156 | get m31() {
157 | return this[elements][8];
158 | }
159 | get m32() {
160 | return this[elements][9];
161 | }
162 | get m33() {
163 | return this[elements][10];
164 | }
165 | get m34() {
166 | return this[elements][11];
167 | }
168 | get m41() {
169 | return this[elements][12];
170 | }
171 | get m42() {
172 | return this[elements][13];
173 | }
174 | get m43() {
175 | return this[elements][14];
176 | }
177 | get m44() {
178 | return this[elements][15];
179 | }
180 | toJSON() {
181 | return {
182 | a: this.a,
183 | b: this.b,
184 | c: this.c,
185 | d: this.d,
186 | e: this.e,
187 | f: this.f,
188 | m11: this.m11,
189 | m12: this.m12,
190 | m13: this.m13,
191 | m14: this.m14,
192 | m21: this.m21,
193 | m22: this.m22,
194 | m23: this.m23,
195 | m24: this.m24,
196 | m31: this.m31,
197 | m32: this.m32,
198 | m33: this.m33,
199 | m34: this.m34,
200 | m41: this.m41,
201 | m42: this.m42,
202 | m43: this.m43,
203 | m44: this.m44,
204 | };
205 | }
206 | static fromMatrix(other) {
207 | const mat = other[elements];
208 | return new this(mat);
209 | }
210 | static fromFloat32Array(array) {
211 | return new this(array);
212 | }
213 | static fromFloat64Array(array) {
214 | return new this(array);
215 | }
216 | }
217 | export class DOMMatrix extends DOMMatrixReadOnly {
218 | constructor(arg) {
219 | if (arg === undefined) {
220 | super();
221 | }
222 | else if (typeof arg == 'string') {
223 | throw new Error('CSS transformList arg not yet implemented.');
224 | // TODO validate that syntax of transformList matches transform-list (http://www.w3.org/TR/css-transforms-1/#typedef-transform-list).
225 | }
226 | else if (isNumberSequence(arg)) {
227 | super(arg);
228 | }
229 | else
230 | throw new Error('Invalid argument to DOMMatrix constructor.');
231 | }
232 | // Mutable transform methods
233 | multiplySelf(other) {
234 | if (!(other instanceof DOMMatrix))
235 | throw new Error('The argument to multiplySelf must be an instance of DOMMatrix');
236 | // TODO: avoid creating a new array, just apply values directly.
237 | multiplyAndApply(this, other, this);
238 | if (!other[is2D])
239 | this[is2D] = false;
240 | return this;
241 | }
242 | preMultiplySelf(other) {
243 | if (!(other instanceof DOMMatrix))
244 | throw new Error('The argument to preMultiplySelf must be an instance of DOMMatrix');
245 | // TODO: avoid creating a new array, just apply values directly.
246 | multiplyAndApply(other, this, this);
247 | if (!other[is2D])
248 | this[is2D] = false;
249 | return this;
250 | }
251 | translateSelf(tx = 0, ty = 0, tz = 0) {
252 | if (tx === 0 && ty === 0 && tz === 0)
253 | return this;
254 | // http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Translate3dDefined
255 | translationMatrix.m41 = tx;
256 | translationMatrix.m42 = ty;
257 | translationMatrix.m43 = tz;
258 | this.multiplySelf(translationMatrix);
259 | if (tz != 0)
260 | this[is2D] = false;
261 | return this;
262 | }
263 | scaleSelf(scaleX = 1, scaleY = scaleX, scaleZ = 1, originX = 0, originY = 0, originZ = 0) {
264 | this.translateSelf(originX, originY, originZ);
265 | scaleMatrix[is2D] = true;
266 | scaleMatrix.m11 = scaleX;
267 | scaleMatrix.m22 = scaleY;
268 | scaleMatrix.m33 = scaleZ;
269 | this.multiplySelf(scaleMatrix);
270 | this.translateSelf(-originX, -originY, -originZ);
271 | if (scaleZ !== 1 || originZ !== 0)
272 | this[is2D] = false;
273 | return this;
274 | }
275 | scale3dSelf(scale = 1, originX = 0, originY = 0, originZ = 0) {
276 | if (scale === 1)
277 | return this;
278 | this.translateSelf(originX, originY, originZ);
279 | scaleMatrix[is2D] = true;
280 | scaleMatrix.m11 = scale;
281 | scaleMatrix.m22 = scale;
282 | scaleMatrix.m33 = scale;
283 | this.multiplySelf(scaleMatrix);
284 | this.translateSelf(-originX, -originY, -originZ);
285 | if (scale !== 1)
286 | this[is2D] = false;
287 | return this;
288 | }
289 | rotateAxisAngleSelf(x = 0, y = 0, z = 0, angle = 0) {
290 | if (angle === 0)
291 | return this; // Firefox behavior.
292 | point.x = x;
293 | point.y = y;
294 | point.z = z;
295 | point.w = 0;
296 | normalizePoint(point);
297 | axisRotationMatrix[is2D] = true;
298 | toAxisRotation(axisRotationMatrix, point.x, point.y, point.z, angle);
299 | this.multiplySelf(axisRotationMatrix);
300 | if (x !== 0 || y !== 0)
301 | this[is2D] = false;
302 | return this;
303 | }
304 | // https://drafts.fxtf.org/geometry/#dom-dommatrix-rotateself
305 | rotateSelf(rotX = 0, rotY, rotZ) {
306 | if (rotY == null && rotZ == null) {
307 | rotZ = rotX;
308 | rotX = 0;
309 | rotY = 0;
310 | }
311 | rotY ??= 0;
312 | rotZ ??= 0;
313 | if (rotZ)
314 | this.rotateAxisAngleSelf(0, 0, 1, rotZ);
315 | if (rotY)
316 | this.rotateAxisAngleSelf(0, 1, 0, rotY);
317 | if (rotX)
318 | this.rotateAxisAngleSelf(1, 0, 0, rotX);
319 | return this;
320 | }
321 | // TODO
322 | rotateFromVectorSelf(_x = 0, _y = 0) {
323 | throw new Error('rotateFromVectorSelf is not implemented yet.');
324 | }
325 | skewXSelf(_sx = 0) {
326 | throw new Error('skewXSelf is not implemented yet.');
327 | }
328 | skewYSelf(_sy = 0) {
329 | throw new Error('skewYSelf is not implemented yet.');
330 | }
331 | invertSelf() {
332 | throw new Error('invertSelf is not implemented yet.');
333 | }
334 | setMatrixValue(_transformList) {
335 | throw new Error('setMatrixValue is not implemented yet.');
336 | }
337 | get a() {
338 | return this.m11;
339 | }
340 | set a(value) {
341 | this.m11 = value;
342 | }
343 | get b() {
344 | return this.m12;
345 | }
346 | set b(value) {
347 | this.m12 = value;
348 | }
349 | get c() {
350 | return this.m21;
351 | }
352 | set c(value) {
353 | this.m21 = value;
354 | }
355 | get d() {
356 | return this.m22;
357 | }
358 | set d(value) {
359 | this.m22 = value;
360 | }
361 | get e() {
362 | return this.m41;
363 | }
364 | set e(value) {
365 | this.m41 = value;
366 | }
367 | get f() {
368 | return this.m42;
369 | }
370 | set f(value) {
371 | this.m42 = value;
372 | }
373 | get m11() {
374 | return this[elements][0];
375 | }
376 | set m11(value) {
377 | this[elements][0] = value;
378 | }
379 | get m12() {
380 | return this[elements][1];
381 | }
382 | set m12(value) {
383 | this[elements][1] = value;
384 | }
385 | get m13() {
386 | return this[elements][2];
387 | }
388 | set m13(value) {
389 | if (value !== 0)
390 | this[is2D] = false;
391 | this[elements][2] = value;
392 | }
393 | get m14() {
394 | return this[elements][3];
395 | }
396 | set m14(value) {
397 | if (value !== 0)
398 | this[is2D] = false;
399 | this[elements][3] = value;
400 | }
401 | get m21() {
402 | return this[elements][4];
403 | }
404 | set m21(value) {
405 | this[elements][4] = value;
406 | }
407 | get m22() {
408 | return this[elements][5];
409 | }
410 | set m22(value) {
411 | this[elements][5] = value;
412 | }
413 | get m23() {
414 | return this[elements][6];
415 | }
416 | set m23(value) {
417 | if (value !== 0)
418 | this[is2D] = false;
419 | this[elements][6] = value;
420 | }
421 | get m24() {
422 | return this[elements][7];
423 | }
424 | set m24(value) {
425 | if (value !== 0)
426 | this[is2D] = false;
427 | this[elements][7] = value;
428 | }
429 | get m31() {
430 | return this[elements][8];
431 | }
432 | set m31(value) {
433 | if (value !== 0)
434 | this[is2D] = false;
435 | this[elements][8] = value;
436 | }
437 | get m32() {
438 | return this[elements][9];
439 | }
440 | set m32(value) {
441 | if (value !== 0)
442 | this[is2D] = false;
443 | this[elements][9] = value;
444 | }
445 | get m33() {
446 | return this[elements][10];
447 | }
448 | set m33(value) {
449 | if (value !== 1)
450 | this[is2D] = false;
451 | this[elements][10] = value;
452 | }
453 | get m34() {
454 | return this[elements][11];
455 | }
456 | set m34(value) {
457 | if (value !== 0)
458 | this[is2D] = false;
459 | this[elements][11] = value;
460 | }
461 | get m41() {
462 | return this[elements][12];
463 | }
464 | set m41(value) {
465 | this[elements][12] = value;
466 | }
467 | get m42() {
468 | return this[elements][13];
469 | }
470 | set m42(value) {
471 | this[elements][13] = value;
472 | }
473 | get m43() {
474 | return this[elements][14];
475 | }
476 | set m43(value) {
477 | if (value !== 0)
478 | this[is2D] = false;
479 | this[elements][14] = value;
480 | }
481 | get m44() {
482 | return this[elements][15];
483 | }
484 | set m44(value) {
485 | if (value !== 1)
486 | this[is2D] = false;
487 | this[elements][15] = value;
488 | }
489 | static fromMatrix(other) {
490 | const mat = other[elements];
491 | return new this(mat);
492 | }
493 | static fromFloat32Array(array) {
494 | return new this(array);
495 | }
496 | static fromFloat64Array(array) {
497 | return new this(array);
498 | }
499 | }
500 | const axisRotationMatrix = new DOMMatrix();
501 | const translationMatrix = new DOMMatrix();
502 | const scaleMatrix = new DOMMatrix();
503 | const point = new DOMPoint();
504 | function getInit(mat) {
505 | return mat.is2D ? [mat.m11, mat.m12, mat.m21, mat.m22, mat.m41, mat.m42] : mat.toFloat64Array();
506 | }
507 | function isNumberSequence(obj) {
508 | if (obj && typeof obj.length === 'number' && typeof obj[0] === 'number')
509 | return true;
510 | return false;
511 | }
512 | //# sourceMappingURL=DOMMatrix.js.map
--------------------------------------------------------------------------------
/dist/DOMMatrix.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMMatrix.js","sourceRoot":"","sources":["../src/DOMMatrix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAA;AACtC,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAC/E,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAE7C,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAEzD,MAAM,QAAQ,G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wB,CAAA;QACnF,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;IACrB,CAAC;IAED,MAAM,CAAU,gBAAgB,CAAC,KAAmB;QACnD,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;IAED,MAAM,CAAU,gBAAgB,CAAC,KAAmB;QACnD,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;CACD;AAED,MAAM,kBAAkB,GAAG,IAAI,SAAS,EAAE,CAAA;AAC1C,MAAM,iBAAiB,GAAG,IAAI,SAAS,EAAE,CAAA;AACzC,MAAM,WAAW,GAAG,IAAI,SAAS,EAAE,CAAA;AACnC,MAAM,KAAK,GAAG,IAAI,QAAQ,EAAE,CAAA;AAE5B,SAAS,OAAO,CAAC,GAAsB;IACtC,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,CAAA;AAChG,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAQ;IACjC,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IAEpF,OAAO,KAAK,CAAA;AACb,CAAC"}
--------------------------------------------------------------------------------
/dist/DOMMatrix.test.d.ts:
--------------------------------------------------------------------------------
1 | declare global {
2 | function expect(...args: any[]): any;
3 | }
4 | export {};
5 | //# sourceMappingURL=DOMMatrix.test.d.ts.map
--------------------------------------------------------------------------------
/dist/DOMMatrix.test.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMMatrix.test.d.ts","sourceRoot":"","sources":["../src/DOMMatrix.test.ts"],"names":[],"mappings":"AAMA,OAAO,CAAC,MAAM,CAAC;IACd,SAAS,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;CACpC"}
--------------------------------------------------------------------------------
/dist/DOMMatrix.test.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMMatrix.test.js","sourceRoot":"","sources":["../src/DOMMatrix.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAA;AAQzC,sEAAsE;AACtE,kEAAkE;AAClE,4EAA4E;AAC5E,iBAAiB;AACjB,MAAM,OAAO,GAAG,iBAAiB,CAAA;AAEjC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;QACnB,IAAI,WAAW,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QACxF,IAAI,SAAS,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QAE7F,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAA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AAA;IACrD,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
--------------------------------------------------------------------------------
/dist/DOMPoint.d.ts:
--------------------------------------------------------------------------------
1 | declare const x_: unique symbol;
2 | declare const y_: unique symbol;
3 | declare const z_: unique symbol;
4 | declare const w_: unique symbol;
5 | export declare class DOMPointReadOnly {
6 | [x_]: number;
7 | [y_]: number;
8 | [z_]: number;
9 | [w_]: number;
10 | constructor(x?: number, y?: number, z?: number, w?: number);
11 | get x(): number;
12 | get y(): number;
13 | get z(): number;
14 | get w(): number;
15 | matrixTransform(_matrix: DOMMatrixInit): DOMPoint;
16 | toJSON(): {
17 | x: number;
18 | y: number;
19 | z: number;
20 | w: number;
21 | };
22 | static fromPoint(other: DOMPointReadOnly): DOMPointReadOnly;
23 | }
24 | export declare class DOMPoint extends DOMPointReadOnly {
25 | get x(): number;
26 | get y(): number;
27 | get z(): number;
28 | get w(): number;
29 | set x(value: number);
30 | set y(value: number);
31 | set z(value: number);
32 | set w(value: number);
33 | }
34 | export {};
35 | //# sourceMappingURL=DOMPoint.d.ts.map
--------------------------------------------------------------------------------
/dist/DOMPoint.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMPoint.d.ts","sourceRoot":"","sources":["../src/DOMPoint.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,eAAc,CAAA;AACtB,QAAA,MAAM,EAAE,eAAc,CAAA;AACtB,QAAA,MAAM,EAAE,eAAc,CAAA;AACtB,QAAA,MAAM,EAAE,eAAc,CAAA;AAEtB,qBAAa,gBAAgB;IAC5B,CAAC,EAAE,CAAC,SAAK;IACT,CAAC,EAAE,CAAC,SAAK;IACT,CAAC,EAAE,CAAC,SAAK;IACT,CAAC,EAAE,CAAC,SAAI;gBAEI,CAAC,SAAI,EAAE,CAAC,SAAI,EAAE,CAAC,SAAI,EAAE,CAAC,SAAI;IAOtC,IAAI,CAAC,WAEJ;IACD,IAAI,CAAC,WAEJ;IACD,IAAI,CAAC,WAEJ;IACD,IAAI,CAAC,WAEJ;IAED,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,QAAQ;IAajD,MAAM;;;;;;IASN,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,gBAAgB;CAGxC;AAED,qBAAa,QAAS,SAAQ,gBAAgB;IAC7C,IAAa,CAAC,WAEb;IACD,IAAa,CAAC,WAEb;IACD,IAAa,CAAC,WAEb;IACD,IAAa,CAAC,WAEb;IAED,IAAa,CAAC,CAAC,KAAK,QAAA,EAEnB;IACD,IAAa,CAAC,CAAC,KAAK,QAAA,EAEnB;IACD,IAAa,CAAC,CAAC,KAAK,QAAA,EAEnB;IACD,IAAa,CAAC,CAAC,KAAK,QAAA,EAEnB;CACD"}
--------------------------------------------------------------------------------
/dist/DOMPoint.js:
--------------------------------------------------------------------------------
1 | const x_ = Symbol('x');
2 | const y_ = Symbol('y');
3 | const z_ = Symbol('z');
4 | const w_ = Symbol('w');
5 | export class DOMPointReadOnly {
6 | [x_] = 0;
7 | [y_] = 0;
8 | [z_] = 0;
9 | [w_] = 1;
10 | constructor(x = 0, y = 0, z = 0, w = 0) {
11 | this[x_] = Number(x);
12 | this[y_] = Number(y);
13 | this[z_] = Number(z);
14 | this[w_] = Number(w);
15 | }
16 | get x() {
17 | return this[x_];
18 | }
19 | get y() {
20 | return this[y_];
21 | }
22 | get z() {
23 | return this[z_];
24 | }
25 | get w() {
26 | return this[w_];
27 | }
28 | matrixTransform(_matrix) {
29 | throw new Error('matrixTransform is not implemented yet.');
30 | // TODO
31 | // let result = new this.constructor(this)
32 | //const x
33 | //const y
34 | //const z
35 | //const w
36 | // return result
37 | }
38 | toJSON() {
39 | return {
40 | x: this[x_],
41 | y: this[y_],
42 | z: this[z_],
43 | w: this[w_],
44 | };
45 | }
46 | static fromPoint(other) {
47 | return new this(other.x, other.y, other.z, other.w);
48 | }
49 | }
50 | export class DOMPoint extends DOMPointReadOnly {
51 | get x() {
52 | return this[x_];
53 | }
54 | get y() {
55 | return this[y_];
56 | }
57 | get z() {
58 | return this[z_];
59 | }
60 | get w() {
61 | return this[w_];
62 | }
63 | set x(value) {
64 | this[x_] = Number(value);
65 | }
66 | set y(value) {
67 | this[y_] = Number(value);
68 | }
69 | set z(value) {
70 | this[z_] = Number(value);
71 | }
72 | set w(value) {
73 | this[w_] = Number(value);
74 | }
75 | }
76 | //# sourceMappingURL=DOMPoint.js.map
--------------------------------------------------------------------------------
/dist/DOMPoint.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMPoint.js","sourceRoot":"","sources":["../src/DOMPoint.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;AACtB,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;AACtB,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;AACtB,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;AAEtB,MAAM,OAAO,gBAAgB;IAC5B,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACT,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACT,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACT,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;IAER,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC;QACrC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACpB,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACpB,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACpB,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IACrB,CAAC;IAED,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,EAAE,CAAC,CAAA;IAChB,C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KAAK;QACnB,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IACD,IAAa,CAAC,CAAC,KAAK;QACnB,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IACD,IAAa,CAAC,CAAC,KAAK;QACnB,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;CACD"}
--------------------------------------------------------------------------------
/dist/DOMQuad.d.ts:
--------------------------------------------------------------------------------
1 | declare const p1: unique symbol;
2 | declare const p2: unique symbol;
3 | declare const p3: unique symbol;
4 | declare const p4: unique symbol;
5 | export declare class DOMQuad {
6 | [p1]: DOMPoint;
7 | [p2]: DOMPoint;
8 | [p3]: DOMPoint;
9 | [p4]: DOMPoint;
10 | constructor(point1?: DOMPointInit, point2?: DOMPointInit, point3?: DOMPointInit, point4?: DOMPointInit);
11 | get p1(): DOMPoint;
12 | get p2(): DOMPoint;
13 | get p3(): DOMPoint;
14 | get p4(): DOMPoint;
15 | static fromRect(other: DOMRectReadOnly): DOMQuad;
16 | static fromQuad(other: DOMQuad): DOMQuad;
17 | getBounds(): DOMRect;
18 | toJSON(): {
19 | p1: any;
20 | p2: any;
21 | p3: any;
22 | p4: any;
23 | };
24 | }
25 | export {};
26 | //# sourceMappingURL=DOMQuad.d.ts.map
--------------------------------------------------------------------------------
/dist/DOMQuad.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMQuad.d.ts","sourceRoot":"","sources":["../src/DOMQuad.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,eAAe,CAAA;AACvB,QAAA,MAAM,EAAE,eAAe,CAAA;AACvB,QAAA,MAAM,EAAE,eAAe,CAAA;AACvB,QAAA,MAAM,EAAE,eAAe,CAAA;AAEvB,qBAAa,OAAO;IACnB,CAAC,EAAE,CAAC,EAAG,QAAQ,CAAC;IAChB,CAAC,EAAE,CAAC,EAAG,QAAQ,CAAC;IAChB,CAAC,EAAE,CAAC,EAAG,QAAQ,CAAC;IAChB,CAAC,EAAE,CAAC,EAAG,QAAQ,CAAA;gBAEH,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,YAAY;IAOtG,IAAI,EAAE,aAEL;IACD,IAAI,EAAE,aAEL;IACD,IAAI,EAAE,aAEL;IACD,IAAI,EAAE,aAEL;IAED,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,eAAe;IAWtC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO;IAI9B,SAAS;IAcT,MAAM;;;;;;CAQN"}
--------------------------------------------------------------------------------
/dist/DOMQuad.js:
--------------------------------------------------------------------------------
1 | const p1 = Symbol('p1');
2 | const p2 = Symbol('p2');
3 | const p3 = Symbol('p3');
4 | const p4 = Symbol('p4');
5 | export class DOMQuad {
6 | [p1];
7 | [p2];
8 | [p3];
9 | [p4];
10 | constructor(point1, point2, point3, point4) {
11 | this[p1] = point1 !== undefined ? new DOMPoint(point1.x, point1.y, point1.z, point1.w) : new DOMPoint();
12 | this[p2] = point2 !== undefined ? new DOMPoint(point2.x, point2.y, point2.z, point2.w) : new DOMPoint();
13 | this[p3] = point3 !== undefined ? new DOMPoint(point3.x, point3.y, point3.z, point3.w) : new DOMPoint();
14 | this[p4] = point4 !== undefined ? new DOMPoint(point4.x, point4.y, point4.z, point4.w) : new DOMPoint();
15 | }
16 | get p1() {
17 | return this[p1];
18 | }
19 | get p2() {
20 | return this[p2];
21 | }
22 | get p3() {
23 | return this[p3];
24 | }
25 | get p4() {
26 | return this[p4];
27 | }
28 | static fromRect(other) {
29 | return other === undefined
30 | ? new this()
31 | : new this(new DOMPoint(other.x, other.y, 0, 1), new DOMPoint(other.x + other.width, other.y, 0, 1), new DOMPoint(other.x + other.width, other.y + other.height, 0, 1), new DOMPoint(other.x, other.y + other.height, 0, 1));
32 | }
33 | static fromQuad(other) {
34 | return other === undefined ? new this() : new this(other.p1, other.p2, other.p3, other.p4);
35 | }
36 | getBounds() {
37 | const _p1 = this[p1];
38 | const _p2 = this[p2];
39 | const _p3 = this[p3];
40 | const _p4 = this[p4];
41 | const left = Math.min(_p1.x, _p2.x, _p3.x, _p4.x);
42 | const top = Math.min(_p1.y, _p2.y, _p3.y, _p4.y);
43 | const right = Math.max(_p1.x, _p2.x, _p3.x, _p4.x);
44 | const bottom = Math.max(_p1.y, _p2.y, _p3.y, _p4.y);
45 | const width = right - left;
46 | const height = bottom - top;
47 | return new DOMRect(left, top, width, height);
48 | }
49 | toJSON() {
50 | return {
51 | p1: this[p1].toJSON(),
52 | p2: this[p2].toJSON(),
53 | p3: this[p3].toJSON(),
54 | p4: this[p4].toJSON(),
55 | };
56 | }
57 | }
58 | //# sourceMappingURL=DOMQuad.js.map
--------------------------------------------------------------------------------
/dist/DOMQuad.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMQuad.js","sourceRoot":"","sources":["../src/DOMQuad.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACvB,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACvB,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACvB,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AAEvB,MAAM,OAAO,OAAO;IACnB,CAAC,EAAE,CAAC,CAAY;IAChB,CAAC,EAAE,CAAC,CAAY;IAChB,CAAC,EAAE,CAAC,CAAY;IAChB,CAAC,EAAE,CAAC,CAAW;IAEf,YAAY,MAAqB,EAAE,MAAqB,EAAE,MAAqB,EAAE,MAAqB;QACrG,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EA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C,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;QAChD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;QACnD,MAAM,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;QAC1B,MAAM,MAAM,GAAG,MAAM,GAAG,GAAG,CAAA;QAC3B,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAC7C,CAAC;IAED,MAAM;QACL,OAAO;YACN,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;YACrB,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;YACrB,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;YACrB,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;SACrB,CAAA;IACF,CAAC;CACD"}
--------------------------------------------------------------------------------
/dist/DOMRect.d.ts:
--------------------------------------------------------------------------------
1 | declare const x_: unique symbol;
2 | declare const y_: unique symbol;
3 | declare const width_: unique symbol;
4 | declare const height_: unique symbol;
5 | export declare class DOMRectReadOnly {
6 | [x_]: number;
7 | [y_]: number;
8 | [width_]: number;
9 | [height_]: number;
10 | constructor(x?: number, y?: number, width?: number, height?: number);
11 | get x(): number;
12 | get y(): number;
13 | get width(): number;
14 | get height(): number;
15 | get top(): number;
16 | get right(): number;
17 | get bottom(): number;
18 | get left(): number;
19 | toJSON(): {
20 | x: number;
21 | y: number;
22 | width: number;
23 | height: number;
24 | };
25 | static fromRect(other: DOMRectReadOnly): DOMRectReadOnly;
26 | }
27 | export declare class DOMRect extends DOMRectReadOnly {
28 | get x(): number;
29 | get y(): number;
30 | get width(): number;
31 | get height(): number;
32 | set x(value: number);
33 | set y(value: number);
34 | set width(value: number);
35 | set height(value: number);
36 | }
37 | export {};
38 | //# sourceMappingURL=DOMRect.d.ts.map
--------------------------------------------------------------------------------
/dist/DOMRect.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMRect.d.ts","sourceRoot":"","sources":["../src/DOMRect.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,EAAE,eAAc,CAAA;AACtB,QAAA,MAAM,EAAE,eAAc,CAAA;AACtB,QAAA,MAAM,MAAM,eAAkB,CAAA;AAC9B,QAAA,MAAM,OAAO,eAAmB,CAAA;AAEhC,qBAAa,eAAe;IAC3B,CAAC,EAAE,CAAC,SAAK;IACT,CAAC,EAAE,CAAC,SAAK;IACT,CAAC,MAAM,CAAC,SAAK;IACb,CAAC,OAAO,CAAC,SAAI;gBAED,CAAC,SAAI,EAAE,CAAC,SAAI,EAAE,KAAK,SAAI,EAAE,MAAM,SAAI;IAO/C,IAAI,CAAC,WAEJ;IACD,IAAI,CAAC,WAEJ;IACD,IAAI,KAAK,WAER;IACD,IAAI,MAAM,WAET;IAED,IAAI,GAAG,WAEN;IACD,IAAI,KAAK,WAER;IACD,IAAI,MAAM,WAET;IACD,IAAI,IAAI,WAEP;IAED,MAAM;;;;;;IASN,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,eAAe;CAGtC;AAED,qBAAa,OAAQ,SAAQ,eAAe;IAC3C,IAAa,CAAC,WAEb;IACD,IAAa,CAAC,WAEb;IACD,IAAa,KAAK,WAEjB;IACD,IAAa,MAAM,WAElB;IAED,IAAa,CAAC,CAAC,KAAK,QAAA,EAEnB;IACD,IAAa,CAAC,CAAC,KAAK,QAAA,EAEnB;IACD,IAAa,KAAK,CAAC,KAAK,QAAA,EAEvB;IACD,IAAa,MAAM,CAAC,KAAK,QAAA,EAExB;CACD"}
--------------------------------------------------------------------------------
/dist/DOMRect.js:
--------------------------------------------------------------------------------
1 | const x_ = Symbol('x');
2 | const y_ = Symbol('y');
3 | const width_ = Symbol('width');
4 | const height_ = Symbol('height');
5 | export class DOMRectReadOnly {
6 | [x_] = 0;
7 | [y_] = 0;
8 | [width_] = 0;
9 | [height_] = 0;
10 | constructor(x = 0, y = 0, width = 0, height = 0) {
11 | this[x_] = Number(x);
12 | this[y_] = Number(y);
13 | this[width_] = Number(width);
14 | this[height_] = Number(height);
15 | }
16 | get x() {
17 | return this[x_];
18 | }
19 | get y() {
20 | return this[y_];
21 | }
22 | get width() {
23 | return this[width_];
24 | }
25 | get height() {
26 | return this[height_];
27 | }
28 | get top() {
29 | return Math.min(this[y_], this[y_] + this[height_]);
30 | }
31 | get right() {
32 | return Math.max(this[x_], this[x_] + this[width_]);
33 | }
34 | get bottom() {
35 | return Math.max(this[y_], this[y_] + this[height_]);
36 | }
37 | get left() {
38 | return Math.min(this[x_], this[x_] + this[width_]);
39 | }
40 | toJSON() {
41 | return {
42 | x: this[x_],
43 | y: this[y_],
44 | width: this[width_],
45 | height: this[height_],
46 | };
47 | }
48 | static fromRect(other) {
49 | return new this(other[x_], other[y_], other[width_], other[height_]);
50 | }
51 | }
52 | export class DOMRect extends DOMRectReadOnly {
53 | get x() {
54 | return this[x_];
55 | }
56 | get y() {
57 | return this[y_];
58 | }
59 | get width() {
60 | return this[width_];
61 | }
62 | get height() {
63 | return this[height_];
64 | }
65 | set x(value) {
66 | this[x_] = Number(value);
67 | }
68 | set y(value) {
69 | this[y_] = Number(value);
70 | }
71 | set width(value) {
72 | this[width_] = Number(value);
73 | }
74 | set height(value) {
75 | this[height_] = Number(value);
76 | }
77 | }
78 | //# sourceMappingURL=DOMRect.js.map
--------------------------------------------------------------------------------
/dist/DOMRect.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DOMRect.js","source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C,OAAO,CAAC,CAAA;IACrB,CAAC;IAED,IAAa,CAAC,CAAC,KAAK;QACnB,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IACD,IAAa,CAAC,CAAC,KAAK;QACnB,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IACD,IAAa,KAAK,CAAC,KAAK;QACvB,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;IACD,IAAa,MAAM,CAAC,KAAK;QACxB,IAAI,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;CACD"}
--------------------------------------------------------------------------------
/dist/index.d.ts:
--------------------------------------------------------------------------------
1 | export * from './DOMMatrix.js';
2 | export * from './DOMPoint.js';
3 | export * from './DOMQuad.js';
4 | export * from './DOMRect.js';
5 | export declare const version = "2.0.0";
6 | //# sourceMappingURL=index.d.ts.map
--------------------------------------------------------------------------------
/dist/index.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AA+B5B,eAAO,MAAM,OAAO,UAAU,CAAA"}
--------------------------------------------------------------------------------
/dist/index.js:
--------------------------------------------------------------------------------
1 | export * from './DOMMatrix.js';
2 | export * from './DOMPoint.js';
3 | export * from './DOMQuad.js';
4 | export * from './DOMRect.js';
5 | import { DOMMatrix, DOMMatrixReadOnly } from './DOMMatrix.js';
6 | import { DOMPoint, DOMPointReadOnly } from './DOMPoint.js';
7 | import { DOMQuad } from './DOMQuad.js';
8 | import { DOMRect, DOMRectReadOnly } from './DOMRect.js';
9 | let _global = null;
10 | // browser
11 | if (typeof globalThis != 'undefined') {
12 | _global = globalThis;
13 | }
14 | else if (typeof window != 'undefined') {
15 | _global = window;
16 | }
17 | // @ts-ignore `global` is from older NodeJS (in case we run this in Node)
18 | else if (typeof global != 'undefined') {
19 | // @ts-ignore `global` is from older NodeJS (in case we run this in Node)
20 | _global = global;
21 | }
22 | if (_global) {
23 | _global.DOMMatrix = DOMMatrix;
24 | _global.DOMMatrixReadOnly = DOMMatrixReadOnly;
25 | _global.DOMPoint = DOMPoint;
26 | _global.DOMPointReadOnly = DOMPointReadOnly;
27 | _global.DOMQuad = DOMQuad;
28 | _global.DOMRect = DOMRect;
29 | _global.DOMRectReadOnly = DOMRectReadOnly;
30 | }
31 | export const version = '2.0.0';
32 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/dist/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAE5B,OAAO,EAAC,SAAS,EAAE,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAA;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,cAAc,CAAA;AAErD,IAAI,OAAO,GAA6B,IAAI,CAAA;AAE5C,UAAU;AACV,IAAI,OAAO,UAAU,IAAI,WAAW,EAAE,CAAC;IACtC,OAAO,GAAG,UAAU,CAAA;AACrB,CAAC;KAAM,IAAI,OAAO,MAAM,IAAI,WAAW,EAAE,CAAC;IACzC,OAAO,GAAG,MAAM,CAAA;AACjB,CAAC;AACD,yEAAyE;KACpE,IAAI,OAAO,MAAM,IAAI,WAAW,EAAE,CAAC;IACvC,yEAAyE;IACzE,OAAO,GAAG,MAAM,CAAA;AACjB,CAAC;AAED,IAAI,OAAO,EAAE,CAAC;IACb,OAAO,CAAC,SAAS,GAAG,SAAS,CAAA;IAC7B,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;IAC7C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC3B,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC3C,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;IACzB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;IACzB,OAAO,CAAC,eAAe,GAAG,eAAe,CAAA;AAC1C,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA"}
--------------------------------------------------------------------------------
/dist/test-utils.d.ts:
--------------------------------------------------------------------------------
1 | export declare function expectNumberArraysEqual(arr1: ArrayLike, arr2: ArrayLike, epsilon?: number): void;
2 | export declare function expectMatricesEqual(mat1: DOMMatrixReadOnly, mat2: DOMMatrixReadOnly, epsilon?: number, skipIsIdentityCheck?: boolean, skipStringCheck?: boolean): void;
3 | //# sourceMappingURL=test-utils.d.ts.map
--------------------------------------------------------------------------------
/dist/test-utils.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,SAAI,QAKpG;AAED,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,iBAAiB,EACvB,OAAO,SAAI,EACX,mBAAmB,UAAQ,EAC3B,eAAe,UAAQ,QA6BvB"}
--------------------------------------------------------------------------------
/dist/test-utils.js:
--------------------------------------------------------------------------------
1 | export function expectNumberArraysEqual(arr1, arr2, epsilon = 0) {
2 | expect(arr1.length).toBe(arr2.length);
3 | for (let i = 0; i < arr1.length; i++) {
4 | expect(arr1[i] - arr2[i]).toBeLessThanOrEqual(epsilon);
5 | }
6 | }
7 | export function expectMatricesEqual(mat1, mat2, epsilon = 0, skipIsIdentityCheck = false, skipStringCheck = false) {
8 | expectNumberArraysEqual(mat1.toFloat32Array(), mat2.toFloat32Array(), epsilon);
9 | expectNumberArraysEqual(mat1.toFloat32Array(), mat2.toFloat32Array(), epsilon);
10 | expect(mat1.a - mat2.a).toBeLessThanOrEqual(epsilon);
11 | expect(mat1.b - mat2.b).toBeLessThanOrEqual(epsilon);
12 | expect(mat1.c - mat2.c).toBeLessThanOrEqual(epsilon);
13 | expect(mat1.d - mat2.d).toBeLessThanOrEqual(epsilon);
14 | expect(mat1.e - mat2.e).toBeLessThanOrEqual(epsilon);
15 | expect(mat1.f - mat2.f).toBeLessThanOrEqual(epsilon);
16 | expect(mat1.m11 - mat2.m11).toBeLessThanOrEqual(epsilon);
17 | expect(mat1.m12 - mat2.m12).toBeLessThanOrEqual(epsilon);
18 | expect(mat1.m13 - mat2.m13).toBeLessThanOrEqual(epsilon);
19 | expect(mat1.m14 - mat2.m14).toBeLessThanOrEqual(epsilon);
20 | expect(mat1.m21 - mat2.m21).toBeLessThanOrEqual(epsilon);
21 | expect(mat1.m22 - mat2.m22).toBeLessThanOrEqual(epsilon);
22 | expect(mat1.m23 - mat2.m23).toBeLessThanOrEqual(epsilon);
23 | expect(mat1.m24 - mat2.m24).toBeLessThanOrEqual(epsilon);
24 | expect(mat1.m31 - mat2.m31).toBeLessThanOrEqual(epsilon);
25 | expect(mat1.m32 - mat2.m32).toBeLessThanOrEqual(epsilon);
26 | expect(mat1.m33 - mat2.m33).toBeLessThanOrEqual(epsilon);
27 | expect(mat1.m34 - mat2.m34).toBeLessThanOrEqual(epsilon);
28 | expect(mat1.m41 - mat2.m41).toBeLessThanOrEqual(epsilon);
29 | expect(mat1.m42 - mat2.m42).toBeLessThanOrEqual(epsilon);
30 | expect(mat1.m43 - mat2.m43).toBeLessThanOrEqual(epsilon);
31 | expect(mat1.m44 - mat2.m44).toBeLessThanOrEqual(epsilon);
32 | expect(mat1.is2D).toBe(mat2.is2D);
33 | if (!skipIsIdentityCheck)
34 | expect(mat1.isIdentity).toBe(mat2.isIdentity);
35 | if (!epsilon && !skipStringCheck)
36 | expect(mat1.toString()).toEqual(mat2.toString());
37 | }
38 | //# sourceMappingURL=test-utils.js.map
--------------------------------------------------------------------------------
/dist/test-utils.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,uBAAuB,CAAC,IAAuB,EAAE,IAAuB,EAAE,OAAO,GAAG,CAAC;IACpG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;IACzD,CAAC;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAClC,IAAuB,EACvB,IAAuB,EACvB,OAAO,GAAG,CAAC,EACX,mBAAmB,GAAG,KAAK,EAC3B,eAAe,GAAG,KAAK;IAEvB,uBAAuB,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,OAAO,CAAC,CAAA;IAC9E,uBAAuB,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,OAAO,CAAC,CAAA;IAC9E,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;IACpD,MAAM,CAAC,IAAI,CAAC,C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,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;AACnF,CAAC"}
--------------------------------------------------------------------------------
/dist/utilities.d.ts:
--------------------------------------------------------------------------------
1 | export declare function multiplyAndApply(A: DOMMatrixReadOnly, B: DOMMatrixReadOnly, target: DOMMatrix): void;
2 | export declare function copyMatrix(from: DOMMatrixReadOnly, to: DOMMatrix): void;
3 | export declare function applyArrayValuesToDOMMatrix(array: ArrayLike, matrix: DOMMatrix): void;
4 | export declare function toAxisRotation(mat: DOMMatrix, x: number, y: number, z: number, angle: number): void;
5 | export declare const identityValues: readonly number[];
6 | export declare function toIdentity(mat: DOMMatrix): void;
7 | type TypedArray = Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array | Uint8ClampedArray;
8 | export declare function toArray(mat: DOMMatrixReadOnly, target?: TypedArray | Array): number[] | TypedArray;
9 | /** Normalize a DOMPoint into a unit vector. */
10 | export declare function normalizePoint(point: DOMPoint): void;
11 | export {};
12 | //# sourceMappingURL=utilities.d.ts.map
--------------------------------------------------------------------------------
/dist/utilities.d.ts.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAQA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,QA0B7F;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,SAAS,QA0BhE;AAGD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,QA6BtF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAkC5F;AASD,eAAO,MAAM,cAAc,mBAKzB,CAAA;AAGF,wBAAgB,UAAU,CAAC,GAAG,EAAE,SAAS,QAoBxC;AAGD,KAAK,UAAU,GACZ,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,cAAc,GACd,iBAAiB,CAAA;AAEpB,wBAAgB,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,GAAE,UAAU,GAAG,KAAK,CAAC,MAAM,CAAM,yBA4BtF;AAED,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,QAO7C"}
--------------------------------------------------------------------------------
/dist/utilities.js:
--------------------------------------------------------------------------------
1 | // A reusable array, to avoid allocating new arrays during multiplication.
2 | let scratch = null;
3 | function getScratch() {
4 | if (!scratch)
5 | scratch = new DOMMatrix();
6 | return scratch;
7 | }
8 | export function multiplyAndApply(A, B, target) {
9 | const scratch = getScratch();
10 | //XXX: Are the following calculations faster hard coded (current), or as a loop?
11 | scratch.m11 = A.m11 * B.m11 + A.m21 * B.m12 + A.m31 * B.m13 + A.m41 * B.m14;
12 | scratch.m21 = A.m11 * B.m21 + A.m21 * B.m22 + A.m31 * B.m23 + A.m41 * B.m24;
13 | scratch.m31 = A.m11 * B.m31 + A.m21 * B.m32 + A.m31 * B.m33 + A.m41 * B.m34;
14 | scratch.m41 = A.m11 * B.m41 + A.m21 * B.m42 + A.m31 * B.m43 + A.m41 * B.m44;
15 | scratch.m12 = A.m12 * B.m11 + A.m22 * B.m12 + A.m32 * B.m13 + A.m42 * B.m14;
16 | scratch.m22 = A.m12 * B.m21 + A.m22 * B.m22 + A.m32 * B.m23 + A.m42 * B.m24;
17 | scratch.m32 = A.m12 * B.m31 + A.m22 * B.m32 + A.m32 * B.m33 + A.m42 * B.m34;
18 | scratch.m42 = A.m12 * B.m41 + A.m22 * B.m42 + A.m32 * B.m43 + A.m42 * B.m44;
19 | scratch.m13 = A.m13 * B.m11 + A.m23 * B.m12 + A.m33 * B.m13 + A.m43 * B.m14;
20 | scratch.m23 = A.m13 * B.m21 + A.m23 * B.m22 + A.m33 * B.m23 + A.m43 * B.m24;
21 | scratch.m33 = A.m13 * B.m31 + A.m23 * B.m32 + A.m33 * B.m33 + A.m43 * B.m34;
22 | scratch.m43 = A.m13 * B.m41 + A.m23 * B.m42 + A.m33 * B.m43 + A.m43 * B.m44;
23 | scratch.m14 = A.m14 * B.m11 + A.m24 * B.m12 + A.m34 * B.m13 + A.m44 * B.m14;
24 | scratch.m24 = A.m14 * B.m21 + A.m24 * B.m22 + A.m34 * B.m23 + A.m44 * B.m24;
25 | scratch.m34 = A.m14 * B.m31 + A.m24 * B.m32 + A.m34 * B.m33 + A.m44 * B.m34;
26 | scratch.m44 = A.m14 * B.m41 + A.m24 * B.m42 + A.m34 * B.m43 + A.m44 * B.m44;
27 | copyMatrix(scratch, target);
28 | }
29 | export function copyMatrix(from, to) {
30 | if (from.is2D) {
31 | to.m11 = from.m11;
32 | to.m12 = from.m12;
33 | to.m21 = from.m21;
34 | to.m22 = from.m22;
35 | to.m41 = from.m41;
36 | to.m42 = from.m42;
37 | }
38 | else {
39 | to.m11 = from.m11;
40 | to.m12 = from.m12;
41 | to.m13 = from.m13;
42 | to.m14 = from.m14;
43 | to.m21 = from.m21;
44 | to.m22 = from.m22;
45 | to.m23 = from.m23;
46 | to.m24 = from.m24;
47 | to.m31 = from.m31;
48 | to.m32 = from.m32;
49 | to.m33 = from.m33;
50 | to.m34 = from.m34;
51 | to.m41 = from.m41;
52 | to.m42 = from.m42;
53 | to.m43 = from.m43;
54 | to.m44 = from.m44;
55 | }
56 | }
57 | // The `array` is column major for 3D matrices, so the first 4 elements are the first column, etc.
58 | export function applyArrayValuesToDOMMatrix(array, matrix) {
59 | const length = array.length;
60 | if (length === 6) {
61 | toIdentity(matrix);
62 | matrix.m11 = array[0];
63 | matrix.m12 = array[1];
64 | matrix.m21 = array[2];
65 | matrix.m22 = array[3];
66 | matrix.m41 = array[4];
67 | matrix.m42 = array[5];
68 | }
69 | else if (length === 16) {
70 | matrix.m11 = array[0];
71 | matrix.m12 = array[1];
72 | matrix.m13 = array[2];
73 | matrix.m14 = array[3];
74 | matrix.m21 = array[4];
75 | matrix.m22 = array[5];
76 | matrix.m23 = array[6];
77 | matrix.m24 = array[7];
78 | matrix.m31 = array[8];
79 | matrix.m32 = array[9];
80 | matrix.m33 = array[10];
81 | matrix.m34 = array[11];
82 | matrix.m41 = array[12];
83 | matrix.m42 = array[13];
84 | matrix.m43 = array[14];
85 | matrix.m44 = array[15];
86 | }
87 | }
88 | export function toAxisRotation(mat, x, y, z, angle) {
89 | const { sin, cos } = Math;
90 | const halfAngle = degreesToRadians(angle / 2);
91 | const sinHalfAngle = sin(halfAngle);
92 | const cosHalfAngle = cos(halfAngle);
93 | const sinHalfAngleSq = sinHalfAngle ** 2;
94 | const sinHalfAngleCosHalfAngle = sinHalfAngle * cosHalfAngle;
95 | // TODO: Maybe performance can be improved by first detecting when x, y, or z of
96 | // the axis are zero or 1, and using a pre-simplified version of the
97 | // folowing math based on that condition.
98 | // TODO: Maybe performance can be improved by using different equations (use trig
99 | // identities to find alternate formulas, I recall Famo.us using less operations).
100 | mat.m11 = 1 - 2 * (y ** 2 + z ** 2) * sinHalfAngleSq;
101 | mat.m12 = 2 * (x * y * sinHalfAngleSq + z * sinHalfAngleCosHalfAngle);
102 | mat.m13 = 2 * (x * z * sinHalfAngleSq - y * sinHalfAngleCosHalfAngle);
103 | mat.m14 = 0;
104 | mat.m21 = 2 * (x * y * sinHalfAngleSq - z * sinHalfAngleCosHalfAngle);
105 | mat.m22 = 1 - 2 * (x ** 2 + z ** 2) * sinHalfAngleSq;
106 | mat.m23 = 2 * (y * z * sinHalfAngleSq + x * sinHalfAngleCosHalfAngle);
107 | mat.m24 = 0;
108 | mat.m31 = 2 * (x * z * sinHalfAngleSq + y * sinHalfAngleCosHalfAngle);
109 | mat.m32 = 2 * (y * z * sinHalfAngleSq - x * sinHalfAngleCosHalfAngle);
110 | mat.m33 = 1 - 2 * (x ** 2 + y ** 2) * sinHalfAngleSq;
111 | mat.m34 = 0;
112 | mat.m41 = 0;
113 | mat.m42 = 0;
114 | mat.m43 = 0;
115 | mat.m44 = 1;
116 | }
117 | function degreesToRadians(degrees) {
118 | return (Math.PI / 180) * degrees;
119 | }
120 | // In a pair of coordinates (as in "m23") the first number
121 | // is the column and the second is the row (so "m23" means column 2 row 3).
122 | // prettier-ignore
123 | export const identityValues = Object.freeze([
124 | 1, 0, 0, 0,
125 | 0, 1, 0, 0,
126 | 0, 0, 1, 0,
127 | 0, 0, 0, 1,
128 | ]);
129 | /* Set the given matrix to identity. */
130 | export function toIdentity(mat) {
131 | mat.m11 = 1;
132 | mat.m12 = 0;
133 | mat.m13 = 0;
134 | mat.m14 = 0;
135 | mat.m21 = 0;
136 | mat.m22 = 1;
137 | mat.m23 = 0;
138 | mat.m24 = 0;
139 | mat.m31 = 0;
140 | mat.m32 = 0;
141 | mat.m33 = 1;
142 | mat.m34 = 0;
143 | mat.m41 = 0;
144 | mat.m42 = 0;
145 | mat.m43 = 0;
146 | mat.m44 = 1;
147 | }
148 | export function toArray(mat, target = []) {
149 | if (mat.is2D) {
150 | target[0] = mat.m11;
151 | target[1] = mat.m12;
152 | target[2] = mat.m21;
153 | target[3] = mat.m22;
154 | target[4] = mat.m41;
155 | target[5] = mat.m42;
156 | }
157 | else {
158 | target[0] = mat.m11;
159 | target[1] = mat.m12;
160 | target[2] = mat.m13;
161 | target[3] = mat.m14;
162 | target[4] = mat.m21;
163 | target[5] = mat.m22;
164 | target[6] = mat.m23;
165 | target[7] = mat.m24;
166 | target[8] = mat.m31;
167 | target[9] = mat.m32;
168 | target[10] = mat.m33;
169 | target[11] = mat.m34;
170 | target[12] = mat.m41;
171 | target[13] = mat.m42;
172 | target[14] = mat.m43;
173 | target[15] = mat.m44;
174 | }
175 | return target;
176 | }
177 | /** Normalize a DOMPoint into a unit vector. */
178 | export function normalizePoint(point) {
179 | const { x, y, z, w } = point;
180 | const length = Math.hypot(x, y, z, w);
181 | point.x = x / length;
182 | point.y = y / length;
183 | point.z = z / length;
184 | point.w = w / length;
185 | }
186 | //# sourceMappingURL=utilities.js.map
--------------------------------------------------------------------------------
/dist/utilities.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,IAAI,OAAO,GAAqB,IAAI,CAAA;AAEpC,SAAS,UAAU;IAClB,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,IAAI,SAAS,EAAE,CAAA;IACvC,OAAO,OAAO,CAAA;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,CAAoB,EAAE,CAAoB,EAAE,MAAiB;IAC7F,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAE5B,gFAAgF;IAEhF,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAA;IAC3E,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAA;IAC3E,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,G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B,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;QACnB,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;QACnB,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;QACnB,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;QACpB,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;QACpB,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;QACpB,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;QACpB,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;QACpB,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAA;IACrB,CAAC;IAED,OAAO,MAAM,CAAA;AACd,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,cAAc,CAAC,KAAe;IAC7C,MAAM,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,GAAG,KAAK,CAAA;IAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACrC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;IACpB,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;IACpB,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;IACpB,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;AACrB,CAAC"}
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "geometry-interfaces",
3 | "version": "2.0.0",
4 | "description": "The W3C Geometry Interfaces implemented in JavaScript and polyfilled.",
5 | "homepage": "https://github.com/trusktr/geometry-interfaces",
6 | "license": "MIT",
7 | "type": "module",
8 | "main": "dist/index.js",
9 | "types": "dist/index.d.ts",
10 | "scripts": {
11 | "clean": "lume clean",
12 | "build": "lume build",
13 | "build:clean": "lume build --clean",
14 | "dev": "lume dev",
15 | "typecheck": "lume typecheck",
16 | "typecheck:watch": "lume typecheckWatch",
17 | "test": "lume test",
18 | "test:watch": "lume test --watch",
19 | "prettier": "lume prettier",
20 | "prettier:check": "lume prettierCheck",
21 | "release:patch": "lume releasePatch",
22 | "release:minor": "lume releaseMinor",
23 | "release:major": "lume releaseMajor",
24 | "version": "lume versionHook",
25 | "postversion": "lume postVersionHook"
26 | },
27 | "devDependencies": {
28 | "@lume/cli": "^0.14.0",
29 | "prettier": "3.0.3",
30 | "typescript": "^5.0.0"
31 | },
32 | "repository": {
33 | "type": "git",
34 | "url": "https://github.com/trusktr/geometry-interfaces.git"
35 | },
36 | "bugs": {
37 | "url": "https://github.com/trusktr/geometry-interfaces/issues"
38 | },
39 | "keywords": [
40 | "DOMMatrix",
41 | "DOMMatrixReadOnly",
42 | "DOMPoint",
43 | "DOMPointReadOnly",
44 | "DOMRect",
45 | "DOMRectReadOnly",
46 | "GeometryUtils",
47 | "geometry",
48 | "Geometry Interfaces",
49 | "3D",
50 | "affine transforms",
51 | "transformation matrices"
52 | ]
53 | }
54 |
--------------------------------------------------------------------------------
/src/DOMMatrix.test.ts:
--------------------------------------------------------------------------------
1 | import {DOMMatrix} from './DOMMatrix.js'
2 | import {expectMatricesEqual} from './test-utils.js'
3 | import {toIdentity} from './utilities.js'
4 |
5 | // TODO move type def to @lume/cli, map @types/jest's `expect` type into the
6 | // global env.
7 | declare global {
8 | function expect(...args: any[]): any
9 | }
10 |
11 | // An epsilon for checking our JavaScript DOMMatrix values vs those of
12 | // Chrome's DOMMatrix in some cases, as there is a small precision
13 | // difference for some reason (maybe slightly different math formulas in one
14 | // of the other).
15 | const epsilon = 0.000000000000001
16 |
17 | describe('DOMMatrixReadOnly', () => {
18 | it('multiply', () => {
19 | let polyfillMat = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
20 | let nativeMat = new window.DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
21 |
22 | polyfillMat = polyfillMat.multiply(new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]))
23 | nativeMat = nativeMat.multiply(new window.DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]))
24 |
25 | expectMatricesEqual(polyfillMat, nativeMat)
26 | })
27 |
28 | it('translate', () => {
29 | let polyfillMat = new DOMMatrixReadOnly()
30 | let nativeMat = new window.DOMMatrixReadOnly()
31 |
32 | polyfillMat = polyfillMat.translate(10)
33 | nativeMat = nativeMat.translate(10)
34 |
35 | expectMatricesEqual(polyfillMat, nativeMat)
36 |
37 | polyfillMat = new DOMMatrixReadOnly()
38 | nativeMat = new window.DOMMatrixReadOnly()
39 | polyfillMat = polyfillMat.translate(0, 10)
40 | nativeMat = nativeMat.translate(0, 10)
41 |
42 | expectMatricesEqual(polyfillMat, nativeMat)
43 |
44 | polyfillMat = new DOMMatrixReadOnly()
45 | nativeMat = new window.DOMMatrixReadOnly()
46 | polyfillMat = polyfillMat.translate(0, 0, 10)
47 | nativeMat = nativeMat.translate(0, 0, 10)
48 |
49 | expectMatricesEqual(polyfillMat, nativeMat)
50 |
51 | polyfillMat = new DOMMatrixReadOnly()
52 | nativeMat = new window.DOMMatrixReadOnly()
53 | polyfillMat = polyfillMat.translate(10, 20, 30)
54 | nativeMat = nativeMat.translate(10, 20, 30)
55 |
56 | expectMatricesEqual(polyfillMat, nativeMat)
57 | })
58 |
59 | it('scale', () => {
60 | let polyfillMat = new DOMMatrixReadOnly()
61 | let nativeMat = new window.DOMMatrixReadOnly()
62 |
63 | polyfillMat = polyfillMat.scale(10)
64 | nativeMat = nativeMat.scale(10)
65 |
66 | expect(polyfillMat.is2D).toBe(true)
67 | expectMatricesEqual(polyfillMat, nativeMat)
68 |
69 | polyfillMat = new DOMMatrixReadOnly()
70 | nativeMat = new window.DOMMatrixReadOnly()
71 | polyfillMat = polyfillMat.scale(0, 10)
72 | nativeMat = nativeMat.scale(0, 10)
73 |
74 | expect(polyfillMat.is2D).toBe(true)
75 | expectMatricesEqual(polyfillMat, nativeMat)
76 |
77 | polyfillMat = new DOMMatrixReadOnly()
78 | nativeMat = new window.DOMMatrixReadOnly()
79 | polyfillMat = polyfillMat.scale(0, 0, 10)
80 | nativeMat = nativeMat.scale(0, 0, 10)
81 |
82 | expect(polyfillMat.is2D).toBe(false)
83 | expectMatricesEqual(polyfillMat, nativeMat)
84 |
85 | polyfillMat = new DOMMatrixReadOnly()
86 | nativeMat = new window.DOMMatrixReadOnly()
87 | polyfillMat = polyfillMat.scale(10, 20, 30)
88 | nativeMat = nativeMat.scale(10, 20, 30)
89 |
90 | expect(polyfillMat.is2D).toBe(false)
91 | expectMatricesEqual(polyfillMat, nativeMat)
92 |
93 | // ensure internal scaleMatrix does not cause incorrect is2D value.
94 | let polyfillMat2 = new DOMMatrixReadOnly()
95 | let nativeMat2 = new window.DOMMatrixReadOnly()
96 |
97 | polyfillMat2 = polyfillMat2.scale(10)
98 | nativeMat2 = nativeMat2.scale(10)
99 |
100 | expect(polyfillMat2.is2D).toBe(true)
101 | expectMatricesEqual(polyfillMat2, nativeMat2)
102 | })
103 |
104 | it('scale3d', () => {
105 | let polyfillMat = new DOMMatrix()
106 | let nativeMat = new window.DOMMatrix()
107 |
108 | polyfillMat = polyfillMat.scale3d(1)
109 | nativeMat = nativeMat.scale3d(1)
110 |
111 | expect(polyfillMat.is2D).toBe(true)
112 | expectMatricesEqual(polyfillMat, nativeMat)
113 |
114 | polyfillMat = polyfillMat.scale3d(10)
115 | nativeMat = nativeMat.scale3d(10)
116 |
117 | expect(polyfillMat.is2D).toBe(false)
118 | expect(polyfillMat.isIdentity).toBe(false)
119 | expectMatricesEqual(polyfillMat, nativeMat)
120 |
121 | polyfillMat = polyfillMat.scale3d(1 / 10)
122 | nativeMat = nativeMat.scale3d(1 / 10)
123 |
124 | const isChromeOrEdge = navigator.userAgent.indexOf('Chrome') !== -1
125 |
126 | expect(polyfillMat.is2D).toBe(false)
127 | expect(polyfillMat.isIdentity).toBe(true)
128 | // Chrome/Edge has an issue where scaling by X then by 1/X does
129 | // not result in an identity matrix. So we need to check for an
130 | // epsilon difference in this case.
131 | if (isChromeOrEdge) expect(nativeMat.isIdentity).toBe(false)
132 | else expect(nativeMat.isIdentity).toBe(true)
133 | // Skip the identity and string checks on this case for now due to the
134 | // Chrome issue.
135 | expectMatricesEqual(polyfillMat, nativeMat, 0, true, true)
136 |
137 | // ensure internal scaleMatrix does not cause incorrect is2D value.
138 | const polyfillMat2 = new DOMMatrix()
139 | const nativeMat2 = new window.DOMMatrix()
140 |
141 | polyfillMat2.scale3d(1)
142 | nativeMat2.scale3d(1)
143 |
144 | expect(polyfillMat2.is2D).toBe(true)
145 | expectMatricesEqual(polyfillMat2, nativeMat2)
146 | })
147 |
148 | it('rotateAxisAngle', () => {
149 | // Firefox behavior is different from Chrome and Safari.
150 | // https://github.com/webcompat/web-bugs/issues/145666
151 |
152 | let polyfillMat = new DOMMatrix()
153 | let nativeMat = new window.DOMMatrix()
154 |
155 | polyfillMat = polyfillMat.rotateAxisAngleSelf(1, 0, 0, 4)
156 | nativeMat = nativeMat.rotateAxisAngleSelf(1, 0, 0, 4)
157 |
158 | expectMatricesEqual(polyfillMat, nativeMat)
159 |
160 | polyfillMat = new DOMMatrix()
161 | nativeMat = new window.DOMMatrix()
162 | polyfillMat = polyfillMat.rotateAxisAngleSelf(0, 1, 0, 4)
163 | nativeMat = nativeMat.rotateAxisAngleSelf(0, 1, 0, 4)
164 |
165 | expectMatricesEqual(polyfillMat, nativeMat)
166 |
167 | polyfillMat = new DOMMatrix()
168 | nativeMat = new window.DOMMatrix()
169 | polyfillMat = polyfillMat.rotateAxisAngleSelf(0, 0, 1, 4)
170 | nativeMat = nativeMat.rotateAxisAngleSelf(0, 0, 1, 4)
171 |
172 | expectMatricesEqual(polyfillMat, nativeMat)
173 |
174 | polyfillMat = new DOMMatrix()
175 | nativeMat = new window.DOMMatrix()
176 | polyfillMat = polyfillMat.rotateAxisAngleSelf(1, 0, 1, 4)
177 | nativeMat = nativeMat.rotateAxisAngleSelf(1, 0, 1, 4)
178 |
179 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
180 |
181 | polyfillMat = new DOMMatrix()
182 | nativeMat = new window.DOMMatrix()
183 | polyfillMat = polyfillMat.rotateAxisAngleSelf(1, 1, 0, 4)
184 | nativeMat = nativeMat.rotateAxisAngleSelf(1, 1, 0, 4)
185 |
186 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
187 |
188 | polyfillMat = new DOMMatrix()
189 | nativeMat = new window.DOMMatrix()
190 | polyfillMat = polyfillMat.rotateAxisAngleSelf(1, 1, 1, 4)
191 | nativeMat = nativeMat.rotateAxisAngleSelf(1, 1, 1, 4)
192 |
193 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
194 |
195 | polyfillMat = new DOMMatrix()
196 | nativeMat = new window.DOMMatrix()
197 | polyfillMat = polyfillMat.rotateAxisAngleSelf(1, 2, 3, 4)
198 | nativeMat = nativeMat.rotateAxisAngleSelf(1, 2, 3, 4)
199 |
200 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
201 | })
202 |
203 | it('rotate', () => {
204 | let polyfillMat = new DOMMatrix()
205 | let nativeMat = new window.DOMMatrix()
206 |
207 | polyfillMat = polyfillMat.rotateSelf(10)
208 | nativeMat = nativeMat.rotateSelf(10)
209 |
210 | expectMatricesEqual(polyfillMat, nativeMat)
211 |
212 | polyfillMat = new DOMMatrix()
213 | nativeMat = new window.DOMMatrix()
214 | polyfillMat = polyfillMat.rotateSelf(0, 10)
215 | nativeMat = nativeMat.rotateSelf(0, 10)
216 |
217 | expectMatricesEqual(polyfillMat, nativeMat)
218 |
219 | polyfillMat = new DOMMatrix()
220 | nativeMat = new window.DOMMatrix()
221 | polyfillMat = polyfillMat.rotateSelf(10, 0, 0)
222 | nativeMat = nativeMat.rotateSelf(10, 0, 0)
223 |
224 | expectMatricesEqual(polyfillMat, nativeMat)
225 |
226 | polyfillMat = new DOMMatrix()
227 | nativeMat = new window.DOMMatrix()
228 | polyfillMat = polyfillMat.rotateSelf(0, 10, 0)
229 | nativeMat = nativeMat.rotateSelf(0, 10, 0)
230 |
231 | expectMatricesEqual(polyfillMat, nativeMat)
232 |
233 | polyfillMat = new DOMMatrix()
234 | nativeMat = new window.DOMMatrix()
235 | polyfillMat = polyfillMat.rotateSelf(0, 0, 10)
236 | nativeMat = nativeMat.rotateSelf(0, 0, 10)
237 |
238 | expectMatricesEqual(polyfillMat, nativeMat)
239 |
240 | polyfillMat = new DOMMatrix()
241 | nativeMat = new window.DOMMatrix()
242 | polyfillMat = polyfillMat.rotateSelf(10, 20, 30)
243 | nativeMat = nativeMat.rotateSelf(10, 20, 30)
244 |
245 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
246 | })
247 | })
248 |
249 | describe('DOMMatrix', () => {
250 | it('isIdentity and is2D', () => {
251 | const polyfillMat = new DOMMatrix()
252 | const nativeMat = new window.DOMMatrix()
253 |
254 | polyfillMat.rotateAxisAngleSelf(1, 2, 3, 4)
255 | nativeMat.rotateAxisAngleSelf(1, 2, 3, 4)
256 |
257 | toIdentity(polyfillMat)
258 | toIdentity(nativeMat)
259 |
260 | expectMatricesEqual(polyfillMat, nativeMat)
261 |
262 | // ensure internal axisRotationMatrix does not cause incorrect is2D value.
263 |
264 | const polyfillMat2 = new DOMMatrix()
265 | const nativeMat2 = new window.DOMMatrix()
266 |
267 | polyfillMat2.rotateSelf(10)
268 | nativeMat2.rotateSelf(10)
269 |
270 | expect(polyfillMat2.isIdentity).toBe(false)
271 | expect(polyfillMat2.isIdentity).toBe(nativeMat2.isIdentity)
272 | expect(polyfillMat2.is2D).toBe(true)
273 | expect(polyfillMat2.is2D).toBe(nativeMat2.is2D)
274 | expectMatricesEqual(polyfillMat2, nativeMat2)
275 |
276 | toIdentity(polyfillMat2)
277 | toIdentity(nativeMat2)
278 |
279 | expect(polyfillMat2.isIdentity).toBe(true)
280 | expect(polyfillMat2.isIdentity).toBe(nativeMat2.isIdentity)
281 | expect(polyfillMat2.is2D).toBe(true)
282 | expect(polyfillMat2.is2D).toBe(nativeMat2.is2D)
283 |
284 | const polyfillMat3 = new DOMMatrix()
285 | const nativeMat3 = new window.DOMMatrix()
286 |
287 | polyfillMat3.rotateSelf(10, 20, 30)
288 | nativeMat3.rotateSelf(10, 20, 30)
289 |
290 | expect(polyfillMat3.isIdentity).toBe(false)
291 | expect(polyfillMat3.isIdentity).toBe(nativeMat3.isIdentity)
292 | expect(polyfillMat3.is2D).toBe(false)
293 | expect(polyfillMat3.is2D).toBe(nativeMat3.is2D)
294 | expectMatricesEqual(polyfillMat3, nativeMat3, epsilon)
295 |
296 | toIdentity(polyfillMat3)
297 | toIdentity(nativeMat3)
298 |
299 | expect(polyfillMat3.isIdentity).toBe(true)
300 | expect(polyfillMat3.isIdentity).toBe(nativeMat3.isIdentity)
301 | expect(polyfillMat3.is2D).toBe(false) // It would be great if it went back to is2D https://github.com/w3c/fxtf-drafts/issues/584
302 | expect(polyfillMat3.is2D).toBe(nativeMat3.is2D)
303 | })
304 |
305 | it('toString', () => {
306 | const polyfillMat = new DOMMatrix()
307 | const nativeMat = new window.DOMMatrix()
308 |
309 | let string = polyfillMat.toString()
310 | expect(string).toBe('matrix(1, 0, 0, 1, 0, 0)')
311 | expect(string).toBe(nativeMat.toString())
312 |
313 | polyfillMat.rotateSelf(10)
314 | nativeMat.rotateSelf(10)
315 |
316 | string = polyfillMat.toString()
317 | expect(string).not.toBe('matrix(1, 0, 0, 1, 0, 0)')
318 | expect(string).not.toBe('matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)')
319 | expect(string).toBe(nativeMat.toString())
320 | expectMatricesEqual(polyfillMat, nativeMat)
321 | })
322 |
323 | it('multiplySelf', () => {
324 | const polyfillMat = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
325 | const nativeMat = new window.DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
326 |
327 | polyfillMat.multiplySelf(new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]))
328 | nativeMat.multiplySelf(new window.DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]))
329 |
330 | expectMatricesEqual(polyfillMat, nativeMat)
331 | })
332 |
333 | it('preMultiplySelf', () => {
334 | const polyfillMat = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
335 | const nativeMat = new window.DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
336 |
337 | polyfillMat.preMultiplySelf(new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]))
338 | nativeMat.preMultiplySelf(new window.DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]))
339 |
340 | expectMatricesEqual(polyfillMat, nativeMat)
341 | })
342 |
343 | it('translateSelf', () => {
344 | const polyfillMat = new DOMMatrix()
345 | const nativeMat = new window.DOMMatrix()
346 |
347 | polyfillMat.translateSelf(10)
348 | nativeMat.translateSelf(10)
349 |
350 | expectMatricesEqual(polyfillMat, nativeMat)
351 |
352 | toIdentity(polyfillMat)
353 | toIdentity(nativeMat)
354 | polyfillMat.translateSelf(0, 10)
355 | nativeMat.translateSelf(0, 10)
356 |
357 | expectMatricesEqual(polyfillMat, nativeMat)
358 |
359 | toIdentity(polyfillMat)
360 | toIdentity(nativeMat)
361 | polyfillMat.translateSelf(0, 0, 10)
362 | nativeMat.translateSelf(0, 0, 10)
363 |
364 | expectMatricesEqual(polyfillMat, nativeMat)
365 |
366 | toIdentity(polyfillMat)
367 | toIdentity(nativeMat)
368 | polyfillMat.translateSelf(10, 20, 30)
369 | nativeMat.translateSelf(10, 20, 30)
370 |
371 | expectMatricesEqual(polyfillMat, nativeMat)
372 | })
373 |
374 | it('scaleSelf', () => {
375 | const polyfillMat = new DOMMatrix()
376 | const nativeMat = new window.DOMMatrix()
377 |
378 | polyfillMat.scaleSelf(10)
379 | nativeMat.scaleSelf(10)
380 |
381 | expect(polyfillMat.is2D).toBe(true)
382 | expectMatricesEqual(polyfillMat, nativeMat)
383 |
384 | toIdentity(polyfillMat)
385 | toIdentity(nativeMat)
386 | polyfillMat.scaleSelf(0, 10)
387 | nativeMat.scaleSelf(0, 10)
388 |
389 | expect(polyfillMat.is2D).toBe(true)
390 | expectMatricesEqual(polyfillMat, nativeMat)
391 |
392 | toIdentity(polyfillMat)
393 | toIdentity(nativeMat)
394 | polyfillMat.scaleSelf(0, 0, 10)
395 | nativeMat.scaleSelf(0, 0, 10)
396 |
397 | expect(polyfillMat.is2D).toBe(false)
398 | expectMatricesEqual(polyfillMat, nativeMat)
399 |
400 | toIdentity(polyfillMat)
401 | toIdentity(nativeMat)
402 | polyfillMat.scaleSelf(10, 20, 30)
403 | nativeMat.scaleSelf(10, 20, 30)
404 |
405 | expect(polyfillMat.is2D).toBe(false)
406 | expectMatricesEqual(polyfillMat, nativeMat)
407 |
408 | // ensure internal scaleMatrix does not cause incorrect is2D value.
409 |
410 | const polyfillMat2 = new DOMMatrix()
411 | const nativeMat2 = new window.DOMMatrix()
412 |
413 | polyfillMat2.scaleSelf(10)
414 | nativeMat2.scaleSelf(10)
415 |
416 | expect(polyfillMat2.is2D).toBe(true)
417 | expectMatricesEqual(polyfillMat2, nativeMat2)
418 | })
419 |
420 | it('scale3dSelf', () => {
421 | const polyfillMat = new DOMMatrix()
422 | const nativeMat = new window.DOMMatrix()
423 |
424 | polyfillMat.scale3dSelf(1)
425 | nativeMat.scale3dSelf(1)
426 |
427 | expect(polyfillMat.is2D).toBe(true)
428 | expectMatricesEqual(polyfillMat, nativeMat)
429 |
430 | polyfillMat.scale3dSelf(10)
431 | nativeMat.scale3dSelf(10)
432 |
433 | expect(polyfillMat.is2D).toBe(false)
434 | expect(polyfillMat.isIdentity).toBe(false)
435 | expectMatricesEqual(polyfillMat, nativeMat)
436 |
437 | polyfillMat.scale3dSelf(1 / 10)
438 | nativeMat.scale3dSelf(1 / 10)
439 |
440 | const isChromeOrEdge = navigator.userAgent.indexOf('Chrome') !== -1
441 |
442 | expect(polyfillMat.is2D).toBe(false)
443 | expect(polyfillMat.isIdentity).toBe(true)
444 | // Chrome/Edge has an issue where scaling by X then by 1/X does
445 | // not result in an identity matrix. So we need to check for an
446 | // epsilon difference in this case.
447 | if (isChromeOrEdge) expect(nativeMat.isIdentity).toBe(false)
448 | else expect(nativeMat.isIdentity).toBe(true)
449 | // Skip the identity and string checks on this case for now due to the
450 | // Chrome issue.
451 | expectMatricesEqual(polyfillMat, nativeMat, 0, true, true)
452 |
453 | // ensure internal scaleMatrix does not cause incorrect is2D value.
454 | const polyfillMat2 = new DOMMatrix()
455 | const nativeMat2 = new window.DOMMatrix()
456 |
457 | polyfillMat2.scale3dSelf(1)
458 | nativeMat2.scale3dSelf(1)
459 |
460 | expect(polyfillMat2.is2D).toBe(true)
461 | expectMatricesEqual(polyfillMat2, nativeMat2)
462 | })
463 |
464 | it('rotateAxisAngleSelf', () => {
465 | // Firefox behavior is different from Chrome and Safari.
466 | // https://github.com/webcompat/web-bugs/issues/145666
467 |
468 | const polyfillMat = new DOMMatrix()
469 | const nativeMat = new window.DOMMatrix()
470 |
471 | polyfillMat.rotateAxisAngleSelf(1, 0, 0, 4)
472 | nativeMat.rotateAxisAngleSelf(1, 0, 0, 4)
473 |
474 | expectMatricesEqual(polyfillMat, nativeMat)
475 |
476 | toIdentity(polyfillMat)
477 | toIdentity(nativeMat)
478 | polyfillMat.rotateAxisAngleSelf(0, 1, 0, 4)
479 | nativeMat.rotateAxisAngleSelf(0, 1, 0, 4)
480 |
481 | expectMatricesEqual(polyfillMat, nativeMat)
482 |
483 | toIdentity(polyfillMat)
484 | toIdentity(nativeMat)
485 | polyfillMat.rotateAxisAngleSelf(0, 0, 1, 4)
486 | nativeMat.rotateAxisAngleSelf(0, 0, 1, 4)
487 |
488 | expectMatricesEqual(polyfillMat, nativeMat)
489 |
490 | toIdentity(polyfillMat)
491 | toIdentity(nativeMat)
492 | polyfillMat.rotateAxisAngleSelf(1, 0, 1, 4)
493 | nativeMat.rotateAxisAngleSelf(1, 0, 1, 4)
494 |
495 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
496 |
497 | toIdentity(polyfillMat)
498 | toIdentity(nativeMat)
499 | polyfillMat.rotateAxisAngleSelf(1, 1, 0, 4)
500 | nativeMat.rotateAxisAngleSelf(1, 1, 0, 4)
501 |
502 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
503 |
504 | toIdentity(polyfillMat)
505 | toIdentity(nativeMat)
506 | polyfillMat.rotateAxisAngleSelf(1, 1, 1, 4)
507 | nativeMat.rotateAxisAngleSelf(1, 1, 1, 4)
508 |
509 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
510 |
511 | toIdentity(polyfillMat)
512 | toIdentity(nativeMat)
513 | polyfillMat.rotateAxisAngleSelf(1, 2, 3, 4)
514 | nativeMat.rotateAxisAngleSelf(1, 2, 3, 4)
515 |
516 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
517 | })
518 |
519 | it('rotateSelf', () => {
520 | const polyfillMat = new DOMMatrix()
521 | const nativeMat = new window.DOMMatrix()
522 |
523 | polyfillMat.rotateSelf(10)
524 | nativeMat.rotateSelf(10)
525 |
526 | expectMatricesEqual(polyfillMat, nativeMat)
527 |
528 | toIdentity(polyfillMat)
529 | toIdentity(nativeMat)
530 | polyfillMat.rotateSelf(0, 10)
531 | nativeMat.rotateSelf(0, 10)
532 |
533 | expectMatricesEqual(polyfillMat, nativeMat)
534 |
535 | toIdentity(polyfillMat)
536 | toIdentity(nativeMat)
537 | polyfillMat.rotateSelf(10, 0, 0)
538 | nativeMat.rotateSelf(10, 0, 0)
539 |
540 | expectMatricesEqual(polyfillMat, nativeMat)
541 |
542 | toIdentity(polyfillMat)
543 | toIdentity(nativeMat)
544 | polyfillMat.rotateSelf(0, 10, 0)
545 | nativeMat.rotateSelf(0, 10, 0)
546 |
547 | expectMatricesEqual(polyfillMat, nativeMat)
548 |
549 | toIdentity(polyfillMat)
550 | toIdentity(nativeMat)
551 | polyfillMat.rotateSelf(0, 0, 10)
552 | nativeMat.rotateSelf(0, 0, 10)
553 |
554 | expectMatricesEqual(polyfillMat, nativeMat)
555 |
556 | toIdentity(polyfillMat)
557 | toIdentity(nativeMat)
558 | polyfillMat.rotateSelf(10, 20, 30)
559 | nativeMat.rotateSelf(10, 20, 30)
560 |
561 | expectMatricesEqual(polyfillMat, nativeMat, epsilon)
562 | })
563 | })
564 |
--------------------------------------------------------------------------------
/src/DOMMatrix.ts:
--------------------------------------------------------------------------------
1 | import {DOMPoint} from './DOMPoint.js'
2 | import {multiplyAndApply, normalizePoint, toAxisRotation} from './utilities.js'
3 | import {identityValues} from './utilities.js'
4 |
5 | const default2DValues = Object.freeze([1, 0, 0, 1, 0, 0])
6 |
7 | const elements = Symbol('elements')
8 | const is2D = Symbol('is2D')
9 |
10 | export class DOMMatrixReadOnly {
11 | /** The elements of the matrix, in column-major order. */
12 | [elements] = new Float64Array(identityValues);
13 |
14 | [is2D] = true
15 |
16 | /**
17 | * @param {string | Array} init An array of numbers, or a CSS
18 | * transform string. If the array has 6 items, then those items set the
19 | * values of m11, m12, m21, m22, m41, m42 in that order (or the values
20 | * a, b, c, d, e, f if you're using those aliases) and this.is2D is
21 | * true. If the array has 16 items (in column-major order), then they
22 | * set all the values of the underlying matrix (m11 to m44) and
23 | * this.is2D is set false. Arrays of other lengths throw an error.
24 | */
25 | constructor(init: string | ArrayLike = default2DValues) {
26 | if (typeof init === 'string') throw new Error('CSS transform string not supported yet.')
27 |
28 | const {length} = init
29 |
30 | if (length === undefined || (length !== 6 && length !== 16))
31 | throw new TypeError(
32 | `Failed to construct '${
33 | new.target === DOMMatrixReadOnly ? 'DOMMatrixReadOnly' : 'DOMMatrix'
34 | }': The sequence must contain 6 elements for a 2D matrix or 16 elements for a 3D matrix.'`,
35 | )
36 |
37 | this[is2D] = length === 6 ? true : false
38 |
39 | if (this[is2D]) {
40 | this[elements][0] = init[0]!
41 | this[elements][1] = init[1]!
42 | this[elements][4] = init[2]!
43 | this[elements][5] = init[3]!
44 | this[elements][12] = init[4]!
45 | this[elements][13] = init[5]!
46 | } else {
47 | this[elements].set(init)
48 | }
49 | }
50 |
51 | // Immutable transform methods -------------------------------------------
52 |
53 | multiply(other: DOMMatrixReadOnly): DOMMatrix {
54 | return new DOMMatrix(getInit(this)).multiplySelf(other)
55 | }
56 |
57 | translate(tx = 0, ty = 0, tz = 0): DOMMatrix {
58 | return new DOMMatrix(getInit(this)).translateSelf(tx, ty, tz)
59 | }
60 |
61 | scale(scaleX = 1, scaleY = scaleX, scaleZ = 1, originX = 0, originY = 0, originZ = 0): DOMMatrix {
62 | return new DOMMatrix(getInit(this)).scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ)
63 | }
64 |
65 | scale3d(scale = 1, originX = 0, originY = 0, originZ = 0): DOMMatrix {
66 | return new DOMMatrix(getInit(this)).scale3dSelf(scale, originX, originY, originZ)
67 | }
68 |
69 | /** @deprecated use `matrix.scale()` */
70 | scaleNonUniform(scaleX = 1, scaleY = scaleX, scaleZ = 1, originX = 0, originY = 0, originZ = 0) {
71 | return this.scale(scaleX, scaleY, scaleZ, originX, originY, originZ)
72 | }
73 |
74 | rotateAxisAngle(x = 0, y = 0, z = 0, angle = 0): DOMMatrix {
75 | return new DOMMatrix(getInit(this)).rotateAxisAngleSelf(x, y, z, angle)
76 | }
77 |
78 | rotate(angle = 0, originX = 0, originY = 0): DOMMatrix {
79 | return new DOMMatrix(getInit(this)).rotateSelf(angle, originX, originY)
80 | }
81 |
82 | // TODO
83 | rotateFromVector(_x = 0, _y = 0): DOMMatrix {
84 | throw new Error('rotateFromVector is not implemented yet.')
85 | }
86 |
87 | skewX(_sx = 0): DOMMatrix {
88 | throw new Error('skewX is not implemented yet.')
89 | }
90 | skewY(_sy = 0): DOMMatrix {
91 | throw new Error('skewY is not implemented yet.')
92 | }
93 |
94 | flipX(): DOMMatrix {
95 | throw new Error('flipX is not implemented yet.')
96 | }
97 | flipY(): DOMMatrix {
98 | throw new Error('flipY is not implemented yet.')
99 | }
100 | inverse(): DOMMatrix {
101 | throw new Error('inverse is not implemented yet.')
102 | }
103 |
104 | transformPoint(_point: DOMPointInit): DOMPoint {
105 | throw new Error('transformPoint is not implemented yet.')
106 | }
107 |
108 | toFloat32Array() {
109 | return Float32Array.from(this[elements])
110 | }
111 | toFloat64Array() {
112 | return Float64Array.from(this[elements])
113 | }
114 |
115 | // stringifier
116 | // https://drafts.fxtf.org/geometry/#dommatrixreadonly-stringification-behavior
117 | toString(): string {
118 | if (this[is2D])
119 | return `matrix(${this[elements][0]}, ${this[elements][1]}, ${this[elements][4]}, ${this[elements][5]}, ${this[elements][12]}, ${this[elements][13]})`
120 | else
121 | return `matrix3d(${this[elements][0]}, ${this[elements][1]}, ${this[elements][2]}, ${this[elements][3]}, ${this[elements][4]}, ${this[elements][5]}, ${this[elements][6]}, ${this[elements][7]}, ${this[elements][8]}, ${this[elements][9]}, ${this[elements][10]}, ${this[elements][11]}, ${this[elements][12]}, ${this[elements][13]}, ${this[elements][14]}, ${this[elements][15]})`
122 | }
123 |
124 | get is2D() {
125 | return this[is2D]
126 | }
127 |
128 | /*
129 | * TODO: make sure this matches the spec.
130 | * TODO: Instead of calculating here, perhaps calculate and set
131 | * this._isIdentity in other operations, and simply return the internal one
132 | * here.
133 | */
134 | get isIdentity() {
135 | for (var i = 0, len = this[elements].length; i < len; i += 1) {
136 | if (this[elements][i] !== identityValues[i]) return false
137 | }
138 |
139 | return true
140 | }
141 |
142 | get a() {
143 | return this.m11 // elements[0]
144 | }
145 | get b() {
146 | return this.m12 // elements[1]
147 | }
148 | get c() {
149 | return this.m21 // elements[4]
150 | }
151 | get d() {
152 | return this.m22 // elements[5]
153 | }
154 | get e() {
155 | return this.m41 // elements[12]
156 | }
157 | get f() {
158 | return this.m42 // elements[13]
159 | }
160 |
161 | get m11() {
162 | return this[elements][0]!
163 | }
164 | get m12() {
165 | return this[elements][1]!
166 | }
167 | get m13() {
168 | return this[elements][2]!
169 | }
170 | get m14() {
171 | return this[elements][3]!
172 | }
173 |
174 | get m21() {
175 | return this[elements][4]!
176 | }
177 | get m22() {
178 | return this[elements][5]!
179 | }
180 | get m23() {
181 | return this[elements][6]!
182 | }
183 | get m24() {
184 | return this[elements][7]!
185 | }
186 |
187 | get m31() {
188 | return this[elements][8]!
189 | }
190 | get m32() {
191 | return this[elements][9]!
192 | }
193 | get m33() {
194 | return this[elements][10]!
195 | }
196 | get m34() {
197 | return this[elements][11]!
198 | }
199 |
200 | get m41() {
201 | return this[elements][12]!
202 | }
203 | get m42() {
204 | return this[elements][13]!
205 | }
206 | get m43() {
207 | return this[elements][14]!
208 | }
209 | get m44() {
210 | return this[elements][15]!
211 | }
212 |
213 | toJSON() {
214 | return {
215 | a: this.a,
216 | b: this.b,
217 | c: this.c,
218 | d: this.d,
219 | e: this.e,
220 | f: this.f,
221 |
222 | m11: this.m11,
223 | m12: this.m12,
224 | m13: this.m13,
225 | m14: this.m14,
226 | m21: this.m21,
227 | m22: this.m22,
228 | m23: this.m23,
229 | m24: this.m24,
230 | m31: this.m31,
231 | m32: this.m32,
232 | m33: this.m33,
233 | m34: this.m34,
234 | m41: this.m41,
235 | m42: this.m42,
236 | m43: this.m43,
237 | m44: this.m44,
238 | }
239 | }
240 |
241 | static fromMatrix(other: DOMMatrixReadOnly) {
242 | const mat = other[elements as unknown as keyof typeof other] as unknown as number[]
243 | return new this(mat)
244 | }
245 |
246 | static fromFloat32Array(array: Float32Array) {
247 | return new this(array)
248 | }
249 |
250 | static fromFloat64Array(array: Float64Array) {
251 | return new this(array)
252 | }
253 | }
254 |
255 | export class DOMMatrix extends DOMMatrixReadOnly {
256 | constructor(arg?: string | ArrayLike) {
257 | if (arg === undefined) {
258 | super()
259 | } else if (typeof arg == 'string') {
260 | throw new Error('CSS transformList arg not yet implemented.')
261 | // TODO validate that syntax of transformList matches transform-list (http://www.w3.org/TR/css-transforms-1/#typedef-transform-list).
262 | } else if (isNumberSequence(arg)) {
263 | super(arg)
264 | } else throw new Error('Invalid argument to DOMMatrix constructor.')
265 | }
266 |
267 | // Mutable transform methods
268 | multiplySelf(other: DOMMatrixInit) {
269 | if (!(other instanceof DOMMatrix)) throw new Error('The argument to multiplySelf must be an instance of DOMMatrix')
270 |
271 | // TODO: avoid creating a new array, just apply values directly.
272 | multiplyAndApply(this, other, this)
273 |
274 | if (!other[is2D]) this[is2D] = false
275 |
276 | return this
277 | }
278 |
279 | preMultiplySelf(other: DOMMatrixReadOnly) {
280 | if (!(other instanceof DOMMatrix))
281 | throw new Error('The argument to preMultiplySelf must be an instance of DOMMatrix')
282 |
283 | // TODO: avoid creating a new array, just apply values directly.
284 | multiplyAndApply(other, this, this)
285 |
286 | if (!other[is2D]) this[is2D] = false
287 |
288 | return this
289 | }
290 |
291 | translateSelf(tx = 0, ty = 0, tz = 0) {
292 | if (tx === 0 && ty === 0 && tz === 0) return this
293 |
294 | // http://www.w3.org/TR/2012/WD-css3-transforms-20120911/#Translate3dDefined
295 | translationMatrix.m41 = tx
296 | translationMatrix.m42 = ty
297 | translationMatrix.m43 = tz
298 |
299 | this.multiplySelf(translationMatrix)
300 |
301 | if (tz != 0) this[is2D] = false
302 |
303 | return this
304 | }
305 |
306 | scaleSelf(scaleX = 1, scaleY = scaleX, scaleZ = 1, originX = 0, originY = 0, originZ = 0) {
307 | this.translateSelf(originX, originY, originZ)
308 |
309 | scaleMatrix[is2D] = true
310 | scaleMatrix.m11 = scaleX
311 | scaleMatrix.m22 = scaleY
312 | scaleMatrix.m33 = scaleZ
313 |
314 | this.multiplySelf(scaleMatrix)
315 |
316 | this.translateSelf(-originX, -originY, -originZ)
317 |
318 | if (scaleZ !== 1 || originZ !== 0) this[is2D] = false
319 |
320 | return this
321 | }
322 |
323 | scale3dSelf(scale = 1, originX = 0, originY = 0, originZ = 0) {
324 | if (scale === 1) return this
325 |
326 | this.translateSelf(originX, originY, originZ)
327 |
328 | scaleMatrix[is2D] = true
329 | scaleMatrix.m11 = scale
330 | scaleMatrix.m22 = scale
331 | scaleMatrix.m33 = scale
332 |
333 | this.multiplySelf(scaleMatrix)
334 |
335 | this.translateSelf(-originX, -originY, -originZ)
336 |
337 | if (scale !== 1) this[is2D] = false
338 |
339 | return this
340 | }
341 |
342 | rotateAxisAngleSelf(x = 0, y = 0, z = 0, angle = 0) {
343 | if (angle === 0) return this // Firefox behavior.
344 |
345 | point.x = x
346 | point.y = y
347 | point.z = z
348 | point.w = 0
349 |
350 | normalizePoint(point)
351 |
352 | axisRotationMatrix[is2D] = true
353 | toAxisRotation(axisRotationMatrix, point.x, point.y, point.z, angle)
354 | this.multiplySelf(axisRotationMatrix)
355 |
356 | if (x !== 0 || y !== 0) this[is2D] = false
357 |
358 | return this
359 | }
360 |
361 | // https://drafts.fxtf.org/geometry/#dom-dommatrix-rotateself
362 | rotateSelf(rotX = 0, rotY?: number, rotZ?: number) {
363 | if (rotY == null && rotZ == null) {
364 | rotZ = rotX
365 | rotX = 0
366 | rotY = 0
367 | }
368 |
369 | rotY ??= 0
370 | rotZ ??= 0
371 |
372 | if (rotZ) this.rotateAxisAngleSelf(0, 0, 1, rotZ)
373 | if (rotY) this.rotateAxisAngleSelf(0, 1, 0, rotY)
374 | if (rotX) this.rotateAxisAngleSelf(1, 0, 0, rotX)
375 |
376 | return this
377 | }
378 |
379 | // TODO
380 | rotateFromVectorSelf(_x = 0, _y = 0): this {
381 | throw new Error('rotateFromVectorSelf is not implemented yet.')
382 | }
383 |
384 | skewXSelf(_sx = 0): this {
385 | throw new Error('skewXSelf is not implemented yet.')
386 | }
387 |
388 | skewYSelf(_sy = 0): this {
389 | throw new Error('skewYSelf is not implemented yet.')
390 | }
391 |
392 | invertSelf(): this {
393 | throw new Error('invertSelf is not implemented yet.')
394 | }
395 |
396 | setMatrixValue(_transformList: string): this {
397 | throw new Error('setMatrixValue is not implemented yet.')
398 | }
399 |
400 | override get a() {
401 | return this.m11
402 | }
403 | override set a(value) {
404 | this.m11 = value
405 | }
406 | override get b() {
407 | return this.m12
408 | }
409 | override set b(value) {
410 | this.m12 = value
411 | }
412 | override get c() {
413 | return this.m21
414 | }
415 | override set c(value) {
416 | this.m21 = value
417 | }
418 | override get d() {
419 | return this.m22
420 | }
421 | override set d(value) {
422 | this.m22 = value
423 | }
424 | override get e() {
425 | return this.m41
426 | }
427 | override set e(value) {
428 | this.m41 = value
429 | }
430 | override get f() {
431 | return this.m42
432 | }
433 | override set f(value) {
434 | this.m42 = value
435 | }
436 |
437 | override get m11() {
438 | return this[elements][0]!
439 | }
440 | override set m11(value) {
441 | this[elements][0] = value
442 | }
443 | override get m12() {
444 | return this[elements][1]!
445 | }
446 | override set m12(value) {
447 | this[elements][1] = value
448 | }
449 | override get m13() {
450 | return this[elements][2]!
451 | }
452 | override set m13(value) {
453 | if (value !== 0) this[is2D] = false
454 | this[elements][2] = value
455 | }
456 | override get m14() {
457 | return this[elements][3]!
458 | }
459 | override set m14(value) {
460 | if (value !== 0) this[is2D] = false
461 | this[elements][3] = value
462 | }
463 |
464 | override get m21() {
465 | return this[elements][4]!
466 | }
467 | override set m21(value) {
468 | this[elements][4] = value
469 | }
470 | override get m22() {
471 | return this[elements][5]!
472 | }
473 | override set m22(value) {
474 | this[elements][5] = value
475 | }
476 | override get m23() {
477 | return this[elements][6]!
478 | }
479 | override set m23(value) {
480 | if (value !== 0) this[is2D] = false
481 | this[elements][6] = value
482 | }
483 | override get m24() {
484 | return this[elements][7]!
485 | }
486 | override set m24(value) {
487 | if (value !== 0) this[is2D] = false
488 | this[elements][7] = value
489 | }
490 |
491 | override get m31() {
492 | return this[elements][8]!
493 | }
494 | override set m31(value) {
495 | if (value !== 0) this[is2D] = false
496 | this[elements][8] = value
497 | }
498 | override get m32() {
499 | return this[elements][9]!
500 | }
501 | override set m32(value) {
502 | if (value !== 0) this[is2D] = false
503 | this[elements][9] = value
504 | }
505 | override get m33() {
506 | return this[elements][10]!
507 | }
508 | override set m33(value) {
509 | if (value !== 1) this[is2D] = false
510 | this[elements][10] = value
511 | }
512 | override get m34() {
513 | return this[elements][11]!
514 | }
515 | override set m34(value) {
516 | if (value !== 0) this[is2D] = false
517 | this[elements][11] = value
518 | }
519 |
520 | override get m41() {
521 | return this[elements][12]!
522 | }
523 | override set m41(value) {
524 | this[elements][12] = value
525 | }
526 | override get m42() {
527 | return this[elements][13]!
528 | }
529 | override set m42(value) {
530 | this[elements][13] = value
531 | }
532 | override get m43() {
533 | return this[elements][14]!
534 | }
535 | override set m43(value) {
536 | if (value !== 0) this[is2D] = false
537 | this[elements][14] = value
538 | }
539 | override get m44() {
540 | return this[elements][15]!
541 | }
542 | override set m44(value) {
543 | if (value !== 1) this[is2D] = false
544 | this[elements][15] = value
545 | }
546 |
547 | static override fromMatrix(other: DOMMatrixReadOnly) {
548 | const mat = other[elements as unknown as keyof typeof other] as unknown as number[]
549 | return new this(mat)
550 | }
551 |
552 | static override fromFloat32Array(array: Float32Array) {
553 | return new this(array)
554 | }
555 |
556 | static override fromFloat64Array(array: Float64Array) {
557 | return new this(array)
558 | }
559 | }
560 |
561 | const axisRotationMatrix = new DOMMatrix()
562 | const translationMatrix = new DOMMatrix()
563 | const scaleMatrix = new DOMMatrix()
564 | const point = new DOMPoint()
565 |
566 | function getInit(mat: DOMMatrixReadOnly) {
567 | return mat.is2D ? [mat.m11, mat.m12, mat.m21, mat.m22, mat.m41, mat.m42] : mat.toFloat64Array()
568 | }
569 |
570 | function isNumberSequence(obj: any): obj is ArrayLike {
571 | if (obj && typeof obj.length === 'number' && typeof obj[0] === 'number') return true
572 |
573 | return false
574 | }
575 |
--------------------------------------------------------------------------------
/src/DOMPoint.ts:
--------------------------------------------------------------------------------
1 | const x_ = Symbol('x')
2 | const y_ = Symbol('y')
3 | const z_ = Symbol('z')
4 | const w_ = Symbol('w')
5 |
6 | export class DOMPointReadOnly {
7 | [x_] = 0;
8 | [y_] = 0;
9 | [z_] = 0;
10 | [w_] = 1
11 |
12 | constructor(x = 0, y = 0, z = 0, w = 0) {
13 | this[x_] = Number(x)
14 | this[y_] = Number(y)
15 | this[z_] = Number(z)
16 | this[w_] = Number(w)
17 | }
18 |
19 | get x() {
20 | return this[x_]
21 | }
22 | get y() {
23 | return this[y_]
24 | }
25 | get z() {
26 | return this[z_]
27 | }
28 | get w() {
29 | return this[w_]
30 | }
31 |
32 | matrixTransform(_matrix: DOMMatrixInit): DOMPoint {
33 | throw new Error('matrixTransform is not implemented yet.')
34 |
35 | // TODO
36 | // let result = new this.constructor(this)
37 | //const x
38 | //const y
39 | //const z
40 | //const w
41 |
42 | // return result
43 | }
44 |
45 | toJSON() {
46 | return {
47 | x: this[x_],
48 | y: this[y_],
49 | z: this[z_],
50 | w: this[w_],
51 | }
52 | }
53 |
54 | static fromPoint(other: DOMPointReadOnly) {
55 | return new this(other.x, other.y, other.z, other.w)
56 | }
57 | }
58 |
59 | export class DOMPoint extends DOMPointReadOnly {
60 | override get x() {
61 | return this[x_]
62 | }
63 | override get y() {
64 | return this[y_]
65 | }
66 | override get z() {
67 | return this[z_]
68 | }
69 | override get w() {
70 | return this[w_]
71 | }
72 |
73 | override set x(value) {
74 | this[x_] = Number(value)
75 | }
76 | override set y(value) {
77 | this[y_] = Number(value)
78 | }
79 | override set z(value) {
80 | this[z_] = Number(value)
81 | }
82 | override set w(value) {
83 | this[w_] = Number(value)
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/DOMQuad.ts:
--------------------------------------------------------------------------------
1 | const p1 = Symbol('p1')
2 | const p2 = Symbol('p2')
3 | const p3 = Symbol('p3')
4 | const p4 = Symbol('p4')
5 |
6 | export class DOMQuad {
7 | [p1]!: DOMPoint;
8 | [p2]!: DOMPoint;
9 | [p3]!: DOMPoint;
10 | [p4]!: DOMPoint
11 |
12 | constructor(point1?: DOMPointInit, point2?: DOMPointInit, point3?: DOMPointInit, point4?: DOMPointInit) {
13 | this[p1] = point1 !== undefined ? new DOMPoint(point1.x, point1.y, point1.z, point1.w) : new DOMPoint()
14 | this[p2] = point2 !== undefined ? new DOMPoint(point2.x, point2.y, point2.z, point2.w) : new DOMPoint()
15 | this[p3] = point3 !== undefined ? new DOMPoint(point3.x, point3.y, point3.z, point3.w) : new DOMPoint()
16 | this[p4] = point4 !== undefined ? new DOMPoint(point4.x, point4.y, point4.z, point4.w) : new DOMPoint()
17 | }
18 |
19 | get p1() {
20 | return this[p1]
21 | }
22 | get p2() {
23 | return this[p2]
24 | }
25 | get p3() {
26 | return this[p3]
27 | }
28 | get p4() {
29 | return this[p4]
30 | }
31 |
32 | static fromRect(other: DOMRectReadOnly) {
33 | return other === undefined
34 | ? new this()
35 | : new this(
36 | new DOMPoint(other.x, other.y, 0, 1),
37 | new DOMPoint(other.x + other.width, other.y, 0, 1),
38 | new DOMPoint(other.x + other.width, other.y + other.height, 0, 1),
39 | new DOMPoint(other.x, other.y + other.height, 0, 1),
40 | )
41 | }
42 |
43 | static fromQuad(other: DOMQuad) {
44 | return other === undefined ? new this() : new this(other.p1, other.p2, other.p3, other.p4)
45 | }
46 |
47 | getBounds() {
48 | const _p1 = this[p1]
49 | const _p2 = this[p2]
50 | const _p3 = this[p3]
51 | const _p4 = this[p4]
52 | const left = Math.min(_p1.x, _p2.x, _p3.x, _p4.x)
53 | const top = Math.min(_p1.y, _p2.y, _p3.y, _p4.y)
54 | const right = Math.max(_p1.x, _p2.x, _p3.x, _p4.x)
55 | const bottom = Math.max(_p1.y, _p2.y, _p3.y, _p4.y)
56 | const width = right - left
57 | const height = bottom - top
58 | return new DOMRect(left, top, width, height)
59 | }
60 |
61 | toJSON() {
62 | return {
63 | p1: this[p1].toJSON(),
64 | p2: this[p2].toJSON(),
65 | p3: this[p3].toJSON(),
66 | p4: this[p4].toJSON(),
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/DOMRect.ts:
--------------------------------------------------------------------------------
1 | const x_ = Symbol('x')
2 | const y_ = Symbol('y')
3 | const width_ = Symbol('width')
4 | const height_ = Symbol('height')
5 |
6 | export class DOMRectReadOnly {
7 | [x_] = 0;
8 | [y_] = 0;
9 | [width_] = 0;
10 | [height_] = 0
11 |
12 | constructor(x = 0, y = 0, width = 0, height = 0) {
13 | this[x_] = Number(x)
14 | this[y_] = Number(y)
15 | this[width_] = Number(width)
16 | this[height_] = Number(height)
17 | }
18 |
19 | get x() {
20 | return this[x_]
21 | }
22 | get y() {
23 | return this[y_]
24 | }
25 | get width() {
26 | return this[width_]
27 | }
28 | get height() {
29 | return this[height_]
30 | }
31 |
32 | get top() {
33 | return Math.min(this[y_], this[y_] + this[height_])
34 | }
35 | get right() {
36 | return Math.max(this[x_], this[x_] + this[width_])
37 | }
38 | get bottom() {
39 | return Math.max(this[y_], this[y_] + this[height_])
40 | }
41 | get left() {
42 | return Math.min(this[x_], this[x_] + this[width_])
43 | }
44 |
45 | toJSON() {
46 | return {
47 | x: this[x_],
48 | y: this[y_],
49 | width: this[width_],
50 | height: this[height_],
51 | }
52 | }
53 |
54 | static fromRect(other: DOMRectReadOnly) {
55 | return new this(other[x_], other[y_], other[width_], other[height_])
56 | }
57 | }
58 |
59 | export class DOMRect extends DOMRectReadOnly {
60 | override get x() {
61 | return this[x_]
62 | }
63 | override get y() {
64 | return this[y_]
65 | }
66 | override get width() {
67 | return this[width_]
68 | }
69 | override get height() {
70 | return this[height_]
71 | }
72 |
73 | override set x(value) {
74 | this[x_] = Number(value)
75 | }
76 | override set y(value) {
77 | this[y_] = Number(value)
78 | }
79 | override set width(value) {
80 | this[width_] = Number(value)
81 | }
82 | override set height(value) {
83 | this[height_] = Number(value)
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './DOMMatrix.js'
2 | export * from './DOMPoint.js'
3 | export * from './DOMQuad.js'
4 | export * from './DOMRect.js'
5 |
6 | import {DOMMatrix, DOMMatrixReadOnly} from './DOMMatrix.js'
7 | import {DOMPoint, DOMPointReadOnly} from './DOMPoint.js'
8 | import {DOMQuad} from './DOMQuad.js'
9 | import {DOMRect, DOMRectReadOnly} from './DOMRect.js'
10 |
11 | let _global: typeof globalThis | null = null
12 |
13 | // browser
14 | if (typeof globalThis != 'undefined') {
15 | _global = globalThis
16 | } else if (typeof window != 'undefined') {
17 | _global = window
18 | }
19 | // @ts-ignore `global` is from older NodeJS (in case we run this in Node)
20 | else if (typeof global != 'undefined') {
21 | // @ts-ignore `global` is from older NodeJS (in case we run this in Node)
22 | _global = global
23 | }
24 |
25 | if (_global) {
26 | _global.DOMMatrix = DOMMatrix
27 | _global.DOMMatrixReadOnly = DOMMatrixReadOnly
28 | _global.DOMPoint = DOMPoint
29 | _global.DOMPointReadOnly = DOMPointReadOnly
30 | _global.DOMQuad = DOMQuad
31 | _global.DOMRect = DOMRect
32 | _global.DOMRectReadOnly = DOMRectReadOnly
33 | }
34 |
35 | export const version = '2.0.0'
36 |
--------------------------------------------------------------------------------
/src/test-utils.ts:
--------------------------------------------------------------------------------
1 | export function expectNumberArraysEqual(arr1: ArrayLike, arr2: ArrayLike, epsilon = 0) {
2 | expect(arr1.length).toBe(arr2.length)
3 | for (let i = 0; i < arr1.length; i++) {
4 | expect(arr1[i]! - arr2[i]!).toBeLessThanOrEqual(epsilon)
5 | }
6 | }
7 |
8 | export function expectMatricesEqual(
9 | mat1: DOMMatrixReadOnly,
10 | mat2: DOMMatrixReadOnly,
11 | epsilon = 0,
12 | skipIsIdentityCheck = false,
13 | skipStringCheck = false,
14 | ) {
15 | expectNumberArraysEqual(mat1.toFloat32Array(), mat2.toFloat32Array(), epsilon)
16 | expectNumberArraysEqual(mat1.toFloat32Array(), mat2.toFloat32Array(), epsilon)
17 | expect(mat1.a - mat2.a).toBeLessThanOrEqual(epsilon)
18 | expect(mat1.b - mat2.b).toBeLessThanOrEqual(epsilon)
19 | expect(mat1.c - mat2.c).toBeLessThanOrEqual(epsilon)
20 | expect(mat1.d - mat2.d).toBeLessThanOrEqual(epsilon)
21 | expect(mat1.e - mat2.e).toBeLessThanOrEqual(epsilon)
22 | expect(mat1.f - mat2.f).toBeLessThanOrEqual(epsilon)
23 | expect(mat1.m11 - mat2.m11).toBeLessThanOrEqual(epsilon)
24 | expect(mat1.m12 - mat2.m12).toBeLessThanOrEqual(epsilon)
25 | expect(mat1.m13 - mat2.m13).toBeLessThanOrEqual(epsilon)
26 | expect(mat1.m14 - mat2.m14).toBeLessThanOrEqual(epsilon)
27 | expect(mat1.m21 - mat2.m21).toBeLessThanOrEqual(epsilon)
28 | expect(mat1.m22 - mat2.m22).toBeLessThanOrEqual(epsilon)
29 | expect(mat1.m23 - mat2.m23).toBeLessThanOrEqual(epsilon)
30 | expect(mat1.m24 - mat2.m24).toBeLessThanOrEqual(epsilon)
31 | expect(mat1.m31 - mat2.m31).toBeLessThanOrEqual(epsilon)
32 | expect(mat1.m32 - mat2.m32).toBeLessThanOrEqual(epsilon)
33 | expect(mat1.m33 - mat2.m33).toBeLessThanOrEqual(epsilon)
34 | expect(mat1.m34 - mat2.m34).toBeLessThanOrEqual(epsilon)
35 | expect(mat1.m41 - mat2.m41).toBeLessThanOrEqual(epsilon)
36 | expect(mat1.m42 - mat2.m42).toBeLessThanOrEqual(epsilon)
37 | expect(mat1.m43 - mat2.m43).toBeLessThanOrEqual(epsilon)
38 | expect(mat1.m44 - mat2.m44).toBeLessThanOrEqual(epsilon)
39 | expect(mat1.is2D).toBe(mat2.is2D)
40 | if (!skipIsIdentityCheck) expect(mat1.isIdentity).toBe(mat2.isIdentity)
41 | if (!epsilon && !skipStringCheck) expect(mat1.toString()).toEqual(mat2.toString())
42 | }
43 |
--------------------------------------------------------------------------------
/src/utilities.ts:
--------------------------------------------------------------------------------
1 | // A reusable array, to avoid allocating new arrays during multiplication.
2 | let scratch: DOMMatrix | null = null
3 |
4 | function getScratch() {
5 | if (!scratch) scratch = new DOMMatrix()
6 | return scratch
7 | }
8 |
9 | export function multiplyAndApply(A: DOMMatrixReadOnly, B: DOMMatrixReadOnly, target: DOMMatrix) {
10 | const scratch = getScratch()
11 |
12 | //XXX: Are the following calculations faster hard coded (current), or as a loop?
13 |
14 | scratch.m11 = A.m11 * B.m11 + A.m21 * B.m12 + A.m31 * B.m13 + A.m41 * B.m14
15 | scratch.m21 = A.m11 * B.m21 + A.m21 * B.m22 + A.m31 * B.m23 + A.m41 * B.m24
16 | scratch.m31 = A.m11 * B.m31 + A.m21 * B.m32 + A.m31 * B.m33 + A.m41 * B.m34
17 | scratch.m41 = A.m11 * B.m41 + A.m21 * B.m42 + A.m31 * B.m43 + A.m41 * B.m44
18 |
19 | scratch.m12 = A.m12 * B.m11 + A.m22 * B.m12 + A.m32 * B.m13 + A.m42 * B.m14
20 | scratch.m22 = A.m12 * B.m21 + A.m22 * B.m22 + A.m32 * B.m23 + A.m42 * B.m24
21 | scratch.m32 = A.m12 * B.m31 + A.m22 * B.m32 + A.m32 * B.m33 + A.m42 * B.m34
22 | scratch.m42 = A.m12 * B.m41 + A.m22 * B.m42 + A.m32 * B.m43 + A.m42 * B.m44
23 |
24 | scratch.m13 = A.m13 * B.m11 + A.m23 * B.m12 + A.m33 * B.m13 + A.m43 * B.m14
25 | scratch.m23 = A.m13 * B.m21 + A.m23 * B.m22 + A.m33 * B.m23 + A.m43 * B.m24
26 | scratch.m33 = A.m13 * B.m31 + A.m23 * B.m32 + A.m33 * B.m33 + A.m43 * B.m34
27 | scratch.m43 = A.m13 * B.m41 + A.m23 * B.m42 + A.m33 * B.m43 + A.m43 * B.m44
28 |
29 | scratch.m14 = A.m14 * B.m11 + A.m24 * B.m12 + A.m34 * B.m13 + A.m44 * B.m14
30 | scratch.m24 = A.m14 * B.m21 + A.m24 * B.m22 + A.m34 * B.m23 + A.m44 * B.m24
31 | scratch.m34 = A.m14 * B.m31 + A.m24 * B.m32 + A.m34 * B.m33 + A.m44 * B.m34
32 | scratch.m44 = A.m14 * B.m41 + A.m24 * B.m42 + A.m34 * B.m43 + A.m44 * B.m44
33 |
34 | copyMatrix(scratch, target)
35 | }
36 |
37 | export function copyMatrix(from: DOMMatrixReadOnly, to: DOMMatrix) {
38 | if (from.is2D) {
39 | to.m11 = from.m11
40 | to.m12 = from.m12
41 | to.m21 = from.m21
42 | to.m22 = from.m22
43 | to.m41 = from.m41
44 | to.m42 = from.m42
45 | } else {
46 | to.m11 = from.m11
47 | to.m12 = from.m12
48 | to.m13 = from.m13
49 | to.m14 = from.m14
50 | to.m21 = from.m21
51 | to.m22 = from.m22
52 | to.m23 = from.m23
53 | to.m24 = from.m24
54 | to.m31 = from.m31
55 | to.m32 = from.m32
56 | to.m33 = from.m33
57 | to.m34 = from.m34
58 | to.m41 = from.m41
59 | to.m42 = from.m42
60 | to.m43 = from.m43
61 | to.m44 = from.m44
62 | }
63 | }
64 |
65 | // The `array` is column major for 3D matrices, so the first 4 elements are the first column, etc.
66 | export function applyArrayValuesToDOMMatrix(array: ArrayLike, matrix: DOMMatrix) {
67 | const length = array.length
68 |
69 | if (length === 6) {
70 | toIdentity(matrix)
71 | matrix.m11 = array[0]!
72 | matrix.m12 = array[1]!
73 | matrix.m21 = array[2]!
74 | matrix.m22 = array[3]!
75 | matrix.m41 = array[4]!
76 | matrix.m42 = array[5]!
77 | } else if (length === 16) {
78 | matrix.m11 = array[0]!
79 | matrix.m12 = array[1]!
80 | matrix.m13 = array[2]!
81 | matrix.m14 = array[3]!
82 | matrix.m21 = array[4]!
83 | matrix.m22 = array[5]!
84 | matrix.m23 = array[6]!
85 | matrix.m24 = array[7]!
86 | matrix.m31 = array[8]!
87 | matrix.m32 = array[9]!
88 | matrix.m33 = array[10]!
89 | matrix.m34 = array[11]!
90 | matrix.m41 = array[12]!
91 | matrix.m42 = array[13]!
92 | matrix.m43 = array[14]!
93 | matrix.m44 = array[15]!
94 | }
95 | }
96 |
97 | export function toAxisRotation(mat: DOMMatrix, x: number, y: number, z: number, angle: number) {
98 | const {sin, cos} = Math
99 |
100 | const halfAngle = degreesToRadians(angle / 2)
101 | const sinHalfAngle = sin(halfAngle)
102 | const cosHalfAngle = cos(halfAngle)
103 | const sinHalfAngleSq = sinHalfAngle ** 2
104 | const sinHalfAngleCosHalfAngle = sinHalfAngle * cosHalfAngle
105 |
106 | // TODO: Maybe performance can be improved by first detecting when x, y, or z of
107 | // the axis are zero or 1, and using a pre-simplified version of the
108 | // folowing math based on that condition.
109 | // TODO: Maybe performance can be improved by using different equations (use trig
110 | // identities to find alternate formulas, I recall Famo.us using less operations).
111 |
112 | mat.m11 = 1 - 2 * (y ** 2 + z ** 2) * sinHalfAngleSq
113 | mat.m12 = 2 * (x * y * sinHalfAngleSq + z * sinHalfAngleCosHalfAngle)
114 | mat.m13 = 2 * (x * z * sinHalfAngleSq - y * sinHalfAngleCosHalfAngle)
115 | mat.m14 = 0
116 |
117 | mat.m21 = 2 * (x * y * sinHalfAngleSq - z * sinHalfAngleCosHalfAngle)
118 | mat.m22 = 1 - 2 * (x ** 2 + z ** 2) * sinHalfAngleSq
119 | mat.m23 = 2 * (y * z * sinHalfAngleSq + x * sinHalfAngleCosHalfAngle)
120 | mat.m24 = 0
121 |
122 | mat.m31 = 2 * (x * z * sinHalfAngleSq + y * sinHalfAngleCosHalfAngle)
123 | mat.m32 = 2 * (y * z * sinHalfAngleSq - x * sinHalfAngleCosHalfAngle)
124 | mat.m33 = 1 - 2 * (x ** 2 + y ** 2) * sinHalfAngleSq
125 | mat.m34 = 0
126 |
127 | mat.m41 = 0
128 | mat.m42 = 0
129 | mat.m43 = 0
130 | mat.m44 = 1
131 | }
132 |
133 | function degreesToRadians(degrees: number) {
134 | return (Math.PI / 180) * degrees
135 | }
136 |
137 | // In a pair of coordinates (as in "m23") the first number
138 | // is the column and the second is the row (so "m23" means column 2 row 3).
139 | // prettier-ignore
140 | export const identityValues = Object.freeze([
141 | 1, 0, 0, 0,
142 | 0, 1, 0, 0,
143 | 0, 0, 1, 0,
144 | 0, 0, 0, 1,
145 | ])
146 |
147 | /* Set the given matrix to identity. */
148 | export function toIdentity(mat: DOMMatrix) {
149 | mat.m11 = 1
150 | mat.m12 = 0
151 | mat.m13 = 0
152 | mat.m14 = 0
153 |
154 | mat.m21 = 0
155 | mat.m22 = 1
156 | mat.m23 = 0
157 | mat.m24 = 0
158 |
159 | mat.m31 = 0
160 | mat.m32 = 0
161 | mat.m33 = 1
162 | mat.m34 = 0
163 |
164 | mat.m41 = 0
165 | mat.m42 = 0
166 | mat.m43 = 0
167 | mat.m44 = 1
168 | }
169 |
170 | // prettier-ignore
171 | type TypedArray =
172 | | Int8Array
173 | | Int16Array
174 | | Int32Array
175 | | Uint8Array
176 | | Uint16Array
177 | | Uint32Array
178 | | Float32Array // O
179 | | Float64Array // /|\/
180 | | BigInt64Array // / |\
181 | | BigUint64Array // _/__|_
182 | | Uint8ClampedArray // o o
183 |
184 | export function toArray(mat: DOMMatrixReadOnly, target: TypedArray | Array = []) {
185 | if (mat.is2D) {
186 | target[0] = mat.m11
187 | target[1] = mat.m12
188 | target[2] = mat.m21
189 | target[3] = mat.m22
190 | target[4] = mat.m41
191 | target[5] = mat.m42
192 | } else {
193 | target[0] = mat.m11
194 | target[1] = mat.m12
195 | target[2] = mat.m13
196 | target[3] = mat.m14
197 | target[4] = mat.m21
198 | target[5] = mat.m22
199 | target[6] = mat.m23
200 | target[7] = mat.m24
201 | target[8] = mat.m31
202 | target[9] = mat.m32
203 | target[10] = mat.m33
204 | target[11] = mat.m34
205 | target[12] = mat.m41
206 | target[13] = mat.m42
207 | target[14] = mat.m43
208 | target[15] = mat.m44
209 | }
210 |
211 | return target
212 | }
213 |
214 | /** Normalize a DOMPoint into a unit vector. */
215 | export function normalizePoint(point: DOMPoint) {
216 | const {x, y, z, w} = point
217 | const length = Math.hypot(x, y, z, w)
218 | point.x = x / length
219 | point.y = y / length
220 | point.z = z / length
221 | point.w = w / length
222 | }
223 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/@lume/cli/config/ts.config.json",
3 | "compilerOptions": {
4 | "types": ["mocha"] // TODO move to lume cli
5 | }
6 | }
7 |
--------------------------------------------------------------------------------