Tilt and device type information would be nice in mouse events

NEW
Unassigned

Status

()

Core
Event Handling
--
enhancement
8 years ago
3 years ago

People

(Reporter: Ilmari Heikkinen, Unassigned)

Tracking

(Depends on: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 4 obsolete attachments)

(Reporter)

Description

8 years ago
Created attachment 414883 [details] [diff] [review]
Adds mozTiltX, mozTiltY, mozWheel and mozDeviceType to mouse events

Drawing tablets pens can report pen tilt and the current pen's type (pen/eraser/cursor). There are also Wacom airbrush styluses that have an extra wheel axis for controlling brush parameters. Having these exposed in mouse events makes it possible to write user-friendly drawing programs in JavaScript.

I wrote an implementation by following the mozPressure path and added mozTiltX, mozTiltY, mozWheel and mozDeviceType {mouse=0,pen=1,eraser=2,cursor=3} to DOMNSMouseEvent. The current implementation only has hooks for GTK2. 

To test the patch you need Linux, a Wacom tablet [that is working in e.g. GIMP] - preferably Intuos for the tilt support, and the XInput-enabling patch from https://bugzilla.mozilla.org/show_bug.cgi?id=531320
(Reporter)

Comment 1

8 years ago
Created attachment 414884 [details]
Sample paint app that uses pressure, device type and tilt to control brush parameters.

Comment 2

8 years ago
So what does the "wheel" mean exactly in this context. The problem is that wheel has other meaning in DOM Events (mousewheel).

I wonder if the similar terminology as what InkML has could be used here.
(Reporter)

Comment 3

8 years ago
The "wheel" is apparently a term only used in Linux Wacom drivers. Looked at the Linux, Windows and Mac tablet event documentation, and it's a bit of a mess.

On Linux http://linuxwacom.sourceforge.net/index.php/appdev :
XTILT = pen x-tilt, puck mouse rotation, tablet left menu strip
YTILT = pen y-tilt, puck mouse wheel position, tablet right menu strip
WHEEL = airbrush control wheel position, art pen rotation, bamboo touch ring


On OS X :
- http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/EventOverview/HandlingTabletEvents/HandlingTabletEvents.html
- http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/Reference/Reference.html

tilt = NSPoint with x-tilt and y-tilt
puck mouse wheel = absoluteZ
rotation = rotation
airbrush wheel = tangentialPressure [-1.0, 1.0]


On Windows:
- http://www.wacomeng.com/devsupport/ibmpc/gddevpc.html

rotation = pkOrientation.orTwist [0, 3599]
mouse wheel = pkZ [-1023, 1023]
airbrush wheel = pkTangentPressure [0, 1023]


The InkML spec uses rotation for rotation (well, yes).

So, yes, wheel would be better renamed to rotation. The overlap in Linux event semantics is unfortunate. So on Linux, if device type is cursor, map XTILT and YTILT to other event fields.

That would replace mozWheel with mozRotation, which would track puck rotation, art pen rotation and airbrush wheel. To keep the mouse wheel value, it could be mapped to Wheel or TiltZ or whatever.
(Reporter)

Comment 4

8 years ago
Created attachment 414927 [details] [diff] [review]
Updated patch, replaces mozWheel with mozRotation, adds mozTiltZ

This patch uses mozRotation for WHEEL events and remaps the puck mouse XTILT(=rotation) to mozRotation and YTILT(=shuttle wheel position) to mozTiltZ.

Also uses tiltx/y/z instead of x/y/ztilt as C++ property names.
Attachment #414883 - Attachment is obsolete: true
Attachment #414884 - Attachment is obsolete: true
(Reporter)

Comment 5

8 years ago
Created attachment 414928 [details]
Updated paint app demo
(Reporter)

Comment 6

8 years ago
Created attachment 414929 [details] [diff] [review]
Updated patch, replaces mozWheel with mozRotation, adds mozTiltZ [bugfix]

bugfix for messed up the puck rotation normalization

This patch uses mozRotation for WHEEL events and remaps the puck mouse
XTILT(=rotation) to mozRotation and YTILT(=shuttle wheel position) to mozTiltZ.

Also uses tiltx/y/z instead of x/y/ztilt as C++ property names.
Attachment #414927 - Attachment is obsolete: true
Attachment #414928 - Attachment is obsolete: true
(Reporter)

Comment 7

8 years ago
Created attachment 414930 [details]
Updated paint app demo
(Reporter)

Updated

6 years ago
Depends on: 531320

Comment 8

3 years ago
Would this be a strong fingerprinting tool?
You need to log in before you can comment on or make changes to this bug.