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::window::Window;
use std::collections::HashMap;
use bevy_webview_wry::prelude::*;
/// 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");
// todo: expose an attribute for element positioning
// Create a new window for the GPS map
let window_entity = commands
.spawn((
Window {
title: "GPS Navigation - OpenStreetMap".to_string(),
resolution: (800.0, 600.0).into(),
position: bevy::window::WindowPosition::Centered(
bevy::window::MonitorSelection::Current,
),
..default()
},
GpsMapWindow,
))
.id();
// let window_entity = commands
// .spawn((
// Window {
// title: "GPS Navigation - OpenStreetMap".to_string(),
// resolution: (800.0, 600.0).into(),
// position: bevy::window::WindowPosition::Centered(
// bevy::window::MonitorSelection::Current,
// ),
// ..default()
// },
// GpsMapWindow,
// ))
// .id();
// todo: expose an attribute for element positioning
// Create a camera for the map window
commands.spawn((
Camera2d,
Camera {
target: bevy::render::camera::RenderTarget::Window(bevy::window::WindowRef::Entity(
window_entity,
)),
..default()
},
RenderLayers::layer(GPS_MAP_LAYER),
GpsMapWindow,
));
// commands.spawn((
// Camera2d,
// Camera {
// target: bevy::render::camera::RenderTarget::Window(bevy::window::WindowRef::Entity(
// window_entity,
// )),
// ..default()
// },
// RenderLayers::layer(GPS_MAP_LAYER),
// 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);