slint
slint copied to clipboard
Android: double-clicked callback not work on TouchArea
- platform: Android
- Android target sdk version: 32
- language: Rust
- slint version: v1.5.1
- style: material
- code snippets
TouchArea {
moved => {
debug("move ok");
}
pointer-event(evt) => {
debug("pointer-event ok");
}
clicked => {
debug("clicked ok");
}
double-clicked => {
debug("double-clicked not work");
}
}
Thanks for reporting an issue.
The problem is that we send a MouseExit event on finger release, which cause the double click state to be reset.
https://github.com/slint-ui/slint/blob/6e7353cf1182712b53a7ed5de3b004ad5507911f/internal/backends/android-activity/androidwindowadapter.rs#L326-L327
(I've actually done the same on some MCU platform)
I think we have the following options:
- Don't send MouseExit on release in the android backend.
- Somehow not resetting the click_count on MouseExit. We have other mechanisms to find out it was done on the same item anyway.
- Have specific events for touch that wouldn't set the has_hover anyway without exit. But that's a bigger change.
Don't send MouseExit on release in the android backend.
Perhaps that could be done with a delay? So that there's still a chance of doing a double tap.