diff --git a/crates/egui/src/containers/frame.rs b/crates/egui/src/containers/frame.rs index 731c48f23..72134dd29 100644 --- a/crates/egui/src/containers/frame.rs +++ b/crates/egui/src/containers/frame.rs @@ -332,6 +332,7 @@ impl Frame { /// Make this frame invisible by setting background and stroke to transparent. /// /// Will not affect layout or contents. + #[inline] pub fn invisible(mut self) -> Self { self.fill = Color32::TRANSPARENT; self.stroke.color = Color32::TRANSPARENT; diff --git a/crates/egui/src/widget_style/mod.rs b/crates/egui/src/widget_style/mod.rs index de446148b..81efe41d8 100644 --- a/crates/egui/src/widget_style/mod.rs +++ b/crates/egui/src/widget_style/mod.rs @@ -17,7 +17,7 @@ use core::fmt::Debug; use epaint::{Color32, FontId, Stroke, Vec2}; use crate::{ - Context, Frame, Response, Style, TextStyle, UiStack, + Context, FontSelection, Frame, Response, Style, UiStack, style::{WidgetVisuals, Widgets}, }; @@ -35,26 +35,26 @@ pub struct TextVisuals { } impl TextVisuals { - /// Text in `color`, using the font of the given [`TextStyle`]. + /// Text in `color`, using the given font. /// - /// `style.override_font_id` wins over `text_style`, if it is set. - pub fn new(style: &Style, text_style: TextStyle, color: Color32) -> Self { + /// `style.override_font_id` wins over `font`, if it is set. + pub fn new(style: &Style, font: impl Into, color: Color32) -> Self { Self { color, font_id: style .override_font_id .clone() - .unwrap_or_else(|| text_style.resolve(style)), + .unwrap_or_else(|| font.into().resolve(style)), } } /// The text of a widget, colored by the [`WidgetVisuals`] of its current state. pub fn from_widget_visuals( style: &Style, - text_style: TextStyle, + font: impl Into, widget_visuals: &WidgetVisuals, ) -> Self { - Self::new(style, text_style, widget_visuals.text_color()) + Self::new(style, font, widget_visuals.text_color()) } } diff --git a/crates/egui_demo_app/tests/snapshots/imageviewer.png b/crates/egui_demo_app/tests/snapshots/imageviewer.png index c08ab1aac..29d317b3f 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:24fc466f6470761a5064a590929fa3a0d95741ed691fc257415eee349bc528e9 -size 101394 +oid sha256:6264f32d3323d0d499ba0da9d379e562c06a7f50930dbec424039549ce7f50f9 +size 101414