Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,10 @@ impl DocumentMessageHandler {
self.current_hash() == self.saved_hash
}

pub fn is_graph_overlay_open(&self) -> bool {
Comment thread
Keavon marked this conversation as resolved.
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();
Expand Down
3 changes: 3 additions & 0 deletions editor/src/messages/portfolio/portfolio_message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,15 @@ 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 {
// Safe to unwrap since we know that there is an active document
document_id: self.active_document_id.unwrap(),
});
}
node_graph_open = document.is_graph_overlay_open();
}

// Set the new active document ID
Expand All @@ -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,
Expand Down