This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18751 - <canvas>: a way to get the coordinate of the last point in a path
Summary: <canvas>: a way to get the coordinate of the last point in a path
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 enhancement
Target Milestone: Needs Impl Interest
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-31 15:06 UTC by contributor
Modified: 2016-04-21 19:36 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2012-08-31 15:06:25 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
Multipage: http://www.whatwg.org/C#path-objects
Complete: http://www.whatwg.org/c#path-objects

Comment:
There are many references to "the last point in the path".  Please provide a
function (or clear documentation) to GET this last point's coordinates.  This
would also help in the canvas lineTo() and moveTo() when you need to figure
out where the current point is.

Posted from: 96.226.222.9
User agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20100101 Firefox/14.0.1
Comment 1 Ian 'Hixie' Hickson 2012-09-28 03:31:43 UTC
What's the use case? Don't you always know what the last point is, by virtue of having just added it?
Comment 2 Luis Reis 2012-11-19 21:28:10 UTC
(not the original bug author)

Answering both questions: A possible use case would be figuring out the end point of an arcTo path segment, where, by the specification, you may not know where that point is.
Comment 3 Ian 'Hixie' Hickson 2013-01-31 23:46:18 UTC
Interesting. When would you need to know that point?
Comment 4 Ian 'Hixie' Hickson 2013-03-22 18:12:50 UTC
Are there any browser vendors who would like to implement this?
Comment 5 Luis Reis 2013-11-21 11:14:25 UTC
Sorry for taking so long to get back.

Answering question on #3: Example: Imagine that you're drawing a balloon text:

  /-------\
  | Hi!   |
  \--v----/

Where / and \ have been drawn with arcTo. If you want to draw the pointy thingy below, it will be nice to know where did the last arcTo ended.

Knowing the last point would also be welcome when calculating more complex paths.
Comment 6 Ian 'Hixie' Hickson 2013-11-21 19:36:37 UTC
What would you actually do with the knowledge?

Wouldn't you basically always just draw a straight line to where you want the tail to start, then draw the tail, then resume? Also, in the case of an axis-aligned rectangular speech bubble, you know where the end point of the arc will be: exactly /radius/ units away from the corner point, in the direction of the second point from the corner point.

Could you maybe post an example of how you would use this, where you've stubbed out the "getLastPoint()" function to return the predetermined right values?
Comment 7 Justin Novosad 2016-04-21 19:36:31 UTC
Closing issue due to lack of implementer interest.
To re-open, please enter a new issue at https://github.com/whatwg/html/issues