ui: remove show_pointer

This can just be achieved by on_hover_cursor

Didn't realize this.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-07-16 09:17:27 -07:00
parent f27b1fe957
commit 461665f599
10 changed files with 58 additions and 94 deletions

View File

@@ -76,14 +76,12 @@ impl<'a> NavTitle<'a> {
ui.spacing_mut().item_spacing.x = item_spacing;
let chev_x = 8.0;
let back_button_resp =
prev(self.routes).map(|r| self.back_button(ui, r, egui::Vec2::new(chev_x, 15.0)));
let back_button_resp = prev(self.routes).map(|r| {
self.back_button(ui, r, egui::Vec2::new(chev_x, 15.0))
.on_hover_cursor(egui::CursorIcon::PointingHand)
});
if let Some(back_resp) = &back_button_resp {
if back_resp.hovered() || back_resp.clicked() {
notedeck_ui::show_pointer(ui);
}
} else {
if back_button_resp.is_none() {
// add some space where chevron would have been. this makes the ui
// less bumpy when navigating
ui.add_space(chev_x + item_spacing);
@@ -216,7 +214,9 @@ impl<'a> NavTitle<'a> {
// returns the column index to switch to, if any
fn move_button_section(&mut self, ui: &mut egui::Ui) -> Option<usize> {
let cur_id = ui.id().with("move");
let mut move_resp = ui.add(grab_button());
let mut move_resp = ui
.add(grab_button())
.on_hover_cursor(egui::CursorIcon::PointingHand);
// showing the hover text while showing the move tooltip causes some weird visuals
if ui.data(|d| d.get_temp::<bool>(cur_id).is_none()) {
@@ -235,8 +235,6 @@ impl<'a> NavTitle<'a> {
d.insert_temp(cur_id, true);
}
});
} else if move_resp.hovered() {
notedeck_ui::show_pointer(ui);
}
ui.data(|d| d.get_temp(cur_id)).and_then(|val| {
@@ -597,11 +595,9 @@ impl<'a> NavTitle<'a> {
top: &Route,
pfp_size: f32,
) -> Option<TitleResponse> {
let pfp_r = self.title_pfp(ui, top, pfp_size);
if pfp_r.as_ref().is_some_and(|r| r.hovered()) {
notedeck_ui::show_pointer(ui);
}
let pfp_r = self
.title_pfp(ui, top, pfp_size)
.map(|r| r.on_hover_cursor(egui::CursorIcon::PointingHand));
self.title_label(ui, top);

View File

@@ -95,7 +95,9 @@ impl<'a> DesktopSidePanel<'a> {
// ui.add_space(24.0);
//}
let compose_resp = ui.add(crate::ui::post::compose_note_button(dark_mode));
let compose_resp = ui
.add(crate::ui::post::compose_note_button(dark_mode))
.on_hover_cursor(egui::CursorIcon::PointingHand);
let search_resp = ui.add(search_button());
let column_resp = ui.add(add_column_button());
@@ -129,9 +131,6 @@ impl<'a> DesktopSidePanel<'a> {
SidePanelAction::ComposeNote,
compose_resp,
))
} else if compose_resp.hovered() {
notedeck_ui::show_pointer(ui);
None
} else if search_resp.clicked() {
Some(InnerResponse::new(SidePanelAction::Search, search_resp))
} else if column_resp.clicked() {

View File

@@ -11,7 +11,7 @@ use crate::timeline::{TimelineCache, TimelineKind, TimelineTab, ViewFilter};
use notedeck::{note::root_note_id_from_selected_id, NoteAction, NoteContext, ScrollInfo};
use notedeck_ui::{
anim::{AnimationHelper, ICON_EXPANSION_MULTIPLE},
show_pointer, NoteOptions, NoteView,
NoteOptions, NoteView,
};
pub struct TimelineView<'a, 'd> {
@@ -127,6 +127,7 @@ fn timeline_ui(
.fixed_pos(top_button_pos)
.show(ui.ctx(), |ui| Some(ui.add(goto_top_button(top_button_pos))))
.inner
.map(|r| r.on_hover_cursor(egui::CursorIcon::PointingHand))
} else {
None
};
@@ -143,12 +144,8 @@ fn timeline_ui(
scroll_area = scroll_area.vertical_scroll_offset(offset);
}
if let Some(goto_top_resp) = goto_top_resp {
if goto_top_resp.clicked() {
scroll_area = scroll_area.vertical_scroll_offset(0.0);
} else if goto_top_resp.hovered() {
show_pointer(ui);
}
if goto_top_resp.is_some_and(|r| r.clicked()) {
scroll_area = scroll_area.vertical_scroll_offset(0.0);
}
// chrome can ask to scroll to top as well via an app option