mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Avatars looking even better, and 3x as big on the person page
This commit is contained in:
parent
cb7c8cddfb
commit
dac2fec259
@ -5,6 +5,7 @@ use crate::AVATAR_SIZE;
|
|||||||
use dashmap::{DashMap, DashSet};
|
use dashmap::{DashMap, DashSet};
|
||||||
use eframe::egui::ColorImage;
|
use eframe::egui::ColorImage;
|
||||||
use egui_extras::image::FitTo;
|
use egui_extras::image::FitTo;
|
||||||
|
use image::imageops::FilterType;
|
||||||
use nostr_types::{Metadata, PublicKeyHex, Unixtime, Url};
|
use nostr_types::{Metadata, PublicKeyHex, Unixtime, Url};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@ -310,7 +311,7 @@ impl People {
|
|||||||
// Finish this later (spawn)
|
// Finish this later (spawn)
|
||||||
let apubkeyhex = pubkeyhex.to_owned();
|
let apubkeyhex = pubkeyhex.to_owned();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let size = AVATAR_SIZE
|
let size = AVATAR_SIZE * 3 // 3x feed size, 1x people page size
|
||||||
* GLOBALS
|
* GLOBALS
|
||||||
.pixels_per_point_times_100
|
.pixels_per_point_times_100
|
||||||
.load(std::sync::atomic::Ordering::Relaxed)
|
.load(std::sync::atomic::Ordering::Relaxed)
|
||||||
@ -319,7 +320,7 @@ impl People {
|
|||||||
// Note: we can't use egui_extras::image::load_image_bytes because we
|
// Note: we can't use egui_extras::image::load_image_bytes because we
|
||||||
// need to force a resize
|
// need to force a resize
|
||||||
let image =
|
let image =
|
||||||
image.resize(size, size, image::imageops::FilterType::CatmullRom); // DynamicImage
|
image.resize(size, size, FilterType::CatmullRom); // DynamicImage
|
||||||
let image_buffer = image.into_rgba8(); // RgbaImage (ImageBuffer)
|
let image_buffer = image.into_rgba8(); // RgbaImage (ImageBuffer)
|
||||||
let color_image = ColorImage::from_rgba_unmultiplied(
|
let color_image = ColorImage::from_rgba_unmultiplied(
|
||||||
[
|
[
|
||||||
|
@ -3,6 +3,7 @@ use crate::comms::ToOverlordMessage;
|
|||||||
use crate::db::DbPerson;
|
use crate::db::DbPerson;
|
||||||
use crate::feed::FeedKind;
|
use crate::feed::FeedKind;
|
||||||
use crate::globals::GLOBALS;
|
use crate::globals::GLOBALS;
|
||||||
|
use crate::AVATAR_SIZE_F32;
|
||||||
use eframe::egui;
|
use eframe::egui;
|
||||||
use egui::{Context, RichText, Ui, Vec2};
|
use egui::{Context, RichText, Ui, Vec2};
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra
|
|||||||
} else {
|
} else {
|
||||||
app.placeholder_avatar.clone()
|
app.placeholder_avatar.clone()
|
||||||
};
|
};
|
||||||
ui.image(&avatar, Vec2 { x: 36.0, y: 36.0 });
|
ui.image(&avatar, Vec2 { x: AVATAR_SIZE_F32 * 3.0, y: AVATAR_SIZE_F32 * 3.0 });
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.label(RichText::new(GossipUi::hex_pubkey_short(&pubkeyhex)).weak());
|
ui.label(RichText::new(GossipUi::hex_pubkey_short(&pubkeyhex)).weak());
|
||||||
GossipUi::render_person_name_line(ui, maybe_person.as_ref());
|
GossipUi::render_person_name_line(ui, maybe_person.as_ref());
|
||||||
|
Loading…
Reference in New Issue
Block a user