commit 2f6f92e62c9e51e027b1f4d681cb20e8c92383ea
parent 7f61d9aeb7ba3dc4f6633cab4798d9dd860f3a2d
Author: William Casarin <jb55@jb55.com>
Date: Sun, 21 Apr 2024 14:50:10 -0700
style: set 0 duration tooltip delay
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/app_creation.rs b/src/app_creation.rs
@@ -1,4 +1,4 @@
-use crate::app_style::{create_text_styles, dark_mode, desktop_font_size, mobile_font_size};
+use crate::app_style::{create_custom_style, dark_mode, desktop_font_size, mobile_font_size};
use crate::fonts::setup_fonts;
use crate::ui::is_mobile;
use eframe::NativeOptions;
@@ -47,8 +47,8 @@ pub fn setup_cc(cc: &eframe::CreationContext<'_>) {
ctx.set_visuals(dark_mode(is_mobile(ctx)));
ctx.set_style(if is_mobile(ctx) {
- create_text_styles(ctx, mobile_font_size)
+ create_custom_style(ctx, mobile_font_size)
} else {
- create_text_styles(ctx, desktop_font_size)
+ create_custom_style(ctx, desktop_font_size)
});
}
diff --git a/src/app_style.rs b/src/app_style.rs
@@ -3,7 +3,7 @@ use crate::colors::{
};
use egui::{
epaint::Shadow,
- style::{Selection, WidgetVisuals, Widgets},
+ style::{Interaction, Selection, WidgetVisuals, Widgets},
Button, Context, FontFamily, FontId, Rounding, Stroke, Style, TextStyle, Ui, Visuals,
};
use strum::IntoEnumIterator;
@@ -50,7 +50,7 @@ pub fn user_requested_visuals_change(
}
/// Create custom text sizes for any FontSizes
-pub fn create_text_styles(ctx: &Context, font_size: fn(&NotedeckTextStyle) -> f32) -> Style {
+pub fn create_custom_style(ctx: &Context, font_size: fn(&NotedeckTextStyle) -> f32) -> Style {
let mut style = (*ctx.style()).clone();
style.text_styles = NotedeckTextStyle::iter()
@@ -62,6 +62,11 @@ pub fn create_text_styles(ctx: &Context, font_size: fn(&NotedeckTextStyle) -> f3
})
.collect();
+ style.interaction = Interaction {
+ tooltip_delay: 0.0,
+ ..Interaction::default()
+ };
+
style
}