Skip to content

Commit

Permalink
Revert unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmerlin committed Dec 29, 2024
1 parent d43e34d commit dfb44f0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/egui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ pub enum WidgetType {
ColorButton,

ImageButton,

Image,

CollapsingHeader,
Expand Down
3 changes: 1 addition & 2 deletions crates/egui/src/widgets/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,7 @@ impl Widget for Button<'_> {
});

if ui.is_rect_visible(rect) {
let style = ui.style().clone();
let visuals = style.interact(&response);
let visuals = ui.style().interact(&response);

let (frame_expansion, frame_rounding, frame_fill, frame_stroke) = if selected {
let selection = ui.visuals().selection;
Expand Down
16 changes: 9 additions & 7 deletions crates/egui/src/widgets/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use epaint::{

use crate::{
load::{Bytes, SizeHint, SizedTexture, TextureLoadResult, TexturePoll},
pos2, Align2, Color32, Context, Id, Mesh, Painter, Rect, Response, Rounding, Sense, Shape,
Spinner, Stroke, TextStyle, TextureOptions, Ui, Vec2, Widget, WidgetInfo, WidgetType,
pos2, Color32, Context, Id, Mesh, Painter, Rect, Response, Rounding, Sense, Shape, Spinner,
Stroke, TextStyle, TextureOptions, Ui, Vec2, Widget, WidgetInfo, WidgetType,
};

/// A widget which displays an image.
Expand Down Expand Up @@ -357,7 +357,7 @@ impl<'a> Image<'a> {
/// # });
/// ```
#[inline]
pub fn paint_at(&self, ui: &mut Ui, rect: Rect) {
pub fn paint_at(&self, ui: &Ui, rect: Rect) {
paint_texture_load_result(
ui,
&self.load_for_size(ui.ctx(), rect.size()),
Expand Down Expand Up @@ -614,7 +614,7 @@ impl<'a> ImageSource<'a> {
}

pub fn paint_texture_load_result(
ui: &mut Ui,
ui: &Ui,
tlr: &TextureLoadResult,
rect: Rect,
show_loading_spinner: Option<bool>,
Expand All @@ -634,9 +634,11 @@ pub fn paint_texture_load_result(
}
Err(_) => {
let font_id = TextStyle::Body.resolve(ui.style());
let mut job = LayoutJob::default();
job.wrap = TextWrapping::truncate_at_width(rect.width());
job.halign = Align::Center;
let mut job = LayoutJob {
wrap: TextWrapping::truncate_at_width(rect.width()),
halign: Align::Center,
..Default::default()
};
job.append(
"⚠",
0.0,
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_app/src/apps/image_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl eframe::App for ImageViewer {
ui.add_space(5.0);
ui.label("Aspect ratio is maintained by scaling both sides as necessary");
ui.checkbox(&mut self.maintain_aspect_ratio, "Maintain aspect ratio");

// alt text
ui.add_space(5.0);
ui.label("Alt text");
Expand Down

0 comments on commit dfb44f0

Please sign in to comment.