This commit is contained in:
2026-10-21 19:51:01 +07:00
parent d7160e196e
commit 6117c8184c
149 changed files with 591 additions and 18 deletions
+5 -2
View File
@@ -4,6 +4,7 @@ use gpui::{
SharedString, StyleRefinement, Styled, StyledImage, Window, canvas, div, img, point, px,
};
use gpui_kit::base::StyledExt as _;
use gpui_kit::component::menu::DropdownMenu;
use gpui_kit::component::{ActiveTheme as _, Selectable, Sizable, Size};
/// Number of rows and columns in the generated pixel grid.
@@ -41,7 +42,7 @@ struct PixelAvatar {
}
impl PixelAvatar {
/// Creates a pixel avatar from `seed.
/// Creates a pixel avatar from the given seed.
fn new(seed: impl AsRef<str>) -> Self {
Self {
seed: fnv1a(seed.as_ref().as_bytes()),
@@ -124,7 +125,7 @@ impl RenderOnce for PixelAvatar {
}
}
/// Builds the mirrored fill pattern for `seed.
/// Builds the mirrored fill pattern for the given seed.
fn pixel_pattern(seed: u64) -> [u8; PIXEL_GRID * PIXEL_GRID] {
let mut rng = PixelRng::new(seed);
let mut pattern = [0u8; PIXEL_GRID * PIXEL_GRID];
@@ -417,6 +418,8 @@ impl InteractiveElement for Avatar {
}
}
impl DropdownMenu for Avatar {}
impl RenderOnce for Avatar {
fn render(self, window: &mut Window, _cx: &mut App) -> impl IntoElement {
let image_size = avatar_size(self.size).to_pixels(window.rem_size());