diff --git a/android-demo/src/app.rs b/android-demo/src/app.rs index 9fbf503..692da08 100644 --- a/android-demo/src/app.rs +++ b/android-demo/src/app.rs @@ -6,7 +6,8 @@ use std::path::PathBuf; use eframe::egui::{ - self, Align, Color32, Event, Layout, RichText, ScrollArea, Sense, Stroke, Vec2, ViewportCommand, + self, Align, Color32, CursorIcon, Event, Layout, RichText, ScrollArea, Sense, Stroke, Vec2, + ViewportCommand, }; use vidya::{ apply, body, button, checkbox, destructive_button, dim_label, primary_button, @@ -439,7 +440,8 @@ impl eframe::App for DemoApp { ); }) .response - .interact(Sense::click()); + .interact(Sense::click()) + .on_hover_cursor(CursorIcon::PointingHand); if resp.hovered() && !selected { ui.painter().rect_filled( diff --git a/src/theme.rs b/src/theme.rs index 84b21fa..8b0dd1d 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -1,9 +1,9 @@ //! Palette, metrics, egui Visuals/Style, and widget helpers. use egui::{ - pos2, style::WidgetVisuals, Button, Color32, CornerRadius, FontId, Frame, Label, Margin, - Response, RichText, Sense, Shadow, Shape, Stroke, StrokeKind, Style, TextBuffer, TextEdit, Ui, - Vec2, Visuals, WidgetInfo, WidgetType, + pos2, style::WidgetVisuals, Button, Color32, CornerRadius, CursorIcon, FontId, Frame, Label, + Margin, Response, RichText, Sense, Shadow, Shape, Stroke, StrokeKind, Style, TextBuffer, + TextEdit, Ui, Vec2, Visuals, WidgetInfo, WidgetType, }; use crate::install_text_styles; @@ -239,6 +239,10 @@ impl Theme { v.selection.bg_fill = p.accent.gamma_multiply(0.35); v.selection.stroke = Stroke::new(1.0_f32, p.accent); v.widgets = widget_visuals(p, &self.spacing); + // Browser-style click affordance: buttons (and apps that opt in) show a + // pointing-hand cursor on hover. egui defaults this to None (native toolkit + // style); Vidya prefers the clickable cue on desktop. + v.interact_cursor = Some(CursorIcon::PointingHand); v } @@ -413,6 +417,10 @@ pub fn checkbox(ui: &mut Ui, theme: &Theme, checked: &mut bool, text: &str) -> R response.mark_changed(); } response.widget_info(|| WidgetInfo::selected(WidgetType::Checkbox, ui.is_enabled(), *checked, text)); + // Custom widget — egui only applies `interact_cursor` on stock `Button`. + if let Some(cursor) = ui.visuals().interact_cursor { + response = response.on_hover_cursor(cursor); + } if ui.is_rect_visible(rect) { let painter = ui.painter();