-
Notifications
You must be signed in to change notification settings - Fork 34
Conversation
src/js/lib/content/src/style.css
Outdated
.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; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"
if !child.has_visible_parent() { | ||
child.set_vis_false(host); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
/// Back DOM with fullscreen visualization. Kept separately from `back`, because use different | ||
/// Camera |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has several problems:
- It's not gramatically correct ('use')
- does not have dot at the end.
- States that this is a "back DOM", which is not specific enough, as this is a back DOM scene.
- 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); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented code
/// View of the visualization container meant to be used in fullscreen mode. Its components are | ||
/// rendered on top-level layers of the stage. |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no nl
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); | ||
} | ||
} |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works in interface.
Original commit: enso-org/ide@ebf5c4f
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:
CHANGELOG.md
was updated with the changes introduced in this PR.