- From: Rik Cabanier <cabanier@gmail.com>
- Date: Thu, 20 Mar 2014 11:11:10 -0700
- To: Justin Novosad <junov@google.com>
- Cc: WHAT Working Group <whatwg@whatwg.org>
On Thu, Mar 20, 2014 at 10:52 AM, Justin Novosad <junov@google.com> wrote: > Hello all, > > The recently added currentTransform attribute on CanvasRenderingContext2D > gives shared access to the rendering context's transform. By "shared", I > mean: > > a) this code modifies the CTM: > var matrix = context.currentTransform; > matrix.a = 2; > > b) In this code, the second line modifies matrix: > var matrix = context.currentTransform; > context.scale(2, 2); > > This behavior is probably not what most developers would expect. > I would like to propose changing this to a getter method instead. We > already have a setter method (setTransform). > > In another thread entitled "Canvas Path.addPath SVGMatrix not optimal", > Dirk Schulze proposed using the name getCTM, which would be consistent with > the SVGLocatable interface, where getCTM returns an SVGMatrix. On the other > hand, we could call it getTransform to be consistent with the existing > setTransform on CRC2D. Opinions? getCTM is nice and short and matches SVG. getCurrentTransform is more clear so I'm fine with either one. Since setTransform takes 6 arguments, it would be a bit strange that getTransform would return an SVGMatrix. > Perhaps we should also have an overload of > setTransform (or setCTM) that would take an SVGMatrix > yes, it would be nice to have a transform/setTransform with that signature > First of all, have any browsers shipped currentTransform yet? > No. > Thoughts? > > -Justin Novosad >
Received on Thursday, 20 March 2014 18:16:46 UTC