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

Creating a new node with the (+) button #3278

Merged
merged 29 commits into from
Feb 24, 2022

Conversation

farmaazon
Copy link
Contributor

@farmaazon farmaazon commented Feb 15, 2022

Pull Request Description

The Task

A new (+) button on the left-bottom corner appeared. It may be clicked to open searcher in the middle of the scene, as an alternative to tab key.

add-button-.5.mp4

Important Notes

  • The window_control_buttons::common was extracted to separate crate ensogl-component-button almost without change.
  • This includes a severe refactoring of adding nodes in general in the Graph Editor. The whole responsibility of adding new nodes (and starting their editing) was moved to Graph Editor - the Project View only reacts for GE events to show searcher properly.
  • The status bar was moved from the bottom-left corner to the middle-top of the scene. It does not collide with (+) button, and plays "notification" role anyway.
  • The interface debug scene was buggy. The problem was with one expression's span-tree. When I replaced it, the scene works.
  • I've removed "new searcher" API, as it is completely outdated.
  • I've changed code owners of integration tests to GUI team, as it is the team writing mostly the integration tests (int rust)

Checklist

Please include the following checklist in your PR:

  • The documentation has been updated if necessary.
  • All code conforms to the Scala, Java, and Rust style guides.
  • All documentation and configuration conforms to the markdown and YAML style guides.
  • All code has been tested where possible.

@farmaazon farmaazon self-assigned this Feb 15, 2022
Copy link
Member

@wdanilo wdanilo left a comment

Choose a reason for hiding this comment

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

There is a LOT of FRP refactoring here. I'm OK with it, but I have a serious request to the tester – please test all corner cases very carefully. Go trough testing scenario – talk with Sylwia about where to find the testing scenario. You can also do the testing together with Sylwia, so she will show you how she does it (she is the most precise tester of Enso ever). Such a big refactoring of FRP requires serious testing.


// ====================
// === OccupiedArea ===
// ===================
Copy link
Member

Choose a reason for hiding this comment

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

missing =


/// The structure describing an occupied area.
///
/// All such areas are rectangles described by x and y ranges.
Copy link
Member

Choose a reason for hiding this comment

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

x1 is start of the range and x2 is end of it? If so, add short info about it pls.

EDIT: after seeing implementation, it seems that x1 and x2 are not sorted. This needs short doc :)

}

/// Return the x position of the left or right boundary, depending on whether the direction
/// points leftwards of rightwards respectively. Returns `None` if direction does not point
Copy link
Member

Choose a reason for hiding this comment

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

In Rust the doc syntax for mentioning things is [`None`], not `None` (unfortunately). Please apply in other comments too.


impl GraphEditorModelWithNetwork {
pub fn new(app: &Application, cursor: cursor::Cursor, frp: &Frp) -> Self {
let network = frp.network.clone_ref(); // FIXME make weak
Copy link
Member

Choose a reason for hiding this comment

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

fix left

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is part of moved code, not written by me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to be non-trivial to change, so I would leave the "fixme".

let y_gap = self.frp.default_y_gap_between_nodes.value();
let y_offset = y_gap + node::HEIGHT;
let starting_point = above_pos - Vector2(0.0, y_offset);
let direction = Vector2(1.0, 0.0);
Copy link
Member

Choose a reason for hiding this comment

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

I think it should mean "left", but (1,0) means right – are we not searching place on the left side of currently occupied place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just wanted to keep it as it was. But of course I can change to left.

Comment on lines 1664 to 1666
// - area taken by node view (obviously)
// - the minimum gap between nodes in all directions, so the new node won't be "glued" to
// another
Copy link
Member

Choose a reason for hiding this comment

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

use either sentences or semicolons at the end of points, please.

@@ -2445,7 +2547,7 @@ fn new_graph_editor(app: &Application) -> GraphEditor {
}


// === Add Node ===
// === Nodes Utilities ===
Copy link
Member

Choose a reason for hiding this comment

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

"Utilities" is the worst word IMO, as everything can be an "utility". This section will probably contain everything in the future. Do you see any better name maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is, that I don't really get what is going on in the block below. Seems like preparing many FRP nodes, without clear theme. But surely it wasn't adding nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I read it more carefully, and it looks like things related to mouse cursor and clicks. So I rename it to "Mouse Interactions"

lib/rust/ensogl/component/button/src/lib.rs Show resolved Hide resolved
@akavel
Copy link
Contributor

akavel commented Feb 18, 2022

When working with the branch, I noticed a gray vertical bar near the top of the screen, where the "status bar" later shows up - should it not be there maybe? It looks a bit like it was a shadow of an empty status bar. It's visible in the screencast attached to the PR description - look in the area highlighted with a yellow circle in the image below:

Screenshot 2022-02-18 at 16 31 55

Copy link
Contributor

@vitvakatu vitvakatu left a comment

Choose a reason for hiding this comment

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

A few remarks

@@ -338,6 +338,7 @@ pub fn expression_mock() -> Expression {
Expression { pattern, code, whole_expression_id, input_span_tree, output_span_tree }
}

// TODO[ao] This expression mocks results in panic. If you want to use it, please fix it first.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand this sentence, and also I'm not sure if we should leave in code TODOs not attached to a created issue in pivotal.


committed_in_searcher <-
searcher.editing_committed.map2(&last_searcher, |&entry, &s| (s.input, entry));
trace committed_in_searcher;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably should be removed (one more slightly below)

Comment on lines 474 to 476
// frp.source.old_expression_of_edited_node <+ existing_node_edited.map(f!((node_id)
// model.graph_editor.model.nodes
// ));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be removed? The output seems to be unused in the code.

@vitvakatu
Copy link
Contributor

Manual testing showed two regressions:

  1. Shadow of the empty status bar is visible, as @akavel pointed out.
  2. The cursor changes its shape to a narrow vertical bar, but doesn't change it back when the searcher is closed. To reproduce (it is not reproducible on develop):
  • Without any node selected, press Tab key to create a new one
  • Press Esc immediately to abort node creation
  • The cursor will not return its round shape.

See attached video for the second issue:

2022-02-21.14-00-37.mp4

Comment on lines +1684 to +1687
pub fn start_editing_new_node(&self, node_id: NodeId) {
self.frp.set_node_expression.emit(&(node_id, node::Expression::default()));
self.frp.edit_node.emit(&node_id);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This function seems to be unused. Is it deliberate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it is not. Thanks for catching!

@wdanilo
Copy link
Member

wdanilo commented Feb 23, 2022

@akavel @vitvakatu absolutely stunning work with the testing!!! Keep it this way ❤️

Copy link
Contributor

@vitvakatu vitvakatu left a comment

Choose a reason for hiding this comment

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

Regressions were fixed 👍🏻

@farmaazon farmaazon added the CI: Ready to merge This PR is eligible for automatic merge label Feb 24, 2022
@mergify mergify bot merged commit 0836ce7 into develop Feb 24, 2022
@mergify mergify bot deleted the wip/farmaazon/add-node-button-180887253 branch February 24, 2022 16:01
vitvakatu pushed a commit that referenced this pull request Mar 14, 2022
[The Task](https://www.pivotaltracker.com/story/show/180887253)

A new (+) button on the left-bottom corner appeared. It may be clicked to open searcher in the middle of the scene, as an alternative to tab key.

https://user-images.githubusercontent.com/3919101/154514279-7972ed6a-0203-47cb-9a09-82dba948cf2f.mp4

* The window_control_buttons::common was extracted to separate crate `ensogl-component-button` almost without change.
* This includes a severe refactoring of adding nodes in general in the Graph Editor. The whole responsibility of adding new nodes (and starting their editing) was moved to Graph Editor - the Project View only reacts for GE events to show searcher properly.
* The status bar was moved from the bottom-left corner to the middle-top of the scene. It does not collide with (+) button, and plays "notification" role anyway.
* The `interface` debug scene was buggy. The problem was with one expression's span-tree. When I replaced it, the scene works.
* I've removed "new searcher" API, as it is completely outdated.
* I've changed code owners of integration tests to GUI team, as it is the team writing mostly the integration tests (int rust)
vitvakatu pushed a commit that referenced this pull request Mar 14, 2022
[The Task](https://www.pivotaltracker.com/story/show/180887253)

A new (+) button on the left-bottom corner appeared. It may be clicked to open searcher in the middle of the scene, as an alternative to tab key.

https://user-images.githubusercontent.com/3919101/154514279-7972ed6a-0203-47cb-9a09-82dba948cf2f.mp4

* The window_control_buttons::common was extracted to separate crate `ensogl-component-button` almost without change.
* This includes a severe refactoring of adding nodes in general in the Graph Editor. The whole responsibility of adding new nodes (and starting their editing) was moved to Graph Editor - the Project View only reacts for GE events to show searcher properly.
* The status bar was moved from the bottom-left corner to the middle-top of the scene. It does not collide with (+) button, and plays "notification" role anyway.
* The `interface` debug scene was buggy. The problem was with one expression's span-tree. When I replaced it, the scene works.
* I've removed "new searcher" API, as it is completely outdated.
* I've changed code owners of integration tests to GUI team, as it is the team writing mostly the integration tests (int rust)
vitvakatu added a commit that referenced this pull request Mar 16, 2022
* Creating a new node with the (+) button (#3278)

[The Task](https://www.pivotaltracker.com/story/show/180887253)

A new (+) button on the left-bottom corner appeared. It may be clicked to open searcher in the middle of the scene, as an alternative to tab key.

https://user-images.githubusercontent.com/3919101/154514279-7972ed6a-0203-47cb-9a09-82dba948cf2f.mp4

* The window_control_buttons::common was extracted to separate crate `ensogl-component-button` almost without change.
* This includes a severe refactoring of adding nodes in general in the Graph Editor. The whole responsibility of adding new nodes (and starting their editing) was moved to Graph Editor - the Project View only reacts for GE events to show searcher properly.
* The status bar was moved from the bottom-left corner to the middle-top of the scene. It does not collide with (+) button, and plays "notification" role anyway.
* The `interface` debug scene was buggy. The problem was with one expression's span-tree. When I replaced it, the scene works.
* I've removed "new searcher" API, as it is completely outdated.
* I've changed code owners of integration tests to GUI team, as it is the team writing mostly the integration tests (int rust)

* Fix regression #181528359

* Add docs & remove unused function

* Fix & enable native Rust tests

* Fix formatting

Co-authored-by: Adam Obuchowicz <adam.obuchowicz@enso.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
vitvakatu pushed a commit that referenced this pull request Mar 20, 2022
[The Task](https://www.pivotaltracker.com/story/show/180887253)

A new (+) button on the left-bottom corner appeared. It may be clicked to open searcher in the middle of the scene, as an alternative to tab key.

https://user-images.githubusercontent.com/3919101/154514279-7972ed6a-0203-47cb-9a09-82dba948cf2f.mp4

* The window_control_buttons::common was extracted to separate crate `ensogl-component-button` almost without change.
* This includes a severe refactoring of adding nodes in general in the Graph Editor. The whole responsibility of adding new nodes (and starting their editing) was moved to Graph Editor - the Project View only reacts for GE events to show searcher properly.
* The status bar was moved from the bottom-left corner to the middle-top of the scene. It does not collide with (+) button, and plays "notification" role anyway.
* The `interface` debug scene was buggy. The problem was with one expression's span-tree. When I replaced it, the scene works.
* I've removed "new searcher" API, as it is completely outdated.
* I've changed code owners of integration tests to GUI team, as it is the team writing mostly the integration tests (int rust)
mergify bot pushed a commit that referenced this pull request Apr 4, 2022
In this branch:
* The workaround for cursor-not-being-updated-after-closing-searcher bug (discovered while testing #3278) is reverted.
* The proper fix was introduced: created an abstraction for EnsoGL component, which, when dropping, will not immediately drop the FRP network and model, but instead put it into the Garbage Collector. The Collector ensures, that all "component hiding" effects and events will be handled, and drops FRP network and model only after that.
* I run clippy for wasm32 target out of curiosity. There was one warning, and I fixed it on this branch.
jdunkerley pushed a commit that referenced this pull request Apr 5, 2022
In this branch:
* The workaround for cursor-not-being-updated-after-closing-searcher bug (discovered while testing #3278) is reverted.
* The proper fix was introduced: created an abstraction for EnsoGL component, which, when dropping, will not immediately drop the FRP network and model, but instead put it into the Garbage Collector. The Collector ensures, that all "component hiding" effects and events will be handled, and drops FRP network and model only after that.
* I run clippy for wasm32 target out of curiosity. There was one warning, and I fixed it on this branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants