-
Notifications
You must be signed in to change notification settings - Fork 34
Deselect visualization when its node gets removed #1556
Conversation
To make sure that the node id is still valid
@@ -1403,6 +1403,7 @@ impl GraphEditorModel { | |||
/// implementation. | |||
fn remove_node(&self, node_id:impl Into<NodeId>) { | |||
let node_id = node_id.into(); | |||
self.frp.source.on_visualization_select.emit(Switch::Off(node_id)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emiting frp events from model functions is rather a bad pattern, as it is really hard to understand where the events come from. Instead, check where this model function is called in the FRP network and handle it directly there.
This should be handled next to the lines:
output.source.on_visualization_select <+ selected.constant(Switch::On(node_id));
output.source.on_visualization_select <+ deselected.constant(Switch::Off(node_id));
so it would be easy to track when visualization is deselectected when reading the code (all deselecting will be coded in one place then)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this, but it cannot be handled next to the lines that you suggested, because we need only one connection per graph editor, but those lines are run for every node.
Pull Request Description
This fixes issue #1352. The graph editor will register visualizations as deselected when their node is removed.
Important Notes
Checklist
Please include the following checklist in your PR:
CHANGELOG.md
was updated with the changes introduced in this PR.