HTML canvas isPointInPath() method
Definition and usage
isPointInPath()
The method returns true
if the specified point is in the current path; otherwise return false
.
Example
Draw a rectangle, if the point 20,50 is in the current path:
JavaScript:
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.rect(20,20,150,100); if (ctx.isPointInPath(20,50)) { ctx.stroke(); };
Syntaksi
context.isPointInPath(x,y);
Parametrin arvo
Parametri | Kuvaus |
---|---|
x | Testatun x-akselin koordinaatti |
y | Testatun y-akselin koordinaatti |
Selaimen tuki
Taulukossa olevat numerot osoittavat ensimmäisen täysin tukevan selaimen version.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.6 | 4.0 | 10.1 |
Huomautus:Internet Explorer 8 ja aikaisemmat versiot eivät tue <canvas> elementtiä.