English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
isPointInPath() ist ein Canvas 2D API zur Bestimmung, ob ein Punkt im aktuellen Pfad enthalten ist.
Wenn der Punkt 20,50 liegt auf dem aktuellen Pfad, zeichne einen Rechteck:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Verwendung der Methode isPointInPath() im HTML canvas-Grund教程(oldtoolbag.com)</<title> </<head> <body> <canvas id="myCanvas" width="3" Höhe="15" style="border:1px fest gestrichen #d3d3d3"> Ihr Browser unterstützt keine HTML5 canvas-Tag. </canvas> <script> var c = document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.rect(20,20,150,100); if (ctx.isPointInPath(20,50)) { ctx.stroke(); }; </script> </body> </html>Test See ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 9Firefox, Opera, Chrome and Safari support isPointInPath() Method.
Note:Internet Explorer 8 And earlier versions do not support the <canvas> element.
If the specified point is within the current path, the isPointInPath() method returns true; otherwise, it returns false
JavaScript Syntax: | context.isPointInPath(x,y); |
---|
Parameter | Description |
---|---|
x | The x-coordinate to be tested. |
y | The y-coordinate to be tested. |