mirror of
https://github.com/eliasstepanik/egui_node_graph.git
synced 2026-01-11 22:08:28 +00:00
Add a scrollbar to the node finder
This commit is contained in:
parent
2607f55746
commit
9f7826ae95
@ -65,23 +65,31 @@ where
|
|||||||
|
|
||||||
let mut query_submit = resp.lost_focus() && ui.input().key_down(Key::Enter);
|
let mut query_submit = resp.lost_focus() && ui.input().key_down(Key::Enter);
|
||||||
|
|
||||||
|
let max_height = ui.input().screen_rect.height() * 0.5;
|
||||||
|
let scroll_area_width = resp.rect.width() - 30.0;
|
||||||
|
|
||||||
Frame::default()
|
Frame::default()
|
||||||
.inner_margin(vec2(10.0, 10.0))
|
.inner_margin(vec2(10.0, 10.0))
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
for kind in all_kinds.all_kinds() {
|
ScrollArea::vertical()
|
||||||
let kind_name = kind.node_finder_label(user_state).to_string();
|
.max_height(max_height)
|
||||||
if kind_name
|
.show(ui, |ui| {
|
||||||
.to_lowercase()
|
ui.set_width(scroll_area_width);
|
||||||
.contains(self.query.to_lowercase().as_str())
|
for kind in all_kinds.all_kinds() {
|
||||||
{
|
let kind_name = kind.node_finder_label(user_state).to_string();
|
||||||
if ui.selectable_label(false, kind_name).clicked() {
|
if kind_name
|
||||||
submitted_archetype = Some(kind);
|
.to_lowercase()
|
||||||
} else if query_submit {
|
.contains(self.query.to_lowercase().as_str())
|
||||||
submitted_archetype = Some(kind);
|
{
|
||||||
query_submit = false;
|
if ui.selectable_label(false, kind_name).clicked() {
|
||||||
|
submitted_archetype = Some(kind);
|
||||||
|
} else if query_submit {
|
||||||
|
submitted_archetype = Some(kind);
|
||||||
|
query_submit = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user