mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Fix CI: #[inline], clippy, and the imageviewer snapshot
* `Frame::invisible` needs `#[inline]` like every other builder method. * `TextVisuals::new` took a `TextStyle` by value but only borrowed it. Take an `impl Into<FontSelection>` instead, which consumes it and lets a theme hand over a `FontId` directly. * A hovered small button now paints its border a pixel further out, since its padding is zeroed before the expansion correction. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<FontSelection>, 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<FontSelection>,
|
||||
widget_visuals: &WidgetVisuals,
|
||||
) -> Self {
|
||||
Self::new(style, text_style, widget_visuals.text_color())
|
||||
Self::new(style, font, widget_visuals.text_color())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:24fc466f6470761a5064a590929fa3a0d95741ed691fc257415eee349bc528e9
|
||||
size 101394
|
||||
oid sha256:6264f32d3323d0d499ba0da9d379e562c06a7f50930dbec424039549ce7f50f9
|
||||
size 101414
|
||||
|
||||
Reference in New Issue
Block a user