I'm writing a cross-platform JavaScript-based drawing tool and run into severe problems on Linux.
First, Google Chrome's pointer events do not distinguish between the regular tip and the eraser end.
Second, in Firefox pointer events always are mouse events, never pen events.
In Chrome, the Eraser is reported as Contact. In Firefox, the pen pointer type is reported as mouse pointer type. I am aware of there having been some incantations in Firefox's configuration such as dom.w3c_pointer_events.enabled true and dom.w3c_pointer_events.dispatch_by_pointer_messages true, but they don't seem to help (anymore?).
In Xournal++, the eraser end of the pen does erase. With PySide6, the eraser end of the stylus is recognized as such (pointerType).
This is a minimal demonstration:
function print(e) {
const theButtons = {
"-1": "-",
0: "Contact",
1: "Middle",
2: "Barrel",
5: "Eraser"
};
log.innerText += ` ${e.pointerType}:${theButtons[e.button]}`;
}
area.addEventListener('contextmenu', e => e.preventDefault());
['pointerdown', 'pointerup', 'pointermove', 'pointerover'].forEach(e => area.addEventListener(e, print));
<div id="area" style="height:100px;background-color:aqua;"><span>Use stylus here</span></div>
<p id="log"></p>
Versions and equipment: Chrome 122.0.6261.94, Firefox 122.0.1, Wacom Cintiq 27QHDT, openSUSE Tumbleweed 2024-02-26, KDE PLasma 5.115.0-1.1, /sys/module/wacom*/version says v2.00