Re: [whatwg] Canvas: dash list API

On Sat, Dec 22, 2012 at 10:04 AM, Ian Hickson <ian@hixie.ch> wrote:

> On Sat, 22 Dec 2012, Anne van Kesteren wrote:
> >
> > Is there not some way we can have a lineDash attribute that returns a
> > manipulatable object that inherits from Array rather than the current
> > Java-like API? I remember this was discussed when getLineDash() and
> > setLineDash() were added, but I think it's worth taking another look at
> > this.
> >
> > (For URLs I want something similar for path segments and I'd rather not
> > introduce get/set methods.)
>
> What would you want to have happen in the case of a library method that
> saves the context, sets the dash to an internal value, draws a line, saves
> the dash state to an internal value, restores the context, then returns?
> Should the caller, if they then grab the dashed line object from the
> context, get the internal value of the library? Should the restore() call
> mutate the saved dash object?
>
>
You are correct. Since linedash is part of the graphics state, its value
can't be a reference to an object.
Having to restore the array at 'restore()' time would be very hard to do
and very confusing for the user.

I agree that get/setLineDash should just handle plain arrays, but an array
property called 'lineDash' is most likely not going to work.

Received on Sunday, 23 December 2012 04:05:17 UTC