Closed tronical closed 11 months ago
Some things we could so:
double-clicked
callback to the TouchAreaI think we should do both eventually. I have the feeling that in most cases user don't want the normal clicked handler to be run if (and only if) there is no double click.
I believe we should do the following:
double-clicked
callback to TouchAreaclicked
immediately, but instead, start a timer of the double click internal, and then call the clicked, if there was no further click.When doing a five-time click you get events with a click count of 1, 2, 3, 4 and 5 and have no idea whether the 5-event will eventually be followed by 6, 7, ... or not. That is not very useful, especially as we the timeout for "double clicks" is not exposed to the public as far as I can tell. So a user have no way to wait for the right amount of time to decide that my 5-event was indeed the last event to happen.
double-clicked
callback:A multi-clicked
callback with a click count argument is probably more generically useful. Someone will want to use a triple-click at some point :-)
I believe we should do the following: [ ... ]
I agree
A multi-clicked callback with a click count argument is probably more generically useful. Someone will want to use a triple-click at some point :-)
I don't think it's necessary to go all the generic way. Honestly, with a mouse event double click is a rather rare pattern (even on Windows I'd say single click is dominant). With finger input double "tap" is not an established pattern IMO. With pencils a double click (on the pencil's button for example) is a good pattern, but I have yet to see a triple or n-click (n > 3).
I'm in favor of a pragmatic double-click and we can worry about a multi-click
in the (unlikely) event that it becomes popular.
I am tempted to move the implementation into core/input.rs and send a MouseClicked
event from there in addition to the MousePressed/Released
, mostly to keep all the lower level mouse handling in one place. But looking at the Text item: That seems to be happy with just the click count it gets, so this might actually be over-doing it and the TouchArea might indeed be the best place to implement this.
This was implemented in #4060 :-)
Discussed in https://github.com/slint-ui/slint/discussions/2772
At the moment the internal mouse press and release events have a click count, which the built-in
Text
item uses to handle double clicks. We should either make this API public or design a new API to make it possible to handle double/triple/etc. clicking in Slint code.