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

Implement area selection. #1588

Merged
merged 13 commits into from
Jun 13, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

#### Visual Environment

[Area selection][1588]. You can now select multiple nodes at once. Just click
and drag on the background of your graph and see the beauty of the area
selection appear.

MichaelMauderer marked this conversation as resolved.
Show resolved Hide resolved
#### EnsoGL (rendering engine)

<br/>![Bug Fixes](/docs/assets/tags/bug_fixes.svg)
Expand All @@ -12,6 +16,8 @@

#### Enso Compiler

[1588]: https://github.com/enso-org/ide/pull/1588

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[1588]: https://github.com/enso-org/ide/pull/1588
[1588]: https://github.com/enso-org/ide/pull/1588

# Enso 2.0.0-alpha.5 (2021-05-14)

<br/>![New Features](/docs/assets/tags/new_features.svg)
Expand Down
2 changes: 1 addition & 1 deletion src/rust/ide/src/ide/integration/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ impl Model {
},
Err(other) => return Err(other.into()),
};
let selected_nodes = this.view.graph().model.selected_nodes().iter().filter_map(|id| {
let selected_nodes = this.view.graph().model.nodes.selected_nodes().iter().filter_map(|id| {
this.get_controller_node_id(*id).ok()
}).collect_vec();
let controller = this.graph.clone_ref();
Expand Down
18 changes: 18 additions & 0 deletions src/rust/ide/view/graph-editor/src/component/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ use ensogl_theme;
use std::f32::EPSILON;

use super::edge;
use super::super::selection::BoundingBox;

MichaelMauderer marked this conversation as resolved.
Show resolved Hide resolved


// =================
Expand Down Expand Up @@ -273,6 +275,7 @@ ensogl::define_endpoints! {
error (Option<Error>),
visualization_enabled (bool),
tooltip (tooltip::Style),
bounding_box (BoundingBox)
}
}

Expand Down Expand Up @@ -534,6 +537,13 @@ impl Node {
let style_frp = &model.style;
let action_bar = &model.action_bar.frp;

// Hook up the display object position updates to the node's FRP. Required to calculate the
// bounding box
MichaelMauderer marked this conversation as resolved.
Show resolved Hide resolved
frp::extend! { network
position <- source::<Vector2>();
}
model.display_object.set_on_updated(f!((p) position.emit(p.position().xy())));

frp::extend! { network

// === Hover ===
Expand Down Expand Up @@ -581,6 +591,14 @@ impl Node {
eval new_size ((t) model.output.frp.set_size.emit(t));


// === Bounding Box ===
bounding_box_input <- all2(&new_size,&position);
out.source.bounding_box <+ bounding_box_input.map(|(size,position)| {
let position = position - Vector2::new(0.0,size.y / 2.0);
BoundingBox::from_position_size(position,*size)
MichaelMauderer marked this conversation as resolved.
Show resolved Hide resolved
});


// === Action Bar ===

let visualization_enabled = action_bar.action_visibility.clone_ref();
Expand Down