Render a close tab button on tab hover
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
co-authored by
Max Brunsfeld
parent
bb95d58c79
commit
eca9f495a1
@@ -12,8 +12,8 @@ pub struct MouseEventHandler {
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct MouseState {
|
||||
hovered: bool,
|
||||
clicked: bool,
|
||||
pub hovered: bool,
|
||||
pub clicked: bool,
|
||||
}
|
||||
|
||||
impl MouseEventHandler {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use crate::{
|
||||
@@ -11,14 +13,14 @@ use crate::{
|
||||
};
|
||||
|
||||
pub struct Svg {
|
||||
path: String,
|
||||
path: Cow<'static, str>,
|
||||
color: ColorU,
|
||||
}
|
||||
|
||||
impl Svg {
|
||||
pub fn new(path: String) -> Self {
|
||||
pub fn new(path: impl Into<Cow<'static, str>>) -> Self {
|
||||
Self {
|
||||
path,
|
||||
path: path.into(),
|
||||
color: ColorU::black(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::{
|
||||
use etagere::BucketedAtlasAllocator;
|
||||
use metal::{MTLPixelFormat, TextureDescriptor};
|
||||
use ordered_float::OrderedFloat;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use std::{borrow::Cow, collections::HashMap, sync::Arc};
|
||||
|
||||
#[derive(Hash, Eq, PartialEq)]
|
||||
struct GlyphDescriptor {
|
||||
@@ -29,7 +29,7 @@ pub struct GlyphSprite {
|
||||
|
||||
#[derive(Hash, Eq, PartialEq)]
|
||||
struct IconDescriptor {
|
||||
path: String,
|
||||
path: Cow<'static, str>,
|
||||
width: i32,
|
||||
height: i32,
|
||||
}
|
||||
@@ -138,7 +138,7 @@ impl SpriteCache {
|
||||
pub fn render_icon(
|
||||
&mut self,
|
||||
size: Vector2F,
|
||||
path: String,
|
||||
path: Cow<'static, str>,
|
||||
svg: usvg::Tree,
|
||||
scale_factor: f32,
|
||||
) -> IconSprite {
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use crate::{
|
||||
@@ -51,7 +53,7 @@ pub struct Glyph {
|
||||
pub struct Icon {
|
||||
pub bounds: RectF,
|
||||
pub svg: usvg::Tree,
|
||||
pub path: String,
|
||||
pub path: Cow<'static, str>,
|
||||
pub color: ColorU,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user