mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
gtkgridview: return empty area for empty tiles during scroll
This commit is contained in:
parent
a483fb2d96
commit
70a9d08e21
@ -411,7 +411,7 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = gtk_list_tile_get_position (self->item_manager, tile);
|
pos = gtk_list_tile_get_position (self->item_manager, tile);
|
||||||
if (tile->n_items > 1)
|
if (tile->n_items > 1 && tile->area.width > 0 && tile->area.height > 0)
|
||||||
{
|
{
|
||||||
int xspacing, yspacing;
|
int xspacing, yspacing;
|
||||||
|
|
||||||
@ -431,11 +431,6 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
|||||||
{
|
{
|
||||||
guint rows_in_tile = tile->n_items / self->n_columns;
|
guint rows_in_tile = tile->n_items / self->n_columns;
|
||||||
guint row_height = (tile->area.height + yspacing) / rows_in_tile - yspacing;
|
guint row_height = (tile->area.height + yspacing) / rows_in_tile - yspacing;
|
||||||
|
|
||||||
/* tile has no computed area */
|
|
||||||
if (row_height + yspacing == 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
guint row_index = MIN (tile->area.height - 1, y - tile->area.y) / (row_height + yspacing);
|
guint row_index = MIN (tile->area.height - 1, y - tile->area.y) / (row_height + yspacing);
|
||||||
pos += self->n_columns * row_index;
|
pos += self->n_columns * row_index;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user