HTML-canvas isPointInPath()- methode
Voorbeeld
Teken een rechthoek als het punt 20,50 in het huidige pad ligt:
javascript:
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.rect(20, 20, 150, 100);
if (ctx.isPointInPath(20, 50)) {
ctx.stroke();
};
Browserondersteuning
De getallen in de tabel geven de eerste browserversie aan die de methode volledig ondersteunt.
Method | |||||
---|---|---|---|---|---|
isPointInPath() | Yes | 9.0 | Yes | Yes | Yes |
Definitie en gebruik
De methode isPointInPath() retourneert true als het opgegeven punt zich in het huidige pad bevindt, anders false.
JavaScript-syntaxis: | context .isPointInPath( x,y ); |
---|
Parameterwaarden
Parameter | Description |
---|---|
x | The x-coordinate to test |
y | The y-coordinate to test |
❮ HTML Canvas-referentie