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

On Mon, Mar 24, 2014 at 8:34 AM, Simon Sarris <simon.sarris@gmail.com>wrote:

>
> On Mon, Mar 24, 2014 at 11:26 AM, Hwang, Dongseong <
> dongseong.hwang@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.
>

+1
There's already a "transform" function that takes an array that works the
same way.

Received on Monday, 24 March 2014 16:17:25 UTC