use iris::prelude::*; pub(crate) fn on_tap( rsc: &mut Rsc, ptr: WeakWidget, list: WeakWidget, f: impl Fn(&mut Rsc) + 'static, ) where Rsc::State: FocusHost + OpenUrl, { ptr.on(CursorSense::drag_senses(), move |ctx, rsc: &mut Rsc| { let input = &ctx.data; let outcome = rsc .with_nearest_controller::(list, |id, selection, rsc| { selection.drag(id, rsc, input) }) .unwrap_or(SelectionInput::Tapped); if outcome == SelectionInput::Tapped { f(rsc); } }) .add(rsc); } pub(crate) fn hold_edge(rsc: &mut impl UiRsc, list: WeakWidget, key: RowKey) { if let Some((top, _bottom)) = list(rsc).extent(key) { list(rsc).note_tap(top); } }