Skip to content

Commit

Permalink
Emit correct events when deselecting all nodes. (enso-org/ide#1664)
Browse files Browse the repository at this point in the history
Original commit: enso-org/ide@63ff1fe
  • Loading branch information
MichaelMauderer authored Jul 6, 2021
1 parent a1cd8b8 commit 8a87fcd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ide/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
undo last action and <kbd>cmd</kbd>+<kbd>z</kbd> 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)

Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion ide/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 ide/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 ide/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 8a87fcd

Please sign in to comment.