Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
fix: Emmit correct events when deselecting all nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMauderer committed Jul 5, 2021
1 parent 9bf3843 commit 8167d41
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rust/ide/src/ide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Ide {
let mouse = &scene.mouse.frp;
let keyboard = &scene.keyboard.frp;

enso_frp::extend! { TRACE_ALL network
enso_frp::extend! { network
on_log_sent <- source::<()>();
mouse_moved <- mouse.position.constant(());
any_mouse_press <- any(mouse.up,mouse.down).constant(());
Expand Down
5 changes: 5 additions & 0 deletions src/rust/ide/view/graph-editor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,11 @@ impl Nodes {
fn select(&self, node_id:impl Into<NodeId>) {
let node_id = node_id.into();
if let Some(node) = self.get_cloned_ref(&node_id) {
// Remove previous instances and add new selection at end of the list, indicating that
// this node was selected last, superseding the previous selection.
while self.selected.contains(&node_id) {
self.selected.remove_item(&node_id)
}
self.selected.push(node_id);
node.frp.select.emit(());
}
Expand Down
4 changes: 2 additions & 2 deletions src/rust/ide/view/graph-editor/src/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ impl Controller {


frp::extend! { network
deselect_all_nodes <- any_(...);

enable_area_selection <- source();

Expand Down Expand Up @@ -373,7 +374,7 @@ impl Controller {

keep_selection <- selection_mode.map(|t| *t != Mode::Normal);
deselect_on_select <- drag_start.gate_not(&keep_selection);
eval_ deselect_on_select ( nodes.deselect_all() );
deselect_all_nodes <+ deselect_on_select;

cursor_selection_nodes.insert <+ node_info;
cursor_selection_nodes.remove_difference_with_vec <+ nodes_in_bb;
Expand Down Expand Up @@ -417,7 +418,6 @@ impl Controller {
|_,mode,was_selected| mode.single_should_deselect(*was_selected)
);

deselect_all_nodes <- any_(...);
deselect_on_select <- node_to_select.gate_not(&keep_selection);
deselect_all_nodes <+ deselect_on_select;
deselect_all_nodes <+ editor.deselect_all_nodes;
Expand Down

0 comments on commit 8167d41

Please sign in to comment.