• Greg Spencer's avatar
    Fix mouse hover to not schedule a frame for every mouse move. (#41014) · 05097916
    Greg Spencer authored
    This fixes the mouse hover code to not schedule frames with every mouse move.
    
    Before this, it would schedule a post frame callback, and then schedule a frame immediately, even if there was nothing that needed to be updated. Now it will schedule checks for mouse position updates synchronously, unless there's a new annotation, and skip scheduling a new frame in all cases. It has to be async in the case of a new annotation (i.e. a new MouseRegion is added), since when the annotation is added, it hasn't yet painted, and it can't hit test against the new layer until after the paint, so in that case it schedules a post frame callback, but since it's already building a frame when it does that, it doesn't need to schedule a frame.
    
    The code also used to do mouse position checks for all mice if only one mouse changed position. I fixed this part too, so that it will only check position for the mouse that changed.
    05097916
test_pointer.dart 14.4 KB