Web 浏览器中的笔/手写笔支持

发布于 2024-10-02 07:42:05 字数 129 浏览 0 评论 0原文

是否有任何 Web 浏览器可以使笔/手写笔特定事件(例如压力)可用于 DOM,类似于 Microsoft 的 RealTimeStylus API?

有没有标准的 DOM 接口?如果没有,是否有专有扩展允许这样做,也许使用插件?

Are there any web browsers that make pen/stylus specific events (such as pressure) available to the DOM, similar to Microsoft's RealTimeStylus API?

Is there any standard DOM interface for this? If not, are there proprietary extensions that allow this, perhaps using a plugin?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

梦纸 2024-10-09 07:42:05

根据当前的 API,您无法检索压力。不过,有一个Wacom 的浏览器插件

DeviantArt Muro 似乎使用它。

According to the current APIs, you can't retrieve pressure. However, there is a browser plugin from Wacom.

DeviantArt Muro seems to use it.

陪我终i 2024-10-09 07:42:05

指针事件 API 是一组指针设备事件可以触发。事件对象与鼠标事件类似,但它们确实添加了压力等属性。所有现代浏览器的当前版本支持这些事件。

The Pointer Events API is a set of events that pointer devices can trigger. The event objects are similar to what you get for mouse events, but they do add properties for attributes like pressure. These events are supported by current releases of all modern browsers.

许仙没带伞 2024-10-09 07:42:05

如果浏览器实现了对“pointerevent.Pressure”的支持,那么它应该能够支持压力敏感输入。对于倾斜和扭曲,等效特征为“ponterevent.tiltx”、“pointerevent.tilty”和“pointerevent.twist”。

查看更多信息。

If the browser implements support for "pointerevent.pressure", then it should be able to support pressure-sensitive input. For tilts and twists, the equivalent features would be "ponterevent.tiltx", "pointerevent.tilty" and "pointerevent.twist".

See for more information.

猫七 2024-10-09 07:42:05

目前还没有浏览器公开此类 API。

但是,根据笔/数字化仪驱动程序,笔事件在浏览器中可能看起来像触摸事件,许多浏览器都已实现了触摸事件。您可以在 Chrome 和 Firefox(通过 Firebug)中使用其控制台中提供的 monitorEvents 函数进行测试。简单调用:

monitorEvents(document);

在控制台中,然后查看浏览器是否捕获到想要的事件。我用自己的 Lenovo X200 平板电脑尝试了此操作,但我的笔寄存器中没有任何非标准事件(它们都显示为鼠标事件)。

我不知道有任何第三方扩展允许这样做,而且谷歌搜索也没有找到任何有用的东西。

No browser currently exposes such APIs.

However, depending on the pen/digitizer drivers, the pen events might look to the browser like touch events, which many browsers have implemented. You can test this in Chrome and Firefox (via Firebug) with the monitorEvents function available in their consoles. Simple call:

monitorEvents(document);

In the console, then see if the browser captures the desired event. I tried this with my own Lenovo X200 tablet, but none of the non-standard events from my pen register (they all appear as mouse events).

I don't know of any third-party extensions that allow this, and a Google search doesn't turn up anything useful.

倾`听者〃 2024-10-09 07:42:05

这是一个可能的使用polyfill的工作解决方案:hand.js

看看这个精彩的MSDN 文章在hand.js上。

我建议使用库来平滑路径。在我的惠普平板电脑上玩触摸游戏时,我很幸运地在 paper.js 中实现了一些东西,我无法想象让这些点适应压力敏感度会太难。

html5 windows 8 应用程序支持它。遗憾的是,据我所知,这个 API 尚未暴露给实际的浏览器。

看起来管道中有一个W3C 建议似乎是基于它的。他们似乎正在根据存储在其存储库中的草稿来制定建议。

有关使用的信息,请参阅快速入门:捕获墨迹数据 (HTML)它在 Windows 8 应用程序中。

Here is a possible working solution with a polyfill: hand.js.

See this great MSDN article on the hand.js.

I recommend using a library to smooth out paths. I've had good luck implementing something in paper.js when playing with touch on my hp tablet, I can't imagine it would be too hard to make the points adapt to pressure sensitivity.

There is support for it within html5 windows 8 apps. Sadly this API hasn't been exposed to actual browsers AFAIK.

It looks like there is a W3C recommendation in the pipeline that appears to be based on it. It seems like they are working on the recommendation based on the drafts stored in their repo.

See Quickstart: Capturing ink data (HTML) about using it in windows 8 apps.

下雨或天晴 2024-10-09 07:42:05

这可能不是一个非常实用的建议,或者有点过分了,但是如果有 API / SDK 将笔 / 手写笔暴露给桌面,您可以创建一个 Web 服务类型的应用程序,该应用程序将使用输入实时更新页面从设备。然而,我没有任何代码可以帮助您解决此问题,我也不知道是否可以在没有不可能的延迟的情况下做到这一点。

This may not be a very practical suggestion or something a bit overkill, but if there are APIs / SDKs that expose the pen / stylus to the desktop, you could create a webservice type of application that would update a page in real time with the input from the device. I don't however have any code to help you with this, nor do I know if it would be possible to do this without impossible lag.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文