Render a close tab button on tab hover

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo
2021-04-27 11:58:59 -06:00
co-authored by Max Brunsfeld
parent bb95d58c79
commit eca9f495a1
8 changed files with 96 additions and 71 deletions
+2 -2
View File
@@ -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 {
+5 -3
View File
@@ -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(),
}
}
+3 -3
View File
@@ -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
View File
@@ -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,
}