Anyone know why this code works AOK on desktop but then decides to not exist on android?
Copy code
import androidx.compose.foundation.PointerMatcher
^^ this is the perfectly legitimate import that it fails on.
If this is not supposed to fail like this, then why is it failing
If this is expected, then the least that could be done here is making it red or something similar so I dont have to wait until I test my code on my device to figure out a refactor is necessary
You have to write expect/actual if you want to use it
e
Enahor Tapmas
02/06/2024, 7:31 AM
So it is possible to detect mouse input on android. Why is this not a feature in compose? Ideally since its multiplatform it should be able to do things like this
Also 🤢 I have to go through and do more work because of the refactor
a
Alexander Zhirkevich
02/06/2024, 8:06 AM
You can do something like this. It should be available everywhere
Copy code
Modifier.pointerInput(0) {
awaitEachGesture {
val event = awaitPointerEvent()
if (event.type == PointerEventType.Press && event.buttons.isSecondaryPressed) {
waitForUpOrCancellation()
println("secondary pressed at ${event.changes.first().position}")
}
}
}
e
Enahor Tapmas
02/07/2024, 3:32 AM
@Alexander Zhirkevich thank you so much, your code worked perfectly once I added my logic