more fixes
authorMatthew Allum <mallum@openedhand.com>
Wed, 23 Mar 2005 18:48:27 +0000 (18:48 +0000)
committerMatthew Allum <mallum@openedhand.com>
Wed, 23 Mar 2005 18:48:27 +0000 (18:48 +0000)
ChangeLog
cltr.c

index ec7f2f9..b64d206 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2005-03-23  mallum,,,  <mallum@openedhand.com>
 
+       * cltr.c: (ctrl_photo_grid_get_trans_coords),
+       Fix grid co-ords -> translation vals converter
+       (cltr_photo_grid_navigate), (cltr_photo_grid_redraw),
+       (cltr_photo_grid_new), (idle_cb):
+       Fix moving between pictures when zoomed
+
+
+2005-03-23  mallum,,,  <mallum@openedhand.com>
+
        * cltr.c: (cltr_dispatch_x_event), (cltr_window_new),
        (cltr_main_loop), (cltr_photo_grid_navigate),
        (cltr_photo_grid_activate_cell), (cltr_photo_grid_populate),
diff --git a/cltr.c b/cltr.c
index c8d3b98..490973a 100644 (file)
--- a/cltr.c
+++ b/cltr.c
@@ -324,9 +324,35 @@ ctrl_photo_grid_get_trans_coords(ClutterPhotoGrid *grid,
 
   /* XXX figure out what magic 2.0 value comes from */
 
+  /*
   *tx = (float)( (max_x-x) - 1.0 ) * 2.0;
   *ty = (float)( y - 1.0 ) * 2.0;
+  */
+
+  /* 
+   3x3 0,0 -> 2,-2
+
+   5x5 0,0 ->
+  *tx = 4.0;
+  *ty = -4.0;
 
+  4x4 0,0 -> 3.0, -3.0
+  */
+
+  /*
+  float trange = ((float)(grid->n_cols - 1.0) * 2.0);
+  float xrange = (float)grid->n_cols - 1.0;
+  */
+
+  /*
+  *tx = ((max_x-x) * (trange/xrange)) - (trange/2);
+  *ty = (y * (trange/xrange)) - (trange/2);
+  */
+
+  /* assumes rows = cols */
+
+  *tx = ((max_x-x) * 2.0) - (grid->n_cols - 1.0);
+  *ty = (y * 2.0) - (grid->n_cols - 1.0);
 }
 
 void
@@ -362,10 +388,9 @@ cltr_photo_grid_navigate(ClutterPhotoGrid *grid,
       if (grid->state == CLTR_PHOTO_GRID_STATE_ZOOMED)
        {
          grid->state      = CLTR_PHOTO_GRID_STATE_ZOOMED_MOVE;
-
-         grid->view_min_x =  grid->view_max_x; 
-         grid->view_min_y =  grid->view_max_y ;
-
+         grid->view_min_x = grid->view_max_x; 
+         grid->view_min_y = grid->view_max_y ;
+         grid->anim_step  = 0;
        }
          
       ctrl_photo_grid_cell_to_coords(grid, grid->cell_active, &x, &y);
@@ -576,8 +601,9 @@ cltr_photo_grid_redraw(ClutterPhotoGrid *grid)
            {
              float f = (float)grid->anim_step/grid->anim_n_steps;
 
-             trans_x = (grid->view_max_x - grid->view_min_x) * f;
-             trans_y = (grid->view_max_y - grid->view_min_y) * f;
+             trans_x = grid->view_min_x + ((grid->view_max_x - grid->view_min_x) * f);
+             trans_y = grid->view_min_y + ((grid->view_max_y - grid->view_min_y) * f);
+
            }
        }
 
@@ -688,7 +714,7 @@ cltr_photo_grid_new(ClutterWindow *win,
 
   grid->state = CLTR_PHOTO_GRID_STATE_BROWSE;
 
-  grid->anim_n_steps = 40; /* value needs to be calced dep on rows */
+  grid->anim_n_steps = 50; /* value needs to be calced dep on rows */
   grid->anim_step    = 0;
 
   /* 
@@ -732,6 +758,10 @@ idle_cb(gpointer data)
 {
   ClutterPhotoGrid *grid = (ClutterPhotoGrid *)data;
 
+  /*
+  if (grid->state != CLTR_PHOTO_GRID_STATE_BROWSE
+      && grid->state != CLTR_PHOTO_GRID_STATE_ZOOMED)
+  */
   cltr_photo_grid_redraw(grid);
 
   return TRUE;