English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

HTML-Tag-Übersicht

HTML canvas isPointInPath() Methode

isPointInPath() ist ein Canvas 2D API zur Bestimmung, ob ein Punkt im aktuellen Pfad enthalten ist.

HTML canvas Reference Manual

Online-Beispiel

Wenn der Punkt 20,50 liegt auf dem aktuellen Pfad, zeichne einen Rechteck:

Ihr Browser unterstützt HTML nicht5 canvas-Tag.
<!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 ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Internet Explorer 9Firefox, Opera, Chrome and Safari support isPointInPath() Method.

Note:Internet Explorer 8 And earlier versions do not support the <canvas> element.

Definition and Usage

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 Value

ParameterDescription
xThe x-coordinate to be tested.
yThe y-coordinate to be tested.
HTML canvas Reference Manual