Latest web development tutorials

méthode toile HTML isPointInPath ()

Canvas Object Reference objet Canvas

Exemples

Si le point 20,50 dans le chemin actuel, dessiner un rectangle:

YourbrowserdoesnotsupporttheHTML5canvastag.

JavaScript:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.rect(20,20,150,100);
if (ctx.isPointInPath(20,50))
{
ctx.stroke();
};

Essayez »

support du navigateur

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 9, la méthode Firefox, Opera, Chrome et Safari soutien isPointInPath ().

Note: 8 et versions antérieures d'Internet Explorer ne prennent pas en charge l'élément <canvas>.


Définition et utilisation

Si le point spécifié dans le chemin de courant, la méthode isPointInPath () renvoie true, sinon il retourne faux.

Syntaxe JavaScript: .isPointInPath contexte(x, y);

Paramètre Valeur

参数 描述
x 要测试的 x 坐标。
y 要测试的 y 坐标。


Canvas Object Reference objet Canvas