Fix scroll on empty folders
This commit is contained in:
parent
1116eaa05a
commit
76a95820a4
1 changed files with 20 additions and 9 deletions
29
src/tab.rs
29
src/tab.rs
|
|
@ -1626,6 +1626,7 @@ impl Tab {
|
||||||
) -> (
|
) -> (
|
||||||
Option<Element<'static, cosmic::app::Message<crate::app::Message>>>,
|
Option<Element<'static, cosmic::app::Message<crate::app::Message>>>,
|
||||||
Element<Message>,
|
Element<Message>,
|
||||||
|
bool,
|
||||||
) {
|
) {
|
||||||
let cosmic_theme::Spacing {
|
let cosmic_theme::Spacing {
|
||||||
space_m,
|
space_m,
|
||||||
|
|
@ -1805,7 +1806,7 @@ impl Tab {
|
||||||
}
|
}
|
||||||
|
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return (None, self.empty_view(hidden > 0));
|
return (None, self.empty_view(hidden > 0), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: HACK If we don't reach the bottom of the view, go ahead and add a spacer to do that
|
//TODO: HACK If we don't reach the bottom of the view, go ahead and add a spacer to do that
|
||||||
|
|
@ -1889,6 +1890,7 @@ impl Tab {
|
||||||
.show_drag_rect(true)
|
.show_drag_rect(true)
|
||||||
.on_release(|_| Message::ClickRelease(None))
|
.on_release(|_| Message::ClickRelease(None))
|
||||||
.into(),
|
.into(),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1897,6 +1899,7 @@ impl Tab {
|
||||||
) -> (
|
) -> (
|
||||||
Option<Element<'static, cosmic::app::Message<crate::app::Message>>>,
|
Option<Element<'static, cosmic::app::Message<crate::app::Message>>>,
|
||||||
Element<Message>,
|
Element<Message>,
|
||||||
|
bool,
|
||||||
) {
|
) {
|
||||||
let cosmic_theme::Spacing {
|
let cosmic_theme::Spacing {
|
||||||
space_m, space_xxs, ..
|
space_m, space_xxs, ..
|
||||||
|
|
@ -2181,7 +2184,7 @@ impl Tab {
|
||||||
}
|
}
|
||||||
|
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
return (None, self.empty_view(hidden > 0));
|
return (None, self.empty_view(hidden > 0), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO: HACK If we don't reach the bottom of the view, go ahead and add a spacer to do that
|
//TODO: HACK If we don't reach the bottom of the view, go ahead and add a spacer to do that
|
||||||
|
|
@ -2209,12 +2212,13 @@ impl Tab {
|
||||||
.show_drag_rect(true)
|
.show_drag_rect(true)
|
||||||
.on_release(|_| Message::ClickRelease(None))
|
.on_release(|_| Message::ClickRelease(None))
|
||||||
.into(),
|
.into(),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn view(&self, key_binds: &HashMap<KeyBind, Action>) -> Element<Message> {
|
pub fn view(&self, key_binds: &HashMap<KeyBind, Action>) -> Element<Message> {
|
||||||
let location_view = self.location_view();
|
let location_view = self.location_view();
|
||||||
let (drag_list, mut item_view) = match self.view {
|
let (drag_list, mut item_view, can_scroll) = match self.view {
|
||||||
View::Grid => self.grid_view(),
|
View::Grid => self.grid_view(),
|
||||||
View::List => self.list_view(),
|
View::List => self.list_view(),
|
||||||
};
|
};
|
||||||
|
|
@ -2270,12 +2274,19 @@ impl Tab {
|
||||||
.popup(menu::context_menu(&self, &key_binds))
|
.popup(menu::context_menu(&self, &key_binds))
|
||||||
.position(widget::popover::Position::Point(point));
|
.position(widget::popover::Position::Point(point));
|
||||||
}
|
}
|
||||||
let scrollable = widget::scrollable(popover)
|
let mut tab_column = widget::column::with_capacity(3);
|
||||||
.id(self.scrollable_id.clone())
|
tab_column = tab_column.push(location_view);
|
||||||
.on_scroll(Message::Scroll)
|
if can_scroll {
|
||||||
.width(Length::Fill)
|
tab_column = tab_column.push(
|
||||||
.height(Length::Fill);
|
widget::scrollable(popover)
|
||||||
let mut tab_column = widget::column::with_children(vec![location_view, scrollable.into()]);
|
.id(self.scrollable_id.clone())
|
||||||
|
.on_scroll(Message::Scroll)
|
||||||
|
.width(Length::Fill)
|
||||||
|
.height(Length::Fill),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
tab_column = tab_column.push(popover);
|
||||||
|
}
|
||||||
if let Location::Trash = self.location {
|
if let Location::Trash = self.location {
|
||||||
if let Some(items) = self.items_opt() {
|
if let Some(items) = self.items_opt() {
|
||||||
if !items.is_empty() {
|
if !items.is_empty() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue