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

Fullscreen Visualization #1355

Merged
merged 17 commits into from
Mar 30, 2021
Merged

Fullscreen Visualization #1355

merged 17 commits into from
Mar 30, 2021

Conversation

farmaazon
Copy link
Collaborator

@farmaazon farmaazon commented Mar 22, 2021

Pull Request Description

This PR enables again the shortcut for FS visualization. It also contains a lot of fixes in visualizations

Important Notes

Checklist

Please include the following checklist in your PR:

  • The CHANGELOG.md was updated with the changes introduced in this PR.
  • The documentation has been updated if necessary.
  • All code conforms to the Rust style guide.
  • All code has automatic tests where possible.
  • All code has been profiled where possible.
  • All code has been manually tested in the IDE.
  • All code has been manually tested in the "debug/interface" scene.
  • All code has been manually tested by the PR owner against our test scenarios.
  • All code has been manually tested by at least one reviewer against our test scenarios.

@farmaazon farmaazon added Difficulty: Core Contributor Should only be attempted by a core contributor Priority: Highest Should be completed ASAP Type: Enhancement An enhancement to the current state of Enso IDE Category: GUI The Graphical User Interface Category: Visualizations Visualizations embedded in Enso IDE labels Mar 22, 2021
@farmaazon farmaazon requested a review from wdanilo March 22, 2021 11:12
@farmaazon farmaazon self-assigned this Mar 22, 2021
Comment on lines 20 to 26
.visualization {
z-index: 2;
border-radius: 14px;
/* visualizations are put into the fullscreen-vis layer which has pointer-events set to none, so we need to
override it */
pointer-events: auto;
}
Copy link
Member

Choose a reason for hiding this comment

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

is the visualization class attached to fullscreen visualizations only? If so, it has a bad name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no, but is attached to the div element we move to the fullscreen-vis. I will change the comment to "may be put"

Comment on lines +357 to 358
if !child.has_visible_parent() {
child.set_vis_false(host);
Copy link
Member

Choose a reason for hiding this comment

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

Wouldnt this change call "set_vis_false" on a child that was already hidden sometimes? For example, if a hidden child was moved to a visible parent, which just got hidden the next frame? If this could happen, this is blocker from merging. I'd love to chat why it never happens (if it never happens). We should add tests about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it may happen. But if the visible parent got hidden, then it will call set_vis_false, and thus the moved child will be also hidden.

Copy link
Member

Choose a reason for hiding this comment

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

So this is bad. set_vis_false sohuld be guaranteed to be called only once and never be called on a thing already hidden. Otherwise it can break some rendering assumptions. The same with showing things.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

but set_vis_false checks if the instance is visible. I will add a test to make sure that on_hide callback is not called redundantly.

Comment on lines 462 to 463
/// Back DOM with fullscreen visualization. Kept separately from `back`, because use different
/// Camera
Copy link
Member

Choose a reason for hiding this comment

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

this has several problems:

  1. It's not gramatically correct ('use')
  2. does not have dot at the end.
  3. States that this is a "back DOM", which is not specific enough, as this is a back DOM scene.
  4. Does not explain what a "different camera" is and why do we use a different camera here. It should be explained here soduring future refactoring it would be clear what it is about.

canvas.set_style_or_warn("pointer-events", "none" , &logger);
front.dom.set_class_name("front");
front.dom.set_style_or_warn("z-index", "1", &logger);
back.dom.set_class_name("back");
back.dom.set_style_or_warn("pointer-events", "auto", &logger);
back.dom.set_style_or_warn("z-index" , "0" , &logger);
fullscreen_vis.dom.set_class_name("fullscreen_vis");
// fullscreen_vis.dom.set_style_or_warn("pointer-events", "auto", &logger);
Copy link
Member

Choose a reason for hiding this comment

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

commented code

@@ -614,7 +622,7 @@ pub struct HardcodedLayers {

pub viz_fullscreen : Layer,
pub breadcrumbs : Layer,
layers : Layers,
layers : Layers,
Copy link
Member

Choose a reason for hiding this comment

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

You left spaces on the end of the line, which is strange, as IDEs should trim it on save

pub fn new(logger:&Logger, scene:&Scene) -> Self {
let logger = Logger::sub(logger,"fullscreen_view");
let display_object = display::object::Instance::new(&logger);
// scene.layers.viz_fullscreen.add_exclusive(&display_object);
Copy link
Member

Choose a reason for hiding this comment

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

commented code

Comment on lines 52 to 53
/// View of the visualization container meant to be used in fullscreen mode. Its components are
/// rendered on top-level layers of the stage.
Copy link
Member

Choose a reason for hiding this comment

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

I dont think this is strictly true. Components of full screen visualization panel, like HTML visualizations will not be rendered on top-level layers of the stage, will they be?

let styles = StyleWatch::new(&scene.style_sheet);
let bg_color = styles.get_color(ensogl_theme::graph_editor::visualization::background);
let bg_color = color::Rgba::from(bg_color);
let bg_hex = format!("rgba({},{},{},{})",bg_color.red*255.0,bg_color.green*255.0,bg_color.blue*255.0,bg_color.alpha);
Copy link
Member

Choose a reason for hiding this comment

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

too long line

fn display_object(&self) -> &display::object::Instance {
&self.display_object
}
}
Copy link
Member

Choose a reason for hiding this comment

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

no nl

Comment on lines +136 to +151
fn show_fullscreen_visualization(&self, node_id:NodeId) {
let node = self.graph_editor.model.model.nodes.all.get_cloned_ref(&node_id);
if let Some(node) = node {
let visualization = node.view.model.visualization.fullscreen_visualization().clone_ref();
self.display_object.remove_child(&self.graph_editor);
self.display_object.add_child(&visualization);
*self.fullscreen_vis.borrow_mut() = Some(visualization);
}
}

fn hide_fullscreen_visualization(&self) {
if let Some(visualization) = std::mem::take(&mut *self.fullscreen_vis.borrow_mut()) {
self.display_object.remove_child(&visualization);
self.display_object.add_child(&self.graph_editor);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

these should have docs of what hacks they are doing and why do we do the hacks with a link to issue which will provide correct solution (the scene cutting one)

Copy link
Member

Choose a reason for hiding this comment

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

Also, does this work in debug-scene? It is implemented in such a module that I'm not sure it works there.

Copy link
Collaborator Author

@farmaazon farmaazon Mar 24, 2021

Choose a reason for hiding this comment

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

It works in interface.

@farmaazon farmaazon requested a review from wdanilo March 24, 2021 10:59
@farmaazon farmaazon merged commit ebf5c4f into develop Mar 30, 2021
@farmaazon farmaazon deleted the wip/ao/fullscreen-vis2 branch March 30, 2021 10:43
mwu-tow pushed a commit to enso-org/enso that referenced this pull request Oct 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Category: GUI The Graphical User Interface Category: Visualizations Visualizations embedded in Enso IDE Difficulty: Core Contributor Should only be attempted by a core contributor Priority: Highest Should be completed ASAP Type: Enhancement An enhancement to the current state of Enso IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants