summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-08-09 15:47:59 +0200
committerdavemds <dave@gurumeditation.it>2014-08-09 15:47:59 +0200
commit71c46f7aad35a4fa4ef22c5f335d835fae82363c (patch)
treebab01d6c1a8453ecbff049ab931d42ff839c277c
parent4b52eaa37af7d3585a5b3870e90d28117d613543 (diff)
Gengrid: fix position calculation
@fix To calc the position in a table you need to make the modulo of the col/row size, not the modulo on the x/y value This unbreak the elm_gengrid_item_pos_get() function that was reporting wrong values
-rw-r--r--src/lib/elm_gengrid.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 120adb8a1..08b6c728e 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -173,8 +173,7 @@ _item_show_region(void *data)
173 row = cvh / sd->item_height; 173 row = cvh / sd->item_height;
174 if (row <= 0) row = 1; 174 if (row <= 0) row = 1;
175 x = (it->position - 1) / row; 175 x = (it->position - 1) / row;
176 if (x == 0) y = it->position - 1; 176 y = (it->position - 1) % row;
177 else if (x > 0) y = (it->position - 1) % x;
178 if (x >= 1) 177 if (x >= 1)
179 it_xpos = ((x - GG_IT(it)->prev_group) * sd->item_width) 178 it_xpos = ((x - GG_IT(it)->prev_group) * sd->item_width)
180 + (GG_IT(it)->prev_group * sd->group_item_width) 179 + (GG_IT(it)->prev_group * sd->group_item_width)
@@ -189,10 +188,10 @@ _item_show_region(void *data)
189 else if (sd->item_width > 0) 188 else if (sd->item_width > 0)
190 { 189 {
191 col = cvw / sd->item_width; 190 col = cvw / sd->item_width;
191
192 if (col <= 0) col = 1; 192 if (col <= 0) col = 1;
193 y = (it->position - 1) / col; 193 y = (it->position - 1) / col;
194 if (y == 0) x = it->position - 1; 194 x = (it->position - 1) % col;
195 else if (y > 0) x = (it->position - 1) % y;
196 it_xpos = x * sd->item_width + minx; 195 it_xpos = x * sd->item_width + minx;
197 if (y >= 1) 196 if (y >= 1)
198 it_ypos = ((y - GG_IT(it)->prev_group) * sd->item_height) 197 it_ypos = ((y - GG_IT(it)->prev_group) * sd->item_height)