emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

Support for graphic tablet/stylus/pen events?

Open Chemrat opened this issue 7 years ago • 6 comments

I've skimmed through C++ HTML5 API and seems like there is API for mouse and touch events, but not for pen events (pointer events with tilt and pressure)

Chemrat avatar Oct 13 '18 00:10 Chemrat

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

stale[bot] avatar Oct 13 '19 01:10 stale[bot]

Given that browsers do support them, I think emscripten should.

https://www.w3.org/TR/pointerevents2/#dom-pointerevent-pressure

Qt's wasm plugin uses emscripten, and Qt supports pen tablets. So this would potentially pave the way for Qt-based drawing applications to be portable not only between desktop and mobile operating systems, but also to the browser.

ec1oud avatar Jul 29 '20 19:07 ec1oud

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

stale[bot] avatar Jul 30 '21 02:07 stale[bot]

Hi is it possible to have a look at this please? I also very much need this feature for a drawing app

Lemovision avatar Nov 02 '21 10:11 Lemovision

SDL3 now has SDL_pen.h as well https://github.com/libsdl-org/SDL/commit/7c80ac6df7001ba8ad37c6cf3ab0dc70b57011dd#diff-8a9cade1c69cd3c5c95378f2b386222c68aa893ea73ae792bb865061b8b9ebf2

digitalsignalperson avatar May 01 '24 22:05 digitalsignalperson

SDL3 now has SDL_pen.h as well

It does, and we've just cut this API down dramatically so we could reasonably target lots more platforms, including Emscripten.

What SDL3 needs from Emscripten is access to Pointer Events, and I suppose we could wedge in some Javascript code to hook into the browser via EM_ASM, but it would be nicer if there were an equivalent of emscripten_set_mousedown_callback (etc) for these, as that's what SDL uses for everything else. Among other reasons, the Emscripten functions do a lot of stuff behind the scenes I'm not really qualified to manage, and don't really understand without a background in Emscripten internals magic. :)

Although I suppose that a Pointer Events equivalent would probably be mostly this same code with different details?

icculus avatar Aug 10 '24 07:08 icculus

I implemented this today in SDL3 using Javascript directly, here, but if would still be nice if this were to have the same Emscripten APIs that mouse/touch already use.

(A demo of the SDL3 implementation is here if you have a stylus/pen that works with your browser.)

icculus avatar Aug 12 '24 04:08 icculus