Latest web development tutorials

HTML 캔버스 isPointInPath () 메소드

HTML 캔버스 참조 설명서 HTML 캔버스 참조 설명서

현재 경로 지점 20, 50 경우, 사각형을 그립니다 :

YourbrowserdoesnotsupporttheHTML5canvastag.

자바 스크립트 :

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

»시도

브라우저 지원

Internet ExplorerFirefoxOperaGoogle ChromeSafari

인터넷 익스플로러 9, 파이어 폭스, 오페라, 크롬과 사파리 지원 isPointInPath () 메소드.

참고 : 인터넷 익스플로러 8 이전 버전의 <캔버스> 요소를 지원하지 않습니다.


정의 및 사용

현재 경로에 지정된 점은, isPointInPath () 메소드가 true를 돌려주는 경우, 그렇지 않으면 false를 반환합니다.

자바 스크립트 구문 : 컨텍스트.isPointInPath (X, Y);

매개 변수 값

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


HTML 캔버스 참조 설명서 HTML 캔버스 참조 설명서