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] point.matrixTransformSelf #325

Open
jakearchibald opened this issue Nov 26, 2018 · 4 comments
Open

[geometry] point.matrixTransformSelf #325

jakearchibald opened this issue Nov 26, 2018 · 4 comments

Comments

@jakearchibald
Copy link
Contributor

https://drafts.fxtf.org/geometry/#DOMPoint

Matrix objects have *self methods that transforms the current matrix rather than creating a new object. If this is a pattern to avoid garbage in hot code, then point.matrixTransformSelf seems missing.

point.matrixTransformSelf would behave like point.matrixTransform, except the context object would be modified, rather than creating a new DOMPoint.

@dirkschulze
Copy link
Contributor

@jakearchibald Since DOMPoint doesn't have any *self methods like DOMMatrix. I don't think we even thought about adding *self to DOMPoint to be honest. Do you think that this can move to level 2 of the spec?

@jakearchibald
Copy link
Contributor Author

I'll leave it to you to decide. Btw I'm writing as a web developer, not an implementor, I can't really speak for implementation interest on this.

In my use case I'm looping through some ImageData data, and creating some new ImageData as the result of a transform, so I'm calling point.matrixTransform for each pixel.

@dirkschulze
Copy link
Contributor

Oh I see. Yeah, the *self functions were introduced to chain the transformations:

matrix.translateSelf(...).scaleSelf(...).rotateSelf(...);

So we probably didn't thought about other use cases at the time. Also, creating new instances of matrix with 16 slots (and another for is2D) is heavier than transformations on DOMPoint. I still see value on *Self in general though.

@chrishtr
Copy link
Contributor

I agree, this should be added.

@chrishtr chrishtr added this to Backlog in High-priority issues via automation Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants