Refresh graph view overlay if it's open when switching documents (#1691)

* Update Graph View Overlay if it is open when switching documents

* Resolve comments
This commit is contained in:
shipp02 2024-03-15 19:52:20 -07:00 committed by GitHub
parent 5bca931813
commit 56f8ecacc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -1126,6 +1126,10 @@ impl DocumentMessageHandler {
self.current_hash() == self.saved_hash
}
pub fn is_graph_overlay_open(&self) -> bool {
self.graph_view_overlay_open
}
pub fn set_auto_save_state(&mut self, is_saved: bool) {
if is_saved {
self.auto_saved_hash = self.current_hash();

View File

@ -430,6 +430,7 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
}
PortfolioMessage::SelectDocument { document_id } => {
// Auto-save the document we are leaving
let mut node_graph_open = false;
if let Some(document) = self.active_document() {
if !document.is_auto_saved() {
responses.add(PortfolioMessage::AutoSaveDocument {
@ -437,6 +438,7 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
document_id: self.active_document_id.unwrap(),
});
}
node_graph_open = document.is_graph_overlay_open();
}
// Set the new active document ID
@ -451,6 +453,7 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
responses.add(PortfolioMessage::UpdateDocumentWidgets);
responses.add(NavigationMessage::TranslateCanvas { delta: (0., 0.).into() });
responses.add(NodeGraphMessage::RunDocumentGraph);
responses.add(DocumentMessage::GraphViewOverlay { open: node_graph_open });
}
PortfolioMessage::SubmitDocumentExport {
file_name,