dave: improve design

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-03-26 16:54:28 -07:00
parent f412b1ac7b
commit c6a7a50f81
7 changed files with 56 additions and 38 deletions

View File

@@ -0,0 +1,27 @@
use egui::{vec2, Color32, Stroke};
/// Creates a magnifying glass icon widget
pub fn search_icon(size: f32, height: f32) -> impl egui::Widget {
move |ui: &mut egui::Ui| {
// Use the provided height parameter
let desired_size = vec2(size, height);
let (rect, response) = ui.allocate_exact_size(desired_size, egui::Sense::hover());
// Calculate center position - this ensures the icon is centered in its allocated space
let center_pos = rect.center();
let stroke = Stroke::new(1.5, Color32::from_rgb(150, 150, 150));
// Draw circle
let circle_radius = size * 0.35;
ui.painter()
.circle(center_pos, circle_radius, Color32::TRANSPARENT, stroke);
// Draw handle
let handle_start = center_pos + vec2(circle_radius * 0.7, circle_radius * 0.7);
let handle_end = handle_start + vec2(size * 0.25, size * 0.25);
ui.painter()
.line_segment([handle_start, handle_end], stroke);
response
}
}

View File

@@ -3,6 +3,7 @@ pub mod colors;
pub mod gif;
pub mod images;
pub mod profile;
pub mod icons;
pub use anim::AnimationHelper;
pub use profile::ProfilePic;