[whatwg] proposed canvas 2d API additions

JustFillBug mozbugbox at yahoo.com.au
Sat Feb 28 12:38:26 PST 2009


On 2006-04-26, Ian Hickson <ian at hixie.ch> wrote:
> On Mon, 24 Apr 2006, Vladimir Vukicevic wrote:
>> >
>> > Assuming nobody has any problem with:
>> >
>> >    boolean isPointInPath(in float x, in float y);
>> >
>> > ...then I'll add that to the spec when you reply to this mail.
>> 
>> Sure, isPointInPath sounds fine.
>
> Added.
>
>> We can always add isPointInStrokedPath if we ever want to bother with 
>> that (which is where the "...Fill" bit came from in my API, because the 
>> region covered by a stroked path and that covered by a filled path are 
>> different, even though testing for a hit against a filled region would 
>> by far be the common case).
>
> We can also call the other one isPointOnPath(), if we want to keep the 
> method names reasonably short. I'm not sure we'll ever need to add it, 
> though. Getting people to click on a line is generally silly.
>

We do have a need of isPointOnPath() for editing Bezier lines
interactively (on a font editing interface). When people want to add a
new point on an already existing curve, we have to know if the click is
on path. besides, we need double click on the curve to pickup the whole
path and then drag on the line to move the whole path.

So I dig up a 2006 post...

Of course it's hard to get people click on a line precisely. But we can
check isPointOnPath for an 5x5 square instead to make the operation easier.

Doing point on curve in javascript is painful. And since checking
isPointInPath() already need to detect the on edge case, this shouldn't
be too much a burdern on the browser developers.

So please conside add the isPointOnPath() call to the function.





More information about the whatwg mailing list