Skip to content

Commit

Permalink
Update to latest egui
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 30, 2025
1 parent 6c534b2 commit cc1e687
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 43 deletions.
31 changes: 15 additions & 16 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]]
name = "ecolor"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"bytemuck",
"color-hex",
Expand All @@ -1974,7 +1974,7 @@ checksum = "18aade80d5e09429040243ce1143ddc08a92d7a22820ac512610410a4dd5214f"
[[package]]
name = "eframe"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"ahash",
"bytemuck",
Expand Down Expand Up @@ -2013,7 +2013,7 @@ dependencies = [
[[package]]
name = "egui"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"accesskit",
"ahash",
Expand All @@ -2031,7 +2031,7 @@ dependencies = [
[[package]]
name = "egui-wgpu"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -2050,7 +2050,7 @@ dependencies = [
[[package]]
name = "egui-winit"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"accesskit_winit",
"ahash",
Expand All @@ -2070,7 +2070,7 @@ dependencies = [
[[package]]
name = "egui_commonmark"
version = "0.19.0"
source = "git+https://github.com/rerun-io/egui_commonmark.git?branch=egui-update#d08ab5704b9cf6bd4234757c43b49e86c7f053c4"
source = "git+https://github.com/rerun-io/egui_commonmark.git?branch=egui-update#9d500ac65fea8273f8d26eb6f513dded86778389"
dependencies = [
"egui",
"egui_commonmark_backend",
Expand All @@ -2081,7 +2081,7 @@ dependencies = [
[[package]]
name = "egui_commonmark_backend"
version = "0.19.0"
source = "git+https://github.com/rerun-io/egui_commonmark.git?branch=egui-update#d08ab5704b9cf6bd4234757c43b49e86c7f053c4"
source = "git+https://github.com/rerun-io/egui_commonmark.git?branch=egui-update#9d500ac65fea8273f8d26eb6f513dded86778389"
dependencies = [
"egui",
"egui_extras",
Expand All @@ -2091,7 +2091,7 @@ dependencies = [
[[package]]
name = "egui_extras"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"ahash",
"egui",
Expand All @@ -2108,7 +2108,7 @@ dependencies = [
[[package]]
name = "egui_glow"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -2125,7 +2125,7 @@ dependencies = [
[[package]]
name = "egui_kittest"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"dify",
"eframe",
Expand All @@ -2140,7 +2140,7 @@ dependencies = [
[[package]]
name = "egui_plot"
version = "0.30.0"
source = "git+https://github.com/emilk/egui_plot.git?rev=80e2199a2e121db288fe6b0099d91c35acc75a7c#80e2199a2e121db288fe6b0099d91c35acc75a7c"
source = "git+https://github.com/emilk/egui_plot.git?branch=main#a19562ea60a13b276a1e96035c5600fb4932ce53"
dependencies = [
"ahash",
"egui",
Expand All @@ -2161,8 +2161,7 @@ dependencies = [
[[package]]
name = "egui_tiles"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "588dcf9028464fb4d23baf1f7805c13927fb540f2f9096f7d177b814848645a3"
source = "git+https://github.com/rerun-io/egui_tiles?branch=emilk/update-egui#4876446fd618c59571490c7a637043d569f2e531"
dependencies = [
"ahash",
"egui",
Expand Down Expand Up @@ -2196,7 +2195,7 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "emath"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"bytemuck",
"serde",
Expand Down Expand Up @@ -2312,7 +2311,7 @@ dependencies = [
[[package]]
name = "epaint"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"
dependencies = [
"ab_glyph",
"ahash",
Expand All @@ -2331,7 +2330,7 @@ dependencies = [
[[package]]
name = "epaint_default_fonts"
version = "0.30.0"
source = "git+https://github.com/emilk/egui.git?branch=master#83649f2e295a4c27ea08023b6e7f591d3e60ea7f"
source = "git+https://github.com/emilk/egui.git?branch=master#8eda32ec64c7b48c7b8f9195e3abc8c10efa8f00"

[[package]]
name = "equivalent"
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,10 @@ emath = { git = "https://github.com/emilk/egui.git", branch = "master" }
# egui-wgpu = { path = "../../egui/crates/egui-wgpu" }
# emath = { path = "../../egui/crates/emath" }

egui_plot = { git = "https://github.com/emilk/egui_plot.git", rev = "80e2199a2e121db288fe6b0099d91c35acc75a7c" }
egui_plot = { git = "https://github.com/emilk/egui_plot.git", branch = "main" }
# egui_plot = { path = "../../egui_plot/egui_plot" }

# egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "48e0ef566479000a23d8dabf84badced98f1b9a6" } # https://github.com/rerun-io/egui_tiles/pull/89 2024-11-19
egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", branch = "emilk/update-egui" }
#egui_tiles = { path = "../egui_tiles" }

egui_commonmark = { git = "https://github.com/rerun-io/egui_commonmark.git", branch = "egui-update" } # https://github.com/lampsitter/egui_commonmark/pull/71
Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_component_ui/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fn edit_rgba32_impl(ui: &mut egui::Ui, color: &mut MaybeMutRef<'_, Rgba32>) -> e
response.rect,
1.0,
ui.visuals().widgets.noninteractive.fg_stroke,
egui::StrokeKind::Inside,
);

let [r, g, b, a] = color.to_array();
Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_component_ui/src/marker_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub(crate) fn paint_marker(
.filled(true);

let bounds = egui_plot::PlotBounds::new_symmetrical(0.5);
let transform = egui_plot::PlotTransform::new(rect, bounds, [true, true].into());
let transform = egui_plot::PlotTransform::new(rect, bounds, true);

let mut shapes = vec![];
points.shapes(ui, &transform, &mut shapes);
Expand Down
3 changes: 1 addition & 2 deletions crates/viewer/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,11 +1235,10 @@ fn paint_range_highlight(
let visible_history_area_rect =
Rect::from_x_y_ranges(x_from..=x_to, rect.y_range()).intersect(rect);

painter.rect(
painter.rect_filled(
visible_history_area_rect,
0.0,
egui::Color32::WHITE.gamma_multiply(0.1),
egui::Stroke::NONE,
);
}
}
Expand Down
7 changes: 6 additions & 1 deletion crates/viewer/re_ui/src/list_item/list_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,12 @@ impl ListItem {
let stroke = crate::design_tokens().drop_target_container_stroke();
ui.painter().set(
background_frame,
Shape::rect_stroke(bg_rect_to_paint.shrink(stroke.width), 0.0, stroke),
Shape::rect_stroke(
bg_rect_to_paint.shrink(stroke.width),
0.0,
stroke,
egui::StrokeKind::Inside,
),
);
}

Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_ui/src/ui_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ pub trait UiExt {
visuals.rounding,
visuals.weak_bg_fill,
visuals.bg_stroke,
egui::StrokeKind::Inside,
);
}

Expand Down
9 changes: 7 additions & 2 deletions crates/viewer/re_view_graph/src/ui/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,13 @@ pub fn draw_entity_rect(

let padded = rect.expand(10.0);

ui.painter()
.rect(padded, 0.0, Color32::TRANSPARENT, Stroke::new(1.0, color));
ui.painter().rect(
padded,
0.0,
Color32::TRANSPARENT,
Stroke::new(1.0, color),
egui::StrokeKind::Inside,
);

ui.painter().text(
padded.left_top(),
Expand Down
22 changes: 19 additions & 3 deletions crates/viewer/re_view_spatial/src/picking_ui_pixel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,18 @@ fn show_zoomed_image_region_area_outline(
let sample_rect = Rect::from_min_max(pos2(left, top), pos2(right, bottom));
// TODO(emilk): use `parent_ui.painter()` and put it in a high Z layer, when https://github.com/emilk/egui/issues/1516 is done
let painter = egui_ctx.debug_painter().with_clip_rect(ui_clip_rect);
painter.rect_stroke(sample_rect, 0.0, (2.0, egui::Color32::BLACK));
painter.rect_stroke(sample_rect, 0.0, (1.0, egui::Color32::WHITE));
painter.rect_stroke(
sample_rect,
0.0,
(2.0, egui::Color32::BLACK),
egui::StrokeKind::Middle,
);
painter.rect_stroke(
sample_rect,
0.0,
(1.0, egui::Color32::WHITE),
egui::StrokeKind::Middle,
);
}

/// Identifies an image/texture interaction.
Expand Down Expand Up @@ -230,8 +240,14 @@ fn try_show_zoomed_image_region(
center_texel_rect.expand(1.0),
0.0,
(1.0, egui::Color32::BLACK),
egui::StrokeKind::Outside,
);
painter.rect_stroke(
center_texel_rect,
0.0,
(1.0, egui::Color32::WHITE),
egui::StrokeKind::Outside,
);
painter.rect_stroke(center_texel_rect, 0.0, (1.0, egui::Color32::WHITE));
}

let [x, y] = center_texel;
Expand Down
10 changes: 8 additions & 2 deletions crates/viewer/re_view_spatial/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,14 @@ pub fn create_labels(
};

label_shapes.push(
egui::epaint::RectShape::new(bg_rect.expand(4.0), 4.0, background_color, rect_stroke)
.into(),
egui::epaint::RectShape::new(
bg_rect.expand(4.0),
4.0,
background_color,
rect_stroke,
egui::StrokeKind::Outside,
)
.into(),
);
label_shapes.push(egui::Shape::galley(
text_rect.center_top(),
Expand Down
13 changes: 5 additions & 8 deletions crates/viewer/re_view_time_series/src/view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ Display time series data in a plot.
let time_zone_for_timestamps = ctx.app_options.time_zone;
let mut plot = Plot::new(plot_id_src)
.id(crate::plot_id(query.view_id))
.auto_bounds([true, false].into()) // Never use y auto bounds: we dictated bounds via blueprint under all circumstances.
.auto_bounds([true, false]) // Never use y auto bounds: we dictated bounds via blueprint under all circumstances.
.allow_zoom([true, !lock_y_during_zoom])
.x_axis_formatter(move |time, _| {
format_time(
Expand Down Expand Up @@ -436,13 +436,10 @@ Display time series data in a plot.
));

let current_auto = plot_ui.auto_bounds();
plot_ui.set_auto_bounds(
[
current_auto[0] || is_resetting,
is_resetting && !y_zoom_lock,
]
.into(),
);
plot_ui.set_auto_bounds([
current_auto[0] || is_resetting,
is_resetting && !y_zoom_lock,
]);

*state.scalar_range.start_mut() = f64::INFINITY;
*state.scalar_range.end_mut() = f64::NEG_INFINITY;
Expand Down
3 changes: 2 additions & 1 deletion crates/viewer/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2070,9 +2070,10 @@ fn paint_native_window_frame(egui_ctx: &egui::Context) {
);

painter.rect_stroke(
egui_ctx.screen_rect().shrink(0.5),
egui_ctx.screen_rect(),
re_ui::DesignTokens::native_window_rounding(),
re_ui::design_tokens().native_frame_stroke,
egui::StrokeKind::Inside,
);
}

Expand Down
8 changes: 3 additions & 5 deletions crates/viewer/re_viewport/src/viewport_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,9 @@ impl ViewportUi {
egui::LayerId::new(ui.layer_id().order, ui.id().with("child_id"));
ui.ctx().set_sublayer(ui.layer_id(), top_layer_id); // Make sure it is directly on top of the ui layer

// We need to shrink a bit so the panel-resize lines don't cover the highlight rectangle.
// This is hacky.
// We paint the stroke on the inside so the panel-resize lines don't cover the highlight rectangle.
let painter = ui.painter().clone().with_layer_id(top_layer_id);
painter.rect_stroke(rect.shrink(stroke.width), 0.0, stroke);
painter.rect_stroke(rect, 0.0, stroke, egui::StrokeKind::Inside);

if should_display_drop_destination_frame {
painter.rect_filled(
Expand Down Expand Up @@ -820,8 +819,7 @@ impl TabWidget {
}

fn paint(self, ui: &egui::Ui) {
ui.painter()
.rect(self.rect, 0.0, self.bg_color, egui::Stroke::NONE);
ui.painter().rect_filled(self.rect, 0.0, self.bg_color);

let icon_image = self
.icon
Expand Down

0 comments on commit cc1e687

Please sign in to comment.