Display graph errors in the viewport (#1577)

* Display graph errors in the viewport

* Polish up the styling

* Clear click targets while graph can't be rendered

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2024-01-15 06:18:08 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent 484acbcde3
commit 8df59be1d5
2 changed files with 17 additions and 1 deletions
@@ -634,6 +634,17 @@ impl PortfolioMessageHandler {
self.executor.poll_node_graph_evaluation(active_document, responses).unwrap_or_else(|e| {
log::error!("Error while evaluating node graph: {e}");
let error = r#"
<rect x="50%" y="50%" width="480" height="100" transform="translate(-240 -50)" rx="4" fill="var(--color-error-red)" />
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-size="18" fill="var(--color-2-mildblack)">
<tspan x="50%" dy="-24" font-weight="bold">The document cannot be rendered in its current state.</tspan>
<tspan x="50%" dy="24">Check for error details in the node graph, which can be</tspan>
<tspan x="50%" dy="24">opened with the viewport's top right <tspan font-style="italic">Node Graph</tspan> button.</tspan>
/text>"#
// It's a mystery why the `/text>` tag above needs to be missing its `<`, but when it exists it prints the `<` character in the text. However this works with it removed.
.to_string();
responses.add(FrontendMessage::UpdateDocumentArtwork { svg: error });
});
}
}