CanvasRenderingContext2D.removeHitRegion() - Web APIs 编辑
Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
The CanvasRenderingContext2D
method removeHitRegion()
removes a given hit region from the canvas.
Syntax
void ctx.removeHitRegion(id);
Parameters
id
- A
DOMString
representing theid
of the region that is to be removed.
Examples
Using the removeHitRegion method
This example demonstrates the removeHitRegion()
method.
HTML
<canvas id="canvas"></canvas>
JavaScript
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
// Set a hit region
ctx.addHitRegion({id: 'eyes'});
// Remove it from the canvas
ctx.removeHitRegion('eyes');
Specifications
Canvas hit regions have been removed from the WHATWG Living Standard, although discussions about future standardization are ongoing. See https://github.com/whatwg/html/issues/3407 for more information.
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论