Metoda HTML canvas isPointInPath().

❮ HTML Canvas Reference

Příklad

Nakreslete obdélník, pokud je bod 20,50 v aktuální cestě:

Váš prohlížeč nepodporuje HTML5canvatag.

JavaScript:

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

Podpora prohlížeče

Čísla v tabulce určují první verzi prohlížeče, která tuto metodu plně podporuje.

Method
isPointInPath() Yes 9.0 Yes Yes Yes

Definice a použití

Metoda isPointInPath() vrátí hodnotu true, pokud je zadaný bod v aktuální cestě, jinak vrací hodnotu false.

Syntaxe JavaScriptu: kontext .isPointInPath( x,y );

Hodnoty parametrů

Parameter Description
x The x-coordinate to test
y The y-coordinate to test

❮ HTML Canvas Reference