disable webview spawn for wasm32

This commit is contained in:
geoffsee
2025-07-08 14:07:46 -04:00
parent 44081ad73d
commit 348f20641c

View File

@@ -2,7 +2,7 @@ use bevy::prelude::*;
use bevy::render::view::RenderLayers; use bevy::render::view::RenderLayers;
use bevy::window::Window; use bevy::window::Window;
use std::collections::HashMap; use std::collections::HashMap;
use bevy_webview_wry::prelude::*;
/// Render layer for GPS map entities to isolate them from other cameras /// Render layer for GPS map entities to isolate them from other cameras
@@ -143,37 +143,40 @@ pub fn spawn_gps_map_window(commands: &mut Commands, gps_map_state: &mut ResMut<
info!("Spawning GPS map window"); info!("Spawning GPS map window");
// todo: expose an attribute for element positioning
// Create a new window for the GPS map // Create a new window for the GPS map
let window_entity = commands // let window_entity = commands
.spawn(( // .spawn((
Window { // Window {
title: "GPS Navigation - OpenStreetMap".to_string(), // title: "GPS Navigation - OpenStreetMap".to_string(),
resolution: (800.0, 600.0).into(), // resolution: (800.0, 600.0).into(),
position: bevy::window::WindowPosition::Centered( // position: bevy::window::WindowPosition::Centered(
bevy::window::MonitorSelection::Current, // bevy::window::MonitorSelection::Current,
), // ),
..default() // ..default()
}, // },
GpsMapWindow, // GpsMapWindow,
)) // ))
.id(); // .id();
// todo: expose an attribute for element positioning
// Create a camera for the map window // Create a camera for the map window
commands.spawn(( // commands.spawn((
Camera2d, // Camera2d,
Camera { // Camera {
target: bevy::render::camera::RenderTarget::Window(bevy::window::WindowRef::Entity( // target: bevy::render::camera::RenderTarget::Window(bevy::window::WindowRef::Entity(
window_entity, // window_entity,
)), // )),
..default() // ..default()
}, // },
RenderLayers::layer(GPS_MAP_LAYER), // RenderLayers::layer(GPS_MAP_LAYER),
GpsMapWindow, // GpsMapWindow,
)); // ));
gps_map_state.window_id = Some(window_entity); // gps_map_state.window_id = Some(window_entity);
#[cfg(not(target_arch = "wasm32"))]
info!("GPS map window spawned with entity: {:?}", window_entity); info!("GPS map window spawned with entity: {:?}", window_entity);