Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disregard visualisation for selection of nodes. #6487

Merged
merged 5 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
such as dropdown can now be placed in the node and affect the code text flow.
- [The IDE UI element for selecting the execution mode of the project is now
sending messages to the backend.][6341].
- [Area selectionof nodes no longer takes into account the visualisation that
belongs to the node.][6487].

#### EnsoGL (rendering engine)

Expand Down Expand Up @@ -199,6 +201,7 @@
[6035]: https://github.com/enso-org/enso/pull/6035
[6097]: https://github.com/enso-org/enso/pull/6097
[6097]: https://github.com/enso-org/enso/pull/6341
[6487]: https://github.com/enso-org/enso/pull/6487

#### Enso Standard Library

Expand Down
12 changes: 8 additions & 4 deletions app/gui/view/graph-editor/src/component/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ ensogl::define_endpoints_2! {
/// [`visualization_visible`] is updated. Please remember, that the [`position`] is not
/// immediately updated, only during the Display Object hierarchy update
bounding_box (BoundingBox),
/// The bounding box of the node without the visualization.
inner_bounding_box (BoundingBox),
/// A set of widgets attached to a method requires metadata to be queried. The tuple
/// contains the ID of the call expression the widget is attached to, and the ID of that
/// call's target expression (`self` or first argument).
Expand Down Expand Up @@ -1009,7 +1011,10 @@ impl Node {
visualization_enabled_and_visible <- visualization_enabled && visualization_visible;
bbox_input <- all4(
&out.position,&new_size,&visualization_enabled_and_visible,visualization_size);
out.bounding_box <+ bbox_input.map(|(a,b,c,d)| bounding_box(*a,*b,*c,*d));
out.bounding_box <+ bbox_input.map(|(a,b,c,d)| bounding_box(*a,*b,c.then(|| *d)));

inner_bbox_input <- all2(&out.position,&new_size);
out.inner_bounding_box <+ inner_bbox_input.map(|(a,b)| bounding_box(*a,*b,None));


// === VCS Handling ===
Expand Down Expand Up @@ -1069,13 +1074,12 @@ fn visualization_offset(node_width: f32) -> Vector2 {
fn bounding_box(
node_position: Vector2,
node_size: Vector2,
visualization_enabled_and_visible: bool,
visualization_size: Vector2,
visualization_size: Option<Vector2>,
) -> BoundingBox {
let x_offset_to_node_center = x_offset_to_node_center(node_size.x);
let node_bbox_pos = node_position + Vector2(x_offset_to_node_center, 0.0) - node_size / 2.0;
let node_bbox = BoundingBox::from_position_and_size(node_bbox_pos, node_size);
if visualization_enabled_and_visible {
if let Some(visualization_size) = visualization_size {
let visualization_offset = visualization_offset(node_size.x);
let visualization_pos = node_position + visualization_offset;
let visualization_bbox_pos = visualization_pos - visualization_size / 2.0;
Expand Down
2 changes: 1 addition & 1 deletion app/gui/view/graph-editor/src/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ fn get_nodes_in_bounding_box(bounding_box: &BoundingBox, nodes: &Nodes) -> Vec<N
nodes_raw
.iter()
.filter_map(|(id, node)| {
bounding_box.intersects(&node.view.bounding_box.value()).as_some(*id)
bounding_box.intersects(&node.view.inner_bounding_box.value()).as_some(*id)
})
.collect()
}
Expand Down