1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 05:10:03 -04:00

Move App::persist_window to NativeOptions and App::max_size_points to WebOptions (#3397)

* Move `App::persist_window` to `NativeOptions`

* Move `App::max_size_points` to `WebOptions`

* Build fixes
This commit is contained in:
Emil Ernerfeldt
2023-09-27 08:48:48 +02:00
committed by GitHub
parent 1b18f8e266
commit b3e19f5b7d
3 changed files with 21 additions and 15 deletions

View File

@@ -182,13 +182,6 @@ pub trait App {
std::time::Duration::from_secs(30)
}
/// The size limit of the web app canvas.
///
/// By default the max size is [`egui::Vec2::INFINITY`], i.e. unlimited.
fn max_size_points(&self) -> egui::Vec2 {
egui::Vec2::INFINITY
}
/// Background color values for the app, e.g. what is sent to `gl.clearColor`.
///
/// This is the background of your windows if you don't set a central panel.
@@ -208,12 +201,6 @@ pub trait App {
// _visuals.window_fill() would also be a natural choice
}
/// Controls whether or not the native window position and size will be
/// persisted (only if the "persistence" feature is enabled).
fn persist_native_window(&self) -> bool {
true
}
/// Controls whether or not the egui memory (window positions etc) will be
/// persisted (only if the "persistence" feature is enabled).
fn persist_egui_memory(&self) -> bool {
@@ -455,6 +442,10 @@ pub struct NativeOptions {
/// }
/// ```
pub app_id: Option<String>,
/// Controls whether or not the native window position and size will be
/// persisted (only if the "persistence" feature is enabled).
pub persist_window: bool,
}
#[cfg(not(target_arch = "wasm32"))]
@@ -529,6 +520,8 @@ impl Default for NativeOptions {
wgpu_options: egui_wgpu::WgpuConfiguration::default(),
app_id: None,
persist_window: true,
}
}
}
@@ -566,6 +559,11 @@ pub struct WebOptions {
/// Configures wgpu instance/device/adapter/surface creation and renderloop.
#[cfg(feature = "wgpu")]
pub wgpu_options: egui_wgpu::WgpuConfiguration,
/// The size limit of the web app canvas.
///
/// By default the max size is [`egui::Vec2::INFINITY`], i.e. unlimited.
pub max_size_points: egui::Vec2,
}
#[cfg(target_arch = "wasm32")]
@@ -581,6 +579,8 @@ impl Default for WebOptions {
#[cfg(feature = "wgpu")]
wgpu_options: egui_wgpu::WgpuConfiguration::default(),
max_size_points: egui::Vec2::INFINITY,
}
}
}