[fxtf-drafts] [geometry-1] setting a matrix to identity with setters keeps is2D `true`. Creating a matrix with a 16-number identity sequence sets `is2D` to `false`. (#588)

trusktr has just created a new issue for https://github.com/w3c/fxtf-drafts:

== [geometry-1] setting a matrix to identity with setters keeps is2D `true`. Creating a matrix with a 16-number identity sequence sets `is2D` to `false`. ==
There's a discrepancy:

This,

```js
const mat = new DOMMatrix()
toIdentity(mat)
console.log(mat.is2D) // "true"

function toIdentity(mat) {
 mat.m11 = 1
 mat.m12 = 0
 mat.m13 = 0
 mat.m14 = 0

 mat.m21 = 0
 mat.m22 = 1
 mat.m23 = 0
 mat.m24 = 0

 mat.m31 = 0
 mat.m32 = 0
 mat.m33 = 1
 mat.m34 = 0

 mat.m41 = 0
 mat.m42 = 0
 mat.m43 = 0
 mat.m44 = 1
}
```

is essentially the same as the following,

```js
const mat = new DOMMatrix([
  1, 0, 0, 0,
  0, 1 ,0, 0,
  0, 0, 1, 0,
  0, 0, 0, 1
])
console.log(mat.is2D) // "false"
```

except `is2D` is `false` instead of `true` in the second one.

I believe that if a matrix is set back to identity in any way, `is2D` should return `true`.

Related:

- https://github.com/w3c/fxtf-drafts/issues/584

Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/588 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 28 December 2024 04:33:54 UTC