Only set the cursor style once per mouse move event

This will hopefully prevent some of the intermittent flickering we seem to be seeing.
This commit is contained in:
Nathan Sobo 2022-04-22 18:57:49 -06:00
parent 5ab21cc0fd
commit ac6880b6ee

View file

@ -181,13 +181,14 @@ impl Presenter {
self.last_mouse_moved_event = Some(event.clone()); self.last_mouse_moved_event = Some(event.clone());
if !left_mouse_down { if !left_mouse_down {
cx.platform().set_cursor_style(CursorStyle::Arrow); let mut style_to_assign = CursorStyle::Arrow;
for (bounds, style) in self.cursor_styles.iter().rev() { for (bounds, style) in self.cursor_styles.iter().rev() {
if bounds.contains_point(position) { if bounds.contains_point(position) {
cx.platform().set_cursor_style(*style); style_to_assign = *style;
break; break;
} }
} }
cx.platform().set_cursor_style(style_to_assign);
} }
} }
Event::LeftMouseDragged { position } => { Event::LeftMouseDragged { position } => {