Skip to content

Commit

Permalink
Fix web compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
maxammann committed Jul 3, 2024
1 parent c348cf7 commit 77c7c8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions maplibre-winit/src/web.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::marker::PhantomData;

use maplibre::window::{MapWindow, MapWindowConfig, PhysicalSize};
use winit::{platform::web::WindowBuilderExtWebSys, window::WindowBuilder};
use winit::{platform::web::WindowAttributesExtWebSys, window::WindowAttributes};

use super::WinitMapWindow;
use crate::WinitEventLoop;
Expand All @@ -25,13 +25,14 @@ impl<ET: 'static + Clone> MapWindowConfig for WinitMapWindowConfig<ET> {
type MapWindow = WinitMapWindow<ET>;

fn create(&self) -> Self::MapWindow {
let raw_event_loop = winit::event_loop::EventLoopBuilder::<ET>::with_user_event()
let raw_event_loop = winit::event_loop::EventLoop::<ET>::with_user_event()
.build()
.unwrap(); // TODO

let window: winit::window::Window = WindowBuilder::new()
.with_canvas(Some(get_canvas(&self.canvas_id)))
.build(&raw_event_loop)
let window: winit::window::Window = raw_event_loop
.create_window(
WindowAttributes::default().with_canvas(Some(get_canvas(&self.canvas_id))),
)
.unwrap();

let size = get_body_size().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pkgs.mkShell {
unstable.just
unstable.nodejs
unstable.mdbook
unstable.wasm-bindgen-cli
# unstable.wasm-bindgen-cli # we need [email protected], so pull it from cargo instead
unstable.tracy
unstable.nixpkgs-fmt # To format this file: nixpkgs-fmt *.nix
# System dependencies
Expand Down

0 comments on commit 77c7c8e

Please sign in to comment.