chore: fix menu anchoring to trigger bounds
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s

This commit is contained in:
2026-11-28 14:30:57 +07:00
parent 3c5fb68f7e
commit cf81443411
14 changed files with 239 additions and 185 deletions
+7 -26
View File
@@ -1,13 +1,11 @@
//! Signed's icon set: application-defined SVG glyphs.
use std::borrow::Cow;
use std::time::Duration;
use gpui::prelude::FluentBuilder as _;
use gpui::{
AbsoluteLength, App, AssetSource, Div, Hsla, IntoElement, ParentElement as _, Pixels, Rems,
RenderOnce, Result, SharedString, Styled as _, TimedTransformation, Transformation, Window,
div, rems, svg,
AbsoluteLength, App, Div, Hsla, IntoElement, ParentElement as _, Pixels, Rems, RenderOnce,
SharedString, Styled as _, TimedTransformation, Transformation, Window, div, rems, svg,
};
const SMALL_ICON_SIZE: Rems = rems(0.875);
@@ -16,6 +14,11 @@ const LARGE_ICON_SIZE: Rems = rems(1.25);
/// The spin presents at most this rate, rotating a sprite needs no more frames.
const SPIN_MAX_FPS: f32 = 60.0;
#[derive(rust_embed::RustEmbed)]
#[folder = "src/icons/assets"]
#[exclude = "*.DS_Store"]
pub struct Assets;
/// The semantic glyphs UI components need.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum IconRole {
@@ -313,25 +316,3 @@ impl RenderOnce for Icon {
Self::render_svg_path(size, Some(color), transformation, rotation_period, path)
}
}
#[derive(rust_embed::RustEmbed)]
#[folder = "src/icons/assets"]
#[exclude = "*.DS_Store"]
pub struct Assets;
impl AssetSource for Assets {
fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {
let name = match path.strip_prefix("icons/") {
Some(name) => name,
None => return Ok(None),
};
Ok(Assets::get(name).map(|file| file.data))
}
fn list(&self, path: &str) -> gpui::Result<Vec<SharedString>> {
Ok(Self::iter()
.map(|file| SharedString::from(format!("icons/{file}")))
.filter(|file| file.starts_with(path))
.collect())
}
}