From 835db5cba6b7d62f3af3bcc17c08aaf29a96e655 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 13 Oct 2025 00:01:34 +0200 Subject: [PATCH 01/30] style by widget --- crates/egui/src/lib.rs | 1 + crates/egui/src/style_trait.rs | 188 ++++++++++++++++++++++++++ crates/egui/src/widgets/button.rs | 55 ++++---- crates/egui/src/widgets/drag_value.rs | 13 +- 4 files changed, 224 insertions(+), 33 deletions(-) create mode 100644 crates/egui/src/style_trait.rs diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 960480b23..c0c68884a 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -434,6 +434,7 @@ mod plugin; pub mod response; mod sense; pub mod style; +pub mod style_trait; pub mod text_selection; mod ui; mod ui_builder; diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs new file mode 100644 index 000000000..079013649 --- /dev/null +++ b/crates/egui/src/style_trait.rs @@ -0,0 +1,188 @@ +use emath::Vec2; +use epaint::{Color32, FontId, Stroke}; + +use crate::{ + Frame, Response, Style, + style::{WidgetVisuals, Widgets}, +}; + +/// General text style +pub struct TextVisuals { + /// Font used + pub font_id: FontId, + /// Font color + pub color: Color32, +} + +/// General widget style +pub struct WidgetStyle { + pub frame: Frame, + + pub text: TextVisuals, + + pub stroke: Stroke, +} + +pub struct ButtonStyle { + pub frame: Frame, + pub text: TextVisuals, +} + +pub struct CheckboxStyle { + /// Frame around + pub frame: Frame, + /// Text next to it + pub text: TextVisuals, + /// Size + pub size: Vec2, + /// Frame of the checkbox itself + pub checkbox_frame: Frame, + /// Checkmark stroke + pub stroke: Stroke, +} + +pub struct DragValueStyle { + /// Frame around + pub frame: Frame, + /// Text of the value + pub text: TextVisuals, + pub min_size: Vec2, +} + +pub struct HyperlinkStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct ImageStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct LabelStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct RadioButtonStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct SeparatorStyle { + pub size: f32, + pub stroke: Stroke, +} + +pub struct SliderStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct SpinnerStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +#[derive(Default, Clone, Copy, Debug, PartialEq, Eq)] +pub enum WidgetState { + Noninteractive, + #[default] + Inactive, + Hovered, + Active, +} + +impl Widgets { + pub fn state(&self, state: WidgetState) -> &WidgetVisuals { + match state { + WidgetState::Noninteractive => &self.noninteractive, + WidgetState::Inactive => &self.inactive, + WidgetState::Hovered => &self.hovered, + WidgetState::Active => &self.active, + } + } +} + +impl Response { + pub fn widget_state(&self) -> WidgetState { + if !self.sense.interactive() { + WidgetState::Noninteractive + } else if self.is_pointer_button_down_on() || self.has_focus() || self.clicked() { + WidgetState::Active + } else if self.hovered() || self.highlighted() { + WidgetState::Hovered + } else { + WidgetState::Inactive + } + } +} + +impl Style { + pub fn widget_style(&self, state: WidgetState) -> WidgetStyle { + let visuals = self.visuals.widgets.state(state); + let font_id = self.override_font_id.clone(); + WidgetStyle { + frame: Frame { + fill: visuals.bg_fill, + stroke: visuals.bg_stroke, + corner_radius: visuals.corner_radius, + ..Default::default() + }, + stroke: visuals.fg_stroke, + text: TextVisuals { + color: visuals.fg_stroke.color, + font_id: font_id.unwrap_or(FontId::new(13.0, epaint::FontFamily::Proportional)), + }, + } + } + + pub fn button_style(&self, state: WidgetState) -> ButtonStyle { + let ws = self.widget_style(state); + ButtonStyle { + frame: ws.frame.inner_margin(self.spacing.button_padding), + text: ws.text, + } + } + + // pub fn checkbox_style(&self, state: WidgetState) -> CheckboxStylee {} + + // pub fn label_style(&self, state: WidgetState) -> LabelStyle {} + + pub fn drag_value_style(&self, state: WidgetState) -> DragValueStyle { + let ws = self.widget_style(state); + DragValueStyle { + frame: ws.frame.inner_margin(self.spacing.button_padding), + min_size: self.spacing.interact_size, + text: ws.text, + } + } + + // pub fn hyperlink_style(&self, state: WidgetState) -> HyperlinkStyle {} + + // pub fn image_style(&self, state: WidgetState) -> ImageStyle {} + + // pub fn slider_style(&self, state: WidgetState) -> SliderStyle {} + + // pub fn separator_style(&self, state: WidgetState) -> SeparatorStyle {} + + // pub fn spinner_style(&self, state: WidgetState) -> SpinnerStyle {} +} diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index af31b40af..00d438959 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,7 +1,9 @@ +use std::{mem, sync::Arc}; + use crate::{ Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Frame, - Image, IntoAtoms, NumExt as _, Response, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, - Widget, WidgetInfo, WidgetText, WidgetType, + Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, + Vec2, Widget, WidgetInfo, WidgetText, WidgetType, }; /// Clickable button with text. @@ -281,25 +283,30 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + + let style = ui.style().button_style(state); + let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); - let mut button_padding = if has_frame_margin { - ui.spacing().button_padding - } else { - Vec2::ZERO - }; - if small { - button_padding.y = 0.0; - } + layout.map_texts(|t| match t { + WidgetText::RichText(mut text) => { + let text_mut = Arc::make_mut(&mut text); + *text_mut = mem::take(text_mut).font(style.text.font_id.clone()); + WidgetText::RichText(text) + } + WidgetText::Text(text) => { + let rich_text = RichText::new(text.clone()).font(style.text.font_id.clone()); + WidgetText::RichText(Arc::new(rich_text)) + } + w => w, + }); - let mut prepared = layout - .frame(Frame::new().inner_margin(button_padding)) - .min_size(min_size) - .allocate(ui); + let mut prepared = layout.frame(style.frame).min_size(min_size).allocate(ui); let response = if ui.is_rect_visible(prepared.response.rect) { - let visuals = ui.style().interact_selectable(&prepared.response, selected); - let visible_frame = if frame_when_inactive { has_frame_margin } else { @@ -310,23 +317,13 @@ impl<'a> Button<'a> { }; if image_tint_follows_text_color { - prepared.map_images(|image| image.tint(visuals.text_color())); + prepared.map_images(|image| image.tint(style.text.color)); } - prepared.fallback_text_color = visuals.text_color(); + prepared.fallback_text_color = style.text.color; if visible_frame { - let stroke = stroke.unwrap_or(visuals.bg_stroke); - let fill = fill.unwrap_or(visuals.weak_bg_fill); - prepared.frame = prepared - .frame - .inner_margin( - button_padding + Vec2::splat(visuals.expansion) - Vec2::splat(stroke.width), - ) - .outer_margin(-Vec2::splat(visuals.expansion)) - .fill(fill) - .stroke(stroke) - .corner_radius(corner_radius.unwrap_or(visuals.corner_radius)); + prepared.frame = style.frame; } prepared.paint(ui) diff --git a/crates/egui/src/widgets/drag_value.rs b/crates/egui/src/widgets/drag_value.rs index 9515726c2..1c4caf995 100644 --- a/crates/egui/src/widgets/drag_value.rs +++ b/crates/egui/src/widgets/drag_value.rs @@ -4,7 +4,7 @@ use std::{cmp::Ordering, ops::RangeInclusive}; use crate::{ Button, CursorIcon, Id, Key, MINUS_CHAR_STR, Modifiers, NumExt as _, Response, RichText, Sense, - TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, text, + TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, grid::State, text, }; // ---------------------------------------------------------------------------- @@ -447,6 +447,10 @@ impl Widget for DragValue<'_> { let id = ui.next_auto_id(); let is_slow_speed = shift && ui.ctx().is_being_dragged(id); + let response = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().drag_value_style(state); + // The following ensures that when a `DragValue` receives focus, // it is immediately rendered in edit mode, rather than being rendered // in button mode for just one frame. This is important for @@ -560,13 +564,14 @@ impl Widget for DragValue<'_> { .clip_text(false) .horizontal_align(ui.layout().horizontal_align()) .vertical_align(ui.layout().vertical_align()) - .margin(ui.spacing().button_padding) - .min_size(ui.spacing().interact_size) + .margin(style.frame.inner_margin) + .min_size(style.min_size) .id(id) .desired_width( ui.spacing().interact_size.x - 2.0 * ui.spacing().button_padding.x, ) - .font(text_style), + .text_color(style.text.color) + .font(style.text.font_id), ); // Select all text when the edit gains focus. From a99adc6c9388ab9b2fb0b2678cf1304a15e866a6 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 13 Oct 2025 21:46:50 +0200 Subject: [PATCH 02/30] Finish button : retrocompatibility + comments --- crates/egui/src/widgets/button.rs | 38 +++++++++++-------------- examples/hello_world_simple/src/main.rs | 10 ++++++- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 00d438959..7a6f03e8a 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,9 +1,9 @@ use std::{mem, sync::Arc}; use crate::{ - Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Frame, - Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, - Vec2, Widget, WidgetInfo, WidgetText, WidgetType, + Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Image, + IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, + Widget, WidgetInfo, WidgetText, WidgetType, style_trait::WidgetState, }; /// Clickable button with text. @@ -255,18 +255,19 @@ impl<'a> Button<'a> { pub fn atom_ui(self, ui: &mut Ui) -> AtomLayoutResponse { let Button { mut layout, - fill, - stroke, + fill: _, + stroke: _, small, frame, frame_when_inactive, mut min_size, - corner_radius, - selected, + corner_radius: _, + selected: _, image_tint_follows_text_color, limit_image_size, } = self; + // Min size height always equal or greater than interact size if not small if !small { min_size.y = min_size.y.at_least(ui.spacing().interact_size.y); } @@ -283,14 +284,15 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); + // Get the widget style let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().button_style(state); let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); + // Apply the correct font on RichText and Text layout.map_texts(|t| match t { WidgetText::RichText(mut text) => { let text_mut = Arc::make_mut(&mut text); @@ -304,28 +306,22 @@ impl<'a> Button<'a> { w => w, }); - let mut prepared = layout.frame(style.frame).min_size(min_size).allocate(ui); - - let response = if ui.is_rect_visible(prepared.response.rect) { - let visible_frame = if frame_when_inactive { - has_frame_margin + // Retrocompatibility with button settings + let mut prepared = + if has_frame_margin && (frame_when_inactive || state != WidgetState::Inactive) { + layout.frame(style.frame).min_size(min_size).allocate(ui) } else { - has_frame_margin - && (prepared.response.hovered() - || prepared.response.is_pointer_button_down_on() - || prepared.response.has_focus()) + layout.min_size(min_size).allocate(ui) }; + // Get AtomLayoutResponse, empty if not visible + let response = if ui.is_rect_visible(prepared.response.rect) { if image_tint_follows_text_color { prepared.map_images(|image| image.tint(style.text.color)); } prepared.fallback_text_color = style.text.color; - if visible_frame { - prepared.frame = style.frame; - } - prepared.paint(ui) } else { AtomLayoutResponse::empty(prepared.response) diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 4fe49a89d..0514db692 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,7 +1,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use eframe::egui; +use eframe::egui::{self, Button}; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). @@ -27,6 +27,14 @@ fn main() -> eframe::Result { if ui.button("Increment").clicked() { age += 1; } + + ui.add(Button::new("no frame").frame(false)); + ui.add(Button::new("small").small()); + ui.add_enabled( + false, + Button::new("no frame inactive").frame_when_inactive(false), + ); + ui.label(format!("Hello '{name}', age {age}")); }); }) From ad4b0de2b371be6937a391e19ecada61a8f07f81 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Wed, 15 Oct 2025 15:35:03 +0200 Subject: [PATCH 03/30] fix some logic --- crates/egui/src/widgets/button.rs | 17 ++++++++--------- examples/hello_world_simple/src/main.rs | 7 +++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 7a6f03e8a..70505a999 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -284,23 +284,22 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); - // Get the widget style + // Get the widget style by reading the rect from the previous pass let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); let style = ui.style().button_style(state); + // let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); - // Apply the correct font on RichText and Text + // Apply the correct font and color if Text + // We assume that the other WidgetText have already a Fontid and color layout.map_texts(|t| match t { - WidgetText::RichText(mut text) => { - let text_mut = Arc::make_mut(&mut text); - *text_mut = mem::take(text_mut).font(style.text.font_id.clone()); - WidgetText::RichText(text) - } WidgetText::Text(text) => { - let rich_text = RichText::new(text.clone()).font(style.text.font_id.clone()); + let rich_text = RichText::new(text.clone()) + .font(style.text.font_id.clone()) + .color(style.text.color); WidgetText::RichText(Arc::new(rich_text)) } w => w, @@ -308,7 +307,7 @@ impl<'a> Button<'a> { // Retrocompatibility with button settings let mut prepared = - if has_frame_margin && (frame_when_inactive || state != WidgetState::Inactive) { + if has_frame_margin && (state != WidgetState::Inactive || frame_when_inactive) { layout.frame(style.frame).min_size(min_size).allocate(ui) } else { layout.min_size(min_size).allocate(ui) diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 0514db692..9a0d98d16 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -28,12 +28,11 @@ fn main() -> eframe::Result { age += 1; } + // Button test ui.add(Button::new("no frame").frame(false)); ui.add(Button::new("small").small()); - ui.add_enabled( - false, - Button::new("no frame inactive").frame_when_inactive(false), - ); + ui.add_enabled(false, Button::new("disabled")); + ui.add(Button::new("no frame inactive").frame_when_inactive(false)); ui.label(format!("Hello '{name}', age {age}")); }); From f66b5b599b0012890512f308a23d1c8c7e3f5aaa Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Wed, 15 Oct 2025 17:44:29 +0200 Subject: [PATCH 04/30] apply style to label --- crates/egui/src/style_trait.rs | 31 +++++++++---- crates/egui/src/widgets/button.rs | 1 - crates/egui/src/widgets/label.rs | 30 ++++++++++--- examples/hello_world_simple/src/main.rs | 59 ++++++++++++++++++------- 4 files changed, 92 insertions(+), 29 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index 079013649..375bb0480 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -1,8 +1,8 @@ use emath::Vec2; -use epaint::{Color32, FontId, Stroke}; +use epaint::{Color32, FontId, Shadow, Stroke, text::TextWrapMode}; use crate::{ - Frame, Response, Style, + Frame, Response, Style, TextStyle, style::{WidgetVisuals, Widgets}, }; @@ -66,11 +66,12 @@ pub struct ImageStyle { } pub struct LabelStyle { + /// Frame around pub frame: Frame, + /// Text style pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, + /// Wrap mode used + pub wrap_mode: TextWrapMode, } pub struct RadioButtonStyle { @@ -149,8 +150,8 @@ impl Style { }, stroke: visuals.fg_stroke, text: TextVisuals { - color: visuals.fg_stroke.color, - font_id: font_id.unwrap_or(FontId::new(13.0, epaint::FontFamily::Proportional)), + color: visuals.text_color(), + font_id: font_id.unwrap_or(TextStyle::Body.resolve(self)), }, } } @@ -165,7 +166,21 @@ impl Style { // pub fn checkbox_style(&self, state: WidgetState) -> CheckboxStylee {} - // pub fn label_style(&self, state: WidgetState) -> LabelStyle {} + pub fn label_style(&self, state: WidgetState) -> LabelStyle { + let ws = self.widget_style(state); + LabelStyle { + frame: Frame { + fill: ws.frame.fill, + inner_margin: 0.0.into(), + outer_margin: 0.0.into(), + stroke: Stroke::NONE, + shadow: Shadow::NONE, + corner_radius: 0.into(), + }, + text: ws.text, + wrap_mode: TextWrapMode::Wrap, + } + } pub fn drag_value_style(&self, state: WidgetState) -> DragValueStyle { let ws = self.widget_style(state); diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 70505a999..128429b00 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -290,7 +290,6 @@ impl<'a> Button<'a> { let state = response.map(|r| r.widget_state()).unwrap_or_default(); let style = ui.style().button_style(state); - // let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); // Apply the correct font and color if Text diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index 86259ab2a..8c4d77dd8 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -1,8 +1,9 @@ use std::sync::Arc; use crate::{ - Align, Direction, FontSelection, Galley, Pos2, Response, Sense, Stroke, TextWrapMode, Ui, - Widget, WidgetInfo, WidgetText, WidgetType, epaint, pos2, text_selection::LabelSelectionState, + Align, Direction, FontSelection, Frame, Galley, Pos2, Response, RichText, Sense, Stroke, + TextWrapMode, Ui, Widget, WidgetInfo, WidgetText, WidgetType, epaint, pos2, + text_selection::LabelSelectionState, }; /// Static text. @@ -179,10 +180,16 @@ impl Label { return (pos, galley, response); } + // Get the widget style by reading the rect from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().label_style(state); + let valign = ui.text_valign(); let mut layout_job = Arc::unwrap_or_clone(self.text.into_layout_job( ui.style(), - FontSelection::Default, + style.text.font_id.into(), // Use the style font valign, )); @@ -266,7 +273,7 @@ impl Label { } impl Widget for Label { - fn ui(self, ui: &mut Ui) -> Response { + fn ui(mut self, ui: &mut Ui) -> Response { // Interactive = the uses asked to sense interaction. // We DON'T want to have the color respond just because the text is selectable; // the cursor is enough to communicate that. @@ -275,6 +282,19 @@ impl Widget for Label { let selectable = self.selectable; let show_tooltip_when_elided = self.show_tooltip_when_elided; + // Get the widget style by reading the rect from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().label_style(state); + + // if let WidgetText::Text(text) = self.text { + // let rich_text = RichText::new(text) + // .font(style.text.font_id) + // .color(style.text.color); + // self.text = WidgetText::RichText(Arc::new(rich_text)); + // } + let (galley_pos, galley, mut response) = self.layout_in_ui(ui); response .widget_info(|| WidgetInfo::labeled(WidgetType::Label, ui.is_enabled(), galley.text())); @@ -292,7 +312,7 @@ impl Widget for Label { } let response_color = if interactive { - ui.style().interact(&response).text_color() + style.text.color } else { ui.style().visuals.text_color() }; diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 9a0d98d16..78bab8d98 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,7 +1,9 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use eframe::egui::{self, Button}; +use std::process::exit; + +use eframe::egui::{self, Color32, FontId, Label, RichText, Sense, Stroke, style::WidgetVisuals}; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). @@ -17,24 +19,51 @@ fn main() -> eframe::Result { eframe::run_simple_native("My egui App", options, move |ctx, _frame| { egui::CentralPanel::default().show(ctx, |ui| { - ui.heading("My egui Application"); - ui.horizontal(|ui| { - let name_label = ui.label("Your name: "); - ui.text_edit_singleline(&mut name) - .labelled_by(name_label.id); + ui.ctx().style_mut(|s| { + s.visuals.widgets.inactive = WidgetVisuals { + fg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), + ..s.visuals.widgets.inactive + }; + s.visuals.widgets.active = WidgetVisuals { + fg_stroke: Stroke::new(1.0, Color32::BLUE), + ..s.visuals.widgets.inactive + }; + s.visuals.widgets.hovered = WidgetVisuals { + fg_stroke: Stroke::new(1.0, Color32::YELLOW), + ..s.visuals.widgets.inactive + }; + s.visuals.widgets.noninteractive = WidgetVisuals { + fg_stroke: Stroke::new(1.0, Color32::RED), + ..s.visuals.widgets.inactive + }; }); - ui.add(egui::Slider::new(&mut age, 0..=120).text("age")); - if ui.button("Increment").clicked() { - age += 1; - } + + // ui.heading("My egui Application"); + // ui.horizontal(|ui| { + // let name_label = ui.label("Your name: "); + // ui.text_edit_singleline(&mut name) + // .labelled_by(name_label.id); + // }); + // ui.add(egui::Slider::new(&mut age, 0..=120).text("age")); + // if ui.button("Increment").clicked() { + // age += 1; + // } // Button test - ui.add(Button::new("no frame").frame(false)); - ui.add(Button::new("small").small()); - ui.add_enabled(false, Button::new("disabled")); - ui.add(Button::new("no frame inactive").frame_when_inactive(false)); + // ui.add(Button::new("no frame").frame(false)); + // ui.add(Button::new("small").small()); + // ui.add_enabled(false, Button::new("disabled")); + // ui.add(Button::new("no frame inactive").frame_when_inactive(false)); - ui.label(format!("Hello '{name}', age {age}")); + ui.label("Normal text"); + // Should not be affected by WidgetStyle + ui.label( + RichText::new("Unaffected by style") + .font(FontId::monospace(15.0)) + .color(Color32::KHAKI), + ); + + ui.add(Label::new("test").sense(Sense::click())) }); }) } From e39d8c43452dada8ee7bbe19a3170943e78f3e65 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Thu, 16 Oct 2025 13:22:09 +0200 Subject: [PATCH 05/30] Finish label --- crates/egui/src/style_trait.rs | 5 +++ crates/egui/src/widgets/button.rs | 2 +- crates/egui/src/widgets/label.rs | 39 ++++++++++-------------- examples/hello_world_simple/questions.md | 9 ++++++ examples/hello_world_simple/src/main.rs | 6 ++-- 5 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 examples/hello_world_simple/questions.md diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index 375bb0480..0dfa3d020 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -12,6 +12,9 @@ pub struct TextVisuals { pub font_id: FontId, /// Font color pub color: Color32, + /// Text decoration + pub underline: Stroke, + pub strikethrough: Stroke, } /// General widget style @@ -152,6 +155,8 @@ impl Style { text: TextVisuals { color: visuals.text_color(), font_id: font_id.unwrap_or(TextStyle::Body.resolve(self)), + strikethrough: Stroke::NONE, + underline: Stroke::NONE, }, } } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 128429b00..24ea33ab3 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,4 +1,4 @@ -use std::{mem, sync::Arc}; +use std::sync::Arc; use crate::{ Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Image, diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index 8c4d77dd8..a0805b7de 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -1,9 +1,8 @@ use std::sync::Arc; use crate::{ - Align, Direction, FontSelection, Frame, Galley, Pos2, Response, RichText, Sense, Stroke, - TextWrapMode, Ui, Widget, WidgetInfo, WidgetText, WidgetType, epaint, pos2, - text_selection::LabelSelectionState, + Align, Direction, Galley, Pos2, Response, Sense, TextWrapMode, Ui, Widget, WidgetInfo, + WidgetText, WidgetType, epaint, pos2, text_selection::LabelSelectionState, }; /// Static text. @@ -169,8 +168,8 @@ impl Label { sense |= select_sense; } + // If the user said "use this specific galley", then just use it: if let WidgetText::Galley(galley) = self.text { - // If the user said "use this specific galley", then just use it: let (rect, response) = ui.allocate_exact_size(galley.size(), sense); let pos = match galley.job.halign { Align::LEFT => rect.left_top(), @@ -189,7 +188,7 @@ impl Label { let valign = ui.text_valign(); let mut layout_job = Arc::unwrap_or_clone(self.text.into_layout_job( ui.style(), - style.text.font_id.into(), // Use the style font + style.text.font_id.into(), // Use the label style font valign, )); @@ -203,7 +202,6 @@ impl Label { { // On a wrapping horizontal layout we want text to start after the previous widget, // then continue on the line below! This will take some extra work: - let cursor = ui.cursor(); let first_row_indentation = available_width - ui.available_size_before_wrap().x; debug_assert!( @@ -273,7 +271,7 @@ impl Label { } impl Widget for Label { - fn ui(mut self, ui: &mut Ui) -> Response { + fn ui(self, ui: &mut Ui) -> Response { // Interactive = the uses asked to sense interaction. // We DON'T want to have the color respond just because the text is selectable; // the cursor is enough to communicate that. @@ -283,22 +281,16 @@ impl Widget for Label { let show_tooltip_when_elided = self.show_tooltip_when_elided; // Get the widget style by reading the rect from the previous pass - let id = ui.next_auto_id(); - let response: Option = ui.ctx().read_response(id); - let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().label_style(state); - - // if let WidgetText::Text(text) = self.text { - // let rich_text = RichText::new(text) - // .font(style.text.font_id) - // .color(style.text.color); - // self.text = WidgetText::RichText(Arc::new(rich_text)); - // } + // let id = ui.next_auto_id(); + // let response: Option = ui.ctx().read_response(id); let (galley_pos, galley, mut response) = self.layout_in_ui(ui); response .widget_info(|| WidgetInfo::labeled(WidgetType::Label, ui.is_enabled(), galley.text())); + let state = response.widget_state(); + let style = ui.style().label_style(state); + if ui.is_rect_visible(response.rect) { if show_tooltip_when_elided && galley.elided { // Keep the sections and text, but reset everything else (especially wrapping): @@ -317,11 +309,12 @@ impl Widget for Label { ui.style().visuals.text_color() }; - let underline = if response.has_focus() || response.highlighted() { - Stroke::new(1.0, response_color) - } else { - Stroke::NONE - }; + // let underline = if response.has_focus() || response.highlighted() { + // Stroke::new(1.0, response_color) + // } else { + // Stroke::NONE + // }; + let underline = style.text.underline; let selectable = selectable.unwrap_or_else(|| ui.style().interaction.selectable_labels); if selectable { diff --git a/examples/hello_world_simple/questions.md b/examples/hello_world_simple/questions.md new file mode 100644 index 000000000..a2afff1cf --- /dev/null +++ b/examples/hello_world_simple/questions.md @@ -0,0 +1,9 @@ +## Button + +- If hovering a button add a stroke, the ui shift. Maybe add the option to avoid this resize by making the frame smaller ? + +## Label + +- I understand checking if a sense has been set by the user, but why check if it's different than hover ? Is it for technical purpose or purely to avoid confusion with a link ? + +- Selecting the text while being underlined move the underline diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 78bab8d98..6798fada6 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -25,7 +25,7 @@ fn main() -> eframe::Result { ..s.visuals.widgets.inactive }; s.visuals.widgets.active = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::BLUE), + fg_stroke: Stroke::new(1.0, Color32::LIGHT_BLUE), ..s.visuals.widgets.inactive }; s.visuals.widgets.hovered = WidgetVisuals { @@ -63,7 +63,9 @@ fn main() -> eframe::Result { .color(Color32::KHAKI), ); - ui.add(Label::new("test").sense(Sense::click())) + ui.add(Label::new("interaction click").sense(Sense::click())); + ui.add(Label::new("focusable").sense(Sense::focusable_noninteractive())) + .request_focus(); }); }) } From 1e346da8749a35ace4d6a70a5a3e0d0bae6332a4 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Thu, 16 Oct 2025 17:11:51 +0200 Subject: [PATCH 06/30] CheckboxStyle --- crates/egui/src/style_trait.rs | 25 +++++++++++++-- crates/egui/src/widgets/checkbox.rs | 29 ++++++++++------- examples/hello_world_simple/questions.md | 10 ++++++ examples/hello_world_simple/src/main.rs | 40 +++++++++++++++--------- 4 files changed, 76 insertions(+), 28 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index 0dfa3d020..cacf5ebe3 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -36,8 +36,10 @@ pub struct CheckboxStyle { pub frame: Frame, /// Text next to it pub text: TextVisuals, - /// Size - pub size: Vec2, + /// Box size + pub size: f32, + /// Check size + pub check_size: f32, /// Frame of the checkbox itself pub checkbox_frame: Frame, /// Checkmark stroke @@ -149,6 +151,7 @@ impl Style { fill: visuals.bg_fill, stroke: visuals.bg_stroke, corner_radius: visuals.corner_radius, + inner_margin: self.spacing.button_padding.into(), ..Default::default() }, stroke: visuals.fg_stroke, @@ -169,7 +172,23 @@ impl Style { } } - // pub fn checkbox_style(&self, state: WidgetState) -> CheckboxStylee {} + pub fn checkbox_style(&self, state: WidgetState) -> CheckboxStyle { + let visuals = self.visuals.widgets.state(state); + let ws = self.widget_style(state); + CheckboxStyle { + frame: ws.frame.fill(Color32::TRANSPARENT), + size: self.spacing.icon_width, + check_size: self.spacing.icon_width_inner, + checkbox_frame: Frame { + fill: visuals.weak_bg_fill, + corner_radius: visuals.corner_radius, + stroke: visuals.bg_stroke, + ..Default::default() + }, + text: ws.text, + stroke: ws.stroke, + } + } pub fn label_style(&self, state: WidgetState) -> LabelStyle { let ws = self.widget_style(state); diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index c90cca292..598fc15e0 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -55,10 +55,17 @@ impl Widget for Checkbox<'_> { indeterminate, } = self; - let spacing = &ui.spacing(); - let icon_width = spacing.icon_width; + // Get the widget style by reading the rect from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().checkbox_style(state); - let mut min_size = Vec2::splat(spacing.interact_size.y); + let icon_width = style.size; + + // interact_size or size ? + // let mut min_size = Vec2::splat(ui.spacing().interact_size.y); + let mut min_size = Vec2::splat(style.size); min_size.y = min_size.y.at_least(icon_width); // In order to center the checkbox based on min_size we set the icon height to at least min_size.y @@ -72,6 +79,7 @@ impl Widget for Checkbox<'_> { let mut prepared = AtomLayout::new(atoms) .sense(Sense::click()) .min_size(min_size) + .frame(style.frame) .allocate(ui); if prepared.response.clicked() { @@ -97,17 +105,16 @@ impl Widget for Checkbox<'_> { if ui.is_rect_visible(prepared.response.rect) { // let visuals = ui.style().interact_selectable(&response, *checked); // too colorful - let visuals = *ui.style().interact(&prepared.response); - prepared.fallback_text_color = visuals.text_color(); + prepared.fallback_text_color = style.text.color; let response = prepared.paint(ui); if let Some(rect) = response.rect(rect_id) { let (small_icon_rect, big_icon_rect) = ui.spacing().icon_rectangles(rect); ui.painter().add(epaint::RectShape::new( - big_icon_rect.expand(visuals.expansion), - visuals.corner_radius, - visuals.bg_fill, - visuals.bg_stroke, + big_icon_rect, + style.checkbox_frame.corner_radius, + style.checkbox_frame.fill, + style.checkbox_frame.stroke, epaint::StrokeKind::Inside, )); @@ -116,7 +123,7 @@ impl Widget for Checkbox<'_> { ui.painter().add(Shape::hline( small_icon_rect.x_range(), small_icon_rect.center().y, - visuals.fg_stroke, + style.stroke, )); } else if *checked { // Check mark: @@ -126,7 +133,7 @@ impl Widget for Checkbox<'_> { pos2(small_icon_rect.center().x, small_icon_rect.bottom()), pos2(small_icon_rect.right(), small_icon_rect.top()), ], - visuals.fg_stroke, + style.stroke, )); } } diff --git a/examples/hello_world_simple/questions.md b/examples/hello_world_simple/questions.md index a2afff1cf..85e5d713f 100644 --- a/examples/hello_world_simple/questions.md +++ b/examples/hello_world_simple/questions.md @@ -1,3 +1,7 @@ +## General + +- Interact size is great, but it SHOULD or MUST be at least this size ? Maybe add a parameter for this choice ? + ## Button - If hovering a button add a stroke, the ui shift. Maybe add the option to avoid this resize by making the frame smaller ? @@ -7,3 +11,9 @@ - I understand checking if a sense has been set by the user, but why check if it's different than hover ? Is it for technical purpose or purely to avoid confusion with a link ? - Selecting the text while being underlined move the underline + +## Checkbox + +- Checkbox are in fact a label and a check box. To propagate the CheckBoxStyle to the label we need to use a scope or something similar and change the global style. Why bind label to the check box, the user can add it himself (To keep the great prototyping speed we could keep this behavior in a Ui method, that would just merge) + +- Propose different type of checkmark ? (eg. small square, dot, filled, custom, etc) diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 6798fada6..8f3da8a44 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,9 +1,10 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use std::process::exit; - -use eframe::egui::{self, Color32, FontId, Label, RichText, Sense, Stroke, style::WidgetVisuals}; +use eframe::egui::{ + self, Atom, Checkbox, Color32, FontId, Label, RichText, Sense, Stroke, style::WidgetVisuals, + vec2, +}; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). @@ -16,12 +17,18 @@ fn main() -> eframe::Result { // Our application state: let mut name = "Arthur".to_owned(); let mut age = 42; + let mut is_adult = age >= 18; eframe::run_simple_native("My egui App", options, move |ctx, _frame| { egui::CentralPanel::default().show(ctx, |ui| { ui.ctx().style_mut(|s| { + s.spacing.icon_width_inner = 8.0; + s.spacing.icon_width = 15.0; + s.spacing.button_padding = vec2(5.0, 5.0); + // s.spacing.interact_size.y = 30.0; s.visuals.widgets.inactive = WidgetVisuals { fg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), + bg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), ..s.visuals.widgets.inactive }; s.visuals.widgets.active = WidgetVisuals { @@ -29,7 +36,7 @@ fn main() -> eframe::Result { ..s.visuals.widgets.inactive }; s.visuals.widgets.hovered = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::YELLOW), + fg_stroke: Stroke::new(3.0, Color32::LIGHT_YELLOW), ..s.visuals.widgets.inactive }; s.visuals.widgets.noninteractive = WidgetVisuals { @@ -55,17 +62,22 @@ fn main() -> eframe::Result { // ui.add_enabled(false, Button::new("disabled")); // ui.add(Button::new("no frame inactive").frame_when_inactive(false)); - ui.label("Normal text"); - // Should not be affected by WidgetStyle - ui.label( - RichText::new("Unaffected by style") - .font(FontId::monospace(15.0)) - .color(Color32::KHAKI), - ); + // ui.label("Normal text"); + // // Should not be affected by WidgetStyle + // ui.label( + // RichText::new("Unaffected by style") + // .font(FontId::monospace(15.0)) + // .color(Color32::KHAKI), + // ); - ui.add(Label::new("interaction click").sense(Sense::click())); - ui.add(Label::new("focusable").sense(Sense::focusable_noninteractive())) - .request_focus(); + // ui.add(Label::new("interaction click").sense(Sense::click())); + // ui.add(Label::new("focusable").sense(Sense::focusable_noninteractive())) + // .request_focus(); + + ui.add(Checkbox::new(&mut is_adult, "test")); + ui.add(Checkbox::new(&mut is_adult, "test")); + ui.add(Checkbox::new(&mut is_adult, Atom::default())); + ui.add(Checkbox::new(&mut is_adult, Atom::default()).indeterminate(true)); }); }) } From b18070caefca9ca39b9484962eb2665d794604da Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Tue, 21 Oct 2025 10:42:42 +0200 Subject: [PATCH 07/30] checkbox & cleanup --- crates/egui/src/style_trait.rs | 78 ++++--------------------- crates/egui/src/widgets/button.rs | 2 +- crates/egui/src/widgets/checkbox.rs | 12 +++- crates/egui/src/widgets/drag_value.rs | 13 ++--- crates/egui/src/widgets/label.rs | 11 +--- crates/egui/src/widgets/separator.rs | 15 ++++- examples/hello_world_simple/src/main.rs | 72 ++++------------------- 7 files changed, 50 insertions(+), 153 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index cacf5ebe3..ecb7b8fbd 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -1,4 +1,3 @@ -use emath::Vec2; use epaint::{Color32, FontId, Shadow, Stroke, text::TextWrapMode}; use crate::{ @@ -36,9 +35,9 @@ pub struct CheckboxStyle { pub frame: Frame, /// Text next to it pub text: TextVisuals, - /// Box size + /// Checkbox size pub size: f32, - /// Check size + /// Checkmark size pub check_size: f32, /// Frame of the checkbox itself pub checkbox_frame: Frame, @@ -46,30 +45,6 @@ pub struct CheckboxStyle { pub stroke: Stroke, } -pub struct DragValueStyle { - /// Frame around - pub frame: Frame, - /// Text of the value - pub text: TextVisuals, - pub min_size: Vec2, -} - -pub struct HyperlinkStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, -} - -pub struct ImageStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, -} - pub struct LabelStyle { /// Frame around pub frame: Frame, @@ -79,32 +54,10 @@ pub struct LabelStyle { pub wrap_mode: TextWrapMode, } -pub struct RadioButtonStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, -} - pub struct SeparatorStyle { - pub size: f32, - pub stroke: Stroke, -} - -pub struct SliderStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, -} - -pub struct SpinnerStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, + /// How much space is allocated in the layout direction + pub spacing: f32, + /// How to paint it pub stroke: Stroke, } @@ -206,22 +159,11 @@ impl Style { } } - pub fn drag_value_style(&self, state: WidgetState) -> DragValueStyle { - let ws = self.widget_style(state); - DragValueStyle { - frame: ws.frame.inner_margin(self.spacing.button_padding), - min_size: self.spacing.interact_size, - text: ws.text, + pub fn separator_style(&self, state: WidgetState) -> SeparatorStyle { + let visuals = self.visuals.widgets.state(state); + SeparatorStyle { + spacing: 0.0, + stroke: visuals.fg_stroke, } } - - // pub fn hyperlink_style(&self, state: WidgetState) -> HyperlinkStyle {} - - // pub fn image_style(&self, state: WidgetState) -> ImageStyle {} - - // pub fn slider_style(&self, state: WidgetState) -> SliderStyle {} - - // pub fn separator_style(&self, state: WidgetState) -> SeparatorStyle {} - - // pub fn spinner_style(&self, state: WidgetState) -> SpinnerStyle {} } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 24ea33ab3..6b5e77b5f 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -284,7 +284,7 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); - // Get the widget style by reading the rect from the previous pass + // Get the widget style by reading the response from the previous pass let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index 598fc15e0..d8458eeb1 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -1,3 +1,5 @@ +use emath::Rect; + use crate::{ Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Shape, Ui, Vec2, Widget, WidgetInfo, WidgetType, epaint, pos2, @@ -55,7 +57,7 @@ impl Widget for Checkbox<'_> { indeterminate, } = self; - // Get the widget style by reading the rect from the previous pass + // Get the widget style by reading the response from the previous pass let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); @@ -109,7 +111,13 @@ impl Widget for Checkbox<'_> { let response = prepared.paint(ui); if let Some(rect) = response.rect(rect_id) { - let (small_icon_rect, big_icon_rect) = ui.spacing().icon_rectangles(rect); + let big_icon_rect = Rect::from_center_size( + pos2(rect.left() + icon_width / 2.0, rect.center().y), + Vec2::splat(style.size), + ); + let small_icon_rect = + Rect::from_center_size(big_icon_rect.center(), Vec2::splat(style.check_size)); + ui.painter().add(epaint::RectShape::new( big_icon_rect, style.checkbox_frame.corner_radius, diff --git a/crates/egui/src/widgets/drag_value.rs b/crates/egui/src/widgets/drag_value.rs index 1c4caf995..9515726c2 100644 --- a/crates/egui/src/widgets/drag_value.rs +++ b/crates/egui/src/widgets/drag_value.rs @@ -4,7 +4,7 @@ use std::{cmp::Ordering, ops::RangeInclusive}; use crate::{ Button, CursorIcon, Id, Key, MINUS_CHAR_STR, Modifiers, NumExt as _, Response, RichText, Sense, - TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, grid::State, text, + TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, text, }; // ---------------------------------------------------------------------------- @@ -447,10 +447,6 @@ impl Widget for DragValue<'_> { let id = ui.next_auto_id(); let is_slow_speed = shift && ui.ctx().is_being_dragged(id); - let response = ui.ctx().read_response(id); - let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().drag_value_style(state); - // The following ensures that when a `DragValue` receives focus, // it is immediately rendered in edit mode, rather than being rendered // in button mode for just one frame. This is important for @@ -564,14 +560,13 @@ impl Widget for DragValue<'_> { .clip_text(false) .horizontal_align(ui.layout().horizontal_align()) .vertical_align(ui.layout().vertical_align()) - .margin(style.frame.inner_margin) - .min_size(style.min_size) + .margin(ui.spacing().button_padding) + .min_size(ui.spacing().interact_size) .id(id) .desired_width( ui.spacing().interact_size.x - 2.0 * ui.spacing().button_padding.x, ) - .text_color(style.text.color) - .font(style.text.font_id), + .font(text_style), ); // Select all text when the edit gains focus. diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index a0805b7de..bd0d347fe 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -179,7 +179,7 @@ impl Label { return (pos, galley, response); } - // Get the widget style by reading the rect from the previous pass + // Get the widget style by reading the response from the previous pass let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); @@ -280,10 +280,6 @@ impl Widget for Label { let selectable = self.selectable; let show_tooltip_when_elided = self.show_tooltip_when_elided; - // Get the widget style by reading the rect from the previous pass - // let id = ui.next_auto_id(); - // let response: Option = ui.ctx().read_response(id); - let (galley_pos, galley, mut response) = self.layout_in_ui(ui); response .widget_info(|| WidgetInfo::labeled(WidgetType::Label, ui.is_enabled(), galley.text())); @@ -309,11 +305,6 @@ impl Widget for Label { ui.style().visuals.text_color() }; - // let underline = if response.has_focus() || response.highlighted() { - // Stroke::new(1.0, response_color) - // } else { - // Stroke::NONE - // }; let underline = style.text.underline; let selectable = selectable.unwrap_or_else(|| ui.style().interaction.selectable_labels); diff --git a/crates/egui/src/widgets/separator.rs b/crates/egui/src/widgets/separator.rs index 6fdd03b96..f130d9272 100644 --- a/crates/egui/src/widgets/separator.rs +++ b/crates/egui/src/widgets/separator.rs @@ -88,11 +88,22 @@ impl Separator { impl Widget for Separator { fn ui(self, ui: &mut Ui) -> Response { let Self { - spacing, + mut spacing, grow, is_horizontal_line, } = self; + // Get the widget style by reading the response from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().separator_style(state); + + // override the spacing if not set + if spacing == 0.0 && style.spacing != 0.0 { + spacing = style.spacing; + } + let is_horizontal_line = is_horizontal_line .unwrap_or_else(|| ui.is_grid() || !ui.layout().main_dir().is_horizontal()); @@ -111,7 +122,7 @@ impl Widget for Separator { let (rect, response) = ui.allocate_at_least(size, Sense::hover()); if ui.is_rect_visible(response.rect) { - let stroke = ui.visuals().widgets.noninteractive.bg_stroke; + let stroke = style.stroke; let painter = ui.painter(); if is_horizontal_line { painter.hline( diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 8f3da8a44..4fe49a89d 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,10 +1,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use eframe::egui::{ - self, Atom, Checkbox, Color32, FontId, Label, RichText, Sense, Stroke, style::WidgetVisuals, - vec2, -}; +use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). @@ -17,67 +14,20 @@ fn main() -> eframe::Result { // Our application state: let mut name = "Arthur".to_owned(); let mut age = 42; - let mut is_adult = age >= 18; eframe::run_simple_native("My egui App", options, move |ctx, _frame| { egui::CentralPanel::default().show(ctx, |ui| { - ui.ctx().style_mut(|s| { - s.spacing.icon_width_inner = 8.0; - s.spacing.icon_width = 15.0; - s.spacing.button_padding = vec2(5.0, 5.0); - // s.spacing.interact_size.y = 30.0; - s.visuals.widgets.inactive = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), - bg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), - ..s.visuals.widgets.inactive - }; - s.visuals.widgets.active = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::LIGHT_BLUE), - ..s.visuals.widgets.inactive - }; - s.visuals.widgets.hovered = WidgetVisuals { - fg_stroke: Stroke::new(3.0, Color32::LIGHT_YELLOW), - ..s.visuals.widgets.inactive - }; - s.visuals.widgets.noninteractive = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::RED), - ..s.visuals.widgets.inactive - }; + ui.heading("My egui Application"); + ui.horizontal(|ui| { + let name_label = ui.label("Your name: "); + ui.text_edit_singleline(&mut name) + .labelled_by(name_label.id); }); - - // ui.heading("My egui Application"); - // ui.horizontal(|ui| { - // let name_label = ui.label("Your name: "); - // ui.text_edit_singleline(&mut name) - // .labelled_by(name_label.id); - // }); - // ui.add(egui::Slider::new(&mut age, 0..=120).text("age")); - // if ui.button("Increment").clicked() { - // age += 1; - // } - - // Button test - // ui.add(Button::new("no frame").frame(false)); - // ui.add(Button::new("small").small()); - // ui.add_enabled(false, Button::new("disabled")); - // ui.add(Button::new("no frame inactive").frame_when_inactive(false)); - - // ui.label("Normal text"); - // // Should not be affected by WidgetStyle - // ui.label( - // RichText::new("Unaffected by style") - // .font(FontId::monospace(15.0)) - // .color(Color32::KHAKI), - // ); - - // ui.add(Label::new("interaction click").sense(Sense::click())); - // ui.add(Label::new("focusable").sense(Sense::focusable_noninteractive())) - // .request_focus(); - - ui.add(Checkbox::new(&mut is_adult, "test")); - ui.add(Checkbox::new(&mut is_adult, "test")); - ui.add(Checkbox::new(&mut is_adult, Atom::default())); - ui.add(Checkbox::new(&mut is_adult, Atom::default()).indeterminate(true)); + ui.add(egui::Slider::new(&mut age, 0..=120).text("age")); + if ui.button("Increment").clicked() { + age += 1; + } + ui.label(format!("Hello '{name}', age {age}")); }); }) } From 51c6c42f0e15d96ff8c78cb45af801a4db525bc2 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Tue, 21 Oct 2025 11:06:39 +0200 Subject: [PATCH 08/30] Button resize fix + Margin i8 -> i16 --- crates/egui/src/style.rs | 4 +-- crates/egui/src/widgets/button.rs | 55 ++++++++++++++++++++++++++----- crates/epaint/src/margin.rs | 42 +++++++++++------------ 3 files changed, 69 insertions(+), 32 deletions(-) diff --git a/crates/egui/src/style.rs b/crates/egui/src/style.rs index 454fc6d89..0bee9bd73 100644 --- a/crates/egui/src/style.rs +++ b/crates/egui/src/style.rs @@ -2600,8 +2600,8 @@ impl Widget for &mut Margin { } else { // Make sure it is not same: if self.is_same() { - if self.right == i8::MAX { - self.right = i8::MAX - 1; + if self.right == i16::MAX { + self.right = i16::MAX - 1; } else { self.right += 1; } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 6b5e77b5f..e20a09bbc 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,5 +1,7 @@ use std::sync::Arc; +use epaint::Margin; + use crate::{ Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, @@ -255,14 +257,14 @@ impl<'a> Button<'a> { pub fn atom_ui(self, ui: &mut Ui) -> AtomLayoutResponse { let Button { mut layout, - fill: _, - stroke: _, + fill, + stroke, small, frame, frame_when_inactive, mut min_size, - corner_radius: _, - selected: _, + corner_radius, + selected, image_tint_follows_text_color, limit_image_size, } = self; @@ -284,14 +286,49 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); - // Get the widget style by reading the response from the previous pass - let id = ui.next_auto_id(); - let response: Option = ui.ctx().read_response(id); - let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let state = if selected { + // If selected is true then the state is active + WidgetState::Active + } else { + // Get the widget state by reading the response from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + response.map(|r| r.widget_state()).unwrap_or_default() + }; + let style = ui.style().button_style(state); let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); + let mut button_padding = if has_frame_margin { + style.frame.inner_margin + } else { + Margin::ZERO + }; + if small { + button_padding.bottom = 0; + button_padding.top = 0; + } + + // Override global style by local style + let mut frame = style.frame; + if let Some(fill) = fill { + frame = frame.fill(fill); + } + if let Some(corner_radius) = corner_radius { + frame = frame.corner_radius(corner_radius); + } + if let Some(stroke) = stroke { + frame = frame.stroke(stroke); + } + + frame = frame.inner_margin(Margin { + left: button_padding.left - frame.stroke.width as i16, + top: button_padding.top - frame.stroke.width as i16, + right: button_padding.right - frame.stroke.width as i16, + bottom: button_padding.bottom - frame.stroke.width as i16, + }); + // Apply the correct font and color if Text // We assume that the other WidgetText have already a Fontid and color layout.map_texts(|t| match t { @@ -307,7 +344,7 @@ impl<'a> Button<'a> { // Retrocompatibility with button settings let mut prepared = if has_frame_margin && (state != WidgetState::Inactive || frame_when_inactive) { - layout.frame(style.frame).min_size(min_size).allocate(ui) + layout.frame(frame).min_size(min_size).allocate(ui) } else { layout.min_size(min_size).allocate(ui) }; diff --git a/crates/epaint/src/margin.rs b/crates/epaint/src/margin.rs index e6f6d2287..66402a7ba 100644 --- a/crates/epaint/src/margin.rs +++ b/crates/epaint/src/margin.rs @@ -8,15 +8,15 @@ use emath::{Rect, Vec2, vec2}; /// Negative margins are possible, but may produce weird behavior. /// Use with care. /// -/// All values are stored as [`i8`] to keep the size of [`Margin`] small. +/// All values are stored as [`i16`] to keep the size of [`Margin`] small. /// If you want floats, use [`crate::MarginF32`] instead. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Margin { - pub left: i8, - pub right: i8, - pub top: i8, - pub bottom: i8, + pub left: i16, + pub right: i16, + pub top: i16, + pub bottom: i16, } impl Margin { @@ -30,7 +30,7 @@ impl Margin { /// The same margin on every side. #[doc(alias = "symmetric")] #[inline] - pub const fn same(margin: i8) -> Self { + pub const fn same(margin: i16) -> Self { Self { left: margin, right: margin, @@ -41,7 +41,7 @@ impl Margin { /// Margins with the same size on opposing sides #[inline] - pub const fn symmetric(x: i8, y: i8) -> Self { + pub const fn symmetric(x: i16, y: i16) -> Self { Self { left: x, right: x, @@ -98,9 +98,9 @@ impl Margin { } } -impl From for Margin { +impl From for Margin { #[inline] - fn from(v: i8) -> Self { + fn from(v: i16) -> Self { Self::same(v) } } @@ -134,12 +134,12 @@ impl std::ops::Add for Margin { } } -/// `Margin + i8` -impl std::ops::Add for Margin { +/// `Margin + i16` +impl std::ops::Add for Margin { type Output = Self; #[inline] - fn add(self, v: i8) -> Self { + fn add(self, v: i16) -> Self { Self { left: self.left.saturating_add(v), right: self.right.saturating_add(v), @@ -149,10 +149,10 @@ impl std::ops::Add for Margin { } } -/// `Margin += i8` -impl std::ops::AddAssign for Margin { +/// `Margin += i16` +impl std::ops::AddAssign for Margin { #[inline] - fn add_assign(&mut self, v: i8) { + fn add_assign(&mut self, v: i16) { *self = *self + v; } } @@ -214,12 +214,12 @@ impl std::ops::Sub for Margin { } } -/// `Margin - i8` -impl std::ops::Sub for Margin { +/// `Margin - i16` +impl std::ops::Sub for Margin { type Output = Self; #[inline] - fn sub(self, v: i8) -> Self { + fn sub(self, v: i16) -> Self { Self { left: self.left.saturating_sub(v), right: self.right.saturating_sub(v), @@ -229,10 +229,10 @@ impl std::ops::Sub for Margin { } } -/// `Margin -= i8` -impl std::ops::SubAssign for Margin { +/// `Margin -= i16` +impl std::ops::SubAssign for Margin { #[inline] - fn sub_assign(&mut self, v: i8) { + fn sub_assign(&mut self, v: i16) { *self = *self - v; } } From f97ade3d7b86d21e2d364039bf5179361469aea1 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Fri, 7 Nov 2025 11:11:07 +0100 Subject: [PATCH 09/30] check passed --- .gitignore | 1 + crates/egui/src/style.rs | 4 +- crates/egui/src/style_trait.rs | 10 ++ crates/egui/src/widgets/button.rs | 8 +- .../egui_demo_app/tests/snapshots/clock.png | 4 +- .../tests/snapshots/custom3d.png | 4 +- .../tests/snapshots/easymarkeditor.png | 4 +- .../tests/snapshots/imageviewer.png | 4 +- .../tests/snapshots/demos/Clipboard Test.png | 4 +- .../tests/snapshots/demos/Code Example.png | 4 +- .../tests/snapshots/demos/Dancing Strings.png | 4 +- .../tests/snapshots/demos/Font Book.png | 4 +- .../tests/snapshots/demos/Frame.png | 4 +- .../tests/snapshots/demos/Grid Test.png | 4 +- .../snapshots/demos/Input Event History.png | 4 +- .../tests/snapshots/demos/Input Test.png | 4 +- .../tests/snapshots/demos/Layout Test.png | 4 +- .../tests/snapshots/demos/Multi Touch.png | 4 +- .../tests/snapshots/demos/Painting.png | 4 +- .../tests/snapshots/demos/Panels.png | 4 +- .../tests/snapshots/demos/Popups.png | 4 +- .../tests/snapshots/demos/Scene.png | 4 +- .../tests/snapshots/demos/Screenshot.png | 4 +- .../tests/snapshots/demos/Scrolling.png | 4 +- .../tests/snapshots/demos/Sliders.png | 4 +- .../tests/snapshots/demos/Table.png | 4 +- .../snapshots/demos/Tessellation Test.png | 4 +- .../tests/snapshots/demos/Text Layout.png | 4 +- .../tests/snapshots/demos/Tooltips.png | 4 +- .../tests/snapshots/demos/Undo Redo.png | 4 +- .../tests/snapshots/demos/Window Options.png | 4 +- .../snapshots/demos/Window Resize Test.png | 4 +- .../tests/snapshots/modals_1.png | 4 +- .../tests/snapshots/modals_2.png | 4 +- .../tests/snapshots/modals_3.png | 4 +- .../snapshots/rendering_test/dpi_1.00.png | 4 +- .../snapshots/rendering_test/dpi_1.25.png | 4 +- .../snapshots/rendering_test/dpi_1.50.png | 4 +- .../snapshots/rendering_test/dpi_1.67.png | 4 +- .../snapshots/rendering_test/dpi_1.75.png | 4 +- .../snapshots/rendering_test/dpi_2.00.png | 4 +- .../tessellation_test/Additive rectangle.png | 4 +- .../tessellation_test/Blurred stroke.png | 4 +- .../snapshots/tessellation_test/Blurred.png | 4 +- .../tessellation_test/Minimal rounding.png | 4 +- .../snapshots/tessellation_test/Normal.png | 4 +- .../Thick stroke, minimal rounding.png | 4 +- .../tessellation_test/Thin filled.png | 4 +- .../tessellation_test/Thin stroked.png | 4 +- .../snapshots/widget_gallery_dark_x1.png | 4 +- .../snapshots/widget_gallery_dark_x2.png | 4 +- .../snapshots/widget_gallery_light_x1.png | 4 +- .../snapshots/widget_gallery_light_x2.png | 4 +- .../tests/snapshots/combobox_opened.png | 4 +- .../tests/snapshots/menu/closed_hovered.png | 4 +- .../tests/snapshots/menu/opened.png | 4 +- .../tests/snapshots/menu/submenu.png | 4 +- .../tests/snapshots/menu/subsubmenu.png | 4 +- .../override_text_color_interactive.png | 4 +- .../tests/snapshots/readme_example.png | 4 +- .../tests/snapshots/test_shrink.png | 4 +- .../tests/snapshots/test_tooltip_hidden.png | 4 +- .../tests/snapshots/test_tooltip_shown.png | 4 +- crates/epaint/src/margin.rs | 42 ++++----- scripts/check.sh | 92 ------------------- .../tests/snapshots/layout/checkbox.png | 4 +- .../snapshots/layout/checkbox_checked.png | 4 +- .../snapshots/layout/selectable_value.png | 4 +- .../layout/selectable_value_selected.png | 4 +- .../tests/snapshots/text_edit_rtl_2.png | 4 +- .../tests/snapshots/visuals/button.png | 4 +- .../tests/snapshots/visuals/button_image.png | 4 +- .../visuals/button_image_shortcut.png | 4 +- .../button_image_shortcut_selected.png | 4 +- .../tests/snapshots/visuals/checkbox.png | 4 +- .../snapshots/visuals/checkbox_checked.png | 4 +- .../tests/snapshots/visuals/drag_value.png | 4 +- .../snapshots/visuals/selectable_value.png | 4 +- .../visuals/selectable_value_selected.png | 4 +- .../tests/snapshots/visuals/text_edit.png | 4 +- 80 files changed, 186 insertions(+), 267 deletions(-) delete mode 100755 scripts/check.sh diff --git a/.gitignore b/.gitignore index 588826e7d..5d96b3808 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.vscode /media/* .idea/ +/scripts/check.sh diff --git a/crates/egui/src/style.rs b/crates/egui/src/style.rs index 0bee9bd73..454fc6d89 100644 --- a/crates/egui/src/style.rs +++ b/crates/egui/src/style.rs @@ -2600,8 +2600,8 @@ impl Widget for &mut Margin { } else { // Make sure it is not same: if self.is_same() { - if self.right == i16::MAX { - self.right = i16::MAX - 1; + if self.right == i8::MAX { + self.right = i8::MAX - 1; } else { self.right += 1; } diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index ecb7b8fbd..7696cd4ea 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -9,8 +9,10 @@ use crate::{ pub struct TextVisuals { /// Font used pub font_id: FontId, + /// Font color pub color: Color32, + /// Text decoration pub underline: Stroke, pub strikethrough: Stroke, @@ -33,14 +35,19 @@ pub struct ButtonStyle { pub struct CheckboxStyle { /// Frame around pub frame: Frame, + /// Text next to it pub text: TextVisuals, + /// Checkbox size pub size: f32, + /// Checkmark size pub check_size: f32, + /// Frame of the checkbox itself pub checkbox_frame: Frame, + /// Checkmark stroke pub stroke: Stroke, } @@ -48,8 +55,10 @@ pub struct CheckboxStyle { pub struct LabelStyle { /// Frame around pub frame: Frame, + /// Text style pub text: TextVisuals, + /// Wrap mode used pub wrap_mode: TextWrapMode, } @@ -57,6 +66,7 @@ pub struct LabelStyle { pub struct SeparatorStyle { /// How much space is allocated in the layout direction pub spacing: f32, + /// How to paint it pub stroke: Stroke, } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index e20a09bbc..e27ee0e9b 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -323,10 +323,10 @@ impl<'a> Button<'a> { } frame = frame.inner_margin(Margin { - left: button_padding.left - frame.stroke.width as i16, - top: button_padding.top - frame.stroke.width as i16, - right: button_padding.right - frame.stroke.width as i16, - bottom: button_padding.bottom - frame.stroke.width as i16, + left: button_padding.left - frame.stroke.width as i8, + top: button_padding.top - frame.stroke.width as i8, + right: button_padding.right - frame.stroke.width as i8, + bottom: button_padding.bottom - frame.stroke.width as i8, }); // Apply the correct font and color if Text diff --git a/crates/egui_demo_app/tests/snapshots/clock.png b/crates/egui_demo_app/tests/snapshots/clock.png index 39d9bb5ce..29e56828e 100644 --- a/crates/egui_demo_app/tests/snapshots/clock.png +++ b/crates/egui_demo_app/tests/snapshots/clock.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44a68dc4d3aeebeb2d296c5c8e03aac330e1e4552364084347b710326c88f70c -size 335794 +oid sha256:7ea2f4e2fc86a3b5a612448d79589df8f5432d8891241541bba2135d80137ef0 +size 335919 diff --git a/crates/egui_demo_app/tests/snapshots/custom3d.png b/crates/egui_demo_app/tests/snapshots/custom3d.png index deed497b1..ca3551c2e 100644 --- a/crates/egui_demo_app/tests/snapshots/custom3d.png +++ b/crates/egui_demo_app/tests/snapshots/custom3d.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e9a760fe4a695e6321f00e40bfa76fd0195bee7157a1217572765e3f146ea2cc -size 93640 +oid sha256:c79323e08a7027699082689194570c9b6c738d4b4d7d227ec4421bed028a12fa +size 93808 diff --git a/crates/egui_demo_app/tests/snapshots/easymarkeditor.png b/crates/egui_demo_app/tests/snapshots/easymarkeditor.png index a039b8c24..bcabed9bd 100644 --- a/crates/egui_demo_app/tests/snapshots/easymarkeditor.png +++ b/crates/egui_demo_app/tests/snapshots/easymarkeditor.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1670bbfc1f0a71e20cbbeb73625c148b680963bc503d9b48e9cc43e704d7c54 -size 181671 +oid sha256:236e36cc1ae7f0b6564536e466a0d7992333254c6fd0853e85531895697fd996 +size 181936 diff --git a/crates/egui_demo_app/tests/snapshots/imageviewer.png b/crates/egui_demo_app/tests/snapshots/imageviewer.png index e1d518a96..8ce5442ca 100644 --- a/crates/egui_demo_app/tests/snapshots/imageviewer.png +++ b/crates/egui_demo_app/tests/snapshots/imageviewer.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc9c22567b76193a7f6753c4217adb3c92afa921c488ba1cf2e14b403814e7ac -size 99841 +oid sha256:8b6566e6aae8f551adbd4f6efbf861ed59d467ec158cf28ada39177911f4b302 +size 100505 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png index 373adc234..9dcfa16e7 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb944eca56724f6a2106ea8db2043dc94c0ea40bdd4cdeb0e520790f97cc9598 -size 27049 +oid sha256:91823881c5d74838d2aea59e1b93a472d2133a184a1f98c9771919a5af4fd19f +size 27138 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png b/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png index 22341d7b3..935e209e8 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5c1951b99908326b3f05ebb72aa4d02d0f297bdd925f38ded09041fae45400c1 -size 85217 +oid sha256:40f6059fb76d24f418d6808732a0887ec9d90f7da0be746a5ec077d2f2c0066b +size 85185 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png b/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png index 05a412548..707a18455 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0df751bac5947c9bf6f82d075cf5670a562742b80d6c512bcd642da5ed449d26 -size 25975 +oid sha256:5f003032015dc8330f4bf5f334482b4a10fa8a25743e265ddbc5c47ff56723ff +size 26027 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png b/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png index 2a12a3152..c47eee065 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1227636b03a7d35db3482b19f6059ec7aaf03ca795edadd5338056be6f6a8f7f -size 126724 +oid sha256:a87f318f97d124b2033acf58b6f32e46e3aed018ce7705a6662681885d55e3b9 +size 126756 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Frame.png b/crates/egui_demo_lib/tests/snapshots/demos/Frame.png index 0385ab120..4c062051b 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Frame.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Frame.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c01e96bf0aab24dbcfc05f2a6dcb0ffcddff69ec2474797de4fbce0a0670a8cd -size 24964 +oid sha256:0dc7d0fc29e216e97a3a39250b40790c4e300b17a39be11674215797a471663a +size 25024 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png index e14a4ecb5..6ead8b900 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec357eafd145194f99c36a53a149a8b331fd691c5088df43ee96282b84bc81a4 -size 99439 +oid sha256:79b95e5b17c03b2301ab42b25ad6911ef5b536c8ecea23350e2973a46e803bdb +size 99707 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png b/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png index c100d9209..e4ad45786 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1378d865af3df02e12a0c4bc087620a4e9ef0029221db3180cdd2fd34f69d7f -size 24832 +oid sha256:c97e448603f69a413fe12f955c1e64eee8eb4700ee6e8eea1202ede9558bfd94 +size 24881 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png index 58cc9f94b..397483016 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aff927596be5db77349ec0bbdcc852a0b1467e94c2a553a740a383ae318bad18 -size 51670 +oid sha256:a83b1f5f2ce1751e8288a2c33a46fa541cd28b2d1eb4ccefeaef4224b0be2f88 +size 51859 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png index ed84d7428..53c80c31f 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad26106a86a6236f0db1c51bed754b370530813e9bb6e36c1be2948820fbef25 -size 47827 +oid sha256:28f191a4ee646fc63e19ac435316fd790103221e3055da9979fce04c4f617c79 +size 48041 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png b/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png index daa9da35a..845529cde 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf7f0a76424a959ede7afbb0eaf777638038cc6fe208ef710d9d82638d68b4d0 -size 37848 +oid sha256:744bfd9c1f714beedaf6cc3c9f5fed1aaeef0d8c8a5521fb09e419079140df35 +size 37922 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Painting.png b/crates/egui_demo_lib/tests/snapshots/demos/Painting.png index e53f4f7af..b2eeb48f8 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Painting.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Painting.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d2370972781f15a1d602deca28bca38f1c077152801870edf2112650b8b1349 -size 17708 +oid sha256:c2449a12444f730d45b6e2856fd878d6b47a0eae56e53576a5899e61e2bd9c15 +size 17680 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Panels.png b/crates/egui_demo_lib/tests/snapshots/demos/Panels.png index 22daed0ed..60d86d8ea 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Panels.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Panels.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c91f592571ba654d0a96791662ae7530a1db4c1630b57c795d1c006ea6e46f19 -size 256975 +oid sha256:4b5998d173ac2c2ebf64ad8c2c4f98463b344a47874b9a390709e639f0fe2a62 +size 257487 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Popups.png b/crates/egui_demo_lib/tests/snapshots/demos/Popups.png index d00256a7e..f882c6728 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Popups.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Popups.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f8b937a8a63de6fedcd0f9748b1d04cd863331a297bec78906885a0107def32a -size 61242 +oid sha256:4237a914a0a57957d54020e496043305fe26438dbd4f03db15e9db43b471ccc8 +size 61322 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Scene.png b/crates/egui_demo_lib/tests/snapshots/demos/Scene.png index 2344a3868..84222180e 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Scene.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Scene.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2855bd95ab33b5232edada1f65684bbba2748025b6b64eb9ac68a5f2d10ad4bd -size 34491 +oid sha256:31ebde2103ea2c30320f95e7ee9a6960feaf3946ad3b6db0da0bbcc5f85fa89b +size 34646 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png b/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png index 7e49a8613..0854a469b 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be599ae66323140bba4a7d63546acbf84340b57e2d82d4736bf3fe590040319d -size 23623 +oid sha256:96d5160a8e70480ac063be67481d890ddd17a929b1a6e8455e6e2568910eaa01 +size 23679 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png b/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png index 6de002ee4..71e08fcff 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01c3cb5e8972e0cab5325328f93af8f51b35a0d61016e74969eab0f7ddea1e02 -size 176973 +oid sha256:f2b02e997183f30bdd7a53afb92cee9e91c205e2ad2f77db7781177c2f20e166 +size 168401 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png b/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png index 417b183b5..cdc160ff2 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2f6cedc262259d52c1fbf4283d99b4b62ec732e8688b1e2799a2581425e0564 -size 120342 +oid sha256:25186c248e415becbbf00c90fad969f5b290683e1b3ffe25c07854330dbce999 +size 120914 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Table.png b/crates/egui_demo_lib/tests/snapshots/demos/Table.png index cf728bf3f..a1060783d 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Table.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Table.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4fbcca2b13c94769a62b44853b19f7e841bbb60c9197b3d0bf6e83ef9f8f76d1 -size 77815 +oid sha256:f95f41ced0ec7831acfb1257502b3d2617576b9d5002c7a30859a1150b4604cd +size 82431 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png index cd8524cef..89371e3bd 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc24f146adf0282cfb51723b56c76eceb92f2988fc67bbeefd16b93950505922 -size 70110 +oid sha256:d441f831d6ac99090756b8cadf13bc22ce11f8cc8aea9edced5c20b4578b71a8 +size 70273 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png b/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png index 28c9f57ac..fa2f782c3 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77aeaa1dcd391a571cb38732686e0b85b2d727975c02507a114d4e932f2c351b -size 65562 +oid sha256:4b6e31294f9933c1788eb5a4636042378610ac1756dbac26c25792fe0a4e7ba1 +size 66108 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png b/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png index 265dfdc1e..36fb1ae20 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:415b1ce17dd6df7ca7a86fed92750c2ef811ff64720a447ae3ca6be10090666e -size 64624 +oid sha256:3bdedaa57fcbd0b082000d47b43f75983171ee6ed7b7370a2092c39964d31309 +size 64906 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png b/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png index fb2bd06aa..0425e3333 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0eaf717bf0083737c4186ac39e7baf98f42fffb36b49434a6658eff1430a0ac6 -size 13187 +oid sha256:a622b6945028e019061fdcf5e6f303fe647e08b2b781ac5ce7eb6fc21bc41e7a +size 13190 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png b/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png index 97fa6cebc..5a08c93e2 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a31f0c12bb70449136443f9086103bd5b46356eedc2bb93ae1b6b10684ab69ca -size 36285 +oid sha256:b3ef5e5bdf4859a295212a17b879884f707e0c48e4a158bbe50961035af1408e +size 36410 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png index 7a042bdba..c7bf0cd12 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b85a2af24c3361a0008fd0996e8d7244dc3e289646ec7233e8bad39a586c871c -size 44512 +oid sha256:4d100a7932f71b02732e454be4bcc9e634a0fc45be0aa4ecff8aefb148ab2f38 +size 44526 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_1.png b/crates/egui_demo_lib/tests/snapshots/modals_1.png index a184b67dc..ca44d5073 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_1.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:60a44771c6bc9236593717236f9eca40bcb4723bac7567493cab4326f003eba3 -size 48693 +oid sha256:25c600764907b9a4e885939b3c5967ca67aa669f5ad2c30e02943bc97ca4cb87 +size 48884 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_2.png b/crates/egui_demo_lib/tests/snapshots/modals_2.png index c8e7cb55a..08281c8ed 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_2.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:53c1509f7be264ed2947cd4ec0f10b555e9f710e949ed6fd8a73ca8ade53abd4 -size 48570 +oid sha256:831268ea2718a60e1142c98fd53c2530a25dd0bd2ededfbf3a5c213da0c72d8a +size 48751 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_3.png b/crates/egui_demo_lib/tests/snapshots/modals_3.png index 777b700c2..eaea56328 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_3.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20eecafb998f69c2384afabc27eec1f97f413d603ece944adae9a99139be0b58 -size 44689 +oid sha256:9147bbd560474269a2294fab2df54d61ccf3eee0ae453e710fd8034d0f709232 +size 44865 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png index 640d84c2b..e72402dc0 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f9980486c36a0242f3b043a172c411d4fc9573543d3cd7c1c43bf020c18868a9 -size 619816 +oid sha256:0f38b9859a1b272a6eeee71ce186a1ecaf245efd954ec5012a0c15236a530b6c +size 622678 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png index df05ada25..84ef56d37 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:040e2e486ae4773a084da99513a53c620e8e2bba215183ec26c6e489381d6254 -size 823086 +oid sha256:8c4e677d8baf46bff20171ea9488ff36ff3d1d367355232c85b0bd1aa2e26009 +size 824364 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png index c6aa2914f..1a7f93546 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:439a5f942a5f05b9c09685ef90be94c150a21a68d1d235af22372b9b6a7b7389 -size 1035734 +oid sha256:6fd3a2ae4ff90181e80c595f82f748cf333e829012bbf69fe65565ef10102006 +size 1038859 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png index 1344edcfb..8a157f86d 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b7d7e290b97a8042af3af3cd9ceb274950cf607dd7e9cd6c71d5a113d3b57a5 -size 1206155 +oid sha256:be318246896430d1ccadcdbd49ce1f1b55656fc43f0df8468c96e8e8bd0186c6 +size 1210243 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png index 9804e2942..f97f20ac4 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fedd5546e36a89121c0bb0a780b0bbe081611c2c04013064872801181503fb83 -size 1231599 +oid sha256:e8a595e9a1d0671c094aa204352a93bb35732bffdf73d2cf266baa860429d955 +size 1235525 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png index 04d4bb4ea..7c2c9cc6e 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69a7040336fc92c6d7b158283aabbc5817980c2fa84a1120b788516cf437b985 -size 1461979 +oid sha256:c1cc2ac5384a5ee41b4cdf1d83a72baf709f7cc8f3439fc5addedea723bbf96c +size 1467077 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png index 50e84c900..b53f69bed 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a32d361afa20fc8c20122a89b01fe14b45849da42663991e589579f70fb8577 -size 46790 +oid sha256:667280ce65e68ecf72202d1eb174114396300f2402e557e06677f23d22707790 +size 47010 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png index ca5a23f97..5dc5c1f5a 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8d55205cf4225123da33895ed45eb186e5e57184ef5928400a4bae3ab6092be -size 88548 +oid sha256:c8f17504759fd16d78fc0ac79d22b4daabc9cf723ff57128e3276aaf8c304446 +size 88708 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png index 41f9ef2f5..7a236ce37 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77ab9e2e18c788f8cdbec171269afe4d0a90c52abeda7063cae3766dcaa5e93b -size 120612 +oid sha256:55c6d784f005e30fd05968b67a5afade2c0244449ead09b5eb4f24fa4e89238a +size 120408 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png index 85d844c79..5203f867c 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:36622a2f934503a7b60ded2f44b002e37eedde22d548dcf5a209f54c19548665 -size 53064 +oid sha256:685df94301659df0e221e6ca1f24d3f002858ad3a7c058b2e8ce70d8aa7104f0 +size 53260 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png index 6e6d9f0f2..0c9f36da1 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4adeb7a77a0d0fe85097fcd190a99b49858dce11bde601d30335afcb6cc3d5f6 -size 56276 +oid sha256:45cc44cff4facce5d19d2447431f4cad717b385afe73a22ddaa48733a2208d1f +size 56463 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png index eefbac2bb..5a135fca8 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f45249f7cc90433a64856905c727571c4ef20468e2c7d3ac2029e18a0477932d -size 56743 +oid sha256:bd14edfdb8384849755784c3b6b43b8e6e88392978a64bca2683002cf5ac1169 +size 56905 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png index 08178eaa8..0337d533c 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d437f68c521f3e627a1b50d46605e8b0b343c5fc3716d9669e8c4436c8992b6f -size 37602 +oid sha256:668b64f04d3249b3046a125eb3a323f30934d35329dc10c711f58ea78d98cfa2 +size 37847 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png index 13f057df9..32c7451c1 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:08ba98437403a08cca825ed8e288c9f088a46d9a1081f0b0a4ed7fbb9b49bb85 -size 37640 +oid sha256:0f8644452fd5211f7ded1d73186c4d866aa49cb23d4087b2a126f87d8c3c5f62 +size 37886 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png index ab2db5eb5..acf9f71ac 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1ed0e40d08b2b9ea978a07a4b7bf282c9e2cba8c52896f12210f396241e1b78 -size 66859 +oid sha256:d1b80b2ae54d7e535700abf2036379c2477230353b53a5cba0bda9eebef32d3c +size 67123 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png index e84863bf4..148283d1f 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28f9862dd6f16b99523f5880bf90346fd9455d0d44e7bdd530d523e0b2ef2d2c -size 158892 +oid sha256:d018e524b432d24c32c641f889aab4e3d5e6192f8c22bb77e6a0f439dfdccf65 +size 159486 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png index 87eb5ce70..3ef62db98 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:98c40c99a237f8388d82259fba4388d7b1759fe7b4bf657d326532934135c934 -size 61119 +oid sha256:b4906bc38d36cb837b417445a24c091c488600bff67be4ed4fc98653ba79dbf3 +size 61403 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png index c2c4705e1..8bd994095 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:90d36311ce5b1dcf81cab22113620a3362f255059d1f52c6794c8249f960549e -size 152215 +oid sha256:2e3c288d8e5cb768345f0577ad965cfb207b47bf37497a4283d28305dd8427ea +size 152658 diff --git a/crates/egui_kittest/tests/snapshots/combobox_opened.png b/crates/egui_kittest/tests/snapshots/combobox_opened.png index aaa7198ce..b64baffec 100644 --- a/crates/egui_kittest/tests/snapshots/combobox_opened.png +++ b/crates/egui_kittest/tests/snapshots/combobox_opened.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f70ef032c241cd63675a246de07886c5c822e6fe21525b3a6d3fee106a589c9 -size 7501 +oid sha256:ec3b264d0243f950babd8eb943efcaa2d40b0fa586cf391ab6ff28e56f1318bb +size 7623 diff --git a/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png b/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png index d2969adee..7f6820276 100644 --- a/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png +++ b/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd6e159a462dde10240c4ca51da5ca5badfb7fc170bad97a59106babb72f8ae3 -size 10795 +oid sha256:1ed9c5dca0551d8e6177dc67def3e8819036e39d935e11f9ee77a974dd7a3306 +size 10938 diff --git a/crates/egui_kittest/tests/snapshots/menu/opened.png b/crates/egui_kittest/tests/snapshots/menu/opened.png index 30f26b446..44f9e1e31 100644 --- a/crates/egui_kittest/tests/snapshots/menu/opened.png +++ b/crates/egui_kittest/tests/snapshots/menu/opened.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f2a5873350f85457d599c1fd165ac756ed69758e7647e160c64f44d2f35c804 -size 21812 +oid sha256:1f765cc56eb84b14d0c7d7804c5ec24f90ea8ba14ee288787aa5131d58365629 +size 22072 diff --git a/crates/egui_kittest/tests/snapshots/menu/submenu.png b/crates/egui_kittest/tests/snapshots/menu/submenu.png index 96ffaf97c..ee122f962 100644 --- a/crates/egui_kittest/tests/snapshots/menu/submenu.png +++ b/crates/egui_kittest/tests/snapshots/menu/submenu.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:facc05c499745594ac286f15645e40447633a176058337cad9edcb850ad578c7 -size 29379 +oid sha256:27c85c456e69f4d885ccf9af606e426138f6ca6b8e0762ea4806d6cc8225382c +size 29569 diff --git a/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png b/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png index d1d0b4cd3..eb4692afe 100644 --- a/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png +++ b/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f23ff8c6782befdbe7bd5f076dcdda15c38555f8e505282369bf52e43938c1b -size 34194 +oid sha256:231c72b67e733d7c12e76d28c4702cef9490d169e80f1388ad0b5276bd7184fc +size 34175 diff --git a/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png b/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png index 6e92f9f03..6d30bd5ee 100644 --- a/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png +++ b/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2fa5cb5b96232d729f89be8cc92263715fe7197e72343b71e57e53a359afe181 -size 19881 +oid sha256:a525d62b50978bfa059f043f502ddf0ea4f8f88b2ec09cf7e07c53a7bf09e763 +size 19969 diff --git a/crates/egui_kittest/tests/snapshots/readme_example.png b/crates/egui_kittest/tests/snapshots/readme_example.png index 2c8565718..399005939 100644 --- a/crates/egui_kittest/tests/snapshots/readme_example.png +++ b/crates/egui_kittest/tests/snapshots/readme_example.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb8d702361987803995c0f557ce94552a87b97dcd25bed5ee39af4c0e6090700 -size 1904 +oid sha256:18fbcc76f0df799331760e06487d6467aa2f575ac14d31d1859bf6ba3dba2941 +size 2199 diff --git a/crates/egui_kittest/tests/snapshots/test_shrink.png b/crates/egui_kittest/tests/snapshots/test_shrink.png index c25ae0367..9155bb6e7 100644 --- a/crates/egui_kittest/tests/snapshots/test_shrink.png +++ b/crates/egui_kittest/tests/snapshots/test_shrink.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:025942c144891b8862bf931385824e0484e60f4e7766f5d4401511c72ff20756 -size 2975 +oid sha256:08da2ac5bfb1e5ef7fb97cdc792bbf0529c20276312f0c444b122af02990e78b +size 3004 diff --git a/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png b/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png index c25ae0367..9155bb6e7 100644 --- a/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png +++ b/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:025942c144891b8862bf931385824e0484e60f4e7766f5d4401511c72ff20756 -size 2975 +oid sha256:08da2ac5bfb1e5ef7fb97cdc792bbf0529c20276312f0c444b122af02990e78b +size 3004 diff --git a/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png b/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png index 8ff6bba67..1c6358ad5 100644 --- a/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png +++ b/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c267530452adb4f1ed1440df476d576ef4c2d96e6c58068bb57fed4615f5e113 -size 4453 +oid sha256:b902df1b5971cd8d54a2e345f293bca2bf6f5ad262812ef8535f4191375e9dd2 +size 4486 diff --git a/crates/epaint/src/margin.rs b/crates/epaint/src/margin.rs index 66402a7ba..e6f6d2287 100644 --- a/crates/epaint/src/margin.rs +++ b/crates/epaint/src/margin.rs @@ -8,15 +8,15 @@ use emath::{Rect, Vec2, vec2}; /// Negative margins are possible, but may produce weird behavior. /// Use with care. /// -/// All values are stored as [`i16`] to keep the size of [`Margin`] small. +/// All values are stored as [`i8`] to keep the size of [`Margin`] small. /// If you want floats, use [`crate::MarginF32`] instead. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Margin { - pub left: i16, - pub right: i16, - pub top: i16, - pub bottom: i16, + pub left: i8, + pub right: i8, + pub top: i8, + pub bottom: i8, } impl Margin { @@ -30,7 +30,7 @@ impl Margin { /// The same margin on every side. #[doc(alias = "symmetric")] #[inline] - pub const fn same(margin: i16) -> Self { + pub const fn same(margin: i8) -> Self { Self { left: margin, right: margin, @@ -41,7 +41,7 @@ impl Margin { /// Margins with the same size on opposing sides #[inline] - pub const fn symmetric(x: i16, y: i16) -> Self { + pub const fn symmetric(x: i8, y: i8) -> Self { Self { left: x, right: x, @@ -98,9 +98,9 @@ impl Margin { } } -impl From for Margin { +impl From for Margin { #[inline] - fn from(v: i16) -> Self { + fn from(v: i8) -> Self { Self::same(v) } } @@ -134,12 +134,12 @@ impl std::ops::Add for Margin { } } -/// `Margin + i16` -impl std::ops::Add for Margin { +/// `Margin + i8` +impl std::ops::Add for Margin { type Output = Self; #[inline] - fn add(self, v: i16) -> Self { + fn add(self, v: i8) -> Self { Self { left: self.left.saturating_add(v), right: self.right.saturating_add(v), @@ -149,10 +149,10 @@ impl std::ops::Add for Margin { } } -/// `Margin += i16` -impl std::ops::AddAssign for Margin { +/// `Margin += i8` +impl std::ops::AddAssign for Margin { #[inline] - fn add_assign(&mut self, v: i16) { + fn add_assign(&mut self, v: i8) { *self = *self + v; } } @@ -214,12 +214,12 @@ impl std::ops::Sub for Margin { } } -/// `Margin - i16` -impl std::ops::Sub for Margin { +/// `Margin - i8` +impl std::ops::Sub for Margin { type Output = Self; #[inline] - fn sub(self, v: i16) -> Self { + fn sub(self, v: i8) -> Self { Self { left: self.left.saturating_sub(v), right: self.right.saturating_sub(v), @@ -229,10 +229,10 @@ impl std::ops::Sub for Margin { } } -/// `Margin -= i16` -impl std::ops::SubAssign for Margin { +/// `Margin -= i8` +impl std::ops::SubAssign for Margin { #[inline] - fn sub_assign(&mut self, v: i16) { + fn sub_assign(&mut self, v: i8) { *self = *self - v; } } diff --git a/scripts/check.sh b/scripts/check.sh deleted file mode 100755 index ffee218f6..000000000 --- a/scripts/check.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -# This scripts runs various CI-like checks in a convenient way. - -set -eu -script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -cd "$script_path/.." -set -x - -# Checks all tests, lints etc. -# Basically does what the CI does. - -# cargo +1.88.0 install --quiet typos-cli - -export RUSTFLAGS="-D warnings" -export RUSTDOCFLAGS="-D warnings" # https://github.com/emilk/egui/pull/1454 - -# Fast checks first: -typos -./scripts/lint.py -cargo fmt --all -- --check -cargo doc --quiet --lib --no-deps --all-features -cargo doc --quiet --document-private-items --no-deps --all-features -cargo clippy --quiet --all-targets --all-features -- -D warnings -cargo clippy --quiet --all-targets --all-features --release -- -D warnings # we need to check release mode too - -./scripts/clippy_wasm.sh - -cargo check --quiet --all-targets -cargo check --quiet --all-targets --all-features -cargo check --quiet -p egui_demo_app --lib --target wasm32-unknown-unknown -cargo check --quiet -p egui_demo_app --lib --target wasm32-unknown-unknown --all-features -# TODO(#5297) re-enable --all-features once the tests work with the unity feature -cargo test --quiet --all-targets --all-features -cargo test --quiet --doc # slow - checks all doc-tests - -cargo check --quiet -p eframe --no-default-features --features "glow" -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - cargo check --quiet -p eframe --no-default-features --features "wgpu","x11" - cargo check --quiet -p eframe --no-default-features --features "wgpu","wayland" -else - cargo check --quiet -p eframe --no-default-features --features "wgpu" -fi - -cargo check --quiet -p egui --no-default-features --features "serde" -cargo check --quiet -p egui_demo_app --no-default-features --features "glow" - -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","x11" - cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","wayland" -else - cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu" -fi - -cargo check --quiet -p egui_demo_lib --no-default-features -cargo check --quiet -p egui_extras --no-default-features -cargo check --quiet -p egui_glow --no-default-features -cargo check --quiet -p egui-winit --no-default-features --features "wayland" -cargo check --quiet -p egui-winit --no-default-features --features "x11" -cargo check --quiet -p emath --no-default-features -cargo check --quiet -p epaint --no-default-features --release -cargo check --quiet -p epaint --no-default-features - -cargo check --quiet -p eframe --all-features -cargo check --quiet -p egui --all-features -cargo check --quiet -p egui_demo_app --all-features -cargo check --quiet -p egui_extras --all-features -cargo check --quiet -p egui_glow --all-features -cargo check --quiet -p egui-winit --all-features -cargo check --quiet -p emath --all-features -cargo check --quiet -p epaint --all-features - -./scripts/wasm_bindgen_check.sh - -./scripts/cargo_deny.sh - -# TODO(emilk): consider using https://github.com/taiki-e/cargo-hack or https://github.com/frewsxcv/cargo-all-features - -# ------------------------------------------------------------ -# - -# For finding bloat: -# cargo bloat --release --bin egui_demo_app -n 200 | rg egui -# Also try https://github.com/google/bloaty - -# what compiles slowly? -# cargo clean && time cargo build -p eframe --timings -# https://fasterthanli.me/articles/why-is-my-rust-build-so-slow - -# what compiles slowly? -# cargo llvm-lines --lib -p egui | head -20 - -echo "All checks passed." diff --git a/tests/egui_tests/tests/snapshots/layout/checkbox.png b/tests/egui_tests/tests/snapshots/layout/checkbox.png index 18ebbdb7c..2fcfe186a 100644 --- a/tests/egui_tests/tests/snapshots/layout/checkbox.png +++ b/tests/egui_tests/tests/snapshots/layout/checkbox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4747efdf758e7e8e2d7f3954d9595dfd45d3b4b86923b8ff39c8a96002bb4825 -size 408726 +oid sha256:ef93c74cb71d7a5386cc361ca91b3826c27c257413eaafc8f283bd177111d6b6 +size 409009 diff --git a/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png b/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png index 127aa7f30..544276069 100644 --- a/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png +++ b/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a3ca4b3a47ff516f9b05799cdf5f92845ae1e058728d635986cc61b7317f110 -size 437102 +oid sha256:554d51d9c557d8f7bc7ef6a5cac04520e0535074c2e762d8fc5ddd23b4a037bd +size 439301 diff --git a/tests/egui_tests/tests/snapshots/layout/selectable_value.png b/tests/egui_tests/tests/snapshots/layout/selectable_value.png index 2ee7f7d0e..efb50987b 100644 --- a/tests/egui_tests/tests/snapshots/layout/selectable_value.png +++ b/tests/egui_tests/tests/snapshots/layout/selectable_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfc900ea84b408564652df487e705311b164d9bd3ff5631c3cebb83b06497a7b -size 410131 +oid sha256:c70f3d9e6e767b9857b218ef25166aa0fc5a1d8b72cb9582e1322d53a3f135e4 +size 403775 diff --git a/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png b/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png index 7e3dd6319..dccd1bc3d 100644 --- a/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png +++ b/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9d08ce85c9210a7d9046480ab208040e5ba399c40acaecf5cb43f807534bce9 -size 423523 +oid sha256:e5188b61af6366680144486d927f8b497dcc1e836ae8e5d767c5bce59e05056a +size 446497 diff --git a/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png b/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png index b9235740d..b6233f378 100644 --- a/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png +++ b/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38f325f2e741f18f897502c176f9a7efe276e9adab41a144511121dd8b8a3073 -size 3079 +oid sha256:055b6111aa48f19c894729e2935cb9298231aab78efb10b9e73c00da9edfd338 +size 3130 diff --git a/tests/egui_tests/tests/snapshots/visuals/button.png b/tests/egui_tests/tests/snapshots/visuals/button.png index 4c81f62fc..89958941a 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button.png +++ b/tests/egui_tests/tests/snapshots/visuals/button.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c05992e16c1abf6d174fed73d19cad6bb2266e0adb87b8232e765d75fcf3f14 -size 10310 +oid sha256:9df0ca1e011ccbba6e8620e2ef04b2e4f5614fd596a6dbc072179614552468c1 +size 10118 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image.png b/tests/egui_tests/tests/snapshots/visuals/button_image.png index 00582f3ae..305907647 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7681d33a5a764187c084c966a4e47063136e2832094c44f62718447b1b3027ec -size 11292 +oid sha256:bf2a513396ba3ba90e65a163fcd21d1eb1277f59ede157c67e12f1f18cbe070a +size 11109 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png index 1429bfd2d..1d1373005 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b99a82e9f3dfa24c079545272d680b55c4285c276befa0efc492fe273422f541 -size 14195 +oid sha256:37cf0ae5fd2fb2e2f2b960b7ea451e380c335e42a0f4d45cacec90dfcb9bdb48 +size 13981 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png index c73effead..8216b4cdf 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cdf079228b762949dbc67308103f8fe1328b6c0175f312ccc492d4e86d42127b -size 13868 +oid sha256:79bc45bc2c675a9deddf25aad80de45170bd97d157bfb195cd59f1b027240652 +size 14600 diff --git a/tests/egui_tests/tests/snapshots/visuals/checkbox.png b/tests/egui_tests/tests/snapshots/visuals/checkbox.png index 16d88e546..866473abb 100644 --- a/tests/egui_tests/tests/snapshots/visuals/checkbox.png +++ b/tests/egui_tests/tests/snapshots/visuals/checkbox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0bafe4c157696bfb52940b69501416d4da0b4eab52f34f52220d2e9ed01357cf -size 12901 +oid sha256:4f400f82eb9339c136f8ba2f393ae3b4832461fd2eca64cb4aa4f2ec60992d0c +size 13026 diff --git a/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png b/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png index fd85297ac..6b854278d 100644 --- a/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png +++ b/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:72175bf108135b422d978b701d29e6d9a5348c536e25abc924234bc11b6b7f21 -size 14016 +oid sha256:d96e5948ab50362475ab034e428804c1091b5dfacb8e3191021b1b13c3ce9c8e +size 14060 diff --git a/tests/egui_tests/tests/snapshots/visuals/drag_value.png b/tests/egui_tests/tests/snapshots/visuals/drag_value.png index 5411009f0..a9fc67d23 100644 --- a/tests/egui_tests/tests/snapshots/visuals/drag_value.png +++ b/tests/egui_tests/tests/snapshots/visuals/drag_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:129121534b5f1a2a668898ebb3560820fe50aa4d3546ef46cc764d5513787e9e -size 7529 +oid sha256:2fc2d9eaec38ec6cc5466117bfa6eedf027b2f8c5d146c16428e992e71352ee2 +size 7526 diff --git a/tests/egui_tests/tests/snapshots/visuals/selectable_value.png b/tests/egui_tests/tests/snapshots/visuals/selectable_value.png index a0b480be4..e6bdd7583 100644 --- a/tests/egui_tests/tests/snapshots/visuals/selectable_value.png +++ b/tests/egui_tests/tests/snapshots/visuals/selectable_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac18e2eef000a80858b2d0811f9ee31304c6ff96f7a91dc60cc1a404ae28ce38 -size 13246 +oid sha256:eaf5722dc3d31272e1f804f46a472aa12cecf2744e617378514a8314f73c173a +size 12708 diff --git a/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png b/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png index 291263c44..ed901d465 100644 --- a/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png +++ b/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c11fe0399c85db5a618580ec4c1f2fe76176c6ea0ead3710a430d9a2bf8acc5d -size 13352 +oid sha256:7b1879c66f124ae40ce8e9fcbc1a36369ec141a31a0d5d9fb5306fe704772277 +size 13784 diff --git a/tests/egui_tests/tests/snapshots/visuals/text_edit.png b/tests/egui_tests/tests/snapshots/visuals/text_edit.png index d8e56eb2a..b3ae22df8 100644 --- a/tests/egui_tests/tests/snapshots/visuals/text_edit.png +++ b/tests/egui_tests/tests/snapshots/visuals/text_edit.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a103b51df184d5480438e8b537106432205a6d86f2927ab1bd507fe8ed3bb29b -size 7656 +oid sha256:e2051b9aeef49c404b49c6b47b8ff34be66dff2c792f5eceba456f855ebdb8bc +size 7682 From e99ce8dec7403c044f608f90fb842ce7bbeb5544 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 13 Oct 2025 00:01:34 +0200 Subject: [PATCH 10/30] style by widget --- crates/egui/src/lib.rs | 1 + crates/egui/src/style_trait.rs | 188 ++++++++++++++++++++++++++ crates/egui/src/widgets/button.rs | 55 ++++---- crates/egui/src/widgets/drag_value.rs | 13 +- 4 files changed, 224 insertions(+), 33 deletions(-) create mode 100644 crates/egui/src/style_trait.rs diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 960480b23..c0c68884a 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -434,6 +434,7 @@ mod plugin; pub mod response; mod sense; pub mod style; +pub mod style_trait; pub mod text_selection; mod ui; mod ui_builder; diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs new file mode 100644 index 000000000..079013649 --- /dev/null +++ b/crates/egui/src/style_trait.rs @@ -0,0 +1,188 @@ +use emath::Vec2; +use epaint::{Color32, FontId, Stroke}; + +use crate::{ + Frame, Response, Style, + style::{WidgetVisuals, Widgets}, +}; + +/// General text style +pub struct TextVisuals { + /// Font used + pub font_id: FontId, + /// Font color + pub color: Color32, +} + +/// General widget style +pub struct WidgetStyle { + pub frame: Frame, + + pub text: TextVisuals, + + pub stroke: Stroke, +} + +pub struct ButtonStyle { + pub frame: Frame, + pub text: TextVisuals, +} + +pub struct CheckboxStyle { + /// Frame around + pub frame: Frame, + /// Text next to it + pub text: TextVisuals, + /// Size + pub size: Vec2, + /// Frame of the checkbox itself + pub checkbox_frame: Frame, + /// Checkmark stroke + pub stroke: Stroke, +} + +pub struct DragValueStyle { + /// Frame around + pub frame: Frame, + /// Text of the value + pub text: TextVisuals, + pub min_size: Vec2, +} + +pub struct HyperlinkStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct ImageStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct LabelStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct RadioButtonStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct SeparatorStyle { + pub size: f32, + pub stroke: Stroke, +} + +pub struct SliderStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +pub struct SpinnerStyle { + pub frame: Frame, + pub text: TextVisuals, + pub size: Vec2, + pub checkbox_frame: Frame, + pub stroke: Stroke, +} + +#[derive(Default, Clone, Copy, Debug, PartialEq, Eq)] +pub enum WidgetState { + Noninteractive, + #[default] + Inactive, + Hovered, + Active, +} + +impl Widgets { + pub fn state(&self, state: WidgetState) -> &WidgetVisuals { + match state { + WidgetState::Noninteractive => &self.noninteractive, + WidgetState::Inactive => &self.inactive, + WidgetState::Hovered => &self.hovered, + WidgetState::Active => &self.active, + } + } +} + +impl Response { + pub fn widget_state(&self) -> WidgetState { + if !self.sense.interactive() { + WidgetState::Noninteractive + } else if self.is_pointer_button_down_on() || self.has_focus() || self.clicked() { + WidgetState::Active + } else if self.hovered() || self.highlighted() { + WidgetState::Hovered + } else { + WidgetState::Inactive + } + } +} + +impl Style { + pub fn widget_style(&self, state: WidgetState) -> WidgetStyle { + let visuals = self.visuals.widgets.state(state); + let font_id = self.override_font_id.clone(); + WidgetStyle { + frame: Frame { + fill: visuals.bg_fill, + stroke: visuals.bg_stroke, + corner_radius: visuals.corner_radius, + ..Default::default() + }, + stroke: visuals.fg_stroke, + text: TextVisuals { + color: visuals.fg_stroke.color, + font_id: font_id.unwrap_or(FontId::new(13.0, epaint::FontFamily::Proportional)), + }, + } + } + + pub fn button_style(&self, state: WidgetState) -> ButtonStyle { + let ws = self.widget_style(state); + ButtonStyle { + frame: ws.frame.inner_margin(self.spacing.button_padding), + text: ws.text, + } + } + + // pub fn checkbox_style(&self, state: WidgetState) -> CheckboxStylee {} + + // pub fn label_style(&self, state: WidgetState) -> LabelStyle {} + + pub fn drag_value_style(&self, state: WidgetState) -> DragValueStyle { + let ws = self.widget_style(state); + DragValueStyle { + frame: ws.frame.inner_margin(self.spacing.button_padding), + min_size: self.spacing.interact_size, + text: ws.text, + } + } + + // pub fn hyperlink_style(&self, state: WidgetState) -> HyperlinkStyle {} + + // pub fn image_style(&self, state: WidgetState) -> ImageStyle {} + + // pub fn slider_style(&self, state: WidgetState) -> SliderStyle {} + + // pub fn separator_style(&self, state: WidgetState) -> SeparatorStyle {} + + // pub fn spinner_style(&self, state: WidgetState) -> SpinnerStyle {} +} diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index af31b40af..00d438959 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,7 +1,9 @@ +use std::{mem, sync::Arc}; + use crate::{ Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Frame, - Image, IntoAtoms, NumExt as _, Response, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, - Widget, WidgetInfo, WidgetText, WidgetType, + Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, + Vec2, Widget, WidgetInfo, WidgetText, WidgetType, }; /// Clickable button with text. @@ -281,25 +283,30 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + + let style = ui.style().button_style(state); + let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); - let mut button_padding = if has_frame_margin { - ui.spacing().button_padding - } else { - Vec2::ZERO - }; - if small { - button_padding.y = 0.0; - } + layout.map_texts(|t| match t { + WidgetText::RichText(mut text) => { + let text_mut = Arc::make_mut(&mut text); + *text_mut = mem::take(text_mut).font(style.text.font_id.clone()); + WidgetText::RichText(text) + } + WidgetText::Text(text) => { + let rich_text = RichText::new(text.clone()).font(style.text.font_id.clone()); + WidgetText::RichText(Arc::new(rich_text)) + } + w => w, + }); - let mut prepared = layout - .frame(Frame::new().inner_margin(button_padding)) - .min_size(min_size) - .allocate(ui); + let mut prepared = layout.frame(style.frame).min_size(min_size).allocate(ui); let response = if ui.is_rect_visible(prepared.response.rect) { - let visuals = ui.style().interact_selectable(&prepared.response, selected); - let visible_frame = if frame_when_inactive { has_frame_margin } else { @@ -310,23 +317,13 @@ impl<'a> Button<'a> { }; if image_tint_follows_text_color { - prepared.map_images(|image| image.tint(visuals.text_color())); + prepared.map_images(|image| image.tint(style.text.color)); } - prepared.fallback_text_color = visuals.text_color(); + prepared.fallback_text_color = style.text.color; if visible_frame { - let stroke = stroke.unwrap_or(visuals.bg_stroke); - let fill = fill.unwrap_or(visuals.weak_bg_fill); - prepared.frame = prepared - .frame - .inner_margin( - button_padding + Vec2::splat(visuals.expansion) - Vec2::splat(stroke.width), - ) - .outer_margin(-Vec2::splat(visuals.expansion)) - .fill(fill) - .stroke(stroke) - .corner_radius(corner_radius.unwrap_or(visuals.corner_radius)); + prepared.frame = style.frame; } prepared.paint(ui) diff --git a/crates/egui/src/widgets/drag_value.rs b/crates/egui/src/widgets/drag_value.rs index 9515726c2..1c4caf995 100644 --- a/crates/egui/src/widgets/drag_value.rs +++ b/crates/egui/src/widgets/drag_value.rs @@ -4,7 +4,7 @@ use std::{cmp::Ordering, ops::RangeInclusive}; use crate::{ Button, CursorIcon, Id, Key, MINUS_CHAR_STR, Modifiers, NumExt as _, Response, RichText, Sense, - TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, text, + TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, grid::State, text, }; // ---------------------------------------------------------------------------- @@ -447,6 +447,10 @@ impl Widget for DragValue<'_> { let id = ui.next_auto_id(); let is_slow_speed = shift && ui.ctx().is_being_dragged(id); + let response = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().drag_value_style(state); + // The following ensures that when a `DragValue` receives focus, // it is immediately rendered in edit mode, rather than being rendered // in button mode for just one frame. This is important for @@ -560,13 +564,14 @@ impl Widget for DragValue<'_> { .clip_text(false) .horizontal_align(ui.layout().horizontal_align()) .vertical_align(ui.layout().vertical_align()) - .margin(ui.spacing().button_padding) - .min_size(ui.spacing().interact_size) + .margin(style.frame.inner_margin) + .min_size(style.min_size) .id(id) .desired_width( ui.spacing().interact_size.x - 2.0 * ui.spacing().button_padding.x, ) - .font(text_style), + .text_color(style.text.color) + .font(style.text.font_id), ); // Select all text when the edit gains focus. From c2e62f87d7c93e58f1f56808d3e71ba98e80f8e2 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 13 Oct 2025 21:46:50 +0200 Subject: [PATCH 11/30] Finish button : retrocompatibility + comments --- crates/egui/src/widgets/button.rs | 38 +++++++++++-------------- examples/hello_world_simple/src/main.rs | 10 ++++++- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 00d438959..7a6f03e8a 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,9 +1,9 @@ use std::{mem, sync::Arc}; use crate::{ - Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Frame, - Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, - Vec2, Widget, WidgetInfo, WidgetText, WidgetType, + Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Image, + IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, + Widget, WidgetInfo, WidgetText, WidgetType, style_trait::WidgetState, }; /// Clickable button with text. @@ -255,18 +255,19 @@ impl<'a> Button<'a> { pub fn atom_ui(self, ui: &mut Ui) -> AtomLayoutResponse { let Button { mut layout, - fill, - stroke, + fill: _, + stroke: _, small, frame, frame_when_inactive, mut min_size, - corner_radius, - selected, + corner_radius: _, + selected: _, image_tint_follows_text_color, limit_image_size, } = self; + // Min size height always equal or greater than interact size if not small if !small { min_size.y = min_size.y.at_least(ui.spacing().interact_size.y); } @@ -283,14 +284,15 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); + // Get the widget style let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().button_style(state); let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); + // Apply the correct font on RichText and Text layout.map_texts(|t| match t { WidgetText::RichText(mut text) => { let text_mut = Arc::make_mut(&mut text); @@ -304,28 +306,22 @@ impl<'a> Button<'a> { w => w, }); - let mut prepared = layout.frame(style.frame).min_size(min_size).allocate(ui); - - let response = if ui.is_rect_visible(prepared.response.rect) { - let visible_frame = if frame_when_inactive { - has_frame_margin + // Retrocompatibility with button settings + let mut prepared = + if has_frame_margin && (frame_when_inactive || state != WidgetState::Inactive) { + layout.frame(style.frame).min_size(min_size).allocate(ui) } else { - has_frame_margin - && (prepared.response.hovered() - || prepared.response.is_pointer_button_down_on() - || prepared.response.has_focus()) + layout.min_size(min_size).allocate(ui) }; + // Get AtomLayoutResponse, empty if not visible + let response = if ui.is_rect_visible(prepared.response.rect) { if image_tint_follows_text_color { prepared.map_images(|image| image.tint(style.text.color)); } prepared.fallback_text_color = style.text.color; - if visible_frame { - prepared.frame = style.frame; - } - prepared.paint(ui) } else { AtomLayoutResponse::empty(prepared.response) diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 4fe49a89d..0514db692 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,7 +1,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use eframe::egui; +use eframe::egui::{self, Button}; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). @@ -27,6 +27,14 @@ fn main() -> eframe::Result { if ui.button("Increment").clicked() { age += 1; } + + ui.add(Button::new("no frame").frame(false)); + ui.add(Button::new("small").small()); + ui.add_enabled( + false, + Button::new("no frame inactive").frame_when_inactive(false), + ); + ui.label(format!("Hello '{name}', age {age}")); }); }) From ce5c9cdd52ec3b99f41acda1554973e7ff209b44 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Wed, 15 Oct 2025 15:35:03 +0200 Subject: [PATCH 12/30] fix some logic --- crates/egui/src/widgets/button.rs | 17 ++++++++--------- examples/hello_world_simple/src/main.rs | 7 +++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 7a6f03e8a..70505a999 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -284,23 +284,22 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); - // Get the widget style + // Get the widget style by reading the rect from the previous pass let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); let style = ui.style().button_style(state); + // let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); - // Apply the correct font on RichText and Text + // Apply the correct font and color if Text + // We assume that the other WidgetText have already a Fontid and color layout.map_texts(|t| match t { - WidgetText::RichText(mut text) => { - let text_mut = Arc::make_mut(&mut text); - *text_mut = mem::take(text_mut).font(style.text.font_id.clone()); - WidgetText::RichText(text) - } WidgetText::Text(text) => { - let rich_text = RichText::new(text.clone()).font(style.text.font_id.clone()); + let rich_text = RichText::new(text.clone()) + .font(style.text.font_id.clone()) + .color(style.text.color); WidgetText::RichText(Arc::new(rich_text)) } w => w, @@ -308,7 +307,7 @@ impl<'a> Button<'a> { // Retrocompatibility with button settings let mut prepared = - if has_frame_margin && (frame_when_inactive || state != WidgetState::Inactive) { + if has_frame_margin && (state != WidgetState::Inactive || frame_when_inactive) { layout.frame(style.frame).min_size(min_size).allocate(ui) } else { layout.min_size(min_size).allocate(ui) diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 0514db692..9a0d98d16 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -28,12 +28,11 @@ fn main() -> eframe::Result { age += 1; } + // Button test ui.add(Button::new("no frame").frame(false)); ui.add(Button::new("small").small()); - ui.add_enabled( - false, - Button::new("no frame inactive").frame_when_inactive(false), - ); + ui.add_enabled(false, Button::new("disabled")); + ui.add(Button::new("no frame inactive").frame_when_inactive(false)); ui.label(format!("Hello '{name}', age {age}")); }); From 5265d4ef0c977ead93c259041c265ece98844546 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Wed, 15 Oct 2025 17:44:29 +0200 Subject: [PATCH 13/30] apply style to label --- crates/egui/src/style_trait.rs | 31 +++++++++---- crates/egui/src/widgets/button.rs | 1 - crates/egui/src/widgets/label.rs | 30 ++++++++++--- examples/hello_world_simple/src/main.rs | 59 ++++++++++++++++++------- 4 files changed, 92 insertions(+), 29 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index 079013649..375bb0480 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -1,8 +1,8 @@ use emath::Vec2; -use epaint::{Color32, FontId, Stroke}; +use epaint::{Color32, FontId, Shadow, Stroke, text::TextWrapMode}; use crate::{ - Frame, Response, Style, + Frame, Response, Style, TextStyle, style::{WidgetVisuals, Widgets}, }; @@ -66,11 +66,12 @@ pub struct ImageStyle { } pub struct LabelStyle { + /// Frame around pub frame: Frame, + /// Text style pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, + /// Wrap mode used + pub wrap_mode: TextWrapMode, } pub struct RadioButtonStyle { @@ -149,8 +150,8 @@ impl Style { }, stroke: visuals.fg_stroke, text: TextVisuals { - color: visuals.fg_stroke.color, - font_id: font_id.unwrap_or(FontId::new(13.0, epaint::FontFamily::Proportional)), + color: visuals.text_color(), + font_id: font_id.unwrap_or(TextStyle::Body.resolve(self)), }, } } @@ -165,7 +166,21 @@ impl Style { // pub fn checkbox_style(&self, state: WidgetState) -> CheckboxStylee {} - // pub fn label_style(&self, state: WidgetState) -> LabelStyle {} + pub fn label_style(&self, state: WidgetState) -> LabelStyle { + let ws = self.widget_style(state); + LabelStyle { + frame: Frame { + fill: ws.frame.fill, + inner_margin: 0.0.into(), + outer_margin: 0.0.into(), + stroke: Stroke::NONE, + shadow: Shadow::NONE, + corner_radius: 0.into(), + }, + text: ws.text, + wrap_mode: TextWrapMode::Wrap, + } + } pub fn drag_value_style(&self, state: WidgetState) -> DragValueStyle { let ws = self.widget_style(state); diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 70505a999..128429b00 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -290,7 +290,6 @@ impl<'a> Button<'a> { let state = response.map(|r| r.widget_state()).unwrap_or_default(); let style = ui.style().button_style(state); - // let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); // Apply the correct font and color if Text diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index 86259ab2a..8c4d77dd8 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -1,8 +1,9 @@ use std::sync::Arc; use crate::{ - Align, Direction, FontSelection, Galley, Pos2, Response, Sense, Stroke, TextWrapMode, Ui, - Widget, WidgetInfo, WidgetText, WidgetType, epaint, pos2, text_selection::LabelSelectionState, + Align, Direction, FontSelection, Frame, Galley, Pos2, Response, RichText, Sense, Stroke, + TextWrapMode, Ui, Widget, WidgetInfo, WidgetText, WidgetType, epaint, pos2, + text_selection::LabelSelectionState, }; /// Static text. @@ -179,10 +180,16 @@ impl Label { return (pos, galley, response); } + // Get the widget style by reading the rect from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().label_style(state); + let valign = ui.text_valign(); let mut layout_job = Arc::unwrap_or_clone(self.text.into_layout_job( ui.style(), - FontSelection::Default, + style.text.font_id.into(), // Use the style font valign, )); @@ -266,7 +273,7 @@ impl Label { } impl Widget for Label { - fn ui(self, ui: &mut Ui) -> Response { + fn ui(mut self, ui: &mut Ui) -> Response { // Interactive = the uses asked to sense interaction. // We DON'T want to have the color respond just because the text is selectable; // the cursor is enough to communicate that. @@ -275,6 +282,19 @@ impl Widget for Label { let selectable = self.selectable; let show_tooltip_when_elided = self.show_tooltip_when_elided; + // Get the widget style by reading the rect from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().label_style(state); + + // if let WidgetText::Text(text) = self.text { + // let rich_text = RichText::new(text) + // .font(style.text.font_id) + // .color(style.text.color); + // self.text = WidgetText::RichText(Arc::new(rich_text)); + // } + let (galley_pos, galley, mut response) = self.layout_in_ui(ui); response .widget_info(|| WidgetInfo::labeled(WidgetType::Label, ui.is_enabled(), galley.text())); @@ -292,7 +312,7 @@ impl Widget for Label { } let response_color = if interactive { - ui.style().interact(&response).text_color() + style.text.color } else { ui.style().visuals.text_color() }; diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 9a0d98d16..78bab8d98 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,7 +1,9 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use eframe::egui::{self, Button}; +use std::process::exit; + +use eframe::egui::{self, Color32, FontId, Label, RichText, Sense, Stroke, style::WidgetVisuals}; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). @@ -17,24 +19,51 @@ fn main() -> eframe::Result { eframe::run_simple_native("My egui App", options, move |ctx, _frame| { egui::CentralPanel::default().show(ctx, |ui| { - ui.heading("My egui Application"); - ui.horizontal(|ui| { - let name_label = ui.label("Your name: "); - ui.text_edit_singleline(&mut name) - .labelled_by(name_label.id); + ui.ctx().style_mut(|s| { + s.visuals.widgets.inactive = WidgetVisuals { + fg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), + ..s.visuals.widgets.inactive + }; + s.visuals.widgets.active = WidgetVisuals { + fg_stroke: Stroke::new(1.0, Color32::BLUE), + ..s.visuals.widgets.inactive + }; + s.visuals.widgets.hovered = WidgetVisuals { + fg_stroke: Stroke::new(1.0, Color32::YELLOW), + ..s.visuals.widgets.inactive + }; + s.visuals.widgets.noninteractive = WidgetVisuals { + fg_stroke: Stroke::new(1.0, Color32::RED), + ..s.visuals.widgets.inactive + }; }); - ui.add(egui::Slider::new(&mut age, 0..=120).text("age")); - if ui.button("Increment").clicked() { - age += 1; - } + + // ui.heading("My egui Application"); + // ui.horizontal(|ui| { + // let name_label = ui.label("Your name: "); + // ui.text_edit_singleline(&mut name) + // .labelled_by(name_label.id); + // }); + // ui.add(egui::Slider::new(&mut age, 0..=120).text("age")); + // if ui.button("Increment").clicked() { + // age += 1; + // } // Button test - ui.add(Button::new("no frame").frame(false)); - ui.add(Button::new("small").small()); - ui.add_enabled(false, Button::new("disabled")); - ui.add(Button::new("no frame inactive").frame_when_inactive(false)); + // ui.add(Button::new("no frame").frame(false)); + // ui.add(Button::new("small").small()); + // ui.add_enabled(false, Button::new("disabled")); + // ui.add(Button::new("no frame inactive").frame_when_inactive(false)); - ui.label(format!("Hello '{name}', age {age}")); + ui.label("Normal text"); + // Should not be affected by WidgetStyle + ui.label( + RichText::new("Unaffected by style") + .font(FontId::monospace(15.0)) + .color(Color32::KHAKI), + ); + + ui.add(Label::new("test").sense(Sense::click())) }); }) } From a40959b04770140bf35ddf781d822c6113567b67 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Thu, 16 Oct 2025 13:22:09 +0200 Subject: [PATCH 14/30] Finish label --- crates/egui/src/style_trait.rs | 5 +++ crates/egui/src/widgets/button.rs | 2 +- crates/egui/src/widgets/label.rs | 39 ++++++++++-------------- examples/hello_world_simple/questions.md | 9 ++++++ examples/hello_world_simple/src/main.rs | 6 ++-- 5 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 examples/hello_world_simple/questions.md diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index 375bb0480..0dfa3d020 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -12,6 +12,9 @@ pub struct TextVisuals { pub font_id: FontId, /// Font color pub color: Color32, + /// Text decoration + pub underline: Stroke, + pub strikethrough: Stroke, } /// General widget style @@ -152,6 +155,8 @@ impl Style { text: TextVisuals { color: visuals.text_color(), font_id: font_id.unwrap_or(TextStyle::Body.resolve(self)), + strikethrough: Stroke::NONE, + underline: Stroke::NONE, }, } } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 128429b00..24ea33ab3 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,4 +1,4 @@ -use std::{mem, sync::Arc}; +use std::sync::Arc; use crate::{ Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Image, diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index 8c4d77dd8..a0805b7de 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -1,9 +1,8 @@ use std::sync::Arc; use crate::{ - Align, Direction, FontSelection, Frame, Galley, Pos2, Response, RichText, Sense, Stroke, - TextWrapMode, Ui, Widget, WidgetInfo, WidgetText, WidgetType, epaint, pos2, - text_selection::LabelSelectionState, + Align, Direction, Galley, Pos2, Response, Sense, TextWrapMode, Ui, Widget, WidgetInfo, + WidgetText, WidgetType, epaint, pos2, text_selection::LabelSelectionState, }; /// Static text. @@ -169,8 +168,8 @@ impl Label { sense |= select_sense; } + // If the user said "use this specific galley", then just use it: if let WidgetText::Galley(galley) = self.text { - // If the user said "use this specific galley", then just use it: let (rect, response) = ui.allocate_exact_size(galley.size(), sense); let pos = match galley.job.halign { Align::LEFT => rect.left_top(), @@ -189,7 +188,7 @@ impl Label { let valign = ui.text_valign(); let mut layout_job = Arc::unwrap_or_clone(self.text.into_layout_job( ui.style(), - style.text.font_id.into(), // Use the style font + style.text.font_id.into(), // Use the label style font valign, )); @@ -203,7 +202,6 @@ impl Label { { // On a wrapping horizontal layout we want text to start after the previous widget, // then continue on the line below! This will take some extra work: - let cursor = ui.cursor(); let first_row_indentation = available_width - ui.available_size_before_wrap().x; debug_assert!( @@ -273,7 +271,7 @@ impl Label { } impl Widget for Label { - fn ui(mut self, ui: &mut Ui) -> Response { + fn ui(self, ui: &mut Ui) -> Response { // Interactive = the uses asked to sense interaction. // We DON'T want to have the color respond just because the text is selectable; // the cursor is enough to communicate that. @@ -283,22 +281,16 @@ impl Widget for Label { let show_tooltip_when_elided = self.show_tooltip_when_elided; // Get the widget style by reading the rect from the previous pass - let id = ui.next_auto_id(); - let response: Option = ui.ctx().read_response(id); - let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().label_style(state); - - // if let WidgetText::Text(text) = self.text { - // let rich_text = RichText::new(text) - // .font(style.text.font_id) - // .color(style.text.color); - // self.text = WidgetText::RichText(Arc::new(rich_text)); - // } + // let id = ui.next_auto_id(); + // let response: Option = ui.ctx().read_response(id); let (galley_pos, galley, mut response) = self.layout_in_ui(ui); response .widget_info(|| WidgetInfo::labeled(WidgetType::Label, ui.is_enabled(), galley.text())); + let state = response.widget_state(); + let style = ui.style().label_style(state); + if ui.is_rect_visible(response.rect) { if show_tooltip_when_elided && galley.elided { // Keep the sections and text, but reset everything else (especially wrapping): @@ -317,11 +309,12 @@ impl Widget for Label { ui.style().visuals.text_color() }; - let underline = if response.has_focus() || response.highlighted() { - Stroke::new(1.0, response_color) - } else { - Stroke::NONE - }; + // let underline = if response.has_focus() || response.highlighted() { + // Stroke::new(1.0, response_color) + // } else { + // Stroke::NONE + // }; + let underline = style.text.underline; let selectable = selectable.unwrap_or_else(|| ui.style().interaction.selectable_labels); if selectable { diff --git a/examples/hello_world_simple/questions.md b/examples/hello_world_simple/questions.md new file mode 100644 index 000000000..a2afff1cf --- /dev/null +++ b/examples/hello_world_simple/questions.md @@ -0,0 +1,9 @@ +## Button + +- If hovering a button add a stroke, the ui shift. Maybe add the option to avoid this resize by making the frame smaller ? + +## Label + +- I understand checking if a sense has been set by the user, but why check if it's different than hover ? Is it for technical purpose or purely to avoid confusion with a link ? + +- Selecting the text while being underlined move the underline diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 78bab8d98..6798fada6 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -25,7 +25,7 @@ fn main() -> eframe::Result { ..s.visuals.widgets.inactive }; s.visuals.widgets.active = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::BLUE), + fg_stroke: Stroke::new(1.0, Color32::LIGHT_BLUE), ..s.visuals.widgets.inactive }; s.visuals.widgets.hovered = WidgetVisuals { @@ -63,7 +63,9 @@ fn main() -> eframe::Result { .color(Color32::KHAKI), ); - ui.add(Label::new("test").sense(Sense::click())) + ui.add(Label::new("interaction click").sense(Sense::click())); + ui.add(Label::new("focusable").sense(Sense::focusable_noninteractive())) + .request_focus(); }); }) } From 785e19f999a514e2b7b0336b141f403efef8fedb Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Thu, 16 Oct 2025 17:11:51 +0200 Subject: [PATCH 15/30] CheckboxStyle --- crates/egui/src/style_trait.rs | 25 +++++++++++++-- crates/egui/src/widgets/checkbox.rs | 29 ++++++++++------- examples/hello_world_simple/questions.md | 10 ++++++ examples/hello_world_simple/src/main.rs | 40 +++++++++++++++--------- 4 files changed, 76 insertions(+), 28 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index 0dfa3d020..cacf5ebe3 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -36,8 +36,10 @@ pub struct CheckboxStyle { pub frame: Frame, /// Text next to it pub text: TextVisuals, - /// Size - pub size: Vec2, + /// Box size + pub size: f32, + /// Check size + pub check_size: f32, /// Frame of the checkbox itself pub checkbox_frame: Frame, /// Checkmark stroke @@ -149,6 +151,7 @@ impl Style { fill: visuals.bg_fill, stroke: visuals.bg_stroke, corner_radius: visuals.corner_radius, + inner_margin: self.spacing.button_padding.into(), ..Default::default() }, stroke: visuals.fg_stroke, @@ -169,7 +172,23 @@ impl Style { } } - // pub fn checkbox_style(&self, state: WidgetState) -> CheckboxStylee {} + pub fn checkbox_style(&self, state: WidgetState) -> CheckboxStyle { + let visuals = self.visuals.widgets.state(state); + let ws = self.widget_style(state); + CheckboxStyle { + frame: ws.frame.fill(Color32::TRANSPARENT), + size: self.spacing.icon_width, + check_size: self.spacing.icon_width_inner, + checkbox_frame: Frame { + fill: visuals.weak_bg_fill, + corner_radius: visuals.corner_radius, + stroke: visuals.bg_stroke, + ..Default::default() + }, + text: ws.text, + stroke: ws.stroke, + } + } pub fn label_style(&self, state: WidgetState) -> LabelStyle { let ws = self.widget_style(state); diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index c90cca292..598fc15e0 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -55,10 +55,17 @@ impl Widget for Checkbox<'_> { indeterminate, } = self; - let spacing = &ui.spacing(); - let icon_width = spacing.icon_width; + // Get the widget style by reading the rect from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().checkbox_style(state); - let mut min_size = Vec2::splat(spacing.interact_size.y); + let icon_width = style.size; + + // interact_size or size ? + // let mut min_size = Vec2::splat(ui.spacing().interact_size.y); + let mut min_size = Vec2::splat(style.size); min_size.y = min_size.y.at_least(icon_width); // In order to center the checkbox based on min_size we set the icon height to at least min_size.y @@ -72,6 +79,7 @@ impl Widget for Checkbox<'_> { let mut prepared = AtomLayout::new(atoms) .sense(Sense::click()) .min_size(min_size) + .frame(style.frame) .allocate(ui); if prepared.response.clicked() { @@ -97,17 +105,16 @@ impl Widget for Checkbox<'_> { if ui.is_rect_visible(prepared.response.rect) { // let visuals = ui.style().interact_selectable(&response, *checked); // too colorful - let visuals = *ui.style().interact(&prepared.response); - prepared.fallback_text_color = visuals.text_color(); + prepared.fallback_text_color = style.text.color; let response = prepared.paint(ui); if let Some(rect) = response.rect(rect_id) { let (small_icon_rect, big_icon_rect) = ui.spacing().icon_rectangles(rect); ui.painter().add(epaint::RectShape::new( - big_icon_rect.expand(visuals.expansion), - visuals.corner_radius, - visuals.bg_fill, - visuals.bg_stroke, + big_icon_rect, + style.checkbox_frame.corner_radius, + style.checkbox_frame.fill, + style.checkbox_frame.stroke, epaint::StrokeKind::Inside, )); @@ -116,7 +123,7 @@ impl Widget for Checkbox<'_> { ui.painter().add(Shape::hline( small_icon_rect.x_range(), small_icon_rect.center().y, - visuals.fg_stroke, + style.stroke, )); } else if *checked { // Check mark: @@ -126,7 +133,7 @@ impl Widget for Checkbox<'_> { pos2(small_icon_rect.center().x, small_icon_rect.bottom()), pos2(small_icon_rect.right(), small_icon_rect.top()), ], - visuals.fg_stroke, + style.stroke, )); } } diff --git a/examples/hello_world_simple/questions.md b/examples/hello_world_simple/questions.md index a2afff1cf..85e5d713f 100644 --- a/examples/hello_world_simple/questions.md +++ b/examples/hello_world_simple/questions.md @@ -1,3 +1,7 @@ +## General + +- Interact size is great, but it SHOULD or MUST be at least this size ? Maybe add a parameter for this choice ? + ## Button - If hovering a button add a stroke, the ui shift. Maybe add the option to avoid this resize by making the frame smaller ? @@ -7,3 +11,9 @@ - I understand checking if a sense has been set by the user, but why check if it's different than hover ? Is it for technical purpose or purely to avoid confusion with a link ? - Selecting the text while being underlined move the underline + +## Checkbox + +- Checkbox are in fact a label and a check box. To propagate the CheckBoxStyle to the label we need to use a scope or something similar and change the global style. Why bind label to the check box, the user can add it himself (To keep the great prototyping speed we could keep this behavior in a Ui method, that would just merge) + +- Propose different type of checkmark ? (eg. small square, dot, filled, custom, etc) diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 6798fada6..8f3da8a44 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,9 +1,10 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use std::process::exit; - -use eframe::egui::{self, Color32, FontId, Label, RichText, Sense, Stroke, style::WidgetVisuals}; +use eframe::egui::{ + self, Atom, Checkbox, Color32, FontId, Label, RichText, Sense, Stroke, style::WidgetVisuals, + vec2, +}; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). @@ -16,12 +17,18 @@ fn main() -> eframe::Result { // Our application state: let mut name = "Arthur".to_owned(); let mut age = 42; + let mut is_adult = age >= 18; eframe::run_simple_native("My egui App", options, move |ctx, _frame| { egui::CentralPanel::default().show(ctx, |ui| { ui.ctx().style_mut(|s| { + s.spacing.icon_width_inner = 8.0; + s.spacing.icon_width = 15.0; + s.spacing.button_padding = vec2(5.0, 5.0); + // s.spacing.interact_size.y = 30.0; s.visuals.widgets.inactive = WidgetVisuals { fg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), + bg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), ..s.visuals.widgets.inactive }; s.visuals.widgets.active = WidgetVisuals { @@ -29,7 +36,7 @@ fn main() -> eframe::Result { ..s.visuals.widgets.inactive }; s.visuals.widgets.hovered = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::YELLOW), + fg_stroke: Stroke::new(3.0, Color32::LIGHT_YELLOW), ..s.visuals.widgets.inactive }; s.visuals.widgets.noninteractive = WidgetVisuals { @@ -55,17 +62,22 @@ fn main() -> eframe::Result { // ui.add_enabled(false, Button::new("disabled")); // ui.add(Button::new("no frame inactive").frame_when_inactive(false)); - ui.label("Normal text"); - // Should not be affected by WidgetStyle - ui.label( - RichText::new("Unaffected by style") - .font(FontId::monospace(15.0)) - .color(Color32::KHAKI), - ); + // ui.label("Normal text"); + // // Should not be affected by WidgetStyle + // ui.label( + // RichText::new("Unaffected by style") + // .font(FontId::monospace(15.0)) + // .color(Color32::KHAKI), + // ); - ui.add(Label::new("interaction click").sense(Sense::click())); - ui.add(Label::new("focusable").sense(Sense::focusable_noninteractive())) - .request_focus(); + // ui.add(Label::new("interaction click").sense(Sense::click())); + // ui.add(Label::new("focusable").sense(Sense::focusable_noninteractive())) + // .request_focus(); + + ui.add(Checkbox::new(&mut is_adult, "test")); + ui.add(Checkbox::new(&mut is_adult, "test")); + ui.add(Checkbox::new(&mut is_adult, Atom::default())); + ui.add(Checkbox::new(&mut is_adult, Atom::default()).indeterminate(true)); }); }) } From 509d17d539cf04bfba06031bc0a5946fe36e7fc9 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Tue, 21 Oct 2025 10:42:42 +0200 Subject: [PATCH 16/30] checkbox & cleanup --- crates/egui/src/style_trait.rs | 78 ++++--------------------- crates/egui/src/widgets/button.rs | 2 +- crates/egui/src/widgets/checkbox.rs | 12 +++- crates/egui/src/widgets/drag_value.rs | 13 ++--- crates/egui/src/widgets/label.rs | 11 +--- crates/egui/src/widgets/separator.rs | 15 ++++- examples/hello_world_simple/src/main.rs | 72 ++++------------------- 7 files changed, 50 insertions(+), 153 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index cacf5ebe3..ecb7b8fbd 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -1,4 +1,3 @@ -use emath::Vec2; use epaint::{Color32, FontId, Shadow, Stroke, text::TextWrapMode}; use crate::{ @@ -36,9 +35,9 @@ pub struct CheckboxStyle { pub frame: Frame, /// Text next to it pub text: TextVisuals, - /// Box size + /// Checkbox size pub size: f32, - /// Check size + /// Checkmark size pub check_size: f32, /// Frame of the checkbox itself pub checkbox_frame: Frame, @@ -46,30 +45,6 @@ pub struct CheckboxStyle { pub stroke: Stroke, } -pub struct DragValueStyle { - /// Frame around - pub frame: Frame, - /// Text of the value - pub text: TextVisuals, - pub min_size: Vec2, -} - -pub struct HyperlinkStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, -} - -pub struct ImageStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, -} - pub struct LabelStyle { /// Frame around pub frame: Frame, @@ -79,32 +54,10 @@ pub struct LabelStyle { pub wrap_mode: TextWrapMode, } -pub struct RadioButtonStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, -} - pub struct SeparatorStyle { - pub size: f32, - pub stroke: Stroke, -} - -pub struct SliderStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, - pub stroke: Stroke, -} - -pub struct SpinnerStyle { - pub frame: Frame, - pub text: TextVisuals, - pub size: Vec2, - pub checkbox_frame: Frame, + /// How much space is allocated in the layout direction + pub spacing: f32, + /// How to paint it pub stroke: Stroke, } @@ -206,22 +159,11 @@ impl Style { } } - pub fn drag_value_style(&self, state: WidgetState) -> DragValueStyle { - let ws = self.widget_style(state); - DragValueStyle { - frame: ws.frame.inner_margin(self.spacing.button_padding), - min_size: self.spacing.interact_size, - text: ws.text, + pub fn separator_style(&self, state: WidgetState) -> SeparatorStyle { + let visuals = self.visuals.widgets.state(state); + SeparatorStyle { + spacing: 0.0, + stroke: visuals.fg_stroke, } } - - // pub fn hyperlink_style(&self, state: WidgetState) -> HyperlinkStyle {} - - // pub fn image_style(&self, state: WidgetState) -> ImageStyle {} - - // pub fn slider_style(&self, state: WidgetState) -> SliderStyle {} - - // pub fn separator_style(&self, state: WidgetState) -> SeparatorStyle {} - - // pub fn spinner_style(&self, state: WidgetState) -> SpinnerStyle {} } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 24ea33ab3..6b5e77b5f 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -284,7 +284,7 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); - // Get the widget style by reading the rect from the previous pass + // Get the widget style by reading the response from the previous pass let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index 598fc15e0..d8458eeb1 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -1,3 +1,5 @@ +use emath::Rect; + use crate::{ Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Shape, Ui, Vec2, Widget, WidgetInfo, WidgetType, epaint, pos2, @@ -55,7 +57,7 @@ impl Widget for Checkbox<'_> { indeterminate, } = self; - // Get the widget style by reading the rect from the previous pass + // Get the widget style by reading the response from the previous pass let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); @@ -109,7 +111,13 @@ impl Widget for Checkbox<'_> { let response = prepared.paint(ui); if let Some(rect) = response.rect(rect_id) { - let (small_icon_rect, big_icon_rect) = ui.spacing().icon_rectangles(rect); + let big_icon_rect = Rect::from_center_size( + pos2(rect.left() + icon_width / 2.0, rect.center().y), + Vec2::splat(style.size), + ); + let small_icon_rect = + Rect::from_center_size(big_icon_rect.center(), Vec2::splat(style.check_size)); + ui.painter().add(epaint::RectShape::new( big_icon_rect, style.checkbox_frame.corner_radius, diff --git a/crates/egui/src/widgets/drag_value.rs b/crates/egui/src/widgets/drag_value.rs index 1c4caf995..9515726c2 100644 --- a/crates/egui/src/widgets/drag_value.rs +++ b/crates/egui/src/widgets/drag_value.rs @@ -4,7 +4,7 @@ use std::{cmp::Ordering, ops::RangeInclusive}; use crate::{ Button, CursorIcon, Id, Key, MINUS_CHAR_STR, Modifiers, NumExt as _, Response, RichText, Sense, - TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, grid::State, text, + TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, text, }; // ---------------------------------------------------------------------------- @@ -447,10 +447,6 @@ impl Widget for DragValue<'_> { let id = ui.next_auto_id(); let is_slow_speed = shift && ui.ctx().is_being_dragged(id); - let response = ui.ctx().read_response(id); - let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().drag_value_style(state); - // The following ensures that when a `DragValue` receives focus, // it is immediately rendered in edit mode, rather than being rendered // in button mode for just one frame. This is important for @@ -564,14 +560,13 @@ impl Widget for DragValue<'_> { .clip_text(false) .horizontal_align(ui.layout().horizontal_align()) .vertical_align(ui.layout().vertical_align()) - .margin(style.frame.inner_margin) - .min_size(style.min_size) + .margin(ui.spacing().button_padding) + .min_size(ui.spacing().interact_size) .id(id) .desired_width( ui.spacing().interact_size.x - 2.0 * ui.spacing().button_padding.x, ) - .text_color(style.text.color) - .font(style.text.font_id), + .font(text_style), ); // Select all text when the edit gains focus. diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index a0805b7de..bd0d347fe 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -179,7 +179,7 @@ impl Label { return (pos, galley, response); } - // Get the widget style by reading the rect from the previous pass + // Get the widget style by reading the response from the previous pass let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); @@ -280,10 +280,6 @@ impl Widget for Label { let selectable = self.selectable; let show_tooltip_when_elided = self.show_tooltip_when_elided; - // Get the widget style by reading the rect from the previous pass - // let id = ui.next_auto_id(); - // let response: Option = ui.ctx().read_response(id); - let (galley_pos, galley, mut response) = self.layout_in_ui(ui); response .widget_info(|| WidgetInfo::labeled(WidgetType::Label, ui.is_enabled(), galley.text())); @@ -309,11 +305,6 @@ impl Widget for Label { ui.style().visuals.text_color() }; - // let underline = if response.has_focus() || response.highlighted() { - // Stroke::new(1.0, response_color) - // } else { - // Stroke::NONE - // }; let underline = style.text.underline; let selectable = selectable.unwrap_or_else(|| ui.style().interaction.selectable_labels); diff --git a/crates/egui/src/widgets/separator.rs b/crates/egui/src/widgets/separator.rs index 6fdd03b96..f130d9272 100644 --- a/crates/egui/src/widgets/separator.rs +++ b/crates/egui/src/widgets/separator.rs @@ -88,11 +88,22 @@ impl Separator { impl Widget for Separator { fn ui(self, ui: &mut Ui) -> Response { let Self { - spacing, + mut spacing, grow, is_horizontal_line, } = self; + // Get the widget style by reading the response from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let style = ui.style().separator_style(state); + + // override the spacing if not set + if spacing == 0.0 && style.spacing != 0.0 { + spacing = style.spacing; + } + let is_horizontal_line = is_horizontal_line .unwrap_or_else(|| ui.is_grid() || !ui.layout().main_dir().is_horizontal()); @@ -111,7 +122,7 @@ impl Widget for Separator { let (rect, response) = ui.allocate_at_least(size, Sense::hover()); if ui.is_rect_visible(response.rect) { - let stroke = ui.visuals().widgets.noninteractive.bg_stroke; + let stroke = style.stroke; let painter = ui.painter(); if is_horizontal_line { painter.hline( diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 8f3da8a44..4fe49a89d 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,10 +1,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![allow(rustdoc::missing_crate_level_docs)] // it's an example -use eframe::egui::{ - self, Atom, Checkbox, Color32, FontId, Label, RichText, Sense, Stroke, style::WidgetVisuals, - vec2, -}; +use eframe::egui; fn main() -> eframe::Result { env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`). @@ -17,67 +14,20 @@ fn main() -> eframe::Result { // Our application state: let mut name = "Arthur".to_owned(); let mut age = 42; - let mut is_adult = age >= 18; eframe::run_simple_native("My egui App", options, move |ctx, _frame| { egui::CentralPanel::default().show(ctx, |ui| { - ui.ctx().style_mut(|s| { - s.spacing.icon_width_inner = 8.0; - s.spacing.icon_width = 15.0; - s.spacing.button_padding = vec2(5.0, 5.0); - // s.spacing.interact_size.y = 30.0; - s.visuals.widgets.inactive = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), - bg_stroke: Stroke::new(1.0, Color32::LIGHT_GRAY), - ..s.visuals.widgets.inactive - }; - s.visuals.widgets.active = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::LIGHT_BLUE), - ..s.visuals.widgets.inactive - }; - s.visuals.widgets.hovered = WidgetVisuals { - fg_stroke: Stroke::new(3.0, Color32::LIGHT_YELLOW), - ..s.visuals.widgets.inactive - }; - s.visuals.widgets.noninteractive = WidgetVisuals { - fg_stroke: Stroke::new(1.0, Color32::RED), - ..s.visuals.widgets.inactive - }; + ui.heading("My egui Application"); + ui.horizontal(|ui| { + let name_label = ui.label("Your name: "); + ui.text_edit_singleline(&mut name) + .labelled_by(name_label.id); }); - - // ui.heading("My egui Application"); - // ui.horizontal(|ui| { - // let name_label = ui.label("Your name: "); - // ui.text_edit_singleline(&mut name) - // .labelled_by(name_label.id); - // }); - // ui.add(egui::Slider::new(&mut age, 0..=120).text("age")); - // if ui.button("Increment").clicked() { - // age += 1; - // } - - // Button test - // ui.add(Button::new("no frame").frame(false)); - // ui.add(Button::new("small").small()); - // ui.add_enabled(false, Button::new("disabled")); - // ui.add(Button::new("no frame inactive").frame_when_inactive(false)); - - // ui.label("Normal text"); - // // Should not be affected by WidgetStyle - // ui.label( - // RichText::new("Unaffected by style") - // .font(FontId::monospace(15.0)) - // .color(Color32::KHAKI), - // ); - - // ui.add(Label::new("interaction click").sense(Sense::click())); - // ui.add(Label::new("focusable").sense(Sense::focusable_noninteractive())) - // .request_focus(); - - ui.add(Checkbox::new(&mut is_adult, "test")); - ui.add(Checkbox::new(&mut is_adult, "test")); - ui.add(Checkbox::new(&mut is_adult, Atom::default())); - ui.add(Checkbox::new(&mut is_adult, Atom::default()).indeterminate(true)); + ui.add(egui::Slider::new(&mut age, 0..=120).text("age")); + if ui.button("Increment").clicked() { + age += 1; + } + ui.label(format!("Hello '{name}', age {age}")); }); }) } From 2df6154d9d20f0bf14ab5d90153e7ef46d6f2904 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Tue, 21 Oct 2025 11:06:39 +0200 Subject: [PATCH 17/30] Button resize fix + Margin i8 -> i16 --- crates/egui/src/style.rs | 4 +-- crates/egui/src/widgets/button.rs | 55 ++++++++++++++++++++++++++----- crates/epaint/src/margin.rs | 42 +++++++++++------------ 3 files changed, 69 insertions(+), 32 deletions(-) diff --git a/crates/egui/src/style.rs b/crates/egui/src/style.rs index 454fc6d89..0bee9bd73 100644 --- a/crates/egui/src/style.rs +++ b/crates/egui/src/style.rs @@ -2600,8 +2600,8 @@ impl Widget for &mut Margin { } else { // Make sure it is not same: if self.is_same() { - if self.right == i8::MAX { - self.right = i8::MAX - 1; + if self.right == i16::MAX { + self.right = i16::MAX - 1; } else { self.right += 1; } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 6b5e77b5f..e20a09bbc 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,5 +1,7 @@ use std::sync::Arc; +use epaint::Margin; + use crate::{ Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, @@ -255,14 +257,14 @@ impl<'a> Button<'a> { pub fn atom_ui(self, ui: &mut Ui) -> AtomLayoutResponse { let Button { mut layout, - fill: _, - stroke: _, + fill, + stroke, small, frame, frame_when_inactive, mut min_size, - corner_radius: _, - selected: _, + corner_radius, + selected, image_tint_follows_text_color, limit_image_size, } = self; @@ -284,14 +286,49 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); - // Get the widget style by reading the response from the previous pass - let id = ui.next_auto_id(); - let response: Option = ui.ctx().read_response(id); - let state = response.map(|r| r.widget_state()).unwrap_or_default(); + let state = if selected { + // If selected is true then the state is active + WidgetState::Active + } else { + // Get the widget state by reading the response from the previous pass + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + response.map(|r| r.widget_state()).unwrap_or_default() + }; + let style = ui.style().button_style(state); let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); + let mut button_padding = if has_frame_margin { + style.frame.inner_margin + } else { + Margin::ZERO + }; + if small { + button_padding.bottom = 0; + button_padding.top = 0; + } + + // Override global style by local style + let mut frame = style.frame; + if let Some(fill) = fill { + frame = frame.fill(fill); + } + if let Some(corner_radius) = corner_radius { + frame = frame.corner_radius(corner_radius); + } + if let Some(stroke) = stroke { + frame = frame.stroke(stroke); + } + + frame = frame.inner_margin(Margin { + left: button_padding.left - frame.stroke.width as i16, + top: button_padding.top - frame.stroke.width as i16, + right: button_padding.right - frame.stroke.width as i16, + bottom: button_padding.bottom - frame.stroke.width as i16, + }); + // Apply the correct font and color if Text // We assume that the other WidgetText have already a Fontid and color layout.map_texts(|t| match t { @@ -307,7 +344,7 @@ impl<'a> Button<'a> { // Retrocompatibility with button settings let mut prepared = if has_frame_margin && (state != WidgetState::Inactive || frame_when_inactive) { - layout.frame(style.frame).min_size(min_size).allocate(ui) + layout.frame(frame).min_size(min_size).allocate(ui) } else { layout.min_size(min_size).allocate(ui) }; diff --git a/crates/epaint/src/margin.rs b/crates/epaint/src/margin.rs index e6f6d2287..66402a7ba 100644 --- a/crates/epaint/src/margin.rs +++ b/crates/epaint/src/margin.rs @@ -8,15 +8,15 @@ use emath::{Rect, Vec2, vec2}; /// Negative margins are possible, but may produce weird behavior. /// Use with care. /// -/// All values are stored as [`i8`] to keep the size of [`Margin`] small. +/// All values are stored as [`i16`] to keep the size of [`Margin`] small. /// If you want floats, use [`crate::MarginF32`] instead. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Margin { - pub left: i8, - pub right: i8, - pub top: i8, - pub bottom: i8, + pub left: i16, + pub right: i16, + pub top: i16, + pub bottom: i16, } impl Margin { @@ -30,7 +30,7 @@ impl Margin { /// The same margin on every side. #[doc(alias = "symmetric")] #[inline] - pub const fn same(margin: i8) -> Self { + pub const fn same(margin: i16) -> Self { Self { left: margin, right: margin, @@ -41,7 +41,7 @@ impl Margin { /// Margins with the same size on opposing sides #[inline] - pub const fn symmetric(x: i8, y: i8) -> Self { + pub const fn symmetric(x: i16, y: i16) -> Self { Self { left: x, right: x, @@ -98,9 +98,9 @@ impl Margin { } } -impl From for Margin { +impl From for Margin { #[inline] - fn from(v: i8) -> Self { + fn from(v: i16) -> Self { Self::same(v) } } @@ -134,12 +134,12 @@ impl std::ops::Add for Margin { } } -/// `Margin + i8` -impl std::ops::Add for Margin { +/// `Margin + i16` +impl std::ops::Add for Margin { type Output = Self; #[inline] - fn add(self, v: i8) -> Self { + fn add(self, v: i16) -> Self { Self { left: self.left.saturating_add(v), right: self.right.saturating_add(v), @@ -149,10 +149,10 @@ impl std::ops::Add for Margin { } } -/// `Margin += i8` -impl std::ops::AddAssign for Margin { +/// `Margin += i16` +impl std::ops::AddAssign for Margin { #[inline] - fn add_assign(&mut self, v: i8) { + fn add_assign(&mut self, v: i16) { *self = *self + v; } } @@ -214,12 +214,12 @@ impl std::ops::Sub for Margin { } } -/// `Margin - i8` -impl std::ops::Sub for Margin { +/// `Margin - i16` +impl std::ops::Sub for Margin { type Output = Self; #[inline] - fn sub(self, v: i8) -> Self { + fn sub(self, v: i16) -> Self { Self { left: self.left.saturating_sub(v), right: self.right.saturating_sub(v), @@ -229,10 +229,10 @@ impl std::ops::Sub for Margin { } } -/// `Margin -= i8` -impl std::ops::SubAssign for Margin { +/// `Margin -= i16` +impl std::ops::SubAssign for Margin { #[inline] - fn sub_assign(&mut self, v: i8) { + fn sub_assign(&mut self, v: i16) { *self = *self - v; } } From daccad61cdc7112eae4f8babf8a51e60add88a23 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Fri, 7 Nov 2025 11:11:07 +0100 Subject: [PATCH 18/30] check passed --- .gitignore | 1 + crates/egui/src/style.rs | 4 +- crates/egui/src/style_trait.rs | 10 ++ crates/egui/src/widgets/button.rs | 8 +- .../egui_demo_app/tests/snapshots/clock.png | 4 +- .../tests/snapshots/custom3d.png | 4 +- .../tests/snapshots/easymarkeditor.png | 4 +- .../tests/snapshots/imageviewer.png | 4 +- .../tests/snapshots/demos/Clipboard Test.png | 4 +- .../tests/snapshots/demos/Code Example.png | 4 +- .../tests/snapshots/demos/Dancing Strings.png | 4 +- .../tests/snapshots/demos/Font Book.png | 4 +- .../tests/snapshots/demos/Frame.png | 4 +- .../tests/snapshots/demos/Grid Test.png | 4 +- .../snapshots/demos/Input Event History.png | 4 +- .../tests/snapshots/demos/Input Test.png | 4 +- .../tests/snapshots/demos/Layout Test.png | 4 +- .../tests/snapshots/demos/Multi Touch.png | 4 +- .../tests/snapshots/demos/Painting.png | 4 +- .../tests/snapshots/demos/Panels.png | 4 +- .../tests/snapshots/demos/Popups.png | 4 +- .../tests/snapshots/demos/Scene.png | 4 +- .../tests/snapshots/demos/Screenshot.png | 4 +- .../tests/snapshots/demos/Scrolling.png | 4 +- .../tests/snapshots/demos/Sliders.png | 4 +- .../tests/snapshots/demos/Table.png | 4 +- .../snapshots/demos/Tessellation Test.png | 4 +- .../tests/snapshots/demos/Text Layout.png | 4 +- .../tests/snapshots/demos/Tooltips.png | 4 +- .../tests/snapshots/demos/Undo Redo.png | 4 +- .../tests/snapshots/demos/Window Options.png | 4 +- .../snapshots/demos/Window Resize Test.png | 4 +- .../tests/snapshots/modals_1.png | 4 +- .../tests/snapshots/modals_2.png | 4 +- .../tests/snapshots/modals_3.png | 4 +- .../snapshots/rendering_test/dpi_1.00.png | 4 +- .../snapshots/rendering_test/dpi_1.25.png | 4 +- .../snapshots/rendering_test/dpi_1.50.png | 4 +- .../snapshots/rendering_test/dpi_1.67.png | 4 +- .../snapshots/rendering_test/dpi_1.75.png | 4 +- .../snapshots/rendering_test/dpi_2.00.png | 4 +- .../tessellation_test/Additive rectangle.png | 4 +- .../tessellation_test/Blurred stroke.png | 4 +- .../snapshots/tessellation_test/Blurred.png | 4 +- .../tessellation_test/Minimal rounding.png | 4 +- .../snapshots/tessellation_test/Normal.png | 4 +- .../Thick stroke, minimal rounding.png | 4 +- .../tessellation_test/Thin filled.png | 4 +- .../tessellation_test/Thin stroked.png | 4 +- .../snapshots/widget_gallery_dark_x1.png | 4 +- .../snapshots/widget_gallery_dark_x2.png | 4 +- .../snapshots/widget_gallery_light_x1.png | 4 +- .../snapshots/widget_gallery_light_x2.png | 4 +- .../tests/snapshots/combobox_opened.png | 4 +- .../tests/snapshots/menu/closed_hovered.png | 4 +- .../tests/snapshots/menu/opened.png | 4 +- .../tests/snapshots/menu/submenu.png | 4 +- .../tests/snapshots/menu/subsubmenu.png | 4 +- .../override_text_color_interactive.png | 4 +- .../tests/snapshots/readme_example.png | 4 +- .../tests/snapshots/test_shrink.png | 4 +- .../tests/snapshots/test_tooltip_hidden.png | 4 +- .../tests/snapshots/test_tooltip_shown.png | 4 +- crates/epaint/src/margin.rs | 42 ++++----- scripts/check.sh | 92 ------------------- .../tests/snapshots/layout/checkbox.png | 4 +- .../snapshots/layout/checkbox_checked.png | 4 +- .../snapshots/layout/selectable_value.png | 4 +- .../layout/selectable_value_selected.png | 4 +- .../tests/snapshots/text_edit_rtl_2.png | 4 +- .../tests/snapshots/visuals/button.png | 4 +- .../tests/snapshots/visuals/button_image.png | 4 +- .../visuals/button_image_shortcut.png | 4 +- .../button_image_shortcut_selected.png | 4 +- .../tests/snapshots/visuals/checkbox.png | 4 +- .../snapshots/visuals/checkbox_checked.png | 4 +- .../tests/snapshots/visuals/drag_value.png | 4 +- .../snapshots/visuals/selectable_value.png | 4 +- .../visuals/selectable_value_selected.png | 4 +- .../tests/snapshots/visuals/text_edit.png | 4 +- 80 files changed, 186 insertions(+), 267 deletions(-) delete mode 100755 scripts/check.sh diff --git a/.gitignore b/.gitignore index 588826e7d..5d96b3808 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.vscode /media/* .idea/ +/scripts/check.sh diff --git a/crates/egui/src/style.rs b/crates/egui/src/style.rs index 0bee9bd73..454fc6d89 100644 --- a/crates/egui/src/style.rs +++ b/crates/egui/src/style.rs @@ -2600,8 +2600,8 @@ impl Widget for &mut Margin { } else { // Make sure it is not same: if self.is_same() { - if self.right == i16::MAX { - self.right = i16::MAX - 1; + if self.right == i8::MAX { + self.right = i8::MAX - 1; } else { self.right += 1; } diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index ecb7b8fbd..7696cd4ea 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -9,8 +9,10 @@ use crate::{ pub struct TextVisuals { /// Font used pub font_id: FontId, + /// Font color pub color: Color32, + /// Text decoration pub underline: Stroke, pub strikethrough: Stroke, @@ -33,14 +35,19 @@ pub struct ButtonStyle { pub struct CheckboxStyle { /// Frame around pub frame: Frame, + /// Text next to it pub text: TextVisuals, + /// Checkbox size pub size: f32, + /// Checkmark size pub check_size: f32, + /// Frame of the checkbox itself pub checkbox_frame: Frame, + /// Checkmark stroke pub stroke: Stroke, } @@ -48,8 +55,10 @@ pub struct CheckboxStyle { pub struct LabelStyle { /// Frame around pub frame: Frame, + /// Text style pub text: TextVisuals, + /// Wrap mode used pub wrap_mode: TextWrapMode, } @@ -57,6 +66,7 @@ pub struct LabelStyle { pub struct SeparatorStyle { /// How much space is allocated in the layout direction pub spacing: f32, + /// How to paint it pub stroke: Stroke, } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index e20a09bbc..e27ee0e9b 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -323,10 +323,10 @@ impl<'a> Button<'a> { } frame = frame.inner_margin(Margin { - left: button_padding.left - frame.stroke.width as i16, - top: button_padding.top - frame.stroke.width as i16, - right: button_padding.right - frame.stroke.width as i16, - bottom: button_padding.bottom - frame.stroke.width as i16, + left: button_padding.left - frame.stroke.width as i8, + top: button_padding.top - frame.stroke.width as i8, + right: button_padding.right - frame.stroke.width as i8, + bottom: button_padding.bottom - frame.stroke.width as i8, }); // Apply the correct font and color if Text diff --git a/crates/egui_demo_app/tests/snapshots/clock.png b/crates/egui_demo_app/tests/snapshots/clock.png index 39d9bb5ce..29e56828e 100644 --- a/crates/egui_demo_app/tests/snapshots/clock.png +++ b/crates/egui_demo_app/tests/snapshots/clock.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44a68dc4d3aeebeb2d296c5c8e03aac330e1e4552364084347b710326c88f70c -size 335794 +oid sha256:7ea2f4e2fc86a3b5a612448d79589df8f5432d8891241541bba2135d80137ef0 +size 335919 diff --git a/crates/egui_demo_app/tests/snapshots/custom3d.png b/crates/egui_demo_app/tests/snapshots/custom3d.png index deed497b1..ca3551c2e 100644 --- a/crates/egui_demo_app/tests/snapshots/custom3d.png +++ b/crates/egui_demo_app/tests/snapshots/custom3d.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e9a760fe4a695e6321f00e40bfa76fd0195bee7157a1217572765e3f146ea2cc -size 93640 +oid sha256:c79323e08a7027699082689194570c9b6c738d4b4d7d227ec4421bed028a12fa +size 93808 diff --git a/crates/egui_demo_app/tests/snapshots/easymarkeditor.png b/crates/egui_demo_app/tests/snapshots/easymarkeditor.png index a039b8c24..bcabed9bd 100644 --- a/crates/egui_demo_app/tests/snapshots/easymarkeditor.png +++ b/crates/egui_demo_app/tests/snapshots/easymarkeditor.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1670bbfc1f0a71e20cbbeb73625c148b680963bc503d9b48e9cc43e704d7c54 -size 181671 +oid sha256:236e36cc1ae7f0b6564536e466a0d7992333254c6fd0853e85531895697fd996 +size 181936 diff --git a/crates/egui_demo_app/tests/snapshots/imageviewer.png b/crates/egui_demo_app/tests/snapshots/imageviewer.png index e1d518a96..8ce5442ca 100644 --- a/crates/egui_demo_app/tests/snapshots/imageviewer.png +++ b/crates/egui_demo_app/tests/snapshots/imageviewer.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc9c22567b76193a7f6753c4217adb3c92afa921c488ba1cf2e14b403814e7ac -size 99841 +oid sha256:8b6566e6aae8f551adbd4f6efbf861ed59d467ec158cf28ada39177911f4b302 +size 100505 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png index 373adc234..9dcfa16e7 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb944eca56724f6a2106ea8db2043dc94c0ea40bdd4cdeb0e520790f97cc9598 -size 27049 +oid sha256:91823881c5d74838d2aea59e1b93a472d2133a184a1f98c9771919a5af4fd19f +size 27138 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png b/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png index 22341d7b3..935e209e8 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5c1951b99908326b3f05ebb72aa4d02d0f297bdd925f38ded09041fae45400c1 -size 85217 +oid sha256:40f6059fb76d24f418d6808732a0887ec9d90f7da0be746a5ec077d2f2c0066b +size 85185 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png b/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png index 05a412548..707a18455 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0df751bac5947c9bf6f82d075cf5670a562742b80d6c512bcd642da5ed449d26 -size 25975 +oid sha256:5f003032015dc8330f4bf5f334482b4a10fa8a25743e265ddbc5c47ff56723ff +size 26027 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png b/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png index 2a12a3152..c47eee065 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1227636b03a7d35db3482b19f6059ec7aaf03ca795edadd5338056be6f6a8f7f -size 126724 +oid sha256:a87f318f97d124b2033acf58b6f32e46e3aed018ce7705a6662681885d55e3b9 +size 126756 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Frame.png b/crates/egui_demo_lib/tests/snapshots/demos/Frame.png index 0385ab120..4c062051b 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Frame.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Frame.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c01e96bf0aab24dbcfc05f2a6dcb0ffcddff69ec2474797de4fbce0a0670a8cd -size 24964 +oid sha256:0dc7d0fc29e216e97a3a39250b40790c4e300b17a39be11674215797a471663a +size 25024 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png index e14a4ecb5..6ead8b900 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec357eafd145194f99c36a53a149a8b331fd691c5088df43ee96282b84bc81a4 -size 99439 +oid sha256:79b95e5b17c03b2301ab42b25ad6911ef5b536c8ecea23350e2973a46e803bdb +size 99707 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png b/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png index c100d9209..e4ad45786 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1378d865af3df02e12a0c4bc087620a4e9ef0029221db3180cdd2fd34f69d7f -size 24832 +oid sha256:c97e448603f69a413fe12f955c1e64eee8eb4700ee6e8eea1202ede9558bfd94 +size 24881 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png index 58cc9f94b..397483016 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aff927596be5db77349ec0bbdcc852a0b1467e94c2a553a740a383ae318bad18 -size 51670 +oid sha256:a83b1f5f2ce1751e8288a2c33a46fa541cd28b2d1eb4ccefeaef4224b0be2f88 +size 51859 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png index ed84d7428..53c80c31f 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad26106a86a6236f0db1c51bed754b370530813e9bb6e36c1be2948820fbef25 -size 47827 +oid sha256:28f191a4ee646fc63e19ac435316fd790103221e3055da9979fce04c4f617c79 +size 48041 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png b/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png index daa9da35a..845529cde 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf7f0a76424a959ede7afbb0eaf777638038cc6fe208ef710d9d82638d68b4d0 -size 37848 +oid sha256:744bfd9c1f714beedaf6cc3c9f5fed1aaeef0d8c8a5521fb09e419079140df35 +size 37922 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Painting.png b/crates/egui_demo_lib/tests/snapshots/demos/Painting.png index e53f4f7af..b2eeb48f8 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Painting.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Painting.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d2370972781f15a1d602deca28bca38f1c077152801870edf2112650b8b1349 -size 17708 +oid sha256:c2449a12444f730d45b6e2856fd878d6b47a0eae56e53576a5899e61e2bd9c15 +size 17680 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Panels.png b/crates/egui_demo_lib/tests/snapshots/demos/Panels.png index 22daed0ed..60d86d8ea 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Panels.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Panels.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c91f592571ba654d0a96791662ae7530a1db4c1630b57c795d1c006ea6e46f19 -size 256975 +oid sha256:4b5998d173ac2c2ebf64ad8c2c4f98463b344a47874b9a390709e639f0fe2a62 +size 257487 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Popups.png b/crates/egui_demo_lib/tests/snapshots/demos/Popups.png index d00256a7e..f882c6728 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Popups.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Popups.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f8b937a8a63de6fedcd0f9748b1d04cd863331a297bec78906885a0107def32a -size 61242 +oid sha256:4237a914a0a57957d54020e496043305fe26438dbd4f03db15e9db43b471ccc8 +size 61322 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Scene.png b/crates/egui_demo_lib/tests/snapshots/demos/Scene.png index 2344a3868..84222180e 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Scene.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Scene.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2855bd95ab33b5232edada1f65684bbba2748025b6b64eb9ac68a5f2d10ad4bd -size 34491 +oid sha256:31ebde2103ea2c30320f95e7ee9a6960feaf3946ad3b6db0da0bbcc5f85fa89b +size 34646 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png b/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png index 7e49a8613..0854a469b 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be599ae66323140bba4a7d63546acbf84340b57e2d82d4736bf3fe590040319d -size 23623 +oid sha256:96d5160a8e70480ac063be67481d890ddd17a929b1a6e8455e6e2568910eaa01 +size 23679 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png b/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png index 6de002ee4..71e08fcff 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01c3cb5e8972e0cab5325328f93af8f51b35a0d61016e74969eab0f7ddea1e02 -size 176973 +oid sha256:f2b02e997183f30bdd7a53afb92cee9e91c205e2ad2f77db7781177c2f20e166 +size 168401 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png b/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png index 417b183b5..cdc160ff2 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2f6cedc262259d52c1fbf4283d99b4b62ec732e8688b1e2799a2581425e0564 -size 120342 +oid sha256:25186c248e415becbbf00c90fad969f5b290683e1b3ffe25c07854330dbce999 +size 120914 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Table.png b/crates/egui_demo_lib/tests/snapshots/demos/Table.png index cf728bf3f..a1060783d 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Table.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Table.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4fbcca2b13c94769a62b44853b19f7e841bbb60c9197b3d0bf6e83ef9f8f76d1 -size 77815 +oid sha256:f95f41ced0ec7831acfb1257502b3d2617576b9d5002c7a30859a1150b4604cd +size 82431 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png index cd8524cef..89371e3bd 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cc24f146adf0282cfb51723b56c76eceb92f2988fc67bbeefd16b93950505922 -size 70110 +oid sha256:d441f831d6ac99090756b8cadf13bc22ce11f8cc8aea9edced5c20b4578b71a8 +size 70273 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png b/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png index 28c9f57ac..fa2f782c3 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77aeaa1dcd391a571cb38732686e0b85b2d727975c02507a114d4e932f2c351b -size 65562 +oid sha256:4b6e31294f9933c1788eb5a4636042378610ac1756dbac26c25792fe0a4e7ba1 +size 66108 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png b/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png index 265dfdc1e..36fb1ae20 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:415b1ce17dd6df7ca7a86fed92750c2ef811ff64720a447ae3ca6be10090666e -size 64624 +oid sha256:3bdedaa57fcbd0b082000d47b43f75983171ee6ed7b7370a2092c39964d31309 +size 64906 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png b/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png index fb2bd06aa..0425e3333 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0eaf717bf0083737c4186ac39e7baf98f42fffb36b49434a6658eff1430a0ac6 -size 13187 +oid sha256:a622b6945028e019061fdcf5e6f303fe647e08b2b781ac5ce7eb6fc21bc41e7a +size 13190 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png b/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png index 97fa6cebc..5a08c93e2 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a31f0c12bb70449136443f9086103bd5b46356eedc2bb93ae1b6b10684ab69ca -size 36285 +oid sha256:b3ef5e5bdf4859a295212a17b879884f707e0c48e4a158bbe50961035af1408e +size 36410 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png index 7a042bdba..c7bf0cd12 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b85a2af24c3361a0008fd0996e8d7244dc3e289646ec7233e8bad39a586c871c -size 44512 +oid sha256:4d100a7932f71b02732e454be4bcc9e634a0fc45be0aa4ecff8aefb148ab2f38 +size 44526 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_1.png b/crates/egui_demo_lib/tests/snapshots/modals_1.png index a184b67dc..ca44d5073 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_1.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:60a44771c6bc9236593717236f9eca40bcb4723bac7567493cab4326f003eba3 -size 48693 +oid sha256:25c600764907b9a4e885939b3c5967ca67aa669f5ad2c30e02943bc97ca4cb87 +size 48884 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_2.png b/crates/egui_demo_lib/tests/snapshots/modals_2.png index c8e7cb55a..08281c8ed 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_2.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:53c1509f7be264ed2947cd4ec0f10b555e9f710e949ed6fd8a73ca8ade53abd4 -size 48570 +oid sha256:831268ea2718a60e1142c98fd53c2530a25dd0bd2ededfbf3a5c213da0c72d8a +size 48751 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_3.png b/crates/egui_demo_lib/tests/snapshots/modals_3.png index 777b700c2..eaea56328 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_3.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20eecafb998f69c2384afabc27eec1f97f413d603ece944adae9a99139be0b58 -size 44689 +oid sha256:9147bbd560474269a2294fab2df54d61ccf3eee0ae453e710fd8034d0f709232 +size 44865 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png index 640d84c2b..e72402dc0 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f9980486c36a0242f3b043a172c411d4fc9573543d3cd7c1c43bf020c18868a9 -size 619816 +oid sha256:0f38b9859a1b272a6eeee71ce186a1ecaf245efd954ec5012a0c15236a530b6c +size 622678 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png index df05ada25..84ef56d37 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:040e2e486ae4773a084da99513a53c620e8e2bba215183ec26c6e489381d6254 -size 823086 +oid sha256:8c4e677d8baf46bff20171ea9488ff36ff3d1d367355232c85b0bd1aa2e26009 +size 824364 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png index c6aa2914f..1a7f93546 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:439a5f942a5f05b9c09685ef90be94c150a21a68d1d235af22372b9b6a7b7389 -size 1035734 +oid sha256:6fd3a2ae4ff90181e80c595f82f748cf333e829012bbf69fe65565ef10102006 +size 1038859 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png index 1344edcfb..8a157f86d 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b7d7e290b97a8042af3af3cd9ceb274950cf607dd7e9cd6c71d5a113d3b57a5 -size 1206155 +oid sha256:be318246896430d1ccadcdbd49ce1f1b55656fc43f0df8468c96e8e8bd0186c6 +size 1210243 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png index 9804e2942..f97f20ac4 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fedd5546e36a89121c0bb0a780b0bbe081611c2c04013064872801181503fb83 -size 1231599 +oid sha256:e8a595e9a1d0671c094aa204352a93bb35732bffdf73d2cf266baa860429d955 +size 1235525 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png index 04d4bb4ea..7c2c9cc6e 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69a7040336fc92c6d7b158283aabbc5817980c2fa84a1120b788516cf437b985 -size 1461979 +oid sha256:c1cc2ac5384a5ee41b4cdf1d83a72baf709f7cc8f3439fc5addedea723bbf96c +size 1467077 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png index 50e84c900..b53f69bed 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a32d361afa20fc8c20122a89b01fe14b45849da42663991e589579f70fb8577 -size 46790 +oid sha256:667280ce65e68ecf72202d1eb174114396300f2402e557e06677f23d22707790 +size 47010 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png index ca5a23f97..5dc5c1f5a 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8d55205cf4225123da33895ed45eb186e5e57184ef5928400a4bae3ab6092be -size 88548 +oid sha256:c8f17504759fd16d78fc0ac79d22b4daabc9cf723ff57128e3276aaf8c304446 +size 88708 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png index 41f9ef2f5..7a236ce37 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77ab9e2e18c788f8cdbec171269afe4d0a90c52abeda7063cae3766dcaa5e93b -size 120612 +oid sha256:55c6d784f005e30fd05968b67a5afade2c0244449ead09b5eb4f24fa4e89238a +size 120408 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png index 85d844c79..5203f867c 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:36622a2f934503a7b60ded2f44b002e37eedde22d548dcf5a209f54c19548665 -size 53064 +oid sha256:685df94301659df0e221e6ca1f24d3f002858ad3a7c058b2e8ce70d8aa7104f0 +size 53260 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png index 6e6d9f0f2..0c9f36da1 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4adeb7a77a0d0fe85097fcd190a99b49858dce11bde601d30335afcb6cc3d5f6 -size 56276 +oid sha256:45cc44cff4facce5d19d2447431f4cad717b385afe73a22ddaa48733a2208d1f +size 56463 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png index eefbac2bb..5a135fca8 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f45249f7cc90433a64856905c727571c4ef20468e2c7d3ac2029e18a0477932d -size 56743 +oid sha256:bd14edfdb8384849755784c3b6b43b8e6e88392978a64bca2683002cf5ac1169 +size 56905 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png index 08178eaa8..0337d533c 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d437f68c521f3e627a1b50d46605e8b0b343c5fc3716d9669e8c4436c8992b6f -size 37602 +oid sha256:668b64f04d3249b3046a125eb3a323f30934d35329dc10c711f58ea78d98cfa2 +size 37847 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png index 13f057df9..32c7451c1 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:08ba98437403a08cca825ed8e288c9f088a46d9a1081f0b0a4ed7fbb9b49bb85 -size 37640 +oid sha256:0f8644452fd5211f7ded1d73186c4d866aa49cb23d4087b2a126f87d8c3c5f62 +size 37886 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png index ab2db5eb5..acf9f71ac 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1ed0e40d08b2b9ea978a07a4b7bf282c9e2cba8c52896f12210f396241e1b78 -size 66859 +oid sha256:d1b80b2ae54d7e535700abf2036379c2477230353b53a5cba0bda9eebef32d3c +size 67123 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png index e84863bf4..148283d1f 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28f9862dd6f16b99523f5880bf90346fd9455d0d44e7bdd530d523e0b2ef2d2c -size 158892 +oid sha256:d018e524b432d24c32c641f889aab4e3d5e6192f8c22bb77e6a0f439dfdccf65 +size 159486 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png index 87eb5ce70..3ef62db98 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:98c40c99a237f8388d82259fba4388d7b1759fe7b4bf657d326532934135c934 -size 61119 +oid sha256:b4906bc38d36cb837b417445a24c091c488600bff67be4ed4fc98653ba79dbf3 +size 61403 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png index c2c4705e1..8bd994095 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:90d36311ce5b1dcf81cab22113620a3362f255059d1f52c6794c8249f960549e -size 152215 +oid sha256:2e3c288d8e5cb768345f0577ad965cfb207b47bf37497a4283d28305dd8427ea +size 152658 diff --git a/crates/egui_kittest/tests/snapshots/combobox_opened.png b/crates/egui_kittest/tests/snapshots/combobox_opened.png index aaa7198ce..b64baffec 100644 --- a/crates/egui_kittest/tests/snapshots/combobox_opened.png +++ b/crates/egui_kittest/tests/snapshots/combobox_opened.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f70ef032c241cd63675a246de07886c5c822e6fe21525b3a6d3fee106a589c9 -size 7501 +oid sha256:ec3b264d0243f950babd8eb943efcaa2d40b0fa586cf391ab6ff28e56f1318bb +size 7623 diff --git a/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png b/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png index d2969adee..7f6820276 100644 --- a/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png +++ b/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd6e159a462dde10240c4ca51da5ca5badfb7fc170bad97a59106babb72f8ae3 -size 10795 +oid sha256:1ed9c5dca0551d8e6177dc67def3e8819036e39d935e11f9ee77a974dd7a3306 +size 10938 diff --git a/crates/egui_kittest/tests/snapshots/menu/opened.png b/crates/egui_kittest/tests/snapshots/menu/opened.png index 30f26b446..44f9e1e31 100644 --- a/crates/egui_kittest/tests/snapshots/menu/opened.png +++ b/crates/egui_kittest/tests/snapshots/menu/opened.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8f2a5873350f85457d599c1fd165ac756ed69758e7647e160c64f44d2f35c804 -size 21812 +oid sha256:1f765cc56eb84b14d0c7d7804c5ec24f90ea8ba14ee288787aa5131d58365629 +size 22072 diff --git a/crates/egui_kittest/tests/snapshots/menu/submenu.png b/crates/egui_kittest/tests/snapshots/menu/submenu.png index 96ffaf97c..ee122f962 100644 --- a/crates/egui_kittest/tests/snapshots/menu/submenu.png +++ b/crates/egui_kittest/tests/snapshots/menu/submenu.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:facc05c499745594ac286f15645e40447633a176058337cad9edcb850ad578c7 -size 29379 +oid sha256:27c85c456e69f4d885ccf9af606e426138f6ca6b8e0762ea4806d6cc8225382c +size 29569 diff --git a/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png b/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png index d1d0b4cd3..eb4692afe 100644 --- a/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png +++ b/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f23ff8c6782befdbe7bd5f076dcdda15c38555f8e505282369bf52e43938c1b -size 34194 +oid sha256:231c72b67e733d7c12e76d28c4702cef9490d169e80f1388ad0b5276bd7184fc +size 34175 diff --git a/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png b/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png index 6e92f9f03..6d30bd5ee 100644 --- a/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png +++ b/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2fa5cb5b96232d729f89be8cc92263715fe7197e72343b71e57e53a359afe181 -size 19881 +oid sha256:a525d62b50978bfa059f043f502ddf0ea4f8f88b2ec09cf7e07c53a7bf09e763 +size 19969 diff --git a/crates/egui_kittest/tests/snapshots/readme_example.png b/crates/egui_kittest/tests/snapshots/readme_example.png index 2c8565718..399005939 100644 --- a/crates/egui_kittest/tests/snapshots/readme_example.png +++ b/crates/egui_kittest/tests/snapshots/readme_example.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb8d702361987803995c0f557ce94552a87b97dcd25bed5ee39af4c0e6090700 -size 1904 +oid sha256:18fbcc76f0df799331760e06487d6467aa2f575ac14d31d1859bf6ba3dba2941 +size 2199 diff --git a/crates/egui_kittest/tests/snapshots/test_shrink.png b/crates/egui_kittest/tests/snapshots/test_shrink.png index c25ae0367..9155bb6e7 100644 --- a/crates/egui_kittest/tests/snapshots/test_shrink.png +++ b/crates/egui_kittest/tests/snapshots/test_shrink.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:025942c144891b8862bf931385824e0484e60f4e7766f5d4401511c72ff20756 -size 2975 +oid sha256:08da2ac5bfb1e5ef7fb97cdc792bbf0529c20276312f0c444b122af02990e78b +size 3004 diff --git a/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png b/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png index c25ae0367..9155bb6e7 100644 --- a/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png +++ b/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:025942c144891b8862bf931385824e0484e60f4e7766f5d4401511c72ff20756 -size 2975 +oid sha256:08da2ac5bfb1e5ef7fb97cdc792bbf0529c20276312f0c444b122af02990e78b +size 3004 diff --git a/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png b/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png index 8ff6bba67..1c6358ad5 100644 --- a/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png +++ b/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c267530452adb4f1ed1440df476d576ef4c2d96e6c58068bb57fed4615f5e113 -size 4453 +oid sha256:b902df1b5971cd8d54a2e345f293bca2bf6f5ad262812ef8535f4191375e9dd2 +size 4486 diff --git a/crates/epaint/src/margin.rs b/crates/epaint/src/margin.rs index 66402a7ba..e6f6d2287 100644 --- a/crates/epaint/src/margin.rs +++ b/crates/epaint/src/margin.rs @@ -8,15 +8,15 @@ use emath::{Rect, Vec2, vec2}; /// Negative margins are possible, but may produce weird behavior. /// Use with care. /// -/// All values are stored as [`i16`] to keep the size of [`Margin`] small. +/// All values are stored as [`i8`] to keep the size of [`Margin`] small. /// If you want floats, use [`crate::MarginF32`] instead. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] pub struct Margin { - pub left: i16, - pub right: i16, - pub top: i16, - pub bottom: i16, + pub left: i8, + pub right: i8, + pub top: i8, + pub bottom: i8, } impl Margin { @@ -30,7 +30,7 @@ impl Margin { /// The same margin on every side. #[doc(alias = "symmetric")] #[inline] - pub const fn same(margin: i16) -> Self { + pub const fn same(margin: i8) -> Self { Self { left: margin, right: margin, @@ -41,7 +41,7 @@ impl Margin { /// Margins with the same size on opposing sides #[inline] - pub const fn symmetric(x: i16, y: i16) -> Self { + pub const fn symmetric(x: i8, y: i8) -> Self { Self { left: x, right: x, @@ -98,9 +98,9 @@ impl Margin { } } -impl From for Margin { +impl From for Margin { #[inline] - fn from(v: i16) -> Self { + fn from(v: i8) -> Self { Self::same(v) } } @@ -134,12 +134,12 @@ impl std::ops::Add for Margin { } } -/// `Margin + i16` -impl std::ops::Add for Margin { +/// `Margin + i8` +impl std::ops::Add for Margin { type Output = Self; #[inline] - fn add(self, v: i16) -> Self { + fn add(self, v: i8) -> Self { Self { left: self.left.saturating_add(v), right: self.right.saturating_add(v), @@ -149,10 +149,10 @@ impl std::ops::Add for Margin { } } -/// `Margin += i16` -impl std::ops::AddAssign for Margin { +/// `Margin += i8` +impl std::ops::AddAssign for Margin { #[inline] - fn add_assign(&mut self, v: i16) { + fn add_assign(&mut self, v: i8) { *self = *self + v; } } @@ -214,12 +214,12 @@ impl std::ops::Sub for Margin { } } -/// `Margin - i16` -impl std::ops::Sub for Margin { +/// `Margin - i8` +impl std::ops::Sub for Margin { type Output = Self; #[inline] - fn sub(self, v: i16) -> Self { + fn sub(self, v: i8) -> Self { Self { left: self.left.saturating_sub(v), right: self.right.saturating_sub(v), @@ -229,10 +229,10 @@ impl std::ops::Sub for Margin { } } -/// `Margin -= i16` -impl std::ops::SubAssign for Margin { +/// `Margin -= i8` +impl std::ops::SubAssign for Margin { #[inline] - fn sub_assign(&mut self, v: i16) { + fn sub_assign(&mut self, v: i8) { *self = *self - v; } } diff --git a/scripts/check.sh b/scripts/check.sh deleted file mode 100755 index ffee218f6..000000000 --- a/scripts/check.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -# This scripts runs various CI-like checks in a convenient way. - -set -eu -script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -cd "$script_path/.." -set -x - -# Checks all tests, lints etc. -# Basically does what the CI does. - -# cargo +1.88.0 install --quiet typos-cli - -export RUSTFLAGS="-D warnings" -export RUSTDOCFLAGS="-D warnings" # https://github.com/emilk/egui/pull/1454 - -# Fast checks first: -typos -./scripts/lint.py -cargo fmt --all -- --check -cargo doc --quiet --lib --no-deps --all-features -cargo doc --quiet --document-private-items --no-deps --all-features -cargo clippy --quiet --all-targets --all-features -- -D warnings -cargo clippy --quiet --all-targets --all-features --release -- -D warnings # we need to check release mode too - -./scripts/clippy_wasm.sh - -cargo check --quiet --all-targets -cargo check --quiet --all-targets --all-features -cargo check --quiet -p egui_demo_app --lib --target wasm32-unknown-unknown -cargo check --quiet -p egui_demo_app --lib --target wasm32-unknown-unknown --all-features -# TODO(#5297) re-enable --all-features once the tests work with the unity feature -cargo test --quiet --all-targets --all-features -cargo test --quiet --doc # slow - checks all doc-tests - -cargo check --quiet -p eframe --no-default-features --features "glow" -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - cargo check --quiet -p eframe --no-default-features --features "wgpu","x11" - cargo check --quiet -p eframe --no-default-features --features "wgpu","wayland" -else - cargo check --quiet -p eframe --no-default-features --features "wgpu" -fi - -cargo check --quiet -p egui --no-default-features --features "serde" -cargo check --quiet -p egui_demo_app --no-default-features --features "glow" - -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","x11" - cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","wayland" -else - cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu" -fi - -cargo check --quiet -p egui_demo_lib --no-default-features -cargo check --quiet -p egui_extras --no-default-features -cargo check --quiet -p egui_glow --no-default-features -cargo check --quiet -p egui-winit --no-default-features --features "wayland" -cargo check --quiet -p egui-winit --no-default-features --features "x11" -cargo check --quiet -p emath --no-default-features -cargo check --quiet -p epaint --no-default-features --release -cargo check --quiet -p epaint --no-default-features - -cargo check --quiet -p eframe --all-features -cargo check --quiet -p egui --all-features -cargo check --quiet -p egui_demo_app --all-features -cargo check --quiet -p egui_extras --all-features -cargo check --quiet -p egui_glow --all-features -cargo check --quiet -p egui-winit --all-features -cargo check --quiet -p emath --all-features -cargo check --quiet -p epaint --all-features - -./scripts/wasm_bindgen_check.sh - -./scripts/cargo_deny.sh - -# TODO(emilk): consider using https://github.com/taiki-e/cargo-hack or https://github.com/frewsxcv/cargo-all-features - -# ------------------------------------------------------------ -# - -# For finding bloat: -# cargo bloat --release --bin egui_demo_app -n 200 | rg egui -# Also try https://github.com/google/bloaty - -# what compiles slowly? -# cargo clean && time cargo build -p eframe --timings -# https://fasterthanli.me/articles/why-is-my-rust-build-so-slow - -# what compiles slowly? -# cargo llvm-lines --lib -p egui | head -20 - -echo "All checks passed." diff --git a/tests/egui_tests/tests/snapshots/layout/checkbox.png b/tests/egui_tests/tests/snapshots/layout/checkbox.png index 18ebbdb7c..2fcfe186a 100644 --- a/tests/egui_tests/tests/snapshots/layout/checkbox.png +++ b/tests/egui_tests/tests/snapshots/layout/checkbox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4747efdf758e7e8e2d7f3954d9595dfd45d3b4b86923b8ff39c8a96002bb4825 -size 408726 +oid sha256:ef93c74cb71d7a5386cc361ca91b3826c27c257413eaafc8f283bd177111d6b6 +size 409009 diff --git a/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png b/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png index 127aa7f30..544276069 100644 --- a/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png +++ b/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a3ca4b3a47ff516f9b05799cdf5f92845ae1e058728d635986cc61b7317f110 -size 437102 +oid sha256:554d51d9c557d8f7bc7ef6a5cac04520e0535074c2e762d8fc5ddd23b4a037bd +size 439301 diff --git a/tests/egui_tests/tests/snapshots/layout/selectable_value.png b/tests/egui_tests/tests/snapshots/layout/selectable_value.png index 2ee7f7d0e..efb50987b 100644 --- a/tests/egui_tests/tests/snapshots/layout/selectable_value.png +++ b/tests/egui_tests/tests/snapshots/layout/selectable_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfc900ea84b408564652df487e705311b164d9bd3ff5631c3cebb83b06497a7b -size 410131 +oid sha256:c70f3d9e6e767b9857b218ef25166aa0fc5a1d8b72cb9582e1322d53a3f135e4 +size 403775 diff --git a/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png b/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png index 7e3dd6319..dccd1bc3d 100644 --- a/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png +++ b/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9d08ce85c9210a7d9046480ab208040e5ba399c40acaecf5cb43f807534bce9 -size 423523 +oid sha256:e5188b61af6366680144486d927f8b497dcc1e836ae8e5d767c5bce59e05056a +size 446497 diff --git a/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png b/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png index b9235740d..b6233f378 100644 --- a/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png +++ b/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:38f325f2e741f18f897502c176f9a7efe276e9adab41a144511121dd8b8a3073 -size 3079 +oid sha256:055b6111aa48f19c894729e2935cb9298231aab78efb10b9e73c00da9edfd338 +size 3130 diff --git a/tests/egui_tests/tests/snapshots/visuals/button.png b/tests/egui_tests/tests/snapshots/visuals/button.png index 4c81f62fc..89958941a 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button.png +++ b/tests/egui_tests/tests/snapshots/visuals/button.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c05992e16c1abf6d174fed73d19cad6bb2266e0adb87b8232e765d75fcf3f14 -size 10310 +oid sha256:9df0ca1e011ccbba6e8620e2ef04b2e4f5614fd596a6dbc072179614552468c1 +size 10118 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image.png b/tests/egui_tests/tests/snapshots/visuals/button_image.png index 00582f3ae..305907647 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7681d33a5a764187c084c966a4e47063136e2832094c44f62718447b1b3027ec -size 11292 +oid sha256:bf2a513396ba3ba90e65a163fcd21d1eb1277f59ede157c67e12f1f18cbe070a +size 11109 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png index 1429bfd2d..1d1373005 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b99a82e9f3dfa24c079545272d680b55c4285c276befa0efc492fe273422f541 -size 14195 +oid sha256:37cf0ae5fd2fb2e2f2b960b7ea451e380c335e42a0f4d45cacec90dfcb9bdb48 +size 13981 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png index c73effead..8216b4cdf 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cdf079228b762949dbc67308103f8fe1328b6c0175f312ccc492d4e86d42127b -size 13868 +oid sha256:79bc45bc2c675a9deddf25aad80de45170bd97d157bfb195cd59f1b027240652 +size 14600 diff --git a/tests/egui_tests/tests/snapshots/visuals/checkbox.png b/tests/egui_tests/tests/snapshots/visuals/checkbox.png index 16d88e546..866473abb 100644 --- a/tests/egui_tests/tests/snapshots/visuals/checkbox.png +++ b/tests/egui_tests/tests/snapshots/visuals/checkbox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0bafe4c157696bfb52940b69501416d4da0b4eab52f34f52220d2e9ed01357cf -size 12901 +oid sha256:4f400f82eb9339c136f8ba2f393ae3b4832461fd2eca64cb4aa4f2ec60992d0c +size 13026 diff --git a/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png b/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png index fd85297ac..6b854278d 100644 --- a/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png +++ b/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:72175bf108135b422d978b701d29e6d9a5348c536e25abc924234bc11b6b7f21 -size 14016 +oid sha256:d96e5948ab50362475ab034e428804c1091b5dfacb8e3191021b1b13c3ce9c8e +size 14060 diff --git a/tests/egui_tests/tests/snapshots/visuals/drag_value.png b/tests/egui_tests/tests/snapshots/visuals/drag_value.png index 5411009f0..a9fc67d23 100644 --- a/tests/egui_tests/tests/snapshots/visuals/drag_value.png +++ b/tests/egui_tests/tests/snapshots/visuals/drag_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:129121534b5f1a2a668898ebb3560820fe50aa4d3546ef46cc764d5513787e9e -size 7529 +oid sha256:2fc2d9eaec38ec6cc5466117bfa6eedf027b2f8c5d146c16428e992e71352ee2 +size 7526 diff --git a/tests/egui_tests/tests/snapshots/visuals/selectable_value.png b/tests/egui_tests/tests/snapshots/visuals/selectable_value.png index a0b480be4..e6bdd7583 100644 --- a/tests/egui_tests/tests/snapshots/visuals/selectable_value.png +++ b/tests/egui_tests/tests/snapshots/visuals/selectable_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac18e2eef000a80858b2d0811f9ee31304c6ff96f7a91dc60cc1a404ae28ce38 -size 13246 +oid sha256:eaf5722dc3d31272e1f804f46a472aa12cecf2744e617378514a8314f73c173a +size 12708 diff --git a/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png b/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png index 291263c44..ed901d465 100644 --- a/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png +++ b/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c11fe0399c85db5a618580ec4c1f2fe76176c6ea0ead3710a430d9a2bf8acc5d -size 13352 +oid sha256:7b1879c66f124ae40ce8e9fcbc1a36369ec141a31a0d5d9fb5306fe704772277 +size 13784 diff --git a/tests/egui_tests/tests/snapshots/visuals/text_edit.png b/tests/egui_tests/tests/snapshots/visuals/text_edit.png index d8e56eb2a..b3ae22df8 100644 --- a/tests/egui_tests/tests/snapshots/visuals/text_edit.png +++ b/tests/egui_tests/tests/snapshots/visuals/text_edit.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a103b51df184d5480438e8b537106432205a6d86f2927ab1bd507fe8ed3bb29b -size 7656 +oid sha256:e2051b9aeef49c404b49c6b47b8ff34be66dff2c792f5eceba456f855ebdb8bc +size 7682 From b938a27ca9a41690f0c923854b5fe3c87078708c Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Fri, 7 Nov 2025 14:51:01 +0100 Subject: [PATCH 19/30] temp --- crates/egui_demo_app/tests/snapshots/clock.png | 4 ++-- crates/egui_demo_app/tests/snapshots/custom3d.png | 4 ++-- crates/egui_demo_app/tests/snapshots/easymarkeditor.png | 4 ++-- crates/egui_demo_app/tests/snapshots/imageviewer.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Code Example.png | 4 ++-- .../egui_demo_lib/tests/snapshots/demos/Dancing Strings.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Font Book.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Frame.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png | 4 ++-- .../tests/snapshots/demos/Input Event History.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Input Test.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Painting.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Panels.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Popups.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Scene.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Sliders.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Table.png | 4 ++-- .../egui_demo_lib/tests/snapshots/demos/Tessellation Test.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/demos/Window Options.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/modals_1.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/modals_2.png | 4 ++-- crates/egui_demo_lib/tests/snapshots/modals_3.png | 4 ++-- .../egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png | 4 ++-- .../egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png | 4 ++-- .../egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png | 4 ++-- .../egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png | 4 ++-- .../egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png | 4 ++-- .../egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png | 4 ++-- .../tests/snapshots/tessellation_test/Additive rectangle.png | 4 ++-- .../tests/snapshots/tessellation_test/Blurred stroke.png | 4 ++-- .../tests/snapshots/tessellation_test/Blurred.png | 4 ++-- .../tests/snapshots/tessellation_test/Minimal rounding.png | 4 ++-- .../tests/snapshots/tessellation_test/Normal.png | 4 ++-- .../tessellation_test/Thick stroke, minimal rounding.png | 4 ++-- .../tests/snapshots/tessellation_test/Thin filled.png | 4 ++-- .../tests/snapshots/tessellation_test/Thin stroked.png | 4 ++-- .../egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png | 4 ++-- .../egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png | 4 ++-- .../egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png | 4 ++-- .../egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png | 4 ++-- tests/egui_tests/tests/snapshots/layout/checkbox.png | 4 ++-- tests/egui_tests/tests/snapshots/layout/checkbox_checked.png | 4 ++-- tests/egui_tests/tests/snapshots/layout/selectable_value.png | 4 ++-- .../tests/snapshots/layout/selectable_value_selected.png | 4 ++-- tests/egui_tests/tests/snapshots/text_edit_rtl_2.png | 4 ++-- tests/egui_tests/tests/snapshots/visuals/button.png | 4 ++-- tests/egui_tests/tests/snapshots/visuals/button_image.png | 4 ++-- .../tests/snapshots/visuals/button_image_shortcut.png | 4 ++-- .../snapshots/visuals/button_image_shortcut_selected.png | 4 ++-- tests/egui_tests/tests/snapshots/visuals/checkbox.png | 4 ++-- tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png | 4 ++-- tests/egui_tests/tests/snapshots/visuals/drag_value.png | 4 ++-- tests/egui_tests/tests/snapshots/visuals/selectable_value.png | 4 ++-- .../tests/snapshots/visuals/selectable_value_selected.png | 4 ++-- 62 files changed, 124 insertions(+), 124 deletions(-) diff --git a/crates/egui_demo_app/tests/snapshots/clock.png b/crates/egui_demo_app/tests/snapshots/clock.png index 29e56828e..30f46b955 100644 --- a/crates/egui_demo_app/tests/snapshots/clock.png +++ b/crates/egui_demo_app/tests/snapshots/clock.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ea2f4e2fc86a3b5a612448d79589df8f5432d8891241541bba2135d80137ef0 -size 335919 +oid sha256:f8ddb5d4fb9e0bc0a2e74aa060145f972d8484b00983282f7bf1633d2d0dd213 +size 335799 diff --git a/crates/egui_demo_app/tests/snapshots/custom3d.png b/crates/egui_demo_app/tests/snapshots/custom3d.png index ca3551c2e..deed497b1 100644 --- a/crates/egui_demo_app/tests/snapshots/custom3d.png +++ b/crates/egui_demo_app/tests/snapshots/custom3d.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c79323e08a7027699082689194570c9b6c738d4b4d7d227ec4421bed028a12fa -size 93808 +oid sha256:e9a760fe4a695e6321f00e40bfa76fd0195bee7157a1217572765e3f146ea2cc +size 93640 diff --git a/crates/egui_demo_app/tests/snapshots/easymarkeditor.png b/crates/egui_demo_app/tests/snapshots/easymarkeditor.png index bcabed9bd..a039b8c24 100644 --- a/crates/egui_demo_app/tests/snapshots/easymarkeditor.png +++ b/crates/egui_demo_app/tests/snapshots/easymarkeditor.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:236e36cc1ae7f0b6564536e466a0d7992333254c6fd0853e85531895697fd996 -size 181936 +oid sha256:a1670bbfc1f0a71e20cbbeb73625c148b680963bc503d9b48e9cc43e704d7c54 +size 181671 diff --git a/crates/egui_demo_app/tests/snapshots/imageviewer.png b/crates/egui_demo_app/tests/snapshots/imageviewer.png index 8ce5442ca..e1d518a96 100644 --- a/crates/egui_demo_app/tests/snapshots/imageviewer.png +++ b/crates/egui_demo_app/tests/snapshots/imageviewer.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b6566e6aae8f551adbd4f6efbf861ed59d467ec158cf28ada39177911f4b302 -size 100505 +oid sha256:dc9c22567b76193a7f6753c4217adb3c92afa921c488ba1cf2e14b403814e7ac +size 99841 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png index 9dcfa16e7..373adc234 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Clipboard Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:91823881c5d74838d2aea59e1b93a472d2133a184a1f98c9771919a5af4fd19f -size 27138 +oid sha256:cb944eca56724f6a2106ea8db2043dc94c0ea40bdd4cdeb0e520790f97cc9598 +size 27049 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png b/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png index 935e209e8..22341d7b3 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Code Example.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40f6059fb76d24f418d6808732a0887ec9d90f7da0be746a5ec077d2f2c0066b -size 85185 +oid sha256:5c1951b99908326b3f05ebb72aa4d02d0f297bdd925f38ded09041fae45400c1 +size 85217 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png b/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png index 707a18455..05a412548 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Dancing Strings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f003032015dc8330f4bf5f334482b4a10fa8a25743e265ddbc5c47ff56723ff -size 26027 +oid sha256:0df751bac5947c9bf6f82d075cf5670a562742b80d6c512bcd642da5ed449d26 +size 25975 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png b/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png index c47eee065..2a12a3152 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Font Book.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a87f318f97d124b2033acf58b6f32e46e3aed018ce7705a6662681885d55e3b9 -size 126756 +oid sha256:1227636b03a7d35db3482b19f6059ec7aaf03ca795edadd5338056be6f6a8f7f +size 126724 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Frame.png b/crates/egui_demo_lib/tests/snapshots/demos/Frame.png index 4c062051b..0385ab120 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Frame.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Frame.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0dc7d0fc29e216e97a3a39250b40790c4e300b17a39be11674215797a471663a -size 25024 +oid sha256:c01e96bf0aab24dbcfc05f2a6dcb0ffcddff69ec2474797de4fbce0a0670a8cd +size 24964 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png index 6ead8b900..e14a4ecb5 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Grid Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:79b95e5b17c03b2301ab42b25ad6911ef5b536c8ecea23350e2973a46e803bdb -size 99707 +oid sha256:ec357eafd145194f99c36a53a149a8b331fd691c5088df43ee96282b84bc81a4 +size 99439 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png b/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png index e4ad45786..c100d9209 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Input Event History.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c97e448603f69a413fe12f955c1e64eee8eb4700ee6e8eea1202ede9558bfd94 -size 24881 +oid sha256:e1378d865af3df02e12a0c4bc087620a4e9ef0029221db3180cdd2fd34f69d7f +size 24832 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png index 397483016..58cc9f94b 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Input Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a83b1f5f2ce1751e8288a2c33a46fa541cd28b2d1eb4ccefeaef4224b0be2f88 -size 51859 +oid sha256:aff927596be5db77349ec0bbdcc852a0b1467e94c2a553a740a383ae318bad18 +size 51670 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png index 53c80c31f..ed84d7428 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Layout Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28f191a4ee646fc63e19ac435316fd790103221e3055da9979fce04c4f617c79 -size 48041 +oid sha256:ad26106a86a6236f0db1c51bed754b370530813e9bb6e36c1be2948820fbef25 +size 47827 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png b/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png index 845529cde..daa9da35a 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Multi Touch.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:744bfd9c1f714beedaf6cc3c9f5fed1aaeef0d8c8a5521fb09e419079140df35 -size 37922 +oid sha256:bf7f0a76424a959ede7afbb0eaf777638038cc6fe208ef710d9d82638d68b4d0 +size 37848 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Painting.png b/crates/egui_demo_lib/tests/snapshots/demos/Painting.png index b2eeb48f8..e53f4f7af 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Painting.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Painting.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c2449a12444f730d45b6e2856fd878d6b47a0eae56e53576a5899e61e2bd9c15 -size 17680 +oid sha256:2d2370972781f15a1d602deca28bca38f1c077152801870edf2112650b8b1349 +size 17708 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Panels.png b/crates/egui_demo_lib/tests/snapshots/demos/Panels.png index 60d86d8ea..22daed0ed 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Panels.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Panels.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4b5998d173ac2c2ebf64ad8c2c4f98463b344a47874b9a390709e639f0fe2a62 -size 257487 +oid sha256:c91f592571ba654d0a96791662ae7530a1db4c1630b57c795d1c006ea6e46f19 +size 256975 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Popups.png b/crates/egui_demo_lib/tests/snapshots/demos/Popups.png index f882c6728..d00256a7e 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Popups.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Popups.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4237a914a0a57957d54020e496043305fe26438dbd4f03db15e9db43b471ccc8 -size 61322 +oid sha256:f8b937a8a63de6fedcd0f9748b1d04cd863331a297bec78906885a0107def32a +size 61242 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Scene.png b/crates/egui_demo_lib/tests/snapshots/demos/Scene.png index 84222180e..2344a3868 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Scene.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Scene.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:31ebde2103ea2c30320f95e7ee9a6960feaf3946ad3b6db0da0bbcc5f85fa89b -size 34646 +oid sha256:2855bd95ab33b5232edada1f65684bbba2748025b6b64eb9ac68a5f2d10ad4bd +size 34491 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png b/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png index 0854a469b..7e49a8613 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Screenshot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:96d5160a8e70480ac063be67481d890ddd17a929b1a6e8455e6e2568910eaa01 -size 23679 +oid sha256:be599ae66323140bba4a7d63546acbf84340b57e2d82d4736bf3fe590040319d +size 23623 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png b/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png index 71e08fcff..6de002ee4 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Scrolling.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2b02e997183f30bdd7a53afb92cee9e91c205e2ad2f77db7781177c2f20e166 -size 168401 +oid sha256:01c3cb5e8972e0cab5325328f93af8f51b35a0d61016e74969eab0f7ddea1e02 +size 176973 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png b/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png index cdc160ff2..417b183b5 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Sliders.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25186c248e415becbbf00c90fad969f5b290683e1b3ffe25c07854330dbce999 -size 120914 +oid sha256:f2f6cedc262259d52c1fbf4283d99b4b62ec732e8688b1e2799a2581425e0564 +size 120342 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Table.png b/crates/egui_demo_lib/tests/snapshots/demos/Table.png index a1060783d..cf728bf3f 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Table.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Table.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f95f41ced0ec7831acfb1257502b3d2617576b9d5002c7a30859a1150b4604cd -size 82431 +oid sha256:4fbcca2b13c94769a62b44853b19f7e841bbb60c9197b3d0bf6e83ef9f8f76d1 +size 77815 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png index 89371e3bd..cd8524cef 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Tessellation Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d441f831d6ac99090756b8cadf13bc22ce11f8cc8aea9edced5c20b4578b71a8 -size 70273 +oid sha256:cc24f146adf0282cfb51723b56c76eceb92f2988fc67bbeefd16b93950505922 +size 70110 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png b/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png index fa2f782c3..28c9f57ac 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Text Layout.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4b6e31294f9933c1788eb5a4636042378610ac1756dbac26c25792fe0a4e7ba1 -size 66108 +oid sha256:77aeaa1dcd391a571cb38732686e0b85b2d727975c02507a114d4e932f2c351b +size 65562 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png b/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png index 36fb1ae20..265dfdc1e 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Tooltips.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3bdedaa57fcbd0b082000d47b43f75983171ee6ed7b7370a2092c39964d31309 -size 64906 +oid sha256:415b1ce17dd6df7ca7a86fed92750c2ef811ff64720a447ae3ca6be10090666e +size 64624 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png b/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png index 0425e3333..fb2bd06aa 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Undo Redo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a622b6945028e019061fdcf5e6f303fe647e08b2b781ac5ce7eb6fc21bc41e7a -size 13190 +oid sha256:0eaf717bf0083737c4186ac39e7baf98f42fffb36b49434a6658eff1430a0ac6 +size 13187 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png b/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png index 5a08c93e2..97fa6cebc 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Window Options.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b3ef5e5bdf4859a295212a17b879884f707e0c48e4a158bbe50961035af1408e -size 36410 +oid sha256:a31f0c12bb70449136443f9086103bd5b46356eedc2bb93ae1b6b10684ab69ca +size 36285 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_1.png b/crates/egui_demo_lib/tests/snapshots/modals_1.png index ca44d5073..a184b67dc 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_1.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25c600764907b9a4e885939b3c5967ca67aa669f5ad2c30e02943bc97ca4cb87 -size 48884 +oid sha256:60a44771c6bc9236593717236f9eca40bcb4723bac7567493cab4326f003eba3 +size 48693 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_2.png b/crates/egui_demo_lib/tests/snapshots/modals_2.png index 08281c8ed..c8e7cb55a 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_2.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:831268ea2718a60e1142c98fd53c2530a25dd0bd2ededfbf3a5c213da0c72d8a -size 48751 +oid sha256:53c1509f7be264ed2947cd4ec0f10b555e9f710e949ed6fd8a73ca8ade53abd4 +size 48570 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_3.png b/crates/egui_demo_lib/tests/snapshots/modals_3.png index eaea56328..777b700c2 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_3.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9147bbd560474269a2294fab2df54d61ccf3eee0ae453e710fd8034d0f709232 -size 44865 +oid sha256:20eecafb998f69c2384afabc27eec1f97f413d603ece944adae9a99139be0b58 +size 44689 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png index e72402dc0..640d84c2b 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f38b9859a1b272a6eeee71ce186a1ecaf245efd954ec5012a0c15236a530b6c -size 622678 +oid sha256:f9980486c36a0242f3b043a172c411d4fc9573543d3cd7c1c43bf020c18868a9 +size 619816 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png index 84ef56d37..df05ada25 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.25.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8c4e677d8baf46bff20171ea9488ff36ff3d1d367355232c85b0bd1aa2e26009 -size 824364 +oid sha256:040e2e486ae4773a084da99513a53c620e8e2bba215183ec26c6e489381d6254 +size 823086 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png index 1a7f93546..c6aa2914f 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.50.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6fd3a2ae4ff90181e80c595f82f748cf333e829012bbf69fe65565ef10102006 -size 1038859 +oid sha256:439a5f942a5f05b9c09685ef90be94c150a21a68d1d235af22372b9b6a7b7389 +size 1035734 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png index 8a157f86d..1344edcfb 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.67.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be318246896430d1ccadcdbd49ce1f1b55656fc43f0df8468c96e8e8bd0186c6 -size 1210243 +oid sha256:9b7d7e290b97a8042af3af3cd9ceb274950cf607dd7e9cd6c71d5a113d3b57a5 +size 1206155 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png index f97f20ac4..9804e2942 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_1.75.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8a595e9a1d0671c094aa204352a93bb35732bffdf73d2cf266baa860429d955 -size 1235525 +oid sha256:fedd5546e36a89121c0bb0a780b0bbe081611c2c04013064872801181503fb83 +size 1231599 diff --git a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png index 7c2c9cc6e..04d4bb4ea 100644 --- a/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png +++ b/crates/egui_demo_lib/tests/snapshots/rendering_test/dpi_2.00.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c1cc2ac5384a5ee41b4cdf1d83a72baf709f7cc8f3439fc5addedea723bbf96c -size 1467077 +oid sha256:69a7040336fc92c6d7b158283aabbc5817980c2fa84a1120b788516cf437b985 +size 1461979 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png index b53f69bed..50e84c900 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Additive rectangle.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:667280ce65e68ecf72202d1eb174114396300f2402e557e06677f23d22707790 -size 47010 +oid sha256:1a32d361afa20fc8c20122a89b01fe14b45849da42663991e589579f70fb8577 +size 46790 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png index 5dc5c1f5a..ca5a23f97 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred stroke.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8f17504759fd16d78fc0ac79d22b4daabc9cf723ff57128e3276aaf8c304446 -size 88708 +oid sha256:c8d55205cf4225123da33895ed45eb186e5e57184ef5928400a4bae3ab6092be +size 88548 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png index 7a236ce37..41f9ef2f5 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Blurred.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:55c6d784f005e30fd05968b67a5afade2c0244449ead09b5eb4f24fa4e89238a -size 120408 +oid sha256:77ab9e2e18c788f8cdbec171269afe4d0a90c52abeda7063cae3766dcaa5e93b +size 120612 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png index 5203f867c..85d844c79 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Minimal rounding.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:685df94301659df0e221e6ca1f24d3f002858ad3a7c058b2e8ce70d8aa7104f0 -size 53260 +oid sha256:36622a2f934503a7b60ded2f44b002e37eedde22d548dcf5a209f54c19548665 +size 53064 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png index 0c9f36da1..6e6d9f0f2 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Normal.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:45cc44cff4facce5d19d2447431f4cad717b385afe73a22ddaa48733a2208d1f -size 56463 +oid sha256:4adeb7a77a0d0fe85097fcd190a99b49858dce11bde601d30335afcb6cc3d5f6 +size 56276 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png index 5a135fca8..eefbac2bb 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thick stroke, minimal rounding.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd14edfdb8384849755784c3b6b43b8e6e88392978a64bca2683002cf5ac1169 -size 56905 +oid sha256:f45249f7cc90433a64856905c727571c4ef20468e2c7d3ac2029e18a0477932d +size 56743 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png index 0337d533c..08178eaa8 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin filled.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:668b64f04d3249b3046a125eb3a323f30934d35329dc10c711f58ea78d98cfa2 -size 37847 +oid sha256:d437f68c521f3e627a1b50d46605e8b0b343c5fc3716d9669e8c4436c8992b6f +size 37602 diff --git a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png index 32c7451c1..13f057df9 100644 --- a/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png +++ b/crates/egui_demo_lib/tests/snapshots/tessellation_test/Thin stroked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f8644452fd5211f7ded1d73186c4d866aa49cb23d4087b2a126f87d8c3c5f62 -size 37886 +oid sha256:08ba98437403a08cca825ed8e288c9f088a46d9a1081f0b0a4ed7fbb9b49bb85 +size 37640 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png index acf9f71ac..ab2db5eb5 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d1b80b2ae54d7e535700abf2036379c2477230353b53a5cba0bda9eebef32d3c -size 67123 +oid sha256:e1ed0e40d08b2b9ea978a07a4b7bf282c9e2cba8c52896f12210f396241e1b78 +size 66859 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png index 148283d1f..e84863bf4 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_dark_x2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d018e524b432d24c32c641f889aab4e3d5e6192f8c22bb77e6a0f439dfdccf65 -size 159486 +oid sha256:28f9862dd6f16b99523f5880bf90346fd9455d0d44e7bdd530d523e0b2ef2d2c +size 158892 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png index 3ef62db98..7d01be1dc 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b4906bc38d36cb837b417445a24c091c488600bff67be4ed4fc98653ba79dbf3 -size 61403 +oid sha256:2e99f2973a676e7319bb5e370fbc7dba061f38e3b266039a04c7f18efe701165 +size 61182 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png index 8bd994095..c2c4705e1 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e3c288d8e5cb768345f0577ad965cfb207b47bf37497a4283d28305dd8427ea -size 152658 +oid sha256:90d36311ce5b1dcf81cab22113620a3362f255059d1f52c6794c8249f960549e +size 152215 diff --git a/tests/egui_tests/tests/snapshots/layout/checkbox.png b/tests/egui_tests/tests/snapshots/layout/checkbox.png index 2fcfe186a..18ebbdb7c 100644 --- a/tests/egui_tests/tests/snapshots/layout/checkbox.png +++ b/tests/egui_tests/tests/snapshots/layout/checkbox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ef93c74cb71d7a5386cc361ca91b3826c27c257413eaafc8f283bd177111d6b6 -size 409009 +oid sha256:4747efdf758e7e8e2d7f3954d9595dfd45d3b4b86923b8ff39c8a96002bb4825 +size 408726 diff --git a/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png b/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png index 544276069..127aa7f30 100644 --- a/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png +++ b/tests/egui_tests/tests/snapshots/layout/checkbox_checked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:554d51d9c557d8f7bc7ef6a5cac04520e0535074c2e762d8fc5ddd23b4a037bd -size 439301 +oid sha256:4a3ca4b3a47ff516f9b05799cdf5f92845ae1e058728d635986cc61b7317f110 +size 437102 diff --git a/tests/egui_tests/tests/snapshots/layout/selectable_value.png b/tests/egui_tests/tests/snapshots/layout/selectable_value.png index efb50987b..2ee7f7d0e 100644 --- a/tests/egui_tests/tests/snapshots/layout/selectable_value.png +++ b/tests/egui_tests/tests/snapshots/layout/selectable_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c70f3d9e6e767b9857b218ef25166aa0fc5a1d8b72cb9582e1322d53a3f135e4 -size 403775 +oid sha256:bfc900ea84b408564652df487e705311b164d9bd3ff5631c3cebb83b06497a7b +size 410131 diff --git a/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png b/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png index dccd1bc3d..7e3dd6319 100644 --- a/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png +++ b/tests/egui_tests/tests/snapshots/layout/selectable_value_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5188b61af6366680144486d927f8b497dcc1e836ae8e5d767c5bce59e05056a -size 446497 +oid sha256:c9d08ce85c9210a7d9046480ab208040e5ba399c40acaecf5cb43f807534bce9 +size 423523 diff --git a/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png b/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png index b6233f378..b9235740d 100644 --- a/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png +++ b/tests/egui_tests/tests/snapshots/text_edit_rtl_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:055b6111aa48f19c894729e2935cb9298231aab78efb10b9e73c00da9edfd338 -size 3130 +oid sha256:38f325f2e741f18f897502c176f9a7efe276e9adab41a144511121dd8b8a3073 +size 3079 diff --git a/tests/egui_tests/tests/snapshots/visuals/button.png b/tests/egui_tests/tests/snapshots/visuals/button.png index 89958941a..4c81f62fc 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button.png +++ b/tests/egui_tests/tests/snapshots/visuals/button.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9df0ca1e011ccbba6e8620e2ef04b2e4f5614fd596a6dbc072179614552468c1 -size 10118 +oid sha256:1c05992e16c1abf6d174fed73d19cad6bb2266e0adb87b8232e765d75fcf3f14 +size 10310 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image.png b/tests/egui_tests/tests/snapshots/visuals/button_image.png index 305907647..00582f3ae 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf2a513396ba3ba90e65a163fcd21d1eb1277f59ede157c67e12f1f18cbe070a -size 11109 +oid sha256:7681d33a5a764187c084c966a4e47063136e2832094c44f62718447b1b3027ec +size 11292 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png index 1d1373005..1429bfd2d 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:37cf0ae5fd2fb2e2f2b960b7ea451e380c335e42a0f4d45cacec90dfcb9bdb48 -size 13981 +oid sha256:b99a82e9f3dfa24c079545272d680b55c4285c276befa0efc492fe273422f541 +size 14195 diff --git a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png index 8216b4cdf..c73effead 100644 --- a/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png +++ b/tests/egui_tests/tests/snapshots/visuals/button_image_shortcut_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:79bc45bc2c675a9deddf25aad80de45170bd97d157bfb195cd59f1b027240652 -size 14600 +oid sha256:cdf079228b762949dbc67308103f8fe1328b6c0175f312ccc492d4e86d42127b +size 13868 diff --git a/tests/egui_tests/tests/snapshots/visuals/checkbox.png b/tests/egui_tests/tests/snapshots/visuals/checkbox.png index 866473abb..16d88e546 100644 --- a/tests/egui_tests/tests/snapshots/visuals/checkbox.png +++ b/tests/egui_tests/tests/snapshots/visuals/checkbox.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f400f82eb9339c136f8ba2f393ae3b4832461fd2eca64cb4aa4f2ec60992d0c -size 13026 +oid sha256:0bafe4c157696bfb52940b69501416d4da0b4eab52f34f52220d2e9ed01357cf +size 12901 diff --git a/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png b/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png index 6b854278d..fd85297ac 100644 --- a/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png +++ b/tests/egui_tests/tests/snapshots/visuals/checkbox_checked.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d96e5948ab50362475ab034e428804c1091b5dfacb8e3191021b1b13c3ce9c8e -size 14060 +oid sha256:72175bf108135b422d978b701d29e6d9a5348c536e25abc924234bc11b6b7f21 +size 14016 diff --git a/tests/egui_tests/tests/snapshots/visuals/drag_value.png b/tests/egui_tests/tests/snapshots/visuals/drag_value.png index a9fc67d23..a6ffcf913 100644 --- a/tests/egui_tests/tests/snapshots/visuals/drag_value.png +++ b/tests/egui_tests/tests/snapshots/visuals/drag_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2fc2d9eaec38ec6cc5466117bfa6eedf027b2f8c5d146c16428e992e71352ee2 -size 7526 +oid sha256:7178b3e92df7912283e1cf12b67f21a3c85c5fe48b2c2feb284886ce7f5e780f +size 7558 diff --git a/tests/egui_tests/tests/snapshots/visuals/selectable_value.png b/tests/egui_tests/tests/snapshots/visuals/selectable_value.png index e6bdd7583..a0b480be4 100644 --- a/tests/egui_tests/tests/snapshots/visuals/selectable_value.png +++ b/tests/egui_tests/tests/snapshots/visuals/selectable_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eaf5722dc3d31272e1f804f46a472aa12cecf2744e617378514a8314f73c173a -size 12708 +oid sha256:ac18e2eef000a80858b2d0811f9ee31304c6ff96f7a91dc60cc1a404ae28ce38 +size 13246 diff --git a/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png b/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png index ed901d465..291263c44 100644 --- a/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png +++ b/tests/egui_tests/tests/snapshots/visuals/selectable_value_selected.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b1879c66f124ae40ce8e9fcbc1a36369ec141a31a0d5d9fb5306fe704772277 -size 13784 +oid sha256:c11fe0399c85db5a618580ec4c1f2fe76176c6ea0ead3710a430d9a2bf8acc5d +size 13352 From 94f8ad6099ebc48409c6828e62618a222c95bc00 Mon Sep 17 00:00:00 2001 From: Adrien Zianne Date: Fri, 7 Nov 2025 17:24:16 +0100 Subject: [PATCH 20/30] fix check --- scripts/check.sh | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 scripts/check.sh diff --git a/scripts/check.sh b/scripts/check.sh new file mode 100755 index 000000000..9c08f3fc6 --- /dev/null +++ b/scripts/check.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash +# This scripts runs various CI-like checks in a convenient way. + +set -eu +script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) +cd "$script_path/.." +set -x + +# Checks all tests, lints etc. +# Basically does what the CI does. + +# cargo +1.88.0 install --quiet typos-cli + +export RUSTFLAGS="-D warnings" +export RUSTDOCFLAGS="-D warnings" # https://github.com/emilk/egui/pull/1454 + +# Fast checks first: +typos +./scripts/lint.py +cargo fmt --all -- --check +cargo doc --quiet --lib --no-deps --all-features +cargo doc --quiet --document-private-items --no-deps --all-features +cargo clippy --quiet --all-targets --all-features -- -D warnings +cargo clippy --quiet --all-targets --all-features --release -- -D warnings # we need to check release mode too + +./scripts/clippy_wasm.sh + +cargo check --quiet --all-targets +cargo check --quiet --all-targets --all-features +cargo check --quiet -p egui_demo_app --lib --target wasm32-unknown-unknown +cargo check --quiet -p egui_demo_app --lib --target wasm32-unknown-unknown --all-features +# TODO(#5297) re-enable --all-features once the tests work with the unity feature +cargo test --quiet --all-targets --all-features +cargo test --quiet --doc # slow - checks all doc-tests + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + cargo check --quiet -p eframe --no-default-features --features "glow","x11" + cargo check --quiet -p eframe --no-default-features --features "glow","wayland" + cargo check --quiet -p eframe --no-default-features --features "wgpu","x11" + cargo check --quiet -p eframe --no-default-features --features "wgpu","wayland" +else + cargo check --quiet -p eframe --no-default-features --features "glow" + cargo check --quiet -p eframe --no-default-features --features "wgpu" +fi + +cargo check --quiet -p egui --no-default-features --features "serde" + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + cargo check --quiet -p egui_demo_app --no-default-features --features "glow","x11" + cargo check --quiet -p egui_demo_app --no-default-features --features "glow","wayland" + cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","x11" + cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu","wayland" +else + cargo check --quiet -p egui_demo_app --no-default-features --features "glow" + cargo check --quiet -p egui_demo_app --no-default-features --features "wgpu" +fi + +cargo check --quiet -p egui_demo_lib --no-default-features +cargo check --quiet -p egui_extras --no-default-features +cargo check --quiet -p egui_glow --no-default-features +cargo check --quiet -p egui-winit --no-default-features --features "wayland" +cargo check --quiet -p egui-winit --no-default-features --features "x11" +cargo check --quiet -p emath --no-default-features +cargo check --quiet -p epaint --no-default-features --release +cargo check --quiet -p epaint --no-default-features + +cargo check --quiet -p eframe --all-features +cargo check --quiet -p egui --all-features +cargo check --quiet -p egui_demo_app --all-features +cargo check --quiet -p egui_extras --all-features +cargo check --quiet -p egui_glow --all-features +cargo check --quiet -p egui-winit --all-features +cargo check --quiet -p emath --all-features +cargo check --quiet -p epaint --all-features + +./scripts/wasm_bindgen_check.sh + +./scripts/cargo_deny.sh + +# TODO(emilk): consider using https://github.com/taiki-e/cargo-hack or https://github.com/frewsxcv/cargo-all-features + +# ------------------------------------------------------------ +# + +# For finding bloat: +# cargo bloat --release --bin egui_demo_app -n 200 | rg egui +# Also try https://github.com/google/bloaty + +# what compiles slowly? +# cargo clean && time cargo build -p eframe --timings +# https://fasterthanli.me/articles/why-is-my-rust-build-so-slow + +# what compiles slowly? +# cargo llvm-lines --lib -p egui | head -20 + +echo "All checks passed." From 33db68f1bafd4b0be169df130bcfb44af2d4fe0e Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 10 Nov 2025 10:16:20 +0100 Subject: [PATCH 21/30] Fix pixel diff --- crates/egui/src/style_trait.rs | 31 +++++++++++++++++++++------- crates/egui/src/widgets/button.rs | 32 +++++++++++------------------ crates/egui/src/widgets/checkbox.rs | 3 +-- crates/egui/src/widgets/label.rs | 28 +++++++++++-------------- 4 files changed, 49 insertions(+), 45 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index 7696cd4ea..ca61700cd 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -1,3 +1,4 @@ +use emath::Vec2; use epaint::{Color32, FontId, Shadow, Stroke, text::TextWrapMode}; use crate::{ @@ -127,10 +128,26 @@ impl Style { } } - pub fn button_style(&self, state: WidgetState) -> ButtonStyle { - let ws = self.widget_style(state); + pub fn button_style(&self, state: WidgetState, selected: bool) -> ButtonStyle { + let mut visuals = *self.visuals.widgets.state(state); + let mut ws = self.widget_style(state); + if selected { + visuals.weak_bg_fill = self.visuals.selection.bg_fill; + visuals.bg_fill = self.visuals.selection.bg_fill; + visuals.fg_stroke = self.visuals.selection.stroke; + ws.text.color = self.visuals.selection.stroke.color; + } ButtonStyle { - frame: ws.frame.inner_margin(self.spacing.button_padding), + frame: Frame { + fill: visuals.weak_bg_fill, + stroke: visuals.bg_stroke, + corner_radius: visuals.corner_radius, + outer_margin: (-Vec2::splat(visuals.expansion)).into(), + inner_margin: (self.spacing.button_padding + Vec2::splat(visuals.expansion) + - Vec2::splat(visuals.bg_stroke.width)) + .into(), + ..Default::default() + }, text: ws.text, } } @@ -139,7 +156,7 @@ impl Style { let visuals = self.visuals.widgets.state(state); let ws = self.widget_style(state); CheckboxStyle { - frame: ws.frame.fill(Color32::TRANSPARENT), + frame: Frame::new(), size: self.spacing.icon_width, check_size: self.spacing.icon_width_inner, checkbox_frame: Frame { @@ -169,11 +186,11 @@ impl Style { } } - pub fn separator_style(&self, state: WidgetState) -> SeparatorStyle { - let visuals = self.visuals.widgets.state(state); + pub fn separator_style(&self, _state: WidgetState) -> SeparatorStyle { + let visuals = self.visuals.noninteractive(); SeparatorStyle { spacing: 0.0, - stroke: visuals.fg_stroke, + stroke: visuals.bg_stroke, } } } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index e27ee0e9b..5f0a43d30 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -3,9 +3,9 @@ use std::sync::Arc; use epaint::Margin; use crate::{ - Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Image, - IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, - Widget, WidgetInfo, WidgetText, WidgetType, style_trait::WidgetState, + Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Frame, + Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, + Vec2, Widget, WidgetInfo, WidgetText, WidgetType, style_trait::WidgetState, }; /// Clickable button with text. @@ -286,17 +286,11 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); - let state = if selected { - // If selected is true then the state is active - WidgetState::Active - } else { - // Get the widget state by reading the response from the previous pass - let id = ui.next_auto_id(); - let response: Option = ui.ctx().read_response(id); - response.map(|r| r.widget_state()).unwrap_or_default() - }; + let id = ui.next_auto_id(); + let response: Option = ui.ctx().read_response(id); + let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().button_style(state); + let style = ui.style().button_style(state, selected); let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); @@ -322,12 +316,7 @@ impl<'a> Button<'a> { frame = frame.stroke(stroke); } - frame = frame.inner_margin(Margin { - left: button_padding.left - frame.stroke.width as i8, - top: button_padding.top - frame.stroke.width as i8, - right: button_padding.right - frame.stroke.width as i8, - bottom: button_padding.bottom - frame.stroke.width as i8, - }); + frame = frame.inner_margin(button_padding); // Apply the correct font and color if Text // We assume that the other WidgetText have already a Fontid and color @@ -346,7 +335,10 @@ impl<'a> Button<'a> { if has_frame_margin && (state != WidgetState::Inactive || frame_when_inactive) { layout.frame(frame).min_size(min_size).allocate(ui) } else { - layout.min_size(min_size).allocate(ui) + layout + .frame(Frame::new().inner_margin(frame.inner_margin)) + .min_size(min_size) + .allocate(ui) }; // Get AtomLayoutResponse, empty if not visible diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index d8458eeb1..7b210cf95 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -66,8 +66,7 @@ impl Widget for Checkbox<'_> { let icon_width = style.size; // interact_size or size ? - // let mut min_size = Vec2::splat(ui.spacing().interact_size.y); - let mut min_size = Vec2::splat(style.size); + let mut min_size = Vec2::splat(ui.spacing().interact_size.y); min_size.y = min_size.y.at_least(icon_width); // In order to center the checkbox based on min_size we set the icon height to at least min_size.y diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index bd0d347fe..035485f5b 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -1,8 +1,8 @@ use std::sync::Arc; use crate::{ - Align, Direction, Galley, Pos2, Response, Sense, TextWrapMode, Ui, Widget, WidgetInfo, - WidgetText, WidgetType, epaint, pos2, text_selection::LabelSelectionState, + Align, Direction, FontSelection, Galley, Pos2, Response, Sense, Stroke, TextWrapMode, Ui, + Widget, WidgetInfo, WidgetText, WidgetType, epaint, pos2, text_selection::LabelSelectionState, }; /// Static text. @@ -168,8 +168,8 @@ impl Label { sense |= select_sense; } - // If the user said "use this specific galley", then just use it: if let WidgetText::Galley(galley) = self.text { + // If the user said "use this specific galley", then just use it: let (rect, response) = ui.allocate_exact_size(galley.size(), sense); let pos = match galley.job.halign { Align::LEFT => rect.left_top(), @@ -179,16 +179,10 @@ impl Label { return (pos, galley, response); } - // Get the widget style by reading the response from the previous pass - let id = ui.next_auto_id(); - let response: Option = ui.ctx().read_response(id); - let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().label_style(state); - let valign = ui.text_valign(); let mut layout_job = Arc::unwrap_or_clone(self.text.into_layout_job( ui.style(), - style.text.font_id.into(), // Use the label style font + FontSelection::Default, valign, )); @@ -202,6 +196,7 @@ impl Label { { // On a wrapping horizontal layout we want text to start after the previous widget, // then continue on the line below! This will take some extra work: + let cursor = ui.cursor(); let first_row_indentation = available_width - ui.available_size_before_wrap().x; debug_assert!( @@ -284,9 +279,6 @@ impl Widget for Label { response .widget_info(|| WidgetInfo::labeled(WidgetType::Label, ui.is_enabled(), galley.text())); - let state = response.widget_state(); - let style = ui.style().label_style(state); - if ui.is_rect_visible(response.rect) { if show_tooltip_when_elided && galley.elided { // Keep the sections and text, but reset everything else (especially wrapping): @@ -300,12 +292,16 @@ impl Widget for Label { } let response_color = if interactive { - style.text.color + ui.style().interact(&response).text_color() } else { ui.style().visuals.text_color() }; - let underline = style.text.underline; + let underline = if response.has_focus() || response.highlighted() { + Stroke::new(1.0, response_color) + } else { + Stroke::NONE + }; let selectable = selectable.unwrap_or_else(|| ui.style().interaction.selectable_labels); if selectable { @@ -327,4 +323,4 @@ impl Widget for Label { response } -} +} \ No newline at end of file From e1af88748bcd5bc0d26de447e20693fbd7788f5a Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 10 Nov 2025 17:12:57 +0100 Subject: [PATCH 22/30] more pixel diff fix --- crates/egui/src/widgets/button.rs | 1 + crates/egui/src/widgets/label.rs | 2 +- .../tests/snapshots/menu/closed_hovered.png | 4 +- .../tests/snapshots/menu/opened.png | 4 +- .../tests/snapshots/menu/submenu.png | 4 +- .../tests/snapshots/menu/subsubmenu.png | 4 +- examples/hello_world_simple/src/main.rs | 46 +++++++++++++++++++ 7 files changed, 56 insertions(+), 9 deletions(-) diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 5f0a43d30..28ed06bae 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -299,6 +299,7 @@ impl<'a> Button<'a> { } else { Margin::ZERO }; + if small { button_padding.bottom = 0; button_padding.top = 0; diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index 035485f5b..86259ab2a 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -323,4 +323,4 @@ impl Widget for Label { response } -} \ No newline at end of file +} diff --git a/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png b/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png index 7f6820276..5d46f1f0f 100644 --- a/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png +++ b/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1ed9c5dca0551d8e6177dc67def3e8819036e39d935e11f9ee77a974dd7a3306 -size 10938 +oid sha256:73b09338bca2da64869595df0a8f990e9091ea0bde15820c572d343b4d1c4bb5 +size 10807 diff --git a/crates/egui_kittest/tests/snapshots/menu/opened.png b/crates/egui_kittest/tests/snapshots/menu/opened.png index 44f9e1e31..c4bf4e70d 100644 --- a/crates/egui_kittest/tests/snapshots/menu/opened.png +++ b/crates/egui_kittest/tests/snapshots/menu/opened.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f765cc56eb84b14d0c7d7804c5ec24f90ea8ba14ee288787aa5131d58365629 -size 22072 +oid sha256:58a58e1db828dbcb2a770c6add716950edcd359c911f3348613ffd8bb7dbeaa2 +size 21812 diff --git a/crates/egui_kittest/tests/snapshots/menu/submenu.png b/crates/egui_kittest/tests/snapshots/menu/submenu.png index ee122f962..e6e8fdb6f 100644 --- a/crates/egui_kittest/tests/snapshots/menu/submenu.png +++ b/crates/egui_kittest/tests/snapshots/menu/submenu.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:27c85c456e69f4d885ccf9af606e426138f6ca6b8e0762ea4806d6cc8225382c -size 29569 +oid sha256:f9786fbc273adeb88a79d4917d8b3da742604644a78b122b7c1307006ac3c581 +size 29252 diff --git a/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png b/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png index eb4692afe..1a254947d 100644 --- a/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png +++ b/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:231c72b67e733d7c12e76d28c4702cef9490d169e80f1388ad0b5276bd7184fc -size 34175 +oid sha256:acdf4b04a4a69b69a255187f7a82e566860d278c5982a34166b3ed2c9435766a +size 34061 diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 4fe49a89d..d3a3ad0fc 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -28,6 +28,52 @@ fn main() -> eframe::Result { age += 1; } ui.label(format!("Hello '{name}', age {age}")); + + egui::MenuBar::new().ui(ui, |ui| { + ui.menu_button("File", |ui| { + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + }); + ui.menu_button("test", |ui| { + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + }); + ui.menu_button("azea", |ui| { + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + ui.menu_button("test", |ui| { + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + }); + }); + ui.menu_button("vrzzzde", |ui| { + if ui.button("Quit").clicked() { + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } + }); + }); }); }) } From 4bd97cec5820be04092a03bf518a5339de2d95f6 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 10 Nov 2025 17:28:34 +0100 Subject: [PATCH 23/30] revert gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5d96b3808..588826e7d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ /.vscode /media/* .idea/ -/scripts/check.sh From a17aa67267cee02b816f61f0ed9fb1b0e4d30ef2 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 10 Nov 2025 17:39:33 +0100 Subject: [PATCH 24/30] cleanup --- .../tests/snapshots/combobox_opened.png | 4 +- .../tests/snapshots/menu/closed_hovered.png | 4 +- .../tests/snapshots/menu/opened.png | 2 +- .../tests/snapshots/menu/submenu.png | 4 +- .../tests/snapshots/menu/subsubmenu.png | 4 +- .../override_text_color_interactive.png | 4 +- .../tests/snapshots/readme_example.png | 4 +- .../snapshots/should_wait_for_images.png | 4 +- .../tests/snapshots/test_shrink.png | 4 +- .../tests/snapshots/test_tooltip_hidden.png | 4 +- .../tests/snapshots/test_tooltip_shown.png | 4 +- examples/hello_world_simple/questions.md | 19 -------- examples/hello_world_simple/src/main.rs | 46 ------------------- 13 files changed, 21 insertions(+), 86 deletions(-) delete mode 100644 examples/hello_world_simple/questions.md diff --git a/crates/egui_kittest/tests/snapshots/combobox_opened.png b/crates/egui_kittest/tests/snapshots/combobox_opened.png index b64baffec..aaa7198ce 100644 --- a/crates/egui_kittest/tests/snapshots/combobox_opened.png +++ b/crates/egui_kittest/tests/snapshots/combobox_opened.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec3b264d0243f950babd8eb943efcaa2d40b0fa586cf391ab6ff28e56f1318bb -size 7623 +oid sha256:8f70ef032c241cd63675a246de07886c5c822e6fe21525b3a6d3fee106a589c9 +size 7501 diff --git a/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png b/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png index 5d46f1f0f..d2969adee 100644 --- a/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png +++ b/crates/egui_kittest/tests/snapshots/menu/closed_hovered.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:73b09338bca2da64869595df0a8f990e9091ea0bde15820c572d343b4d1c4bb5 -size 10807 +oid sha256:dd6e159a462dde10240c4ca51da5ca5badfb7fc170bad97a59106babb72f8ae3 +size 10795 diff --git a/crates/egui_kittest/tests/snapshots/menu/opened.png b/crates/egui_kittest/tests/snapshots/menu/opened.png index c4bf4e70d..30f26b446 100644 --- a/crates/egui_kittest/tests/snapshots/menu/opened.png +++ b/crates/egui_kittest/tests/snapshots/menu/opened.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:58a58e1db828dbcb2a770c6add716950edcd359c911f3348613ffd8bb7dbeaa2 +oid sha256:8f2a5873350f85457d599c1fd165ac756ed69758e7647e160c64f44d2f35c804 size 21812 diff --git a/crates/egui_kittest/tests/snapshots/menu/submenu.png b/crates/egui_kittest/tests/snapshots/menu/submenu.png index e6e8fdb6f..96ffaf97c 100644 --- a/crates/egui_kittest/tests/snapshots/menu/submenu.png +++ b/crates/egui_kittest/tests/snapshots/menu/submenu.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f9786fbc273adeb88a79d4917d8b3da742604644a78b122b7c1307006ac3c581 -size 29252 +oid sha256:facc05c499745594ac286f15645e40447633a176058337cad9edcb850ad578c7 +size 29379 diff --git a/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png b/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png index 1a254947d..d1d0b4cd3 100644 --- a/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png +++ b/crates/egui_kittest/tests/snapshots/menu/subsubmenu.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:acdf4b04a4a69b69a255187f7a82e566860d278c5982a34166b3ed2c9435766a -size 34061 +oid sha256:9f23ff8c6782befdbe7bd5f076dcdda15c38555f8e505282369bf52e43938c1b +size 34194 diff --git a/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png b/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png index 6d30bd5ee..6e92f9f03 100644 --- a/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png +++ b/crates/egui_kittest/tests/snapshots/override_text_color_interactive.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a525d62b50978bfa059f043f502ddf0ea4f8f88b2ec09cf7e07c53a7bf09e763 -size 19969 +oid sha256:2fa5cb5b96232d729f89be8cc92263715fe7197e72343b71e57e53a359afe181 +size 19881 diff --git a/crates/egui_kittest/tests/snapshots/readme_example.png b/crates/egui_kittest/tests/snapshots/readme_example.png index 399005939..2c8565718 100644 --- a/crates/egui_kittest/tests/snapshots/readme_example.png +++ b/crates/egui_kittest/tests/snapshots/readme_example.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18fbcc76f0df799331760e06487d6467aa2f575ac14d31d1859bf6ba3dba2941 -size 2199 +oid sha256:bb8d702361987803995c0f557ce94552a87b97dcd25bed5ee39af4c0e6090700 +size 1904 diff --git a/crates/egui_kittest/tests/snapshots/should_wait_for_images.png b/crates/egui_kittest/tests/snapshots/should_wait_for_images.png index 7e33877fc..25ae1c39c 100644 --- a/crates/egui_kittest/tests/snapshots/should_wait_for_images.png +++ b/crates/egui_kittest/tests/snapshots/should_wait_for_images.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f038c7fdf31f35107ec6e29edc0895049160ccbe98d1577c16ae082605b58d52 -size 2207 +oid sha256:e145d6abdcdcbad1f9ed58f3b50a1c697ee2bff481279640d9ee449f5f2a51dd +size 2820 diff --git a/crates/egui_kittest/tests/snapshots/test_shrink.png b/crates/egui_kittest/tests/snapshots/test_shrink.png index 9155bb6e7..c25ae0367 100644 --- a/crates/egui_kittest/tests/snapshots/test_shrink.png +++ b/crates/egui_kittest/tests/snapshots/test_shrink.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:08da2ac5bfb1e5ef7fb97cdc792bbf0529c20276312f0c444b122af02990e78b -size 3004 +oid sha256:025942c144891b8862bf931385824e0484e60f4e7766f5d4401511c72ff20756 +size 2975 diff --git a/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png b/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png index 9155bb6e7..c25ae0367 100644 --- a/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png +++ b/crates/egui_kittest/tests/snapshots/test_tooltip_hidden.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:08da2ac5bfb1e5ef7fb97cdc792bbf0529c20276312f0c444b122af02990e78b -size 3004 +oid sha256:025942c144891b8862bf931385824e0484e60f4e7766f5d4401511c72ff20756 +size 2975 diff --git a/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png b/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png index 1c6358ad5..8ff6bba67 100644 --- a/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png +++ b/crates/egui_kittest/tests/snapshots/test_tooltip_shown.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b902df1b5971cd8d54a2e345f293bca2bf6f5ad262812ef8535f4191375e9dd2 -size 4486 +oid sha256:c267530452adb4f1ed1440df476d576ef4c2d96e6c58068bb57fed4615f5e113 +size 4453 diff --git a/examples/hello_world_simple/questions.md b/examples/hello_world_simple/questions.md deleted file mode 100644 index 85e5d713f..000000000 --- a/examples/hello_world_simple/questions.md +++ /dev/null @@ -1,19 +0,0 @@ -## General - -- Interact size is great, but it SHOULD or MUST be at least this size ? Maybe add a parameter for this choice ? - -## Button - -- If hovering a button add a stroke, the ui shift. Maybe add the option to avoid this resize by making the frame smaller ? - -## Label - -- I understand checking if a sense has been set by the user, but why check if it's different than hover ? Is it for technical purpose or purely to avoid confusion with a link ? - -- Selecting the text while being underlined move the underline - -## Checkbox - -- Checkbox are in fact a label and a check box. To propagate the CheckBoxStyle to the label we need to use a scope or something similar and change the global style. Why bind label to the check box, the user can add it himself (To keep the great prototyping speed we could keep this behavior in a Ui method, that would just merge) - -- Propose different type of checkmark ? (eg. small square, dot, filled, custom, etc) diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index d3a3ad0fc..4fe49a89d 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -28,52 +28,6 @@ fn main() -> eframe::Result { age += 1; } ui.label(format!("Hello '{name}', age {age}")); - - egui::MenuBar::new().ui(ui, |ui| { - ui.menu_button("File", |ui| { - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - }); - ui.menu_button("test", |ui| { - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - }); - ui.menu_button("azea", |ui| { - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - ui.menu_button("test", |ui| { - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - }); - }); - ui.menu_button("vrzzzde", |ui| { - if ui.button("Quit").clicked() { - ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); - } - }); - }); }); }) } From c3ce6bf11f98b2a81961363adf0c6898952193cf Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Mon, 10 Nov 2025 19:26:56 +0100 Subject: [PATCH 25/30] cleanup snapshot --- crates/egui_demo_app/tests/snapshots/clock.png | 4 ++-- .../tests/snapshots/demos/Window Resize Test.png | 4 ++-- .../egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png | 4 ++-- .../egui_kittest/tests/snapshots/should_wait_for_images.png | 4 ++-- tests/egui_tests/tests/snapshots/visuals/drag_value.png | 4 ++-- tests/egui_tests/tests/snapshots/visuals/text_edit.png | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/egui_demo_app/tests/snapshots/clock.png b/crates/egui_demo_app/tests/snapshots/clock.png index 30f46b955..39d9bb5ce 100644 --- a/crates/egui_demo_app/tests/snapshots/clock.png +++ b/crates/egui_demo_app/tests/snapshots/clock.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f8ddb5d4fb9e0bc0a2e74aa060145f972d8484b00983282f7bf1633d2d0dd213 -size 335799 +oid sha256:44a68dc4d3aeebeb2d296c5c8e03aac330e1e4552364084347b710326c88f70c +size 335794 diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png b/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png index c7bf0cd12..7a042bdba 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Window Resize Test.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4d100a7932f71b02732e454be4bcc9e634a0fc45be0aa4ecff8aefb148ab2f38 -size 44526 +oid sha256:b85a2af24c3361a0008fd0996e8d7244dc3e289646ec7233e8bad39a586c871c +size 44512 diff --git a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png index 7d01be1dc..87eb5ce70 100644 --- a/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png +++ b/crates/egui_demo_lib/tests/snapshots/widget_gallery_light_x1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e99f2973a676e7319bb5e370fbc7dba061f38e3b266039a04c7f18efe701165 -size 61182 +oid sha256:98c40c99a237f8388d82259fba4388d7b1759fe7b4bf657d326532934135c934 +size 61119 diff --git a/crates/egui_kittest/tests/snapshots/should_wait_for_images.png b/crates/egui_kittest/tests/snapshots/should_wait_for_images.png index 25ae1c39c..7e33877fc 100644 --- a/crates/egui_kittest/tests/snapshots/should_wait_for_images.png +++ b/crates/egui_kittest/tests/snapshots/should_wait_for_images.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e145d6abdcdcbad1f9ed58f3b50a1c697ee2bff481279640d9ee449f5f2a51dd -size 2820 +oid sha256:f038c7fdf31f35107ec6e29edc0895049160ccbe98d1577c16ae082605b58d52 +size 2207 diff --git a/tests/egui_tests/tests/snapshots/visuals/drag_value.png b/tests/egui_tests/tests/snapshots/visuals/drag_value.png index a6ffcf913..5411009f0 100644 --- a/tests/egui_tests/tests/snapshots/visuals/drag_value.png +++ b/tests/egui_tests/tests/snapshots/visuals/drag_value.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7178b3e92df7912283e1cf12b67f21a3c85c5fe48b2c2feb284886ce7f5e780f -size 7558 +oid sha256:129121534b5f1a2a668898ebb3560820fe50aa4d3546ef46cc764d5513787e9e +size 7529 diff --git a/tests/egui_tests/tests/snapshots/visuals/text_edit.png b/tests/egui_tests/tests/snapshots/visuals/text_edit.png index b3ae22df8..d8e56eb2a 100644 --- a/tests/egui_tests/tests/snapshots/visuals/text_edit.png +++ b/tests/egui_tests/tests/snapshots/visuals/text_edit.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e2051b9aeef49c404b49c6b47b8ff34be66dff2c792f5eceba456f855ebdb8bc -size 7682 +oid sha256:a103b51df184d5480438e8b537106432205a6d86f2927ab1bd507fe8ed3bb29b +size 7656 From 34bf318782f396a2e3cebc2761b191823701bab2 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Wed, 12 Nov 2025 10:05:30 +0100 Subject: [PATCH 26/30] fix features --- crates/egui/src/style_trait.rs | 18 ++++++------ crates/egui/src/widgets/button.rs | 44 +++++++++++++++------------- crates/egui/src/widgets/checkbox.rs | 37 +++++++++++++---------- crates/egui/src/widgets/separator.rs | 12 ++++---- 4 files changed, 59 insertions(+), 52 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index ca61700cd..66efc1def 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -30,7 +30,7 @@ pub struct WidgetStyle { pub struct ButtonStyle { pub frame: Frame, - pub text: TextVisuals, + pub text_style: TextVisuals, } pub struct CheckboxStyle { @@ -38,10 +38,10 @@ pub struct CheckboxStyle { pub frame: Frame, /// Text next to it - pub text: TextVisuals, + pub text_style: TextVisuals, /// Checkbox size - pub size: f32, + pub checkbox_size: f32, /// Checkmark size pub check_size: f32, @@ -50,7 +50,7 @@ pub struct CheckboxStyle { pub checkbox_frame: Frame, /// Checkmark stroke - pub stroke: Stroke, + pub check_stroke: Stroke, } pub struct LabelStyle { @@ -148,7 +148,7 @@ impl Style { .into(), ..Default::default() }, - text: ws.text, + text_style: ws.text, } } @@ -157,16 +157,16 @@ impl Style { let ws = self.widget_style(state); CheckboxStyle { frame: Frame::new(), - size: self.spacing.icon_width, + checkbox_size: self.spacing.icon_width, check_size: self.spacing.icon_width_inner, checkbox_frame: Frame { - fill: visuals.weak_bg_fill, + fill: visuals.bg_fill, corner_radius: visuals.corner_radius, stroke: visuals.bg_stroke, ..Default::default() }, - text: ws.text, - stroke: ws.stroke, + text_style: ws.text, + check_stroke: ws.stroke, } } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 91634bf05..cccef733c 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,11 +1,12 @@ -use std::sync::Arc; +use std::{mem, sync::Arc}; use epaint::Margin; use crate::{ Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Frame, Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, - Vec2, Widget, WidgetInfo, WidgetText, WidgetType, style_trait::WidgetState, + Vec2, Widget, WidgetInfo, WidgetText, WidgetType, + style_trait::{ButtonStyle, WidgetState}, }; /// Clickable button with text. @@ -293,16 +294,16 @@ impl<'a> Button<'a> { let text = layout.text().map(String::from); + let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); + let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().button_style(state, selected); - - let has_frame_margin = frame.unwrap_or_else(|| ui.visuals().button_frame); + let ButtonStyle { frame, text_style } = ui.style().button_style(state, selected); let mut button_padding = if has_frame_margin { - style.frame.inner_margin + frame.inner_margin } else { Margin::ZERO }; @@ -313,7 +314,7 @@ impl<'a> Button<'a> { } // Override global style by local style - let mut frame = style.frame; + let mut frame = frame; if let Some(fill) = fill { frame = frame.fill(fill); } @@ -331,31 +332,34 @@ impl<'a> Button<'a> { layout.map_texts(|t| match t { WidgetText::Text(text) => { let rich_text = RichText::new(text.clone()) - .font(style.text.font_id.clone()) - .color(style.text.color); + .font(text_style.font_id.clone()) + .color(text_style.color); WidgetText::RichText(Arc::new(rich_text)) } + WidgetText::RichText(mut text) => { + let text_mut = Arc::make_mut(&mut text); + *text_mut = mem::take(text_mut).font(text_style.font_id.clone()); + WidgetText::RichText(text) + } w => w, }); // Retrocompatibility with button settings - let mut prepared = - if has_frame_margin && (state != WidgetState::Inactive || frame_when_inactive) { - layout.frame(frame).min_size(min_size).allocate(ui) - } else { - layout - .frame(Frame::new().inner_margin(frame.inner_margin)) - .min_size(min_size) - .allocate(ui) - }; + layout = if has_frame_margin && (state != WidgetState::Inactive || frame_when_inactive) { + layout.frame(frame) + } else { + layout.frame(Frame::new().inner_margin(frame.inner_margin)) + }; + + let mut prepared = layout.min_size(min_size).allocate(ui); // Get AtomLayoutResponse, empty if not visible let response = if ui.is_rect_visible(prepared.response.rect) { if image_tint_follows_text_color { - prepared.map_images(|image| image.tint(style.text.color)); + prepared.map_images(|image| image.tint(text_style.color)); } - prepared.fallback_text_color = style.text.color; + prepared.fallback_text_color = text_style.color; prepared.paint(ui) } else { diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index 7b210cf95..f3a57af47 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -2,7 +2,7 @@ use emath::Rect; use crate::{ Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Shape, Ui, Vec2, Widget, - WidgetInfo, WidgetType, epaint, pos2, + WidgetInfo, WidgetType, epaint, pos2, style_trait::CheckboxStyle, }; // TODO(emilk): allow checkbox without a text label @@ -61,16 +61,22 @@ impl Widget for Checkbox<'_> { let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().checkbox_style(state); - let icon_width = style.size; + let CheckboxStyle { + check_size, + checkbox_frame, + checkbox_size, + frame, + check_stroke, + text_style, + } = ui.style().checkbox_style(state); // interact_size or size ? let mut min_size = Vec2::splat(ui.spacing().interact_size.y); - min_size.y = min_size.y.at_least(icon_width); + min_size.y = min_size.y.at_least(checkbox_size); // In order to center the checkbox based on min_size we set the icon height to at least min_size.y - let mut icon_size = Vec2::splat(icon_width); + let mut icon_size = Vec2::splat(checkbox_size); icon_size.y = icon_size.y.at_least(min_size.y); let rect_id = Id::new("egui::checkbox"); atoms.push_left(Atom::custom(rect_id, icon_size)); @@ -80,7 +86,7 @@ impl Widget for Checkbox<'_> { let mut prepared = AtomLayout::new(atoms) .sense(Sense::click()) .min_size(min_size) - .frame(style.frame) + .frame(frame) .allocate(ui); if prepared.response.clicked() { @@ -105,23 +111,22 @@ impl Widget for Checkbox<'_> { }); if ui.is_rect_visible(prepared.response.rect) { - // let visuals = ui.style().interact_selectable(&response, *checked); // too colorful - prepared.fallback_text_color = style.text.color; + prepared.fallback_text_color = text_style.color; let response = prepared.paint(ui); if let Some(rect) = response.rect(rect_id) { let big_icon_rect = Rect::from_center_size( - pos2(rect.left() + icon_width / 2.0, rect.center().y), - Vec2::splat(style.size), + pos2(rect.left() + checkbox_size / 2.0, rect.center().y), + Vec2::splat(checkbox_size), ); let small_icon_rect = - Rect::from_center_size(big_icon_rect.center(), Vec2::splat(style.check_size)); + Rect::from_center_size(big_icon_rect.center(), Vec2::splat(check_size)); ui.painter().add(epaint::RectShape::new( big_icon_rect, - style.checkbox_frame.corner_radius, - style.checkbox_frame.fill, - style.checkbox_frame.stroke, + checkbox_frame.corner_radius, + checkbox_frame.fill, + checkbox_frame.stroke, epaint::StrokeKind::Inside, )); @@ -130,7 +135,7 @@ impl Widget for Checkbox<'_> { ui.painter().add(Shape::hline( small_icon_rect.x_range(), small_icon_rect.center().y, - style.stroke, + check_stroke, )); } else if *checked { // Check mark: @@ -140,7 +145,7 @@ impl Widget for Checkbox<'_> { pos2(small_icon_rect.center().x, small_icon_rect.bottom()), pos2(small_icon_rect.right(), small_icon_rect.top()), ], - style.stroke, + check_stroke, )); } } diff --git a/crates/egui/src/widgets/separator.rs b/crates/egui/src/widgets/separator.rs index f130d9272..5dfedf1d2 100644 --- a/crates/egui/src/widgets/separator.rs +++ b/crates/egui/src/widgets/separator.rs @@ -13,7 +13,7 @@ use crate::{Response, Sense, Ui, Vec2, Widget, vec2}; /// ``` #[must_use = "You should put this widget in a ui with `ui.add(widget);`"] pub struct Separator { - spacing: f32, + spacing: Option, grow: f32, is_horizontal_line: Option, } @@ -21,7 +21,7 @@ pub struct Separator { impl Default for Separator { fn default() -> Self { Self { - spacing: 6.0, + spacing: None, grow: 0.0, is_horizontal_line: None, } @@ -38,7 +38,7 @@ impl Separator { /// this is the width of the separator widget. #[inline] pub fn spacing(mut self, spacing: f32) -> Self { - self.spacing = spacing; + self.spacing = Some(spacing); self } @@ -88,7 +88,7 @@ impl Separator { impl Widget for Separator { fn ui(self, ui: &mut Ui) -> Response { let Self { - mut spacing, + spacing, grow, is_horizontal_line, } = self; @@ -100,9 +100,7 @@ impl Widget for Separator { let style = ui.style().separator_style(state); // override the spacing if not set - if spacing == 0.0 && style.spacing != 0.0 { - spacing = style.spacing; - } + let spacing = spacing.unwrap_or(style.spacing); let is_horizontal_line = is_horizontal_line .unwrap_or_else(|| ui.is_grid() || !ui.layout().main_dir().is_horizontal()); From 2f917bcb9fb199cd5d4c519bc7d53c7cc2bc5b37 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Wed, 12 Nov 2025 17:29:29 +0100 Subject: [PATCH 27/30] fix text color override --- crates/egui/src/style_trait.rs | 9 +++++++-- crates/egui/src/widgets/button.rs | 9 ++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/style_trait.rs index 66efc1def..424eea460 100644 --- a/crates/egui/src/style_trait.rs +++ b/crates/egui/src/style_trait.rs @@ -120,7 +120,10 @@ impl Style { }, stroke: visuals.fg_stroke, text: TextVisuals { - color: visuals.text_color(), + color: self + .visuals + .override_text_color + .unwrap_or(visuals.text_color()), font_id: font_id.unwrap_or(TextStyle::Body.resolve(self)), strikethrough: Stroke::NONE, underline: Stroke::NONE, @@ -131,12 +134,14 @@ impl Style { pub fn button_style(&self, state: WidgetState, selected: bool) -> ButtonStyle { let mut visuals = *self.visuals.widgets.state(state); let mut ws = self.widget_style(state); + if selected { visuals.weak_bg_fill = self.visuals.selection.bg_fill; visuals.bg_fill = self.visuals.selection.bg_fill; visuals.fg_stroke = self.visuals.selection.stroke; ws.text.color = self.visuals.selection.stroke.color; } + ButtonStyle { frame: Frame { fill: visuals.weak_bg_fill, @@ -189,7 +194,7 @@ impl Style { pub fn separator_style(&self, _state: WidgetState) -> SeparatorStyle { let visuals = self.visuals.noninteractive(); SeparatorStyle { - spacing: 0.0, + spacing: 6.0, stroke: visuals.bg_stroke, } } diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index cccef733c..8fc3e1a79 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -7,6 +7,7 @@ use crate::{ Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType, style_trait::{ButtonStyle, WidgetState}, + text_selection::visuals, }; /// Clickable button with text. @@ -338,7 +339,9 @@ impl<'a> Button<'a> { } WidgetText::RichText(mut text) => { let text_mut = Arc::make_mut(&mut text); - *text_mut = mem::take(text_mut).font(text_style.font_id.clone()); + *text_mut = mem::take(text_mut) + .font(text_style.font_id.clone()) + .color(text_style.color); WidgetText::RichText(text) } w => w, @@ -356,10 +359,10 @@ impl<'a> Button<'a> { // Get AtomLayoutResponse, empty if not visible let response = if ui.is_rect_visible(prepared.response.rect) { if image_tint_follows_text_color { - prepared.map_images(|image| image.tint(text_style.color)); + prepared.map_images(|image| image.tint(ui.visuals().text_color())); } - prepared.fallback_text_color = text_style.color; + prepared.fallback_text_color = ui.visuals().text_color(); prepared.paint(ui) } else { From 0b9f70d47b85f62d0cbd1aaba9f128b1a9cdede2 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Wed, 12 Nov 2025 18:18:20 +0100 Subject: [PATCH 28/30] remove unused import --- crates/egui/src/widgets/button.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 8fc3e1a79..2c63b5fde 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -7,7 +7,6 @@ use crate::{ Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType, style_trait::{ButtonStyle, WidgetState}, - text_selection::visuals, }; /// Clickable button with text. From 58992a635a3dcb8fa74bbf0c69db2a6ab73148ab Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Wed, 19 Nov 2025 09:26:28 +0100 Subject: [PATCH 29/30] rename style_trait.rs -> widget_style.rs and font/color fallback for button --- crates/egui/src/lib.rs | 2 +- .../src/{style_trait.rs => widget_style.rs} | 0 crates/egui/src/widgets/button.rs | 30 +++++-------------- crates/egui/src/widgets/checkbox.rs | 2 +- crates/egui/src/widgets/separator.rs | 10 ++++--- 5 files changed, 15 insertions(+), 29 deletions(-) rename crates/egui/src/{style_trait.rs => widget_style.rs} (100%) diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index c0c68884a..df01e752a 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -434,7 +434,6 @@ mod plugin; pub mod response; mod sense; pub mod style; -pub mod style_trait; pub mod text_selection; mod ui; mod ui_builder; @@ -442,6 +441,7 @@ mod ui_stack; pub mod util; pub mod viewport; mod widget_rect; +pub mod widget_style; pub mod widget_text; pub mod widgets; diff --git a/crates/egui/src/style_trait.rs b/crates/egui/src/widget_style.rs similarity index 100% rename from crates/egui/src/style_trait.rs rename to crates/egui/src/widget_style.rs diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 2c63b5fde..08acd12f9 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -1,12 +1,10 @@ -use std::{mem, sync::Arc}; - use epaint::Margin; use crate::{ Atom, AtomExt as _, AtomKind, AtomLayout, AtomLayoutResponse, Color32, CornerRadius, Frame, - Image, IntoAtoms, NumExt as _, Response, RichText, Sense, Stroke, TextStyle, TextWrapMode, Ui, - Vec2, Widget, WidgetInfo, WidgetText, WidgetType, - style_trait::{ButtonStyle, WidgetState}, + Image, IntoAtoms, NumExt as _, Response, Sense, Stroke, TextStyle, TextWrapMode, Ui, Vec2, + Widget, WidgetInfo, WidgetText, WidgetType, + widget_style::{ButtonStyle, WidgetState}, }; /// Clickable button with text. @@ -327,24 +325,10 @@ impl<'a> Button<'a> { frame = frame.inner_margin(button_padding); - // Apply the correct font and color if Text - // We assume that the other WidgetText have already a Fontid and color - layout.map_texts(|t| match t { - WidgetText::Text(text) => { - let rich_text = RichText::new(text.clone()) - .font(text_style.font_id.clone()) - .color(text_style.color); - WidgetText::RichText(Arc::new(rich_text)) - } - WidgetText::RichText(mut text) => { - let text_mut = Arc::make_mut(&mut text); - *text_mut = mem::take(text_mut) - .font(text_style.font_id.clone()) - .color(text_style.color); - WidgetText::RichText(text) - } - w => w, - }); + // Apply the style font and color as fallback + layout = layout + .fallback_font(text_style.font_id.clone()) + .fallback_text_color(text_style.color); // Retrocompatibility with button settings layout = if has_frame_margin && (state != WidgetState::Inactive || frame_when_inactive) { diff --git a/crates/egui/src/widgets/checkbox.rs b/crates/egui/src/widgets/checkbox.rs index f3a57af47..077673a9e 100644 --- a/crates/egui/src/widgets/checkbox.rs +++ b/crates/egui/src/widgets/checkbox.rs @@ -2,7 +2,7 @@ use emath::Rect; use crate::{ Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Shape, Ui, Vec2, Widget, - WidgetInfo, WidgetType, epaint, pos2, style_trait::CheckboxStyle, + WidgetInfo, WidgetType, epaint, pos2, widget_style::CheckboxStyle, }; // TODO(emilk): allow checkbox without a text label diff --git a/crates/egui/src/widgets/separator.rs b/crates/egui/src/widgets/separator.rs index 5dfedf1d2..ab211773e 100644 --- a/crates/egui/src/widgets/separator.rs +++ b/crates/egui/src/widgets/separator.rs @@ -1,4 +1,4 @@ -use crate::{Response, Sense, Ui, Vec2, Widget, vec2}; +use crate::{Response, Sense, Ui, Vec2, Widget, vec2, widget_style::SeparatorStyle}; /// A visual separator. A horizontal or vertical line (depending on [`crate::Layout`]). /// @@ -97,10 +97,13 @@ impl Widget for Separator { let id = ui.next_auto_id(); let response: Option = ui.ctx().read_response(id); let state = response.map(|r| r.widget_state()).unwrap_or_default(); - let style = ui.style().separator_style(state); + let SeparatorStyle { + spacing: spacing_style, + stroke, + } = ui.style().separator_style(state); // override the spacing if not set - let spacing = spacing.unwrap_or(style.spacing); + let spacing = spacing.unwrap_or(spacing_style); let is_horizontal_line = is_horizontal_line .unwrap_or_else(|| ui.is_grid() || !ui.layout().main_dir().is_horizontal()); @@ -120,7 +123,6 @@ impl Widget for Separator { let (rect, response) = ui.allocate_at_least(size, Sense::hover()); if ui.is_rect_visible(response.rect) { - let stroke = style.stroke; let painter = ui.painter(); if is_horizontal_line { painter.hline( From dbd718104e0c9abdf1379bea040b3ab840236371 Mon Sep 17 00:00:00 2001 From: adrien <221212@umons.ac.be> Date: Fri, 21 Nov 2025 09:50:07 +0100 Subject: [PATCH 30/30] fix button color --- crates/egui/src/widgets/button.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 08acd12f9..4b4c2fe32 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -342,10 +342,10 @@ impl<'a> Button<'a> { // Get AtomLayoutResponse, empty if not visible let response = if ui.is_rect_visible(prepared.response.rect) { if image_tint_follows_text_color { - prepared.map_images(|image| image.tint(ui.visuals().text_color())); + prepared.map_images(|image| image.tint(text_style.color)); } - prepared.fallback_text_color = ui.visuals().text_color(); + prepared.fallback_text_color = text_style.color; prepared.paint(ui) } else {