Skip to content

Commit 8586d47

Browse files
authored
Update to latest egui/main (#11461)
More testing before next egui release. All the new changes: * emilk/egui@f6fe3bf...683214b I updated a bunch of dependencies in Rerun using `cargo upgrade`, thus actually changing their minimum version in `Cargo.toml`. That means there is a lot of updated 3rd party crates here too… for better or for worse. I can try to split those out in a separate PR… but it will be a lot of work methingks.
1 parent cfb69d9 commit 8586d47

File tree

17 files changed

+256
-288
lines changed

17 files changed

+256
-288
lines changed

Cargo.lock

Lines changed: 231 additions & 254 deletions
Large diffs are not rendered by default.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ gltf = "1.1"
252252
h264-reader = "0.8"
253253
half = { version = "2.3.1", features = ["bytemuck"] }
254254
hexasphere = "16.0.0"
255-
home = "=0.5.9"
255+
home = "0.5.9"
256256
http = "1.2.0"
257257
image = { version = "0.25", default-features = false }
258258
indent = "0.1"
@@ -397,8 +397,8 @@ walkdir = "2.0"
397397
# Do not make this an `=` dependency, because that may break Rust users’ builds when a newer
398398
# version is released, even if they are not building the web viewer.
399399
# For details see https://github.com/rerun-io/rerun/issues/8766
400-
wasm-bindgen = "0.2.100"
401-
wasm-bindgen-cli-support = "=0.2.100"
400+
wasm-bindgen = "0.2.104"
401+
wasm-bindgen-cli-support = "=0.2.104"
402402
wasm-bindgen-futures = "0.4.50"
403403
wayland-sys = "0.31.5"
404404
web-sys = "0.3"

crates/viewer/re_selection_panel/src/selection_panel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl SelectionPanel {
5555
ui: &mut egui::Ui,
5656
expanded: bool,
5757
) {
58-
let screen_width = ui.ctx().screen_rect().width();
58+
let screen_width = ui.ctx().content_rect().width();
5959

6060
let panel = egui::SidePanel::right("selection_view")
6161
.min_width(120.0)

crates/viewer/re_selection_panel/src/view_entity_picker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ impl ViewEntityPicker {
4242
egui_ctx,
4343
|| {
4444
re_ui::modal::ModalWrapper::new("Add/remove Entities")
45-
.min_height(f32::min(160.0, egui_ctx.screen_rect().height() * 0.8))
45+
.min_height(f32::min(160.0, egui_ctx.content_rect().height() * 0.8))
4646
.full_span_content(true)
4747
// we set the scroll area ourselves
4848
.set_side_margin(false)
4949
.scrollable([false, false])
5050
},
5151
|ui| {
5252
// 80%, never more than 500px
53-
ui.set_max_height(f32::min(ui.ctx().screen_rect().height() * 0.8, 500.0));
53+
ui.set_max_height(f32::min(ui.ctx().content_rect().height() * 0.8, 500.0));
5454
let Some(view_id) = &self.view_id else {
5555
ui.close();
5656
return;

crates/viewer/re_test_context/src/lib.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,12 @@ fn create_egui_renderstate() -> egui_wgpu::RenderState {
236236
};
237237

238238
let compatible_surface = None;
239-
// `re_renderer`'s individual views (managed each by a `ViewBuilder`) have MSAA,
240-
// but egui's final target doesn't - re_renderer resolves and copies into egui in `ViewBuilder::composite`.
241-
let msaa_samples = 1;
242-
// Similarly, depth is handled by re_renderer.
243-
let depth_format = None;
244-
// Disable dithering in order to not unnecessarily add a source of noise & variance between renderers.
245-
let dithering = false;
246239

247240
let render_state = pollster::block_on(egui_wgpu::RenderState::create(
248241
&config,
249242
&shared_wgpu_setup.instance,
250243
compatible_surface,
251-
depth_format,
252-
msaa_samples,
253-
dithering,
244+
egui_wgpu::RendererOptions::PREDICTABLE,
254245
))
255246
.expect("Failed to set up egui_wgpu::RenderState");
256247

crates/viewer/re_time_panel/src/time_panel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl TimePanel {
230230
panel_frame.inner_margin.right = 0;
231231
}
232232

233-
let window_height = ui.ctx().screen_rect().height();
233+
let window_height = ui.ctx().content_rect().height();
234234

235235
let id: egui::Id = self.source.into();
236236

crates/viewer/re_ui/src/command_palette.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl CommandPalette {
7373
return None;
7474
}
7575

76-
let screen_rect = egui_ctx.screen_rect();
76+
let screen_rect = egui_ctx.content_rect();
7777
let width = 300.0;
7878
let max_height = 320.0.at_most(screen_rect.height());
7979

crates/viewer/re_ui/src/context_ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub trait ContextExt {
162162
egui::SizeHint::Scale(1.0.ord()),
163163
) {
164164
let rect = Align2::RIGHT_BOTTOM
165-
.align_size_within_rect(texture.size, self.ctx().screen_rect())
165+
.align_size_within_rect(texture.size, self.ctx().content_rect())
166166
.translate(-Vec2::splat(16.0));
167167
let mut mesh = Mesh::with_texture(texture.id);
168168
let uv = Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0));

crates/viewer/re_ui/src/modal.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ impl ModalWrapper {
271271

272272
if self.scrollable.any() {
273273
// Make the modal size less jumpy and work around https://github.com/emilk/egui/issues/5138
274-
let max_height = 0.85 * ui.ctx().screen_rect().height();
275-
let min_height = 0.3 * ui.ctx().screen_rect().height().at_most(max_height);
274+
let max_height = 0.85 * ui.ctx().content_rect().height();
275+
let min_height = 0.3 * ui.ctx().content_rect().height().at_most(max_height);
276276

277277
egui::ScrollArea::new(self.scrollable)
278278
.min_scrolled_height(max_height)
@@ -358,7 +358,7 @@ pub fn prevent_shrinking(ui: &mut egui::Ui) {
358358
// The Uis response at this point will conveniently contain last frame's rect
359359
let last_rect = ui.response().rect;
360360

361-
let screen_size = ui.ctx().screen_rect().size();
361+
let screen_size = ui.ctx().content_rect().size();
362362

363363
let id = ui.id().with("prevent_shrinking");
364364
let screen_size_changed = ui.data_mut(|d| {

crates/viewer/re_ui/src/notifications.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl NotificationUi {
278278
.frame(ui.tokens().popup_frame(ui.style()))
279279
// Put the popup below the button, but all the way to the right of the screen:
280280
.anchor(egui::PopupAnchor::Position(egui::pos2(
281-
ui.ctx().screen_rect().right() - gap,
281+
ui.ctx().content_rect().right() - gap,
282282
ui.max_rect().bottom() + gap,
283283
)))
284284
.align(egui::RectAlign::BOTTOM_END)
@@ -309,7 +309,7 @@ impl NotificationUi {
309309
let notifications = &mut self.notifications;
310310

311311
let panel_width = 356.0;
312-
let panel_max_height = (ui.ctx().screen_rect().height() - 100.0)
312+
let panel_max_height = (ui.ctx().content_rect().height() - 100.0)
313313
.at_least(0.0)
314314
.at_most(640.0);
315315

0 commit comments

Comments
 (0)