diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4cdcd5e230..4dbdc753f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,8 +10,13 @@
#### Visual Environment
+- [Nodes in graph no longer overlap panels][1577]. The Searcher, project name,
+ breadcrumbs and status bar are displayed "above" nodes.
+
#### Enso Compiler
+[1577]: https://github.com/enso-org/ide/pull/1577
+
# Enso 2.0.0-alpha.5 (2021-05-14)
![New Features](/docs/assets/tags/new_features.svg)
diff --git a/src/rust/ensogl/lib/components/src/label.rs b/src/rust/ensogl/lib/components/src/label.rs
index ac47c747da..8e31f140bf 100644
--- a/src/rust/ensogl/lib/components/src/label.rs
+++ b/src/rust/ensogl/lib/components/src/label.rs
@@ -85,9 +85,9 @@ impl Model {
// FIXME[MM/WD]: Depth sorting of labels to in front of everything else in the scene.
// Temporary solution. The depth management needs to allow defining relative position of
// the text and background and let the whole component to be set to am an arbitrary layer.
- label.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- label.add_to_scene_layer_DEPRECATED(&scene.layers.tooltip_text);
- scene.layers.tooltip_background.add_exclusive(&background);
+ label.remove_from_scene_layer(&scene.layers.main);
+ label.add_to_scene_layer(&scene.layers.tooltip_text);
+ scene.layers.tooltip.add_exclusive(&background);
display_object.add_child(&background);
display_object.add_child(&label);
diff --git a/src/rust/ensogl/lib/components/src/list_view.rs b/src/rust/ensogl/lib/components/src/list_view.rs
index 8dca937c23..64a08964ec 100644
--- a/src/rust/ensogl/lib/components/src/list_view.rs
+++ b/src/rust/ensogl/lib/components/src/list_view.rs
@@ -13,6 +13,7 @@ use ensogl_core::application;
use ensogl_core::application::Application;
use ensogl_core::application::shortcut;
use ensogl_core::display;
+use ensogl_core::display::scene::layer::LayerId;
use ensogl_core::display::shape::*;
use ensogl_core::DEPRECATED_Animation;
use ensogl_theme as theme;
@@ -412,6 +413,11 @@ impl ListView {
self
}
+
+ /// Sets the scene layer where the labels will be placed.
+ pub fn set_label_layer(&self, layer:LayerId) {
+ self.model.entries.set_label_layer(layer);
+ }
}
impl display::Object for ListView {
diff --git a/src/rust/ensogl/lib/components/src/list_view/entry.rs b/src/rust/ensogl/lib/components/src/list_view/entry.rs
index 6922937611..ea3a7bf53e 100644
--- a/src/rust/ensogl/lib/components/src/list_view/entry.rs
+++ b/src/rust/ensogl/lib/components/src/list_view/entry.rs
@@ -3,6 +3,7 @@ use crate::prelude::*;
use ensogl_core::application::Application;
use ensogl_core::display;
+use ensogl_core::display::scene::layer::LayerId;
use ensogl_core::display::shape::StyleWatch;
use ensogl_text as text;
use ensogl_theme;
@@ -315,18 +316,20 @@ pub struct List {
entries : Rc>>,
entries_range : Rc>>,
provider : Rc>,
+ label_layer : Rc>,
}
impl List {
/// Entry List View constructor.
pub fn new(parent:impl AnyLogger, app:&Application) -> Self {
- let app = app.clone_ref();
- let logger = Logger::sub(parent,"entry::List");
- let entries = default();
- let entries_range = Rc::new(CloneCell::new(default()..default()));
+ let app = app.clone_ref();
+ let logger = Logger::sub(parent,"entry::List");
+ let entries = default();
+ let entries_range = Rc::new(CloneCell::new(default()..default()));
let display_object = display::object::Instance::new(&logger);
- let provider = default();
- List {logger,app,display_object,entries,entries_range,provider}
+ let provider = default();
+ let label_layer = Rc::new(Cell::new(app.display.scene().layers.label.id));
+ List {logger,app,display_object,entries,entries_range,provider,label_layer}
}
/// The number of all entries in List, including not displayed.
@@ -414,8 +417,29 @@ impl List {
self.provider.set(provider);
}
+ /// Sets the scene layer where the labels will be placed.
+ pub fn set_label_layer(&self, label_layer:LayerId) {
+ if let Some(layer) = self.app.display.scene().layers.get(self.label_layer.get()) {
+ for entry in &*self.entries.borrow() {
+ entry.label.remove_from_scene_layer(&self.app.display.scene().layers.label);
+ entry.label.add_to_scene_layer(&layer);
+ }
+ } else {
+ error!(self.logger, "Cannot set layer {label_layer:?} for labels: the layer does not \
+ exist in the scene");
+ }
+ self.label_layer.set(label_layer);
+ }
+
fn create_new_entry(&self) -> Entry {
let entry = Entry::new(&self.logger,&self.app);
+ if let Some(layer) = self.app.display.scene().layers.get(self.label_layer.get()) {
+ entry.label.remove_from_scene_layer(&self.app.display.scene().layers.label);
+ entry.label.add_to_scene_layer(&layer);
+ } else {
+ error!(self.logger, "Cannot set layer {self.label_layer:?} for labels: the layer does \
+ not exist in the scene");
+ }
self.add_child(&entry);
entry
}
diff --git a/src/rust/ensogl/lib/components/src/selector/decimal_aligned.rs b/src/rust/ensogl/lib/components/src/selector/decimal_aligned.rs
index 1b06f3e295..e4023cba2a 100644
--- a/src/rust/ensogl/lib/components/src/selector/decimal_aligned.rs
+++ b/src/rust/ensogl/lib/components/src/selector/decimal_aligned.rs
@@ -61,8 +61,8 @@ impl component::Model for Model {
let label_full = app.new_view::();
let label_left = app.new_view::();
- label_full.remove_from_scene_layer_DEPRECATED(&app.display.scene().layers.main);
- label_full.add_to_scene_layer_DEPRECATED(&app.display.scene().layers.label);
+ label_full.remove_from_scene_layer(&app.display.scene().layers.main);
+ label_full.add_to_scene_layer(&app.display.scene().layers.label);
root.add_child(&label_full);
root.add_child(&label_left);
diff --git a/src/rust/ensogl/lib/components/src/selector/model.rs b/src/rust/ensogl/lib/components/src/selector/model.rs
index 55aa35da15..89bc23e4af 100644
--- a/src/rust/ensogl/lib/components/src/selector/model.rs
+++ b/src/rust/ensogl/lib/components/src/selector/model.rs
@@ -98,14 +98,14 @@ impl component::Model for Model {
root.add_child(&track);
root.add_child(&right_overflow);
- label_left.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- label_left.add_to_scene_layer_DEPRECATED(&scene.layers.label);
- label_right.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- label_right.add_to_scene_layer_DEPRECATED(&scene.layers.label);
- caption_left.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- caption_left.add_to_scene_layer_DEPRECATED(&scene.layers.label);
- caption_center.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- caption_center.add_to_scene_layer_DEPRECATED(&scene.layers.label);
+ label_left.remove_from_scene_layer(&scene.layers.main);
+ label_left.add_to_scene_layer(&scene.layers.label);
+ label_right.remove_from_scene_layer(&scene.layers.main);
+ label_right.add_to_scene_layer(&scene.layers.label);
+ caption_left.remove_from_scene_layer(&scene.layers.main);
+ caption_left.add_to_scene_layer(&scene.layers.label);
+ caption_center.remove_from_scene_layer(&scene.layers.main);
+ caption_center.add_to_scene_layer(&scene.layers.label);
Self{background,track,track_handle_left,track_handle_right,left_overflow,right_overflow,
label,label_left,label_right,caption_left,caption_center,root}
diff --git a/src/rust/ensogl/lib/core/src/display/scene.rs b/src/rust/ensogl/lib/core/src/display/scene.rs
index 372ab870f5..e24b283f2a 100644
--- a/src/rust/ensogl/lib/core/src/display/scene.rs
+++ b/src/rust/ensogl/lib/core/src/display/scene.rs
@@ -615,15 +615,17 @@ pub struct HardcodedLayers {
pub viz : Layer,
pub below_main : Layer,
// main <- here is the 'main` layer inserted.
- pub cursor : Layer,
+ pub port_selection : Layer,
pub label : Layer,
-
- pub tooltip_background : Layer,
+ pub above_nodes : Layer,
+ pub above_nodes_text : Layer,
+ /// Layer containing all panels with fixed position (not moving with the panned scene):
+ /// like status bar, breadcrumbs or similar.
+ pub panel : Layer,
+ pub panel_text : Layer,
+ pub tooltip : Layer,
pub tooltip_text : Layer,
-
- pub viz_fullscreen : Layer,
- pub breadcrumbs_background : Layer,
- pub breadcrumbs_text : Layer,
+ pub cursor : Layer,
layers : Layers,
}
@@ -636,32 +638,38 @@ impl Deref for HardcodedLayers {
impl HardcodedLayers {
pub fn new(logger:impl AnyLogger) -> Self {
- let layers = Layers::new(logger);
- let viz = layers.new_layer();
- let cursor = layers.new_layer();
- let label = layers.new_layer();
- let tooltip_background = layers.new_layer();
- let tooltip_text = layers.new_layer();
- let viz_fullscreen = layers.new_layer();
- let below_main = layers.new_layer();
- let breadcrumbs_background = layers.new_layer();
- let breadcrumbs_text = layers.new_layer();
+ let layers = Layers::new(logger);
+ let viz = layers.new_layer();
+ let below_main = layers.new_layer();
+ let port_selection = layers.new_layer();
+ let label = layers.new_layer();
+ let above_nodes = layers.new_layer();
+ let above_nodes_text = layers.new_layer();
+ let panel = layers.new_layer();
+ let panel_text = layers.new_layer();
+ let tooltip = layers.new_layer();
+ let tooltip_text = layers.new_layer();
+ let cursor = layers.new_layer();
viz.set_camera(layers.main.camera());
+ below_main.set_camera(layers.main.camera());
label.set_camera(layers.main.camera());
- tooltip_background.set_camera(layers.main.camera());
+ above_nodes.set_camera(layers.main.camera());
+ above_nodes_text.set_camera(layers.main.camera());
+ tooltip.set_camera(layers.main.camera());
tooltip_text.set_camera(layers.main.camera());
- below_main.set_camera(layers.main.camera());
- layers.add_layers_order_dependency(&breadcrumbs_background,&breadcrumbs_text);
- layers.add_layers_order_dependency(&breadcrumbs_text,&viz);
layers.add_layers_order_dependency(&viz,&below_main);
layers.add_layers_order_dependency(&below_main,&layers.main);
- layers.add_layers_order_dependency(&layers.main,&cursor);
- layers.add_layers_order_dependency(&cursor,&label);
- layers.add_layers_order_dependency(&label,&tooltip_background);
- layers.add_layers_order_dependency(&tooltip_background,&tooltip_text);
- layers.add_layers_order_dependency(&tooltip_text,&viz_fullscreen);
- Self {viz,below_main,cursor,label,tooltip_background,tooltip_text,viz_fullscreen
- ,breadcrumbs_background,breadcrumbs_text,layers}
+ layers.add_layers_order_dependency(&layers.main,&port_selection);
+ layers.add_layers_order_dependency(&port_selection,&label);
+ layers.add_layers_order_dependency(&label,&above_nodes);
+ layers.add_layers_order_dependency(&above_nodes,&above_nodes_text);
+ layers.add_layers_order_dependency(&above_nodes_text,&panel);
+ layers.add_layers_order_dependency(&panel,&panel_text);
+ layers.add_layers_order_dependency(&panel_text,&tooltip);
+ layers.add_layers_order_dependency(&tooltip,&tooltip_text);
+ layers.add_layers_order_dependency(&tooltip_text,&cursor);
+ Self {viz,below_main,port_selection,label,above_nodes,above_nodes_text,panel,panel_text
+ ,tooltip,tooltip_text,cursor,layers}
}
}
@@ -862,7 +870,7 @@ impl SceneData {
// Updating camera for DOM layers. Please note that DOM layers cannot use multi-camera
// setups now, so we are using here the main camera only.
let camera = self.camera();
- let fullscreen_vis_camera = self.layers.viz_fullscreen.camera();
+ let fullscreen_vis_camera = self.layers.panel.camera();
let changed = camera.update(scene);
if changed {
self.frp.camera_changed_source.emit(());
diff --git a/src/rust/ensogl/lib/core/src/gui/cursor.rs b/src/rust/ensogl/lib/core/src/gui/cursor.rs
index 05eb5d0cfc..45a8340a8f 100644
--- a/src/rust/ensogl/lib/core/src/gui/cursor.rs
+++ b/src/rust/ensogl/lib/core/src/gui/cursor.rs
@@ -40,12 +40,13 @@ define_style! {
/// Host defines an object which the cursor position is bound to. It is used to implement
/// label selection. After setting the host to the label, cursor will not follow mouse anymore,
/// it will inherit its position from the label instead.
- host : display::object::Instance,
- size : Vector2,
- offset : Vector2,
- color : color::Lcha,
- radius : f32,
- press : f32,
+ host : display::object::Instance,
+ size : Vector2,
+ offset : Vector2,
+ color : color::Lcha,
+ radius : f32,
+ press : f32,
+ port_selection_layer : bool
}
@@ -62,7 +63,8 @@ impl Style {
let color = color.into();
StyleValue::new(color)
});
- Self {host,size,color,..default()}
+ let port_selection_layer = Some(StyleValue::new_no_animation(true));
+ Self {host,size,color,port_selection_layer,..default()}
}
pub fn new_color(color:color::Lcha) -> Self {
@@ -175,26 +177,44 @@ crate::define_endpoints! {
#[derive(Clone,CloneRef,Debug)]
#[allow(missing_docs)]
pub struct CursorModel {
- pub logger : Logger,
- pub scene : Scene,
- pub view : shape::View,
- pub style : Rc>,
+ pub logger : Logger,
+ pub scene : Scene,
+ pub display_object : display::object::Instance,
+ pub view : shape::View,
+ pub port_selection : shape::View,
+ pub style : Rc>,
}
impl CursorModel {
/// Constructor.
pub fn new(scene:&Scene) -> Self {
- let scene = scene.clone_ref();
- let logger = Logger::new("cursor");
- let view = shape::View::new(&logger);
- let style = default();
-
- let tgt_layer = &scene.layers.cursor;
- let shape_sys = tgt_layer.shape_system_registry.shape_system(&scene,PhantomData::);
+ let scene = scene.clone_ref();
+ let logger = Logger::new("cursor");
+ let display_object = display::object::Instance::new(&logger);
+ let view = shape::View::new(&logger);
+ let port_selection = shape::View::new(&logger);
+ let style = default();
+
+ display_object.add_child(&view);
+ display_object.add_child(&port_selection);
+ let tgt_layer = &scene.layers.cursor;
+ let port_selection_layer = &scene.layers.port_selection;
tgt_layer.add_exclusive(&view);
- shape_sys.shape_system.set_pointer_events(false);
+ port_selection_layer.add_exclusive(&port_selection);
+
+ for layer in &[tgt_layer,port_selection_layer] {
+ let registry = &layer.shape_system_registry;
+ let shape_sys = registry.shape_system(&scene,PhantomData::);
+ shape_sys.shape_system.set_pointer_events(false);
+ }
- Self {logger,scene,view,style}
+ Self {logger,scene,display_object,view,port_selection,style}
+ }
+
+ fn for_each_view(&self, f:impl Fn(&shape::View)) {
+ for view in &[&self.view,&self.port_selection] {
+ f(*view)
+ }
}
}
@@ -240,16 +260,17 @@ impl Cursor {
// host during the movement. After it is fully attached, cursor moves with the same
// speed as the scene when panning.
//
- let press = Animation :: :: new(&network);
- let radius = DEPRECATED_Animation :: :: new(&network);
- let size = DEPRECATED_Animation :: :: new(&network);
- let offset = DEPRECATED_Animation :: :: new(&network);
- let color_lab = DEPRECATED_Animation :: :: new(&network);
- let color_alpha = DEPRECATED_Animation :: :: new(&network);
- let inactive_fade = DEPRECATED_Animation :: :: new(&network);
- let host_position = DEPRECATED_Animation :: :: new(&network);
- let host_follow_weight = DEPRECATED_Animation :: :: new(&network);
- let host_attached_weight = DEPRECATED_Tween :: new(&network);
+ let press = Animation :: :: new(&network);
+ let radius = DEPRECATED_Animation :: :: new(&network);
+ let size = DEPRECATED_Animation :: :: new(&network);
+ let offset = DEPRECATED_Animation :: :: new(&network);
+ let color_lab = DEPRECATED_Animation :: :: new(&network);
+ let color_alpha = DEPRECATED_Animation :: :: new(&network);
+ let inactive_fade = DEPRECATED_Animation :: :: new(&network);
+ let host_position = DEPRECATED_Animation :: :: new(&network);
+ let host_follow_weight = DEPRECATED_Animation :: :: new(&network);
+ let host_attached_weight = DEPRECATED_Tween :: new(&network);
+ let port_selection_layer_weight = Animation :: :: new(&network);
host_attached_weight.set_duration(300.0);
color_lab.set_target_value(DEFAULT_COLOR.opaque.into());
@@ -261,11 +282,11 @@ impl Cursor {
let fade_in_spring = inactive_fade.spring();
frp::extend! { network
- eval press.value ((v) model.view.press.set(*v));
- eval radius.value ((v) model.view.radius.set(*v));
+ eval press.value ((v) model.for_each_view(|vw| vw.press.set(*v)));
+ eval radius.value ((v) model.for_each_view(|vw| vw.radius.set(*v)));
eval size.value ([model] (v) {
let dim = Vector2(v.x+SIDES_PADDING,v.y+SIDES_PADDING);
- model.view.size.set(dim);
+ model.for_each_view(|vw| vw.size.set(dim));
});
alpha <- all_with(&color_alpha.value,&inactive_fade.value,|s,t| s*t);
@@ -273,6 +294,12 @@ impl Cursor {
anim_color <- all_with(&color_lab.value,&alpha,
|lab,alpha| color::Rgba::from(color::Laba::new(lab.x,lab.y,lab.z,*alpha))
);
+ front_color <- all_with(&anim_color,&port_selection_layer_weight.value, |color,w| {
+ color::Rgba::new(color.red,color.green,color.blue,color.alpha*(1.0 - w))
+ });
+ port_selection_color <- all_with(&anim_color,&port_selection_layer_weight.value, |color,w| {
+ color::Rgba::new(color.red,color.green,color.blue,color.alpha*w)
+ });
eval frp.set_style([host_attached_weight,size,offset,model] (new_style) {
host_attached_weight.stop_and_rewind();
@@ -337,6 +364,15 @@ impl Cursor {
*model.style.borrow_mut() = new_style.clone();
});
+ port_selection_layer_weight.target <+ frp.set_style.map(|new_style| {
+ let val_opt = new_style.port_selection_layer.as_ref().and_then(|t| t.value);
+ let val = val_opt.unwrap_or(false);
+ if val {1.0} else {0.0}
+ });
+ port_selection_layer_weight.skip <+ frp.set_style.filter(|new_style|
+ new_style.port_selection_layer.as_ref().map_or(false, |t| !t.animate)
+ ).constant(());
+
host_changed <- any_(frp.set_style,scene.frp.camera_changed);
hosted_position <- host_changed.map(f_!(model.style.borrow().host_position()));
is_not_hosted <- hosted_position.map(|p| p.is_none());
@@ -412,9 +448,10 @@ impl Cursor {
// === Evals ===
- eval mouse_pos_rt ((t) host_position.set_target_value(Vector3(t.x,t.y,0.0)));
- eval anim_color ((t) model.view.color.set(t.into()));
- eval position ((t) model.view.set_position(*t));
+ eval mouse_pos_rt ((t) host_position.set_target_value(Vector3(t.x,t.y,0.0)));
+ eval position ((t) model.display_object.set_position(*t));
+ eval front_color ((t) model.view.color.set(t.into()));
+ eval port_selection_color ((t) model.port_selection.color.set(t.into()));
// === Outputs ===
@@ -436,7 +473,5 @@ impl Cursor {
}
impl display::Object for Cursor {
- fn display_object(&self) -> &display::object::Instance {
- &self.model.view.display_object()
- }
+ fn display_object(&self) -> &display::object::Instance { &self.model.display_object }
}
diff --git a/src/rust/ensogl/lib/text/src/component/area.rs b/src/rust/ensogl/lib/text/src/component/area.rs
index 20b0cbd637..232b0e5404 100644
--- a/src/rust/ensogl/lib/text/src/component/area.rs
+++ b/src/rust/ensogl/lib/text/src/component/area.rs
@@ -656,32 +656,30 @@ impl Area {
/// Add the text area to a specific scene layer. The mouse event positions will be mapped to
/// this view regardless the previous views this component could be added to.
///
- /// # Depreciation
- /// This function is magical and needs to be updated. However, it requires a few steps:
- /// 1. The new `ShapeView` and `DynamicShape` are implemented and they use display objects to
- /// pass information about scene layers they are assigned to. However, the [`GlyphSystem`]
- /// is a very non-standard implementation, and thus has to handle the new display object
- /// callbacks in a special way as well.
- /// 2. The `self.data.camera` has to still be used, otherwise there would be no way to convert
- /// the screen to object space (see the [`to_object_space`] function). This is a very
- /// temporary solution, as any object can be assigned to more than one scene layer, and thus
- /// can be rendered from more than one camera. Screen / object space location of events
- /// should thus become much more primitive information / mechanisms.
- ///
- /// Please note, that this function handles the selection management correctly, as it uses
- /// the new shape system definition, and thus, inherits the scene layer settings from this
- /// display object.
- #[allow(non_snake_case)]
- pub fn add_to_scene_layer_DEPRECATED(&self, layer:&display::scene::Layer) {
+ // TODO https://github.com/enso-org/ide/issues/1576
+ // This function needs to be updated. However, it requires a few steps:
+ // 1. The new `ShapeView` and `DynamicShape` are implemented and they use display objects to
+ // pass information about scene layers they are assigned to. However, the [`GlyphSystem`]
+ // is a very non-standard implementation, and thus has to handle the new display object
+ // callbacks in a special way as well.
+ // 2. The `self.data.camera` has to still be used, otherwise there would be no way to convert
+ // the screen to object space (see the [`to_object_space`] function). This is a very
+ // temporary solution, as any object can be assigned to more than one scene layer, and thus
+ // can be rendered from more than one camera. Screen / object space location of events
+ // should thus become much more primitive information / mechanisms.
+ // Please note, that this function handles the selection management correctly, as it uses
+ // the new shape system definition, and thus, inherits the scene layer settings from this
+ // display object.
+ pub fn add_to_scene_layer(&self, layer:&display::scene::Layer) {
for symbol in self.symbols() { layer.add_symbol_exclusive(&symbol); }
self.data.camera.set(layer.camera());
layer.add_exclusive(self);
}
- /// Remove this component from view. See [`add_to_scene_layer_DEPRECATED`] to learn more about
- /// the deprecation.
+ /// Remove this component from view.
+ // TODO see TODO in add_to_scene_layer method.
#[allow(non_snake_case)]
- pub fn remove_from_scene_layer_DEPRECATED(&self, layer:&display::scene::Layer) {
+ pub fn remove_from_scene_layer(&self, layer:&display::scene::Layer) {
for symbol in self.symbols() { layer.remove_symbol(&symbol); }
}
diff --git a/src/rust/ide/view/graph-editor/src/component/breadcrumbs.rs b/src/rust/ide/view/graph-editor/src/component/breadcrumbs.rs
index bc117ceee5..98ae5b642d 100644
--- a/src/rust/ide/view/graph-editor/src/component/breadcrumbs.rs
+++ b/src/rust/ide/view/graph-editor/src/component/breadcrumbs.rs
@@ -199,7 +199,7 @@ impl BreadcrumbsModel {
let background = background::View::new(&logger);
let gap_width = default();
- scene.layers.breadcrumbs_background.add_exclusive(&background);
+ scene.layers.panel.add_exclusive(&background);
Self{logger,display_object,background,project_name,root,breadcrumbs_container,app
,breadcrumbs,frp_inputs,current_index,camera,gap_width}.init(&scene)
diff --git a/src/rust/ide/view/graph-editor/src/component/breadcrumbs/breadcrumb.rs b/src/rust/ide/view/graph-editor/src/component/breadcrumbs/breadcrumb.rs
index a06dc81a33..1989cc4010 100644
--- a/src/rust/ide/view/graph-editor/src/component/breadcrumbs/breadcrumb.rs
+++ b/src/rust/ide/view/graph-editor/src/component/breadcrumbs/breadcrumb.rs
@@ -291,23 +291,30 @@ impl BreadcrumbModel {
let relative_position = default();
let outputs = frp.outputs.clone_ref();
- scene.layers.breadcrumbs_background.add_exclusive(&view);
- let shape_system = scene.layers.breadcrumbs_background.shape_system_registry.shape_system
+ ensogl::shapes_order_dependencies! {
+ scene => {
+ background -> icon;
+ background -> separator;
+ }
+ }
+
+ scene.layers.panel.add_exclusive(&view);
+ let shape_system = scene.layers.panel.shape_system_registry.shape_system
(scene,PhantomData::);
- scene.layers.breadcrumbs_background.add_symbol_exclusive(&shape_system.shape_system.symbol);
+ scene.layers.panel.add_symbol_exclusive(&shape_system.shape_system.symbol);
- scene.layers.breadcrumbs_text.add_exclusive(&icon);
- let shape_system = scene.layers.breadcrumbs_text.shape_system_registry.shape_system
+ scene.layers.panel.add_exclusive(&icon);
+ let shape_system = scene.layers.panel.shape_system_registry.shape_system
(scene,PhantomData::);
shape_system.shape_system.set_pointer_events(false);
- scene.layers.breadcrumbs_background.add_exclusive(&separator);
- let shape_system = scene.layers.breadcrumbs_background.shape_system_registry.shape_system
+ scene.layers.panel.add_exclusive(&separator);
+ let shape_system = scene.layers.panel.shape_system_registry.shape_system
(scene,PhantomData::);
shape_system.shape_system.set_pointer_events(false);
- label.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- label.add_to_scene_layer_DEPRECATED(&scene.layers.breadcrumbs_text);
+ label.remove_from_scene_layer(&scene.layers.main);
+ label.add_to_scene_layer(&scene.layers.panel_text);
// FIXME : StyleWatch is unsuitable here, as it was designed as an internal tool for shape
// system (#795)
diff --git a/src/rust/ide/view/graph-editor/src/component/breadcrumbs/project_name.rs b/src/rust/ide/view/graph-editor/src/component/breadcrumbs/project_name.rs
index cc0899de3d..c435e206d8 100644
--- a/src/rust/ide/view/graph-editor/src/component/breadcrumbs/project_name.rs
+++ b/src/rust/ide/view/graph-editor/src/component/breadcrumbs/project_name.rs
@@ -145,14 +145,14 @@ impl ProjectNameModel {
text_field.set_default_text_size(text_size);
text_field.single_line(true);
- text_field.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- text_field.add_to_scene_layer_DEPRECATED(&scene.layers.breadcrumbs_text);
+ text_field.remove_from_scene_layer(&scene.layers.main);
+ text_field.add_to_scene_layer(&scene.layers.panel_text);
text_field.hover();
let view_logger = Logger::sub(&logger,"view_logger");
let view = background::View::new(&view_logger);
- scene.layers.breadcrumbs_background.add_exclusive(&view);
+ scene.layers.panel.add_exclusive(&view);
let project_name = default();
Self{app,logger,display_object,view,style,text_field,project_name}.init()
diff --git a/src/rust/ide/view/graph-editor/src/component/node/input/area.rs b/src/rust/ide/view/graph-editor/src/component/node/input/area.rs
index 5143645410..245e36be5d 100644
--- a/src/rust/ide/view/graph-editor/src/component/node/input/area.rs
+++ b/src/rust/ide/view/graph-editor/src/component/node/input/area.rs
@@ -245,8 +245,8 @@ impl Model {
// FIXME[WD]: Depth sorting of labels to in front of the mouse pointer. Temporary solution.
// It needs to be more flexible once we have proper depth management.
let scene = self.app.display.scene();
- self.label.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- self.label.add_to_scene_layer_DEPRECATED(&scene.layers.label);
+ self.label.remove_from_scene_layer(&scene.layers.main);
+ self.label.add_to_scene_layer(&scene.layers.label);
let text_color = self.styles.get_color(theme::graph_editor::node::text);
self.label.single_line(true);
diff --git a/src/rust/ide/view/graph-editor/src/component/node/output/area.rs b/src/rust/ide/view/graph-editor/src/component/node/output/area.rs
index a689c746f4..54a06d89e4 100644
--- a/src/rust/ide/view/graph-editor/src/component/node/output/area.rs
+++ b/src/rust/ide/view/graph-editor/src/component/node/output/area.rs
@@ -179,8 +179,8 @@ impl Model {
// FIXME[WD]: Depth sorting of labels to in front of the mouse pointer. Temporary solution.
// It needs to be more flexible once we have proper depth management.
let scene = self.app.display.scene();
- self.label.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- self.label.add_to_scene_layer_DEPRECATED(&scene.layers.label);
+ self.label.remove_from_scene_layer(&scene.layers.main);
+ self.label.add_to_scene_layer(&scene.layers.label);
let text_color = self.styles.get_color(theme::graph_editor::node::text);
self.label.single_line(true);
diff --git a/src/rust/ide/view/graph-editor/src/component/visualization/container.rs b/src/rust/ide/view/graph-editor/src/component/visualization/container.rs
index b6b6b757ce..b7cc3f0a30 100644
--- a/src/rust/ide/view/graph-editor/src/component/visualization/container.rs
+++ b/src/rust/ide/view/graph-editor/src/component/visualization/container.rs
@@ -584,7 +584,7 @@ impl Container {
model.set_corner_roundness(weight_inv);
model.set_size(current_size);
- let m1 = model.scene.layers.viz_fullscreen.camera().inversed_view_matrix();
+ let m1 = model.scene.layers.panel.camera().inversed_view_matrix();
let m2 = model.scene.layers.viz.camera().view_matrix();
let pos = model.global_position();
let pos = Vector4::new(pos.x,pos.y,pos.z,1.0);
diff --git a/src/rust/ide/view/src/code_editor.rs b/src/rust/ide/view/src/code_editor.rs
index 8c94c2485b..85503e5805 100644
--- a/src/rust/ide/view/src/code_editor.rs
+++ b/src/rust/ide/view/src/code_editor.rs
@@ -75,8 +75,8 @@ impl View {
let height_fraction = DEPRECATED_Animation::::new(network);
model.set_position_x(PADDING_LEFT);
- model.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- model.add_to_scene_layer_DEPRECATED(&scene.layers.breadcrumbs_text);
+ model.remove_from_scene_layer(&scene.layers.main);
+ model.add_to_scene_layer(&scene.layers.panel_text);
// TODO[ao]: To have code editor usable we treat it as constantly mouse-hovered, but this
// should be changed in the second part of focus management
// (https://github.com/enso-org/ide/issues/823)
diff --git a/src/rust/ide/view/src/project.rs b/src/rust/ide/view/src/project.rs
index f67e1e0dcb..8e77085414 100644
--- a/src/rust/ide/view/src/project.rs
+++ b/src/rust/ide/view/src/project.rs
@@ -56,7 +56,7 @@ impl Model {
let window_control_buttons = ARGS.is_in_cloud.unwrap_or_default().as_some_from(|| {
let window_control_buttons = app.new_view::();
display_object.add_child(&window_control_buttons);
- app.display.scene().layers.breadcrumbs_text.add_exclusive(&window_control_buttons);
+ app.display.scene().layers.panel.add_exclusive(&window_control_buttons);
window_control_buttons
});
let window_control_buttons = Immutable(window_control_buttons);
@@ -110,14 +110,21 @@ impl Model {
/// Update Searcher View - its visibility and position - when edited node changed.
fn update_searcher_view
- (&self, edited_node:Option, searcher_left_top_position:&DEPRECATED_Animation>) {
- if let Some(id) = edited_node {
- self.searcher.show();
- let new_position = self.searcher_left_top_position_when_under_node(id);
- searcher_left_top_position.set_target_value(new_position);
- } else {
- self.searcher.hide();
- self.searcher.clear_actions();
+ ( &self
+ , edited_node : Option
+ , is_searcher_empty : bool
+ , searcher_left_top_position : &DEPRECATED_Animation>
+ ) {
+ match edited_node {
+ Some(id) if !is_searcher_empty => {
+ self.searcher.show();
+ let new_position = self.searcher_left_top_position_when_under_node(id);
+ searcher_left_top_position.set_target_value(new_position);
+ }
+ _ => {
+ self.searcher.hide();
+ self.searcher.clear_actions();
+ }
}
}
@@ -363,9 +370,10 @@ impl View {
should_finish_editing <- should_finish_editing_if_any.gate(&graph.output.node_editing);
eval should_finish_editing ((()) graph.input.stop_editing.emit(()));
- _eval <- graph.output.node_being_edited.map2(&searcher.is_visible,
- f!([model,searcher_left_top_position](node_id,is_visible) {
- model.update_searcher_view(*node_id,&searcher_left_top_position);
+ visibility_conditions <- all(&graph.output.node_being_edited,&searcher.is_empty);
+ _eval <- visibility_conditions.map2(&searcher.is_visible,
+ f!([model,searcher_left_top_position]((node_id,is_searcher_empty),is_visible) {
+ model.update_searcher_view(*node_id,*is_searcher_empty,&searcher_left_top_position);
if !is_visible {
// Do not animate
searcher_left_top_position.skip();
diff --git a/src/rust/ide/view/src/searcher.rs b/src/rust/ide/view/src/searcher.rs
index 4597b6a4d7..9851a193e2 100644
--- a/src/rust/ide/view/src/searcher.rs
+++ b/src/rust/ide/view/src/searcher.rs
@@ -102,7 +102,7 @@ impl Model {
let list = app.new_view::();
let documentation = documentation::View::new(&scene);
let doc_provider = default();
- scene.layers.below_main.add_exclusive(&list);
+ scene.layers.above_nodes.add_exclusive(&list);
display_object.add_child(&documentation);
display_object.add_child(&list);
@@ -111,6 +111,7 @@ impl Model {
let style = StyleWatch::new(&app.display.scene().style_sheet);
let action_list_gap_path = ensogl_theme::application::searcher::action_list_gap;
let action_list_gap = style.get_number_or(action_list_gap_path,0.0);
+ list.set_label_layer(scene.layers.above_nodes_text.id);
list.set_position_y(-action_list_gap);
list.set_position_x(ACTION_LIST_X);
documentation.set_position_x(DOCUMENTATION_X);
@@ -155,6 +156,7 @@ ensogl::define_endpoints! {
size (Vector2),
is_visible (bool),
is_selected (bool),
+ is_empty (bool),
}
}
@@ -209,6 +211,7 @@ impl View {
source.size <+ height.value.map(|h| Vector2(SEARCHER_WIDTH,*h));
source.is_visible <+ model.list.size.map(|size| size.x*size.y > std::f32::EPSILON);
source.is_selected <+ model.documentation.frp.is_selected.map(|&value|value);
+ source.is_empty <+ frp.set_actions.map(|(entries,_)| entries.entry_count() == 0);
eval height.value ((h) model.set_height(*h));
eval frp.show ((()) height.set_target_value(SEARCHER_HEIGHT));
diff --git a/src/rust/ide/view/src/status_bar.rs b/src/rust/ide/view/src/status_bar.rs
index a969d5675a..4c785c2a3a 100644
--- a/src/rust/ide/view/src/status_bar.rs
+++ b/src/rust/ide/view/src/status_bar.rs
@@ -169,9 +169,9 @@ impl Model {
let next_process_id = default();
let camera = scene.camera();
- scene.layers.breadcrumbs_background.add_exclusive(&background);
- label.remove_from_scene_layer_DEPRECATED(&scene.layers.main);
- label.add_to_scene_layer_DEPRECATED(&scene.layers.breadcrumbs_text);
+ scene.layers.panel.add_exclusive(&background);
+ label.remove_from_scene_layer(&scene.layers.main);
+ label.add_to_scene_layer(&scene.layers.panel_text);
let text_color_path = theme::application::status_bar::text;
let style = StyleWatch::new(&app.display.scene().style_sheet);
|