Fix scrollbars not being visible in fullscreen text visualisation. (#7069)

Fixes #6855

Correctly sets the layers of the full-screen panel and the scrollbars. The full-screen panel needs to be in the `panel` layer, as it is fixed and above everything else.  The scrollbars in the text visualization should be placed together with their parents, so they are switched correctly between layers when enabling/disabling full-screen. Leaving their layer otherwise unspecified should not lead to occlusion issues, as all other elements in the text visualization are Dom elements, and therefore placed below EnsoGL elements.

https://github.com/enso-org/enso/assets/1428930/db80c5b7-69fd-4bf5-84ab-c83664227059
This commit is contained in:
Michael Mauderer 2023-06-20 11:29:35 +02:00 committed by GitHub
parent 1859ccbab5
commit d26b826a77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 12 deletions

View File

@ -42,7 +42,8 @@ use ensogl_component::grid_view::GridView;
use ensogl_component::scrollbar; use ensogl_component::scrollbar;
use ensogl_component::scrollbar::Scrollbar; use ensogl_component::scrollbar::Scrollbar;
use ensogl_hardcoded_theme as theme; use ensogl_hardcoded_theme as theme;
use text_provider::BackendTextProvider;
use text_provider::TextProvider;
// ================= // =================
@ -80,9 +81,6 @@ pub struct GridWindow {
size: GridSize, size: GridSize,
} }
use text_provider::BackendTextProvider;
use text_provider::TextProvider;
// ============= // =============
@ -164,19 +162,16 @@ impl<T: 'static> Model<T> {
self.root.add_child(&self.scroll_bar_horizontal); self.root.add_child(&self.scroll_bar_horizontal);
self.root.add_child(&self.scroll_bar_vertical); self.root.add_child(&self.scroll_bar_vertical);
self.scroll_bar_vertical.set_rotation_z(-90.0_f32.to_radians()); self.scroll_bar_vertical.set_rotation_z(-90.0_f32.to_radians());
self.app.display.default_scene.layers.main.add(&self.scroll_bar_horizontal);
self.app.display.default_scene.layers.main.add(&self.scroll_bar_vertical);
} }
fn set_size(&self, size: Vector2) { fn set_size(&self, size: Vector2) {
self.scroll_bar_horizontal.set_y(-size.y / 2.0);
self.scroll_bar_horizontal.set_length(size.x);
let scrollbar_width = scrollbar::WIDTH - scrollbar::PADDING; let scrollbar_width = scrollbar::WIDTH - scrollbar::PADDING;
self.scroll_bar_horizontal.modify_y(|y| *y += scrollbar_width / 2.0); let h_y = -size.y / 2.0 + scrollbar_width / 2.0;
self.scroll_bar_vertical.set_x(size.x / 2.0); self.scroll_bar_horizontal.set_y(h_y);
self.scroll_bar_horizontal.set_length(size.x);
let v_x = size.x / 2.0 - scrollbar_width / 2.0;
self.scroll_bar_vertical.set_x(v_x);
self.scroll_bar_vertical.set_length(size.y); self.scroll_bar_vertical.set_length(size.y);
self.scroll_bar_vertical.modify_x(|x| *x -= scrollbar_width / 2.0);
let text_padding = Vector2::new(PADDING_TEXT, PADDING_TEXT); let text_padding = Vector2::new(PADDING_TEXT, PADDING_TEXT);
self.clipping_div.set_dom_size(size - 2.0 * text_padding); self.clipping_div.set_dom_size(size - 2.0 * text_padding);
self.size.set(size); self.size.set(size);

View File

@ -353,6 +353,7 @@ impl ContainerModel {
fn init(self) -> Self { fn init(self) -> Self {
self.display_object.add_child(&self.drag_root); self.display_object.add_child(&self.drag_root);
self.scene.layers.above_nodes.add(&self.action_bar); self.scene.layers.above_nodes.add(&self.action_bar);
self.scene.layers.panel.add(&self.fullscreen_view);
self.update_shape_sizes(ViewState::default()); self.update_shape_sizes(ViewState::default());
self.init_corner_roundness(); self.init_corner_roundness();
self.view.show_waiting_screen(); self.view.show_waiting_screen();