HTML-Leinwand isPointInPath() Methode
Beispiel
Zeichnen Sie ein Rechteck, wenn der Punkt 20,50 im aktuellen Pfad liegt:
JavaScript:
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.rect(20, 20, 150, 100);
if (ctx.isPointInPath(20, 50)) {
ctx.stroke();
};
Browser-Unterstützung
Die Zahlen in der Tabelle geben die erste Browserversion an, die das Verfahren vollständig unterstützt.
Method | |||||
---|---|---|---|---|---|
isPointInPath() | Yes | 9.0 | Yes | Yes | Yes |
Definition und Verwendung
Die Methode isPointInPath() gibt true zurück, wenn sich der angegebene Punkt im aktuellen Pfad befindet, andernfalls false.
JavaScript-Syntax: | Kontext .isPointInPath( x,y ); |
---|
Parameterwerte
Parameter | Description |
---|---|
x | The x-coordinate to test |
y | The y-coordinate to test |
❮ HTML-Canvas-Referenz