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] Why does multiplySelf (etc) accept DOMMatrixInit instead of DOMMatrix? #582

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

Comments

@trusktr
Copy link

trusktr commented Dec 27, 2024

I don't see why multiplySelf should accept a DOMMatrix-like object, rather than an actual DOMMatrix object.

If multiplySelf accepted DOMMatrix instances only (like an API of this sort would typically do, where "other" in a multiply(other) type of method is typically the same type of object as the object on which the method is called), then there would be no need to do runtime type checking of plain JS objects, which would improve performance.

By making it accept DOMMatrix instances, it would be possible to avoid the fixup steps, because the operations on DOMMatrix always produce valid properties (f.e. a is always the same value as m11).

instead of this:

const a = {m11: 1, ..., m44: 1}

// later
const b = new DOMMatrix().multiplySelf(a)

we could have

const a = new DOMMatrix([1, ..., 1])

// later
const b = new DOMMatrix().multiplySelf(a)

Is there a specific reason why we want to pass in non-DOMMatrix objects?

@trusktr trusktr changed the title [geometry-1] Why does multiplySelf just accept another DOMMatrix? [geometry-1] Why does multiplySelf (etc) accept DOMMatrixInit instead of DOMMatrix? Dec 30, 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