Skip to content

Commit

Permalink
Initial scroll fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blissd committed Apr 1, 2024
1 parent 4b81c02 commit e12a93a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/app/components/all_photos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ impl SimpleComponent for AllPhotos {

let pictures_box = &model.pictures_grid_view.view;

pictures_box.scroll_to(model.pictures_grid_view.len(), gtk::ListScrollFlags::SELECT, None);
if !model.pictures_grid_view.is_empty(){
pictures_box.scroll_to(model.pictures_grid_view.len() - 1, gtk::ListScrollFlags::SELECT, None);
}

let widgets = view_output!();
ComponentParts { model, widgets }
Expand Down
4 changes: 3 additions & 1 deletion src/app/components/month_photos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ impl SimpleComponent for MonthPhotos {
};

let pictures_box = &model.pictures_grid_view.view;
pictures_box.scroll_to(model.pictures_grid_view.len(), gtk::ListScrollFlags::SELECT, None);
if !model.pictures_grid_view.is_empty(){
pictures_box.scroll_to(model.pictures_grid_view.len() - 1, gtk::ListScrollFlags::SELECT, None);
}

let widgets = view_output!();
ComponentParts { model, widgets }
Expand Down
4 changes: 3 additions & 1 deletion src/app/components/year_photos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ impl SimpleComponent for YearPhotos {
};

let pictures_box = &model.pictures_grid_view.view;
pictures_box.scroll_to(model.pictures_grid_view.len(), gtk::ListScrollFlags::SELECT, None);
if !model.pictures_grid_view.is_empty(){
pictures_box.scroll_to(model.pictures_grid_view.len() - 1, gtk::ListScrollFlags::SELECT, None);
}

let widgets = view_output!();
ComponentParts { model, widgets }
Expand Down

0 comments on commit e12a93a

Please sign in to comment.