From 8167d4172bf9dcf725c4528e973e10bf9a13b927 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Mon, 5 Jul 2021 17:01:24 +0200 Subject: [PATCH 1/2] fix: Emmit correct events when deselecting all nodes. --- src/rust/ide/src/ide.rs | 2 +- src/rust/ide/view/graph-editor/src/lib.rs | 5 +++++ src/rust/ide/view/graph-editor/src/selection.rs | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/rust/ide/src/ide.rs b/src/rust/ide/src/ide.rs index 8a46e31bbc..9538f106f1 100644 --- a/src/rust/ide/src/ide.rs +++ b/src/rust/ide/src/ide.rs @@ -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(()); diff --git a/src/rust/ide/view/graph-editor/src/lib.rs b/src/rust/ide/view/graph-editor/src/lib.rs index bdcba7ffa1..0367029b75 100644 --- a/src/rust/ide/view/graph-editor/src/lib.rs +++ b/src/rust/ide/view/graph-editor/src/lib.rs @@ -960,6 +960,11 @@ impl Nodes { fn select(&self, node_id:impl Into) { 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(()); } diff --git a/src/rust/ide/view/graph-editor/src/selection.rs b/src/rust/ide/view/graph-editor/src/selection.rs index 9ca2dfe846..52ae632a72 100644 --- a/src/rust/ide/view/graph-editor/src/selection.rs +++ b/src/rust/ide/view/graph-editor/src/selection.rs @@ -310,6 +310,7 @@ impl Controller { frp::extend! { network + deselect_all_nodes <- any_(...); enable_area_selection <- source(); @@ -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; @@ -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; From b1bd2a6f285d560586f9f7869dc92eb13f090254 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Mon, 5 Jul 2021 17:06:57 +0200 Subject: [PATCH 2/2] chore: Update changelog. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8275ca603e..a821e4971a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ undo last action and cmd+z to redo last undone action. This version of undo redo does not have proper support for text editor and undoing UI changes (like selecting nodes). +- [Fox node selection bug ][1664]. Fix nodes not being deselected correctly in + some circumstances. This would lead to nodes moving too fast when dragged + [1650] or the internal state of the project being inconsistent [1626]. #### EnsoGL (rendering engine) @@ -34,6 +37,9 @@ [1577]: https://github.com/enso-org/ide/pull/1577 [1587]: https://github.com/enso-org/ide/pull/1587 [1602]: https://github.com/enso-org/ide/pull/1602 +[1602]: https://github.com/enso-org/ide/pull/1664 +[1602]: https://github.com/enso-org/ide/pull/1650 +[1602]: https://github.com/enso-org/ide/pull/1626 # Enso 2.0.0-alpha.5 (2021-05-14)