Skip to content

Commit 465c961

Browse files
authored
egui_web: by default, use full web browser size (#1378)
* egui_web: by default, use full web browser size Closes #1377 * Remove max_size_points from demo app
1 parent 6ce8594 commit 465c961

File tree

7 files changed

+8
-37
lines changed

7 files changed

+8
-37
lines changed

eframe/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ NOTE: [`egui_web`](../egui_web/CHANGELOG.md), [`egui-winit`](../egui-winit/CHANG
55

66

77
## Unreleased
8-
* Remove the `egui_glium` feature. `eframe` will now always use `egui_glow` as the native backend ([#1357](https://github.com/emilk/egui/pull/1357)).
98
* Change default for `NativeOptions::drag_and_drop_support` to `true` ([#1329](https://github.com/emilk/egui/pull/1329)).
9+
* Remove the `egui_glium` feature. `eframe` will now always use `egui_glow` as the native backend ([#1357](https://github.com/emilk/egui/pull/1357)).
1010
* Removed `Frame::request_repaint` - just call `egui::Context::request_repaint` for the same effect ([#1366](https://github.com/emilk/egui/pull/1366)).
11+
* Use full browser width by default ([#1378](https://github.com/emilk/egui/pull/1378)).
1112

1213

1314
## 0.17.0 - 2022-02-22

eframe/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ pub use egui_web::wasm_bindgen;
8484
/// Install event listeners to register different input events
8585
/// and start running the given app.
8686
///
87-
/// For performance reasons (on some browsers) the egui canvas does not, by default,
88-
/// fill the whole width of the browser.
89-
/// This can be changed by overriding [`epi::Frame::max_size_points`].
90-
///
9187
/// ``` no_run
9288
/// #[cfg(target_arch = "wasm32")]
9389
/// use wasm_bindgen::prelude::*;

egui_demo_lib/src/backend_panel.rs

-17
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ pub struct BackendPanel {
5454
#[cfg_attr(feature = "serde", serde(skip))]
5555
pixels_per_point: Option<f32>,
5656

57-
/// maximum size of the web browser canvas
58-
max_size_points_ui: egui::Vec2,
59-
pub max_size_points_active: egui::Vec2,
60-
6157
#[cfg_attr(feature = "serde", serde(skip))]
6258
frame_history: crate::frame_history::FrameHistory,
6359

@@ -70,8 +66,6 @@ impl Default for BackendPanel {
7066
open: false,
7167
run_mode: Default::default(),
7268
pixels_per_point: Default::default(),
73-
max_size_points_ui: egui::Vec2::new(1024.0, 2048.0),
74-
max_size_points_active: egui::Vec2::new(1024.0, 2048.0),
7569
frame_history: Default::default(),
7670
egui_windows: Default::default(),
7771
}
@@ -157,17 +151,6 @@ impl BackendPanel {
157151
ui.hyperlink("https://github.com/emilk/egui");
158152

159153
ui.separator();
160-
161-
ui.add(
162-
egui::Slider::new(&mut self.max_size_points_ui.x, 512.0..=f32::INFINITY)
163-
.logarithmic(true)
164-
.largest_finite(8192.0)
165-
.text("Max width"),
166-
)
167-
.on_hover_text("Maximum width of the egui region of the web page.");
168-
if !ui.ctx().is_using_pointer() {
169-
self.max_size_points_active = self.max_size_points_ui;
170-
}
171154
}
172155

173156
show_integration_name(ui, &frame.info());

egui_demo_lib/src/wrap_app.rs

-4
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ impl epi::App for WrapApp {
6565
epi::set_value(storage, epi::APP_KEY, self);
6666
}
6767

68-
fn max_size_points(&self) -> egui::Vec2 {
69-
self.backend_panel.max_size_points_active
70-
}
71-
7268
fn clear_color(&self) -> egui::Rgba {
7369
egui::Rgba::TRANSPARENT // we set a `CentralPanel` fill color in `demo_windows.rs`
7470
}

egui_web/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ All notable changes to the `egui_web` integration will be noted in this file.
33

44

55
## Unreleased
6-
* egui code will no longer be called after panic ([#1306](https://github.com/emilk/egui/pull/1306))
6+
* egui code will no longer be called after panic ([#1306](https://github.com/emilk/egui/pull/1306)).
77
* Remove the "webgl" feature. `egui_web` now always use `glow` (which in turn wraps WebGL) ([#1356](https://github.com/emilk/egui/pull/1356)).
8+
* Use full browser width by default ([#1378](https://github.com/emilk/egui/pull/1378)).
89

910

1011
## 0.17.0 - 2022-02-22

egui_web/src/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
//! This library is an [`epi`] backend.
44
//!
55
//! If you are writing an app, you may want to look at [`eframe`](https://docs.rs/eframe) instead.
6-
//!
7-
//! ## Specifying the size of the egui canvas
8-
//! For performance reasons (on some browsers) the egui canvas does not, by default,
9-
//! fill the whole width of the browser.
10-
//! This can be changed by overriding [`epi::App::max_size_points`].
116
127
// Forbid warnings in release builds:
138
#![cfg_attr(not(debug_assertions), deny(warnings))]

epi/src/lib.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,12 @@ pub trait App {
176176

177177
/// The size limit of the web app canvas.
178178
///
179-
/// By default the size if limited to 1024x2048.
179+
/// By default the max size is [`egui::Vec2::INFINITY`], i.e. unlimited.
180180
///
181-
/// A larger canvas can lead to bad frame rates on some browsers on some platforms.
182-
/// In particular, Firefox on Mac and Linux is really bad at handling large WebGL canvases:
183-
/// <https://bugzilla.mozilla.org/show_bug.cgi?id=1010527#c0> (unfixed since 2014).
181+
/// A large canvas can lead to bad frame rates on some older browsers on some platforms
182+
/// (see <https://bugzilla.mozilla.org/show_bug.cgi?id=1010527#c0>).
184183
fn max_size_points(&self) -> egui::Vec2 {
185-
egui::Vec2::new(1024.0, 2048.0)
184+
egui::Vec2::INFINITY
186185
}
187186

188187
/// Background color for the app, e.g. what is sent to `gl.clearColor`.

0 commit comments

Comments
 (0)