Do not attach visualization on startup. (#5841)

@hubertp has reported in #5620 that sometimes enabling visualization does not send "attachVisualization" message to the engine.

The actual cause was simply because it was already attached. Updating the default visualizations (when receiving information about type) updated the preprocessors, what caused in turn attaching visualization.

That was a bug, of course. This PR fixes it: now we don't update any visualization if it's hidden.
This commit is contained in:
Adam Obuchowicz 2023-03-08 18:37:18 +01:00 committed by GitHub
parent ad03f98c5d
commit d3b247a2bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -128,6 +128,7 @@ syn = { version = "1.0", features = [
"extra-traits", "extra-traits",
"printing", "printing",
"parsing", "parsing",
"visit",
"visit-mut", "visit-mut",
] } ] }
quote = { version = "1.0.23" } quote = { version = "1.0.23" }

View File

@ -1619,12 +1619,16 @@ impl GraphEditorModelWithNetwork {
selected <- vis_is_selected.on_true(); selected <- vis_is_selected.on_true();
deselected <- vis_is_selected.on_false(); deselected <- vis_is_selected.on_false();
output.visualization_preprocessor_changed <+
node_model.visualization.frp.preprocessor.map(move |preprocessor|
(node_id,preprocessor.clone()));
output.on_visualization_select <+ selected.constant(Switch::On(node_id)); output.on_visualization_select <+ selected.constant(Switch::On(node_id));
output.on_visualization_select <+ deselected.constant(Switch::Off(node_id)); output.on_visualization_select <+ deselected.constant(Switch::Off(node_id));
preprocessor_changed <-
node_model.visualization.frp.preprocessor.map(move |preprocessor| {
(node_id,preprocessor.clone())
});
output.visualization_preprocessor_changed <+ preprocessor_changed.gate(&node.visualization_visible);
metadata <- any(...); metadata <- any(...);
metadata <+ node_model.visualization.frp.preprocessor.map(visualization::Metadata::new); metadata <+ node_model.visualization.frp.preprocessor.map(visualization::Metadata::new);