File tree Expand file tree Collapse file tree 2 files changed +9
-429
lines changed
Expand file tree Collapse file tree 2 files changed +9
-429
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ use glam::{Vec3, Vec4};
55use instant:: Instant ;
66use std:: cell:: RefCell ;
77use std:: rc:: Rc ;
8- use web_sys as web;
9- use wasm_bindgen:: JsCast ;
108use wasm_bindgen:: closure:: Closure ;
9+ use wasm_bindgen:: JsCast ;
10+ use web_sys as web;
1111
1212const CAMERA_Z : f32 = 6.0 ;
1313
@@ -290,9 +290,7 @@ impl<'a> FrameContext<'a> {
290290 }
291291}
292292
293- pub async fn init_gpu (
294- canvas : & web:: HtmlCanvasElement ,
295- ) -> Option < render:: GpuState < ' static > > {
293+ pub async fn init_gpu ( canvas : & web:: HtmlCanvasElement ) -> Option < render:: GpuState < ' static > > {
296294 // leak a canvas clone to satisfy 'static lifetime for surface
297295 let leaked_canvas = Box :: leak ( Box :: new ( canvas. clone ( ) ) ) ;
298296 match render:: GpuState :: new ( leaked_canvas, CAMERA_Z ) . await {
@@ -322,9 +320,7 @@ pub fn start_loop(frame_ctx: Rc<RefCell<FrameContext<'static>>>) {
322320 }
323321 } ) as Box < dyn FnMut ( ) > ) ) ;
324322 if let Some ( w) = web:: window ( ) {
325- let _ = w. request_animation_frame (
326- tick. borrow ( ) . as_ref ( ) . unwrap ( ) . as_ref ( ) . unchecked_ref ( ) ,
327- ) ;
323+ let _ = w. request_animation_frame ( tick. borrow ( ) . as_ref ( ) . unwrap ( ) . as_ref ( ) . unchecked_ref ( ) ) ;
328324 }
329325}
330326
You can’t perform that action at this time.
0 commit comments