mirror of https://codeberg.org/topola/topola.git
feat(topola-egui): Add checkbox to hide pathfinding scores
This commit is contained in:
parent
896deb1777
commit
6f20994dab
|
|
@ -166,6 +166,7 @@ pub struct ViewActions {
|
|||
pub zoom_to_fit: Switch,
|
||||
pub show_ratsnest: Switch,
|
||||
pub show_navmesh: Switch,
|
||||
pub show_pathfinding_scores: Switch,
|
||||
pub show_topo_navmesh: Switch,
|
||||
pub show_bboxes: Switch,
|
||||
pub show_origin_destination: Switch,
|
||||
|
|
@ -178,6 +179,10 @@ impl ViewActions {
|
|||
zoom_to_fit: Action::new_keyless(tr.text("tr-menu-view-zoom-to-fit")).into_switch(),
|
||||
show_ratsnest: Action::new_keyless(tr.text("tr-menu-view-show-ratsnest")).into_switch(),
|
||||
show_navmesh: Action::new_keyless(tr.text("tr-menu-view-show-navmesh")).into_switch(),
|
||||
show_pathfinding_scores: Action::new_keyless(
|
||||
tr.text("tr-menu-view-show-pathfinding-scores"),
|
||||
)
|
||||
.into_switch(),
|
||||
show_topo_navmesh: Action::new_keyless(tr.text("tr-menu-view-show-topo-navmesh"))
|
||||
.into_switch(),
|
||||
show_bboxes: Action::new_keyless(tr.text("tr-menu-view-show-bboxes")).into_switch(),
|
||||
|
|
@ -206,6 +211,8 @@ impl ViewActions {
|
|||
ui.add_enabled_ui(have_workspace, |ui| {
|
||||
self.show_ratsnest.checkbox(ui, &mut menu_bar.show_ratsnest);
|
||||
self.show_navmesh.checkbox(ui, &mut menu_bar.show_navmesh);
|
||||
self.show_pathfinding_scores
|
||||
.checkbox(ui, &mut menu_bar.show_pathfinding_scores);
|
||||
self.show_topo_navmesh
|
||||
.checkbox(ui, &mut menu_bar.show_topo_navmesh);
|
||||
self.show_bboxes.checkbox(ui, &mut menu_bar.show_bboxes);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ pub struct MenuBar {
|
|||
pub is_placing_via: bool,
|
||||
pub show_ratsnest: bool,
|
||||
pub show_navmesh: bool,
|
||||
pub show_pathfinding_scores: bool,
|
||||
pub show_topo_navmesh: bool,
|
||||
pub show_bboxes: bool,
|
||||
pub show_origin_destination: bool,
|
||||
|
|
@ -47,6 +48,7 @@ impl MenuBar {
|
|||
is_placing_via: false,
|
||||
show_ratsnest: true,
|
||||
show_navmesh: false,
|
||||
show_pathfinding_scores: false,
|
||||
show_topo_navmesh: false,
|
||||
show_bboxes: false,
|
||||
show_origin_destination: false,
|
||||
|
|
|
|||
|
|
@ -354,15 +354,20 @@ impl Viewport {
|
|||
None => [0.0, 0.0].into(),
|
||||
};
|
||||
|
||||
if menu_bar.show_pathfinding_scores {
|
||||
//TODO "{astar.scores[index]} ({astar.estimate_scores[index]}) (...)"
|
||||
let score_text = astar
|
||||
.scores()
|
||||
.get(&navnode)
|
||||
.map_or_else(String::new, |s| format!("g={:.2}", s));
|
||||
.map_or_else(String::new, |s| {
|
||||
format!("g={:.2}", s)
|
||||
});
|
||||
let estimate_score_text = astar
|
||||
.estimate_scores()
|
||||
.get(&navnode)
|
||||
.map_or_else(String::new, |s| format!("(f={:.2})", s));
|
||||
.map_or_else(String::new, |s| {
|
||||
format!("(f={:.2})", s)
|
||||
});
|
||||
let debug_text =
|
||||
activity.navnode_debug_text(navnode).unwrap_or("");
|
||||
|
||||
|
|
@ -379,6 +384,7 @@ impl Viewport {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if menu_bar.show_topo_navmesh {
|
||||
if let Some(navmesh) = workspace.overlay.planar_incr_navmesh() {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ tr-menu-view = View
|
|||
tr-menu-view-zoom-to-fit = Zoom to Fit
|
||||
tr-menu-view-show-ratsnest = Show Ratsnest
|
||||
tr-menu-view-show-navmesh = Show Navmesh
|
||||
tr-menu-view-show-pathfinding-scores = Show Pathfinding Scores
|
||||
tr-menu-view-show-topo-navmesh = Show Topological Navmesh
|
||||
tr-menu-view-show-bboxes = Show BBoxes
|
||||
tr-menu-view-show-origin-destination = Show Origin–Destination
|
||||
|
|
|
|||
Loading…
Reference in New Issue