[libshumate] map-layer: Allocate columns, then rows



commit 996a0a1bd6b8ba55a53ed4306678881f61fd3263
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Mar 7 19:28:46 2021 -0300

    map-layer: Allocate columns, then rows
    
    My totally westener brain is hardwired to think of it the same way I
    read text: top-left to bottom-right. The current allocation code goes
    top-bottom and left-right, and that's making me think of it wrongly
    way too many times.
    
    Allocate top-left to bottom-right through each column then row.

 shumate/shumate-map-layer.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/shumate/shumate-map-layer.c b/shumate/shumate-map-layer.c
index 04311f8..3bb2d40 100644
--- a/shumate/shumate-map-layer.c
+++ b/shumate/shumate-map-layer.c
@@ -390,16 +390,16 @@ shumate_map_layer_size_allocate (GtkWidget *widget,
 
   x_offset = (center_x - tile_initial_column * tile_size) - width/2;
   y_offset = (center_y - tile_initial_row * tile_size) - height/2;
-  child_allocation.x = -x_offset;
+  child_allocation.y = -y_offset;
   child_allocation.width = tile_size;
   child_allocation.height = tile_size;
 
-  tile_column = tile_initial_column;
-  for (int column = 0; column < self->required_tiles_columns; column++)
+  tile_row = tile_initial_row;
+  for (int row = 0; row < self->required_tiles_rows; row++)
     {
-      child_allocation.y = -y_offset;
-      tile_row = tile_initial_row;
-      for (int row = 0; row < self->required_tiles_rows; row++)
+      child_allocation.x = -x_offset;
+      tile_column = tile_initial_column;
+      for (int column = 0; column < self->required_tiles_columns; column++)
         {
           TileGridPosition *tile_child;
           ShumateTile *child;
@@ -435,12 +435,12 @@ shumate_map_layer_size_allocate (GtkWidget *widget,
               g_hash_table_insert (self->tile_fill, g_object_ref (child), cancellable);
             }
 
-          child_allocation.y += tile_size;
-          tile_row++;
+          child_allocation.x += tile_size;
+          tile_column++;
         }
 
-      child_allocation.x += tile_size;
-      tile_column++;
+      child_allocation.y += tile_size;
+      tile_row++;
     }
 
   /* We can't recompute while allocating, so queue an idle callback to run


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]