You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mapsui Platform
WPF (though it probably can happen on other platforms depending on how similar the logic is.)
Device
Windows desktop, and Windows tablets.
Describe the bug
There is seemingly a bug where animations will freeze under high app loading.
We think there's a bug in the animation logic in how Navigator.UpdateAnimations() checks for when the panning or zoom limit is reached. This gets the desired viewport from the animation, uses Navigator.SetViewportWithLimit() to apply the viewport with limiting, and then calls Navigator.ShouldAnimationsBeHaltedBecauseOfLimiting() which checks if the current viewport was not updated because the panning/zoom limits were reached,
However this can spuriously trigger if an animation step happens to result in no change to the viewport before applying the limits.
The timer used for the animation (MapControl._invalidateTimer) is aSystem.Threading.Timer, which queues timer events on the thread pool at a fixed rate - so if a timer's not processed quickly enough (or if there's a lot of other work happening on the thread pool) there can be multiple outstanding timer events, and these queued events can run in parallel.
The animation step works out what the current viewport should be given the number of ticks since the animation started. This means that if two animation steps happen to run back-to-back or in parallel, they can calculate the same required viewport. This would trigger the early stop behaviour described earlier.
To Reproduce
Steps to reproduce the behavior:
Add a Navigator.ViewportChanged event handler with an artificial delay: Map.Navigator.ViewportChanged += (s, e) => { Thread.sleep(50); };
Zoom the map with an animation: Map.Navigator.ZoomIn(1000, Easing.Linear);
Expected behavior
The animations should complete without abruptly stopping.
The text was updated successfully, but these errors were encountered:
Mapsui Version
4.1.3
Mapsui Platform
WPF (though it probably can happen on other platforms depending on how similar the logic is.)
Device
Windows desktop, and Windows tablets.
Describe the bug
There is seemingly a bug where animations will freeze under high app loading.
We think there's a bug in the animation logic in how
Navigator.UpdateAnimations()
checks for when the panning or zoom limit is reached. This gets the desired viewport from the animation, usesNavigator.SetViewportWithLimit()
to apply the viewport with limiting, and then callsNavigator.ShouldAnimationsBeHaltedBecauseOfLimiting()
which checks if the current viewport was not updated because the panning/zoom limits were reached,However this can spuriously trigger if an animation step happens to result in no change to the viewport before applying the limits.
The timer used for the animation (
MapControl._invalidateTimer
) is aSystem.Threading.Timer
, which queues timer events on the thread pool at a fixed rate - so if a timer's not processed quickly enough (or if there's a lot of other work happening on the thread pool) there can be multiple outstanding timer events, and these queued events can run in parallel.The animation step works out what the current viewport should be given the number of ticks since the animation started. This means that if two animation steps happen to run back-to-back or in parallel, they can calculate the same required viewport. This would trigger the early stop behaviour described earlier.
To Reproduce
Steps to reproduce the behavior:
Navigator.ViewportChanged
event handler with an artificial delay:Map.Navigator.ViewportChanged += (s, e) => { Thread.sleep(50); };
Map.Navigator.ZoomIn(1000, Easing.Linear);
Expected behavior
The animations should complete without abruptly stopping.
The text was updated successfully, but these errors were encountered: