mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-23 08:36:09 +00:00
Add OpsLog::selected
This commit is contained in:
parent
090262c7db
commit
e1e7e55e7b
@ -106,9 +106,7 @@ impl ApplicationHandler for App {
|
||||
window.request_redraw();
|
||||
}
|
||||
WindowEvent::RedrawRequested => {
|
||||
if let Some(selected) =
|
||||
self.ops.operations.get(self.ops.selected)
|
||||
{
|
||||
if let Some(selected) = self.ops.selected() {
|
||||
if let Err(err) = renderer.render(selected, &self.ops) {
|
||||
eprintln!("Render error: {err}");
|
||||
}
|
||||
|
@ -64,6 +64,10 @@ impl OpsLog {
|
||||
pub fn select_previous(&mut self) {
|
||||
self.selected = self.selected.saturating_sub(1);
|
||||
}
|
||||
|
||||
pub fn selected(&self) -> Option<&dyn Operation> {
|
||||
self.operations.get(self.selected).map(|op| op as &_)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for OpsLog {
|
||||
|
Loading…
Reference in New Issue
Block a user