Marcin Wisniowski
11/21/2023, 3:09 PMonPointerEvent(PointerEventType.Release)
modifier, and an onClick
modifier on the same element, which closes the window. The click release event is never delivered, regardless of the modifier order (the window closes before the event is delivered). How can I properly ensure that I get the click release event?Alexander Maryanovsky
11/21/2023, 3:18 PMPress
, there’s nothing to deliver the Release
to.Marcin Wisniowski
11/21/2023, 3:26 PMonClick
fires when you release the mouse button, so they happen at the same time. Sometimes I get the Release event, sometimes I don't, seems like some race condition. It makes sense to me, but I'm looking for a solution. My problem is that my close button gets visually "stuck" in the pressed state when I reopen the window, because it was never told the cursor was released.Alexander Maryanovsky
11/21/2023, 3:29 PMMarcin Wisniowski
11/21/2023, 3:37 PMPointerEventType.Exit
is never delivered. The cursor technically never leaves the button before it's gone with the window, so it does make sense. 🤔Alexander Maryanovsky
11/21/2023, 3:39 PMAlexander Maryanovsky
11/21/2023, 3:40 PMMarcin Wisniowski
11/21/2023, 3:41 PMvisible = false
on the Window
, so the window is still composed, just not visible.Alexander Maryanovsky
11/21/2023, 3:42 PMif
instead. Then it’ll be gone.Marcin Wisniowski
11/21/2023, 3:42 PMAlexander Maryanovsky
11/21/2023, 3:43 PMAlexander Maryanovsky
11/21/2023, 3:44 PMMarcin Wisniowski
11/21/2023, 3:53 PMto something that changes when you re-open it
LaunchedEffect(windowOpenTimestamp) {
state.isHovered = false // Window was just opened, clear hover
}
This worked. Though because it clears the hover state when the window is reopened, and the button hover state to normal state transition is animated, you can still see the button animating back to the normal state when you reopen the window. But it's barely noticeable so I can live with that! Thanks.Alexander Maryanovsky
11/21/2023, 3:57 PMkey(windowTimestampOpen) { Button() }
Marcin Wisniowski
11/21/2023, 4:03 PM