Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[geometry-1] propose adding DOMPoint as an argument for DOMMatrix that accepts vectors. #585

Open
trusktr opened this issue Dec 28, 2024 · 0 comments

Comments

@trusktr
Copy link

trusktr commented Dec 28, 2024

For example we can currently do this:

const mat = new DOMMatrix()

mat.translateSelf(10, 20, 30)

and this:

const mat = new DOMMatrix()
const movement = new DOMPoint(10, 20, 30) // This can be used like a "Vector3" or "vec3" in other libraries

mat.translateSelf(movement.x, movement.y, movement.z)

To simplify things, especially once we add more methods that can help people do more things with matrices and points (i.e. vectors), it would be nice to be able to simply pass points around where they can be used:

const mat = new DOMMatrix()
const movement = new DOMPoint(10, 20, 30) // This can be used like a "Vector3" or "vec3" in other libraries

mat.translateSelf(movement) // new option: pass a DOMPoint directly.

If the first parameter to translateSelf can accept a DOMPointInit, then it can accept a POJO as well as an actual DOMPoint instance to match with patterns of other methods (for example those that accept DOMMatrixInit), and we would similarly upddate for other methods that accept individual vector values to also accept DOMPointInit values.

@trusktr trusktr changed the title [geometry-1] propose adding DOMPoint as an argument for DOMMatrix that accepts vectors. [geometry-1] propose adding DOMPoint as an argument for DOMMatrix that accepts vectors. Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant