mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 14:49:06 -04:00
Refactor: don't call ctx.global_style more than once
This commit is contained in:
@@ -475,11 +475,11 @@ impl Window<'_> {
|
||||
fade_out,
|
||||
} = self;
|
||||
|
||||
let header_color = frame.map_or_else(
|
||||
|| ctx.global_style().visuals.widgets.open.weak_bg_fill,
|
||||
|f| f.fill,
|
||||
);
|
||||
let mut window_frame = frame.unwrap_or_else(|| Frame::window(&ctx.global_style()));
|
||||
let style = ctx.global_style();
|
||||
|
||||
let header_color =
|
||||
frame.map_or_else(|| style.visuals.widgets.open.weak_bg_fill, |f| f.fill);
|
||||
let mut window_frame = frame.unwrap_or_else(|| Frame::window(&style));
|
||||
|
||||
let is_explicitly_closed = matches!(open, Some(false));
|
||||
let is_open = !is_explicitly_closed || ctx.memory(|mem| mem.everything_is_visible());
|
||||
@@ -511,7 +511,6 @@ impl Window<'_> {
|
||||
|
||||
// Calculate roughly how much larger the full window inner size is compared to the content rect
|
||||
let (title_bar_height_with_margin, title_content_spacing) = if with_title_bar {
|
||||
let style = ctx.global_style();
|
||||
let title_bar_inner_height = ctx
|
||||
.fonts_mut(|fonts| title.font_height(fonts, &style))
|
||||
.at_least(style.spacing.interact_size.y);
|
||||
@@ -987,8 +986,10 @@ fn do_resize_interaction(
|
||||
|
||||
let id = Id::new(layer_id).with("edge_drag");
|
||||
|
||||
let side_grab_radius = ctx.global_style().interaction.resize_grab_radius_side;
|
||||
let corner_grab_radius = ctx.global_style().interaction.resize_grab_radius_corner;
|
||||
let style = ctx.global_style();
|
||||
|
||||
let side_grab_radius = style.interaction.resize_grab_radius_side;
|
||||
let corner_grab_radius = style.interaction.resize_grab_radius_corner;
|
||||
|
||||
let vetrtical_rect = |a: Pos2, b: Pos2| {
|
||||
Rect::from_min_max(a, b).expand2(vec2(side_grab_radius, -corner_grab_radius))
|
||||
|
||||
Reference in New Issue
Block a user