From 9f801cf79e9e17ed4220dbaa051ea80e2e6226b0 Mon Sep 17 00:00:00 2001 From: Ryan Goldstein Date: Mon, 29 Apr 2019 15:39:43 -0400 Subject: [PATCH] Only send the request-redraw on the next animation frame --- src/platform_impl/stdweb/window.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/platform_impl/stdweb/window.rs b/src/platform_impl/stdweb/window.rs index 2a712f12..12fbaba5 100644 --- a/src/platform_impl/stdweb/window.rs +++ b/src/platform_impl/stdweb/window.rs @@ -12,7 +12,7 @@ use stdweb::{ unstable::TryInto }; use stdweb::web::{ - document, + document, window, html_element::CanvasElement, }; @@ -21,7 +21,6 @@ pub struct MonitorHandle; impl MonitorHandle { pub fn get_hidpi_factor(&self) -> f64 { - // TODO 1.0 } @@ -72,10 +71,10 @@ impl Window { register(&target.runner, &canvas); let runner = target.runner.clone(); - let redraw = Box::new(move || runner.send_event(Event::WindowEvent { + let redraw = Box::new(move || window().request_animation_frame(|| runner.send_event(Event::WindowEvent { window_id: RootWI(WindowId), event: WindowEvent::RedrawRequested - })); + }))); let window = Window { canvas, @@ -95,7 +94,6 @@ impl Window { height: 768.0, }) } - // TODO: most of these are no-op, but should they stay here just in case? window.set_min_dimensions(attr.min_dimensions); window.set_max_dimensions(attr.max_dimensions); window.set_resizable(attr.resizable); @@ -191,7 +189,6 @@ impl Window { #[inline] pub fn get_hidpi_factor(&self) -> f64 { - // TODO 1.0 } @@ -286,7 +283,7 @@ impl Window { #[inline] pub fn set_window_icon(&self, _window_icon: Option) { - // TODO: should this set the favicon? + // Currently an intentional no-op } #[inline]