- From: Joe Pea via GitHub <sysbot+gh@w3.org>
- Date: Fri, 27 Dec 2024 08:50:03 +0000
- To: public-fxtf-archive@w3.org
trusktr has just created a new issue for https://github.com/w3c/fxtf-drafts:
== [geometry-1] What's the point of `DOMMatrixInit` if the `constructor` cannot accept such a value? ==
You'd think this should be possible:
```js
const init = {m11: 1, ..., m44: 1}
const matrix = new DOMMatrix(init)
```
Instead, one has to do this:
```js
const init = {m11: 1, ..., m44: 1}
const matrix = new DOMMatrix([init.m11, ..., init.m44])
```
which is more cumbersome and also more wasteful (an extra array is created just to create a new DOMMatrix), or this:
```js
const init = {m11: 1, ..., m44: 1}
const matrix = Object.assign(new DOMMatrix(), init)
```
which is also not as simple as it could be.
These problems could be alleviated if `toFloat32Array` or `toFloat64Array` methods would accept a target array to write to, making it easy to clone matrices without allocating new arrays:
```js
const array = new Float32Array(16)
matrix.toFloat32Array(array) // provide an array to write to (instead of it creating a new one)
const newMatrix = new DOMMatrix(array)
```
Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/581 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 27 December 2024 08:50:03 UTC