Fix table scrollbar display layer.

This commit is contained in:
Jason Lee 2024-07-17 23:19:03 +08:00
parent b8a7d6a2dd
commit 0fdf7be40d
2 changed files with 20 additions and 12 deletions

View file

@ -1,10 +1,10 @@
use gpui::{ use gpui::{
div, prelude::FluentBuilder as _, AnyElement, Context, Div, FocusHandle, FocusableView, div, prelude::FluentBuilder as _, AnyElement, Context, FocusHandle, FocusableView,
InteractiveElement, IntoElement, KeyDownEvent, Model, MouseButton, MouseDownEvent, InteractiveElement, IntoElement, KeyDownEvent, Model, MouseButton, MouseDownEvent,
ParentElement as _, Render, SharedString, Stateful, Styled as _, ViewContext, WindowContext, ParentElement as _, Render, SharedString, Styled as _, ViewContext, WindowContext,
}; };
use crate::{h_flex, theme::ActiveTheme, v_flex, StyledExt}; use crate::{h_flex, theme::ActiveTheme, v_flex};
use super::blink_cursor::BlinkCursor; use super::blink_cursor::BlinkCursor;

View file

@ -7,8 +7,8 @@ use crate::{
v_flex, v_flex,
}; };
use gpui::{ use gpui::{
actions, deferred, div, prelude::FluentBuilder as _, px, uniform_list, AppContext, Div, actions, div, prelude::FluentBuilder as _, px, uniform_list, AppContext, Div, FocusHandle,
FocusHandle, FocusableView, InteractiveElement as _, IntoElement, KeyBinding, MouseButton, FocusableView, InteractiveElement as _, IntoElement, KeyBinding, MouseButton,
ParentElement as _, Render, ScrollHandle, SharedString, StatefulInteractiveElement as _, ParentElement as _, Render, ScrollHandle, SharedString, StatefulInteractiveElement as _,
Styled, UniformListScrollHandle, ViewContext, WindowContext, Styled, UniformListScrollHandle, ViewContext, WindowContext,
}; };
@ -255,12 +255,20 @@ where
let view = cx.view().clone(); let view = cx.view().clone();
let state = self.scrollbar_state.clone(); let state = self.scrollbar_state.clone();
Some(deferred(Scrollbar::uniform_scroll( Some(
view, div()
state, .absolute()
self.vertical_scroll_handle.clone(), .top_0()
self.delegate.rows_count(), .left_0()
))) .right_0()
.bottom_0()
.child(Scrollbar::uniform_scroll(
view,
state,
self.vertical_scroll_handle.clone(),
self.delegate.rows_count(),
)),
)
} }
} }
@ -408,8 +416,8 @@ where
.border_1() .border_1()
.border_color(cx.theme().border) .border_color(cx.theme().border)
.bg(cx.theme().card) .bg(cx.theme().card)
.children(self.render_scrollbar(cx))
.child(inner_table) .child(inner_table)
.children(self.render_scrollbar(cx))
.child(ScrollableMask::new( .child(ScrollableMask::new(
cx.view().clone(), cx.view().clone(),
ScrollableAxis::Horizontal, ScrollableAxis::Horizontal,