Skip to content

Commit

Permalink
Update map_view.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rfuzzo committed Aug 27, 2023
1 parent 59d04d2 commit 5b37f03
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions src/views/map_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,32 @@ impl TemplateApp {
else if self.map_data.tooltip_names {
let name = get_cell_name(&self.map_data, self.map_data.hover_pos);
if !name.is_empty() {
egui::show_tooltip(ui.ctx(), egui::Id::new("my_tooltip"), |ui| {
ui.label(name);
});
if self.map_data.overlay_travel {
egui::show_tooltip(ui.ctx(), egui::Id::new("my_tooltip"), |ui| {
ui.label(name);

// travel destinations
let mut destinations: Vec<String> = vec![];
for (p1, p2) in self.map_data.edges.iter() {
if &self.map_data.hover_pos == p1 {
destinations.push(get_cell_name(&self.map_data, *p2));
}
if &self.map_data.hover_pos == p2 {
destinations.push(get_cell_name(&self.map_data, *p1));
}
}
if !destinations.is_empty() {
ui.separator();
}
for d in destinations {
ui.label(d);
}
});
} else {
egui::show_tooltip(ui.ctx(), egui::Id::new("my_tooltip"), |ui| {
ui.label(name);
});
}
}
}
}
Expand Down

0 comments on commit 5b37f03

Please sign in to comment.