Bug 20458 - Support stylus pressure info in mouse events
Summary: Support stylus pressure info in mouse events
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Oliver Hunt
URL: http://nerget.com/Scrije/scrije.html
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-20 06:19 PDT by Oliver Hunt
Modified: 2024-03-15 04:31 PDT (History)
9 users (show)

See Also:


Attachments
Initial implementation of pressure support (11.39 KB, patch)
2008-08-20 06:28 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Hunt 2008-08-20 06:19:28 PDT
Styluses commonly provide a variety of data, including pressure, tilt, and rotation.  Given almost all tablet/stylus sets now provide pressure information it seems useful to provide it to the dom.  This is especially helpful for drawing applications that use the canvas.
Comment 1 Oliver Hunt 2008-08-20 06:28:25 PDT
Created attachment 22893 [details]
Initial implementation of pressure support

This patch provides pressure information in the mouse event.  

The MouseEvent.pressure property is an double value from 0 to 1, where 0 indicates no pressure, and 1 indicates max pressure.  We use a float rather than an integer value as different styluses have different pressure precision, so a float range from 0 to 1 effectively normalises this.

A mouse is considered to have binary pressure levels, with pressure of 1 indicating a mouse is down, and pressure 0 indicating no button.

I haven't looked into providing tilt info, etc as I am not sure how commonly such information is provided, ditto for rotation information which seems even less common.

One other issue is that many styluses provide an "eraser" and it would be nice if we had a mechanism to allow a webpage to identify when the eraser was being used, as this would further increase the fidelity of the browser image processing experience.
Comment 2 mitz 2008-08-20 07:27:22 PDT
See also bug 10598.
Comment 3 Oliver Hunt 2008-09-28 02:05:50 PDT
roc pointed me at the moz tracking bug https://bugzilla.mozilla.org/show_bug.cgi?id=428988 and noted that we should be using vendor prefixes on the pressure property (whoops)
Comment 4 Oliver Hunt 2009-01-02 11:07:26 PST
Okay, I've been looking at the windows mechanisms for getting stylus information.  It is worse than the IME APIs.

There are multiple halfway there APIs.  The most complete is the WinTab API, but afaict that's not actually part of windows, but that's okay because it also doesn't interact with the event queue.

It looks like Vista may have some APIs that make this more feasible but on XP there appears to be no such luck.  On XP the best we seem to be able to detect is whether an event is from a pen and even that code is unbelievably ugly -- and it only gives us the mouse vs. pen distinction, nothing more.

In all honesty I'm leaning towards supporting pressure information on Mac and Gtk, seriously trying to support this on windows seems to be an exercise in futility.

Comment 5 Anne van Kesteren 2024-03-15 04:31:27 PDT
As I understand it this now happens through pointer events.