If I have an HTML Canvas context and do:
ctx.beginPath();
ctx.moveTo(10,10);
ctx.lineTo(20,30);
ctx.closePath();
ctx.stroke();
...a line is drawn between 10,10 and 20,30. Suppose I have this:
ctx.beginPath();
ctx.moveTo(10,10);
myFunction(ctx);
Is there any way for myFunction()
to find out that the path 'cursor' is currently at 10,10
?
As far as I know there's no direct way to access arguments passed to various ctx methods (ie. moveTo in this case). You can wrap the Context API into a class of its own to do this, however. See [1] and [2] for reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With