Skip to content

Commit

Permalink
Make status draggable and store last 5 messages
Browse files Browse the repository at this point in the history
  • Loading branch information
devanlooches authored and hannobraun committed Aug 8, 2022
1 parent ad16aa4 commit 27e4059
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
5 changes: 4 additions & 1 deletion crates/fj-interop/src/status_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ impl StatusReport {

/// Update the status
pub fn update_status(&mut self, status: &str) {
if self.status.len() >= 5 {
self.clear_status();
}
self.status.push(status.to_string());
}

Expand All @@ -22,7 +25,7 @@ impl StatusReport {
}

/// Reset status
pub fn clear_status(&mut self) {
fn clear_status(&mut self) {
self.status.clear();
}
}
Expand Down
22 changes: 12 additions & 10 deletions crates/fj-viewer/src/graphics/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,16 +427,6 @@ impl Renderer {
}

let line_drawing_available = self.is_line_drawing_available();
egui::SidePanel::right("fj-right-panel").show(
&self.egui.context,
|ui| {
ui.group(|ui| {
egui::ScrollArea::vertical().show(ui, |ui| {
ui.label(format!("Status:\n{}", status.status()))
});
})
},
);

egui::SidePanel::left("fj-left-panel").show(&self.egui.context, |ui| {
ui.add_space(16.0);
Expand Down Expand Up @@ -581,6 +571,18 @@ impl Renderer {
ui.add_space(16.0);
});

egui::Area::new("fj-status-message").show(&self.egui.context, |ui| {
ui.group(|ui| {
ui.add(egui::Label::new(
egui::RichText::new(format!(
"Status:\n{}",
status.status()
))
.color(egui::Color32::BLACK),
))
})
});

// End the UI frame. We could now handle the output and draw the UI with the backend.
let egui_output = self.egui.context.end_frame();
let egui_paint_jobs = self.egui.context.tessellate(egui_output.shapes);
Expand Down

0 comments on commit 27e4059

Please sign in to comment.