ui: make pixel sizes correct, use more of the figma
I noticed the pixel sizes were off which made it harder to match the pixel dimensions of rob's figma designs. This restores the pixel size and adjust the font sizes so that things look somewhat ok with the default pixel settings. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -5,32 +5,42 @@ use egui::{vec2, Sense, TextureHandle};
|
||||
pub struct ProfilePic<'cache, 'url> {
|
||||
cache: &'cache mut ImageCache,
|
||||
url: &'url str,
|
||||
size: f32,
|
||||
}
|
||||
|
||||
impl<'cache, 'url> egui::Widget for ProfilePic<'cache, 'url> {
|
||||
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
|
||||
render_pfp(ui, self.cache, self.url)
|
||||
render_pfp(ui, self.cache, self.url, self.size)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'cache, 'url> ProfilePic<'cache, 'url> {
|
||||
pub fn new(cache: &'cache mut ImageCache, url: &'url str) -> Self {
|
||||
ProfilePic { cache, url }
|
||||
let size = 32.0;
|
||||
ProfilePic { cache, url, size }
|
||||
}
|
||||
|
||||
pub fn no_pfp_url() -> &'static str {
|
||||
"https://damus.io/img/no-profile.svg"
|
||||
}
|
||||
|
||||
pub fn size(mut self, size: f32) -> Self {
|
||||
self.size = size;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn render_pfp(ui: &mut egui::Ui, img_cache: &mut ImageCache, url: &str) -> egui::Response {
|
||||
fn render_pfp(
|
||||
ui: &mut egui::Ui,
|
||||
img_cache: &mut ImageCache,
|
||||
url: &str,
|
||||
ui_size: f32,
|
||||
) -> egui::Response {
|
||||
#[cfg(feature = "profiling")]
|
||||
puffin::profile_function!();
|
||||
|
||||
let ui_size = 30.0;
|
||||
|
||||
// We will want to downsample these so it's not blurry on hi res displays
|
||||
let img_size = (ui_size * 2.0) as u32;
|
||||
let img_size = 128u32;
|
||||
|
||||
let m_cached_promise = img_cache.map().get(url);
|
||||
if m_cached_promise.is_none() {
|
||||
|
||||
Reference in New Issue
Block a user