Ojav
07/26/2024, 8:41 PMSkaldebane
07/27/2024, 1:54 PMclickable
and friends (or go lower-level with pointerInput
).
However, anything deeper than that is probably not possible, at least not from the browser. Deeper data on where a touch has physically happened on a touchpad or other input devices is not exposed by the browser, and thus can't be accomplished in Compose/Wasm, unless you build some sort of external installable program to communicate these things to the web app.
However it is possible to do with Compose/Desktop through JNI. You'll have to write native code (in C/C++/Rust, for each target platform, different code for Linux/Windows/macOS) that talks to the device drivers in the kernel to get such data. I've done this in the past (on Linux) to get the touch position from the touchpad and send it over to a Compose Desktop app. Spoiler alert: it's a lot of work, and can be quite error prone.
The same applies if you want to write some external utility to talk to a web app (whether it's Compose or Kotlin or just plain JS doesn't matter), you'll have to write some low-level code to make such utility work.
In other words, there's no native solution, and that would be out of scope for Compose UI IMHO.
In any case, what's the usecase you have in mind?Ojav
07/30/2024, 12:36 PMIgor Yakovlev
07/30/2024, 1:00 PMOjav
07/30/2024, 1:09 PMOleksandr Karpovich [JB]
07/30/2024, 1:10 PMModifier.onClick
- https://github.com/JetBrains/compose-multiplatform/tree/master/tutorials/Mouse_Events#new-experimental-onclick-hand[…]-only-for-desktop-jvm-platform (the doc says it's desktop/jvm only, but actually this API is available for web too as I see)
Compose for Web currently doesn't support the context menu. You can try to workaround it using contextmenu
browser event: https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event
For compose-web questions you can use #compose-webSkaldebane
07/30/2024, 1:40 PMOjav
07/30/2024, 2:55 PMAru
10/15/2024, 3:40 PMSkaldebane
10/15/2024, 6:40 PMpointerdown
events happening but all mouse buttons set to off), then Compose/Wasm should change how it handles these pointerdown
events (e.g. treat events with no mouse buttons on as a "left click" by default? but what if this also happens on right click?).
@bashor any thoughts here? How is Flutter/Wasm handling this?bashor
10/15/2024, 7:25 PMbashor
10/15/2024, 7:26 PM