slint
slint copied to clipboard
TouchArea: `pressed` and `has_hover` issue in a Flickable
The pressed
and has_hover
properties are not kept to true when the Flickable is being interacted with (even if the mouse is still "holding" one of the elements)
That's because when the Flickable is operated on, it grabs the mouse completely and the inner child don't get the mouse.
While it might make sense for pressed, it should probably not be the case for has_hover
In addition has_hover is kept to true if the viewport moves while it had the mouse before (eg, using the wheel)
(this can also be seen in the slide puzzle demo)
Testcase: https://sixtyfps.io/editor/?snippet=%0Aexport+Demo+%3A%3D+Window+%7B%0A++width%3A+300px%3B+height%3A+300px%3B%0A++Flickable+%7B+%0A++++VerticalLayout+%7B%0A++++++for+c+in+%5B%23ff0%2C+%23f0f%2C+%2300f%2C+%230ff%2C+%238f0%2C+%23f80%2C+%23f8f%2C+%23f88%2C+%23080%2C+%23800%2C+%23880%2C+%23008%2C+%2308f%5D+%3A+Rectangle+%7B%0A+++++++++background%3A+ta.pressed+%3F+black+%3A+ta.has_hover%3F+white+%3A+c%3B%0A+++++++++height%3A+50px%3B%0A+++++++++ta+%3A%3D+TouchArea+%7B%7D%0A++++++%7D%0A++++%7D%0A++%7D%0A%7D%0A
This is similar to #1107
I found similar behavior on moving the mouse pointer fast on a screen with many elements that can be hovered. Sometime an unhovered elements keeps has-hover
.
In the screen to upper element is hovered the lower not.
This seems to be fixed. (Some patches went in the Flickable and mouse handling before and after 1.0)