[whatwg] Proposal: change 2D canvas currentTransform to getter method

Simon Sarris simon.sarris at gmail.com
Mon Mar 24 08:34:53 PDT 2014

On Mon, Mar 24, 2014 at 11:26 AM, Hwang, Dongseong <
dongseong.hwang at intel.com> wrote:

> Looking over this thread, we make a consensus not to
> expose currentTransform attribute.
> Now, all we have to decide is API
> Option 1,
> SVGMatrix getTransform();
> void setTransform(SVGMatrix);  <-- it overrides void
> setTransform(unrestricted double a, unrestricted double b, unrestricted
> double c, unrestricted double d, unrestricted double e, unrestricted double
> f);
> Option 2,
> SVGMatrix getCTM();
> void setCTM(SVGMatrix);
> Option 3,
> SVGMatrix getCurrentTransform();
> void setCurrentTransform(SVGMatrix);
> Which is the best?
> Greetings, DS
I'm heavily in favor of option 1.

I think using "Current" in the naming convention is silly. The transform
just as much a part of state as lineWidth/etc, but nobody would propose
naming lineWidth something like currentLineWidth! There's no way to get a
*non-current* transformation matrix (or lineWidth), so I think the
distinction is unnecessary.

CTM only seems like a good idea if we're worried that the name is too long,
but since "Current" is redundant/extraneous, I don't think an initialism is
worth the added layer of confusion.


More information about the whatwg mailing list