cleanup transform

This commit is contained in:
Orion Reed 2024-12-19 02:36:35 -05:00
parent 44db3a77a2
commit 207c81e9df
1 changed files with 9 additions and 11 deletions

View File

@ -33,8 +33,6 @@ export class DOMTransform {
this.#updateMatrices(); this.#updateMatrices();
} }
// Getters and setters for properties
get x(): number { get x(): number {
return this.#x; return this.#x;
} }
@ -59,15 +57,6 @@ export class DOMTransform {
this.#updateMatrices(); this.#updateMatrices();
} }
/**
* Updates the transformation matrices based on the current position and rotation.
*/
#updateMatrices() {
this.#transformMatrix.identity().translate(this.#x, this.#y).rotate(this.#rotation);
this.#inverseMatrix = this.#transformMatrix.clone().invert();
}
// Matrix accessors // Matrix accessors
get matrix(): Matrix { get matrix(): Matrix {
return this.#transformMatrix; return this.#transformMatrix;
@ -107,4 +96,13 @@ export class DOMTransform {
rotation: this.rotation, rotation: this.rotation,
}; };
} }
/**
* Updates the transformation matrices based on the current position and rotation.
*/
#updateMatrices() {
this.#transformMatrix.identity().translate(this.#x, this.#y).rotate(this.#rotation);
this.#inverseMatrix = this.#transformMatrix.clone().invert();
}
} }