YouTip LogoYouTip

Met Canvas Ispointinpath

# HTML canvas isPointInPath() Method [![Image 8: Canvas Object Reference](#) Canvas Object](#) ## Example If the point 20,50 is within the current path, draw a 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(); }; [Try it Β»](#) * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The isPointInPath() method is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari. **Note:** Internet Explorer 8 and earlier versions do not support the element. * * * ## Definition and Usage The isPointInPath() method returns true if the specified point is within the current path, otherwise it returns false. | JavaScript Syntax: | _context_.isPointInPath(_x,y_); | | --- | ## Parameter Values | Parameter | Description | | --- | --- | | _x_ | The x-coordinate to test. | | _y_ | The y-coordinate to test. | * * Canvas Object](#)
← Met Canvas ScaleMet Canvas Arcto β†’