@@ -121,6 +121,9 @@ pub trait PickerDelegate: Sized + 'static {
) -> bool {
true
}
+ fn select_on_hover(&self) -> bool {
+ true
+ }
// Allows binding some optional effect to when the selection changes.
fn selected_index_changed(
@@ -788,12 +791,14 @@ impl<D: PickerDelegate> Picker<D> {
this.handle_click(ix, event.modifiers.platform, window, cx)
}),
)
- .on_hover(cx.listener(move |this, hovered: &bool, window, cx| {
- if *hovered {
- this.set_selected_index(ix, None, false, window, cx);
- cx.notify();
- }
- }))
+ .when(self.delegate.select_on_hover(), |this| {
+ this.on_hover(cx.listener(move |this, hovered: &bool, window, cx| {
+ if *hovered {
+ this.set_selected_index(ix, None, false, window, cx);
+ cx.notify();
+ }
+ }))
+ })
.children(self.delegate.render_match(
ix,
ix == self.delegate.selected_index(),
@@ -225,6 +225,10 @@ impl PickerDelegate for RulePickerDelegate {
}
}
+ fn select_on_hover(&self) -> bool {
+ false
+ }
+
fn placeholder_text(&self, _window: &mut Window, _cx: &mut App) -> Arc<str> {
"Searchโฆ".into()
}