Hi,
My app makes quite heavy use of onHover to do custom mouse over events. These were working perfectly in iPadOS 13.4 but no longer in iPadOS 14.0.
This is the sort of code that I’m using.
Running this on an iPad with MagicKeyboard and iPadOS 13.4 results in the blue Rectangle scaling up whenever the mouse pointer is over the view and back down whenever the mouse pointer moves away. The “Tapped” message is played each time the trackpad is clicked with the pointer on the blue Rectangle.
With iPadOS 14 the behaviour is very different. The blue Rectangle scales up when the mouse is over and then back down when it’s moved away, but it only does this once. Moving the mouse pointer back over the blue Rectangle does nothing.
The TapGesture is also broken but in a slightly different way. It plays once but not again until the mouse is moved off the view and back over.
The broken behaviour seems to be related somehow to the overlapping views. If the red Rectangle is removed everything is fine. If I create partially overlapping views I only get the broken behaviour if I move the mouse from the blue to the red Rectangle, it’s fine if I move the mouse from the blue rectangle to empty space.
I can’t use the standard .hoverEffect() because many of my views are also animated and .hoverEffect() does very unpleasant things. Besides even with .hoverEffect() the TapGesture is still broken.
Has anybody seen similar behaviour? Any suggestions on how to move forward?
Thanks
Chris
My app makes quite heavy use of onHover to do custom mouse over events. These were working perfectly in iPadOS 13.4 but no longer in iPadOS 14.0.
This is the sort of code that I’m using.
Code Block struct ContentView: View { @State private var hoverActive = false var body: some View { ZStack { Rectangle() .foregroundColor(.red) Rectangle() .scaleEffect(hoverActive ? 2.0 : 1.0) .animation(.easeInOut) .foregroundColor(.blue) .frame(width: 50, height: 50, alignment: .center) .position(x: 100, y: 100) .onHover(perform: { hovering in hoverActive = hovering }) .onTapGesture { print("Tapped") } } } }
Running this on an iPad with MagicKeyboard and iPadOS 13.4 results in the blue Rectangle scaling up whenever the mouse pointer is over the view and back down whenever the mouse pointer moves away. The “Tapped” message is played each time the trackpad is clicked with the pointer on the blue Rectangle.
With iPadOS 14 the behaviour is very different. The blue Rectangle scales up when the mouse is over and then back down when it’s moved away, but it only does this once. Moving the mouse pointer back over the blue Rectangle does nothing.
The TapGesture is also broken but in a slightly different way. It plays once but not again until the mouse is moved off the view and back over.
The broken behaviour seems to be related somehow to the overlapping views. If the red Rectangle is removed everything is fine. If I create partially overlapping views I only get the broken behaviour if I move the mouse from the blue to the red Rectangle, it’s fine if I move the mouse from the blue rectangle to empty space.
I can’t use the standard .hoverEffect() because many of my views are also animated and .hoverEffect() does very unpleasant things. Besides even with .hoverEffect() the TapGesture is still broken.
Has anybody seen similar behaviour? Any suggestions on how to move forward?
Thanks
Chris