I've made some custom slider views in SwiftUI that change appearance based on hover state, but if the mouse moves out too fast (which is actually a very reasonable speed of moving a cursor), it stays in the hover state until you re-hover and re-leave the component slowly.
Is there a solution for this? The hover code is pretty standard:
struct RulerSlider: View { @State var hovering = false var body: some View { GeometryReader { geometry in ZStack { // Ruler lines if hovering { Ruler() } } .onHover { hover in withAnimation(.easeOut(duration: 0.1)) { self.hovering = hover } } } } }
Here's what the issue looks like:
Sample code for reproducing the bug: https://gist.github.com/rdev/ea0c53448e12835b29faa11fec8e0388
1.4m articles
1.4m replys
5 comments
56.9k users