From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../clearhitregions/index.html | 121 +++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 files/zh-cn/web/api/canvasrenderingcontext2d/clearhitregions/index.html (limited to 'files/zh-cn/web/api/canvasrenderingcontext2d/clearhitregions') diff --git a/files/zh-cn/web/api/canvasrenderingcontext2d/clearhitregions/index.html b/files/zh-cn/web/api/canvasrenderingcontext2d/clearhitregions/index.html new file mode 100644 index 0000000000..a119329e0f --- /dev/null +++ b/files/zh-cn/web/api/canvasrenderingcontext2d/clearhitregions/index.html @@ -0,0 +1,121 @@ +--- +title: CanvasRenderingContext2D.clearHitRegions() +slug: Web/API/CanvasRenderingContext2D/clearHitRegions +translation_of: Web/API/CanvasRenderingContext2D/clearHitRegions +--- +
{{APIRef}} {{obsolete_header}}
+ +

CanvasRenderingContext2D.clearHitRegions() 是 Canvas 2D API 在画布中删除所有点击区域的方法。

+ +

语法

+ +
void ctx.clearHitRegions();
+
+ +

示例

+ +

使用 clearHitRegions 方法

+ +

这仅是一段简单的使用 clearHitRegions 方法的代码片段。

+ +

HTML

+ +
<canvas id="canvas"></canvas>
+
+ +

JavaScript

+ +
var canvas = document.getElementById("canvas");
+var ctx = canvas.getContext("2d");
+
+// set some hit regions
+ctx.addHitRegion({id: "eyes"});
+ctx.addHitRegion({id: "nose"});
+ctx.addHitRegion({id: "mouth"});
+
+// remove them altogether from the canvas
+ctx.clearHitRegions();
+
+ +

规范描述

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', "scripting.html#dom-context-2d-clearhitregions", "CanvasRenderingContext2D.clearHitRegions")}}{{Spec2('HTML WHATWG')}}
+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatVersionUnknown}}[1]{{CompatGeckoDesktop(38)}} [2]{{ CompatNo }}{{ CompatNo }}{{ CompatNo }}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatNo }}{{ CompatNo }}{{CompatGeckoMobile(38)}} [2]{{ CompatNo }}{{ CompatNo }}{{ CompatNo }}
+
+ +

兼容性注解

+ + + +

参见

+ + -- cgit v1.2.3-54-g00ecf