This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Several methods in the '2d' context are of the To variety, for example moveTo, lineTo, and arcTo which take as an implicit first argument the current point in the path being constructed. It's not possible to make similar methods from javascript if you need to do something to the end at the initial point, because it's not possible to find out what that point is. As an example, if you wanted to make an arrowTo(x,y,angle,which,length,type) (x,y) - destination of arrow angle - angle between shaft of line and barb of one side of arrow which - which end, could be 0,1,2,3 0 would operate like lineTo 1 put arrow head on destination end 2 put arrow head on source end 3 both ends get arrow length - length of the arrow head type - curved bezier or block straight line You couldn't do it. You don't know the originating current point in the path and there's no way to ask for it. Same would apply to arcArrowTo. It forces you to ask the user to supply both points. Here's http://stackoverflow.com/questions/4577410/find-current-point-on-path-for-html-canvas-context a link to someone else who wants the current point to be able to do a dashTo. I could create a wrapper around the context and have my uber context keep track of the information, but adding one getter to the context2d would solve the problem. context2d.currentPoint or perhaps currentPointX, and currentPointY Thanks:) Patrick
Another example of where it could be useful came up today. I wanted to do something like: CanvasRenderingContext2D.prototype.drawLineAtAngle = function(ctx,x0,y0,angle,length) { this.save(); this.lineTo(curpointX+length*Math.cos(angle),curPointY+length*Math.sin(angle)); this.stroke(); this.restore(); } But of course there's no way to get the current point, so the context2D is not extensible like this. If the getter method(s) would just supply this it would be great!
Mass move to "HTML WG"
Moving to the Canvas 2d Context spec component.
Maybe something like this: // System current path point interface context { readonly attribute double currentPointX; readonly attribute double currentPointY; } // Path2D current point interface Path2D { readonly attribute double currentPointX; readonly attribute double currentPointY; } currentX = context.currentPointX; currentY = context.currentPointY; Return the current starting point of a system subpath. currentPathX = Path2D.currentPointX; currentPathY = Path2D.currentPointY; Return the current starting point of a path object's subpath.