table: Use deferred to render scrollbar to avoid some element overflow it. (#513)
This commit is contained in:
parent
7d8166a05e
commit
3601cb399b
1 changed files with 17 additions and 6 deletions
|
|
@ -11,8 +11,8 @@ use crate::{
|
||||||
Icon, IconName, Sizable, Size, StyleSized as _,
|
Icon, IconName, Sizable, Size, StyleSized as _,
|
||||||
};
|
};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions, canvas, div, prelude::FluentBuilder, px, uniform_list, AppContext, Axis, Bounds, Div,
|
actions, canvas, deferred, div, prelude::FluentBuilder, px, uniform_list, AppContext, Axis,
|
||||||
DragMoveEvent, Edges, Entity, EntityId, EventEmitter, FocusHandle, FocusableView,
|
Bounds, Div, DragMoveEvent, Edges, Entity, EntityId, EventEmitter, FocusHandle, FocusableView,
|
||||||
InteractiveElement, IntoElement, KeyBinding, ListSizingBehavior, MouseButton, ParentElement,
|
InteractiveElement, IntoElement, KeyBinding, ListSizingBehavior, MouseButton, ParentElement,
|
||||||
Pixels, Point, Render, ScrollHandle, ScrollStrategy, SharedString, Stateful,
|
Pixels, Point, Render, ScrollHandle, ScrollStrategy, SharedString, Stateful,
|
||||||
StatefulInteractiveElement as _, Styled, UniformListScrollHandle, ViewContext,
|
StatefulInteractiveElement as _, Styled, UniformListScrollHandle, ViewContext,
|
||||||
|
|
@ -1248,10 +1248,21 @@ where
|
||||||
move |bounds, cx| view.update(cx, |r, _| r.bounds = bounds),
|
move |bounds, cx| view.update(cx, |r, _| r.bounds = bounds),
|
||||||
|_, _, _| {},
|
|_, _, _| {},
|
||||||
))
|
))
|
||||||
.child(self.render_horizontal_scrollbar(cx))
|
.child(
|
||||||
.when(rows_count > 0, |this| {
|
// use deferred to render the scrollbar for
|
||||||
this.children(self.render_scrollbar(cx))
|
// avoid some custom element overflow the scrollbar.
|
||||||
})
|
deferred(
|
||||||
|
div()
|
||||||
|
.absolute()
|
||||||
|
.top_0()
|
||||||
|
.size_full()
|
||||||
|
.child(self.render_horizontal_scrollbar(cx))
|
||||||
|
.when(rows_count > 0, |this| {
|
||||||
|
this.children(self.render_scrollbar(cx))
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.with_priority(0),
|
||||||
|
)
|
||||||
// Click out to cancel right clicked row
|
// Click out to cancel right clicked row
|
||||||
.when(self.right_clicked_row.is_some(), |this| {
|
.when(self.right_clicked_row.is_some(), |this| {
|
||||||
this.on_mouse_down_out(cx.listener(|this, _, cx| {
|
this.on_mouse_down_out(cx.listener(|this, _, cx| {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue