summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippo Argiolas <filippo.argiolas@gmail.com>2009-04-25 21:39:19 +0200
committerFilippo Argiolas <filippo.argiolas@gmail.com>2009-04-25 23:10:08 +0200
commitae5220c8902a35d21850927f5e1e3648ad98a06d (patch)
treee3ff32c8c3515c1ccd6d2dc35bf47cd01c27359f
parent702f7483dcf1c14860e06e3bf67475f047d21cf5 (diff)
Center actors keeping aspect ratio
-rw-r--r--src/cheese-grid.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/cheese-grid.c b/src/cheese-grid.c
index 8a2e43a..a979de9 100644
--- a/src/cheese-grid.c
+++ b/src/cheese-grid.c
@@ -1,6 +1,5 @@
-/* cheese-grid.h: Reflowing grid layout container for clutter.
- *
- * Copyright (C) 2008 Intel Corporation
+/*
+ * Copyright (C) 2009 Filippo Argiolas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,15 +16,6 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Written by: Øyvind Kolås <pippin@linux.intel.com>
- */
-
-/* TODO:
- *
- * - Better names for properties.
- * - Caching layouted positions? (perhaps needed for huge collections)
- * - More comments / overall concept on how the layouting is done.
- * - Allow more layout directions than just row major / column major.
*/
#include "cheese-grid.h"
@@ -440,11 +430,11 @@ cheese_grid_allocate (ClutterActor *self,
child_box.x1 = child_width * i;
child_box.x2 = child_box.x1 + child_width;
- child_box.y1 = child_height * j;
- child_box.y2 = child_box.y1 + child_width/ratio;
+ child_box.y1 = child_height * j + (child_height - child_width/ratio)/2.0;
+ child_box.y2 = child_box.y1 + (child_width/ratio);
}
else {
- child_box.x1 = child_width * i;
+ child_box.x1 = child_width * i + (child_width - child_height*ratio)/2.0;
child_box.x2 = child_box.x1 + child_height*ratio;
child_box.y1 = child_height * j;