- From: /#!/JoePea <trusktr@gmail.com>
- Date: Mon, 11 Jan 2016 14:02:11 -0800
- To: Simon Pieters <simonp@opera.com>
- Cc: public-fx@w3.org
I noticed that in the Editor's draft. Should I follow that instead? I wasn't sure. I'm new to w3c specs in general. How do we know when a spec is finalized? So, if we want to copy values from one DOMMatrix to another, we are expected to convert the values to a DOMString only so they can be converted back to numbers, which is extra overhead that we should avoid. Since we wish to have setMatrixValue for compatibility with the other classes, but wish to avoid overloading (which I think is a good idea and can lead to code that is more readable (compare to my ugly overloaded constructor with all the conditional checks in it)), why not create some setter methods matching the static creator methods. For example, we have these static methods: ``` [NewObject] static DOMMatrix fromMatrix(optional DOMMatrixInit other); [NewObject] static DOMMatrix fromString(DOMString transformList); [NewObject] static DOMMatrix fromFloat32Array(Float32Array array32); [NewObject] static DOMMatrix fromFloat64Array(Float64Array array64); ``` Likewise we could have these instance methods: ``` DOMMatrix setFromMatrix(optional DOMMatrixInit other); DOMMatrix setFromString(DOMString transformList); DOMMatrix setFromFloat32Array(Float32Array array32); DOMMatrix setFromFloat64Array(Float64Array array64); ``` and we can make ``` DOMMatrix setMatrixValue(DOMString transformList); ``` simply an alias for ``` DOMMatrix setFromString(DOMString transformList); ``` What do you think of this idea? /#!/JoePea On Mon, Jan 11, 2016 at 4:44 AM, Simon Pieters <simonp@opera.com> wrote: > On Sun, 10 Jan 2016 12:52:18 +0100, /#!/JoePea <trusktr@gmail.com> wrote: > >> DOMMatrix.setMatrixValue >> >> <http://www.w3.org/TR/geometry-1/#dom-dommatrix-setmatrixvalue-transformlist> >> accepts a DOMString transformList. Why not accept the same things the >> constructor accepts (which can be more performant that passing a DOMString >> for parsing)? > > > From https://lists.w3.org/Archives/Public/public-fx/2014AprJun/0118.html it > looks like it was added to match MSCSSMatrix and WebKitCSSMatrix. > > I will note that the constructor for DOMMatrix per the editor's draft is > just > > [Constructor(sequence<unrestricted double> numberSequence)] > > and then there are a few static methods for other inputs. In particular, we > wanted to avoid overloading, and presumably we should avoid that here also. > > -- > Simon Pieters > Opera Software
Received on Monday, 11 January 2016 22:03:19 UTC