新的HTML5 canvas方法:addHitRegion [英] New HTML5 canvas method: addHitRegion

查看:651
本文介绍了新的HTML5 canvas方法:addHitRegion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读一些关于 canvas addHitRegion()方法。从我读过的东西听起来很像是一种向您的画布添加可点击的热点的方法 - 这是正确的吗?

I've been reading a bit about the forthcoming addHitRegion() method for canvas. From what I've read it sounds much like a way to add clickable hotspots to your canvas - is this correct?

推荐答案

从未听说过,但它似乎可点击的热点是可能的用途之一。

I never heard of that before, but it seems clickable hotspots are one of the possible uses.

从当前规格

匹配区域可用于多种用途:

Hit regions can be used for a variety of purposes:


  • 使用ID,

  • 通过使用控件,用户代理可以自动将路由事件传递到DOM元素,从而允许例如点击画布即可通过按钮元素自动提交表单。

  • 使用标签,用户可以更轻松地浏览画布,而无需看到它。

  • 使用光标,它们可以使画布的不同区域更容易具有不同的光标,用户代理可以自动在它们之间切换。

  • With an ID, they can make hit detection easier by having the user agent check which region the mouse is over and include the ID in the mouse events.
  • With a control, they can make routing events to DOM elements automatic, allowing e.g. clicks on a canvas to automatically submit a form via a button element.
  • With a label, they can make it easier for users to explore a canvas without seeing it, e.g. by touch on a mobile device.
  • With a cursor, they can make it easier for different regions of the canvas to have different cursors, with the user agent automatically switching between them.

这篇关于新的HTML5 canvas方法:addHitRegion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆