I use "leave" event as workaround. When "pressed" pointer leaves canvas it automatically became unpressed. It works fine in most cases for me.
вт, 8 февр. 2022 г. в 20:29, Floh <[email protected]>: > oops typos: > > > setCapture()/releaseCapture() event pair > > ...this should be "function pair". Don't know why I got that wrong *twice* > :) > > On Tuesday, 8 February 2022 at 14:28:30 UTC+1 Floh wrote: > >> First...I don't mean pointer-lock (which works fine), but instead the >> setCapture() (old) or setPointerCapture() (new) functionality. >> >> For example, if I drag a Dear ImGui window and the mouse pointer goes out >> of the browser window, mouse events are no longer reported. Releasing the >> mouse button outside the window means that the ImGui window now sticks to >> the mouse button when the mouse is moved back inside, because the >> application still thinks the mouse button is pressed. >> >> In the olden times, there was a setCapture()/releaseCapture() event pair, >> which doesn't work in Chrome. >> >> In modern times, there's a new >> setPointerCapture()/releasePointerCapture() event pair, but this requires a >> 'pointerId' parameter, which isn't part of the regular mouse events, but of >> the derived 'pointer events'. >> >> Long story short, has anybody managed to hack this somehow with the >> emscripten_*() functions? I tinkered around with calling an EM_JS() >> function from within the mouse button event handlers, which then calls >> setPointerCapture/releasePointerCapture, but that isn't successful because >> those functions want an actual, active "pointerId" object, not just some >> random number :D >> >> I guess that emscripten/html5.h needs a new set of event functions for >> pointer events ( >> https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events), >> instead of regular mouse events? >> >> Thanks! >> -Floh. >> > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/6f17bf5e-5c08-4e8b-996c-437d62d0fa1fn%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/6f17bf5e-5c08-4e8b-996c-437d62d0fa1fn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVHYxqtkUTRQnSRytJGQNxU%3DH1T-Do7FwQ6OhkamJfcQXQ%40mail.gmail.com.
