diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-09-14 23:56:59 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-09-14 23:56:59 (GMT) |
commit | 40ac3960554373fd6fed54f193f932d3e050ab51 (patch) | |
tree | cf8f9d0c4c979271fd1d9dd40475a8952e016c1c /sugar/canvas | |
parent | ae9adff40bda83fafe6e44ac9df7dfe9a981a8a8 (diff) |
Fix small bugs in the grid logic
Diffstat (limited to 'sugar/canvas')
-rw-r--r-- | sugar/canvas/Grid.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sugar/canvas/Grid.py b/sugar/canvas/Grid.py index e4c377a..50b5dbe 100644 --- a/sugar/canvas/Grid.py +++ b/sugar/canvas/Grid.py @@ -10,7 +10,11 @@ class Grid: def convert_from_screen(self, x, y): factor = Grid.COLS / gtk.gdk.screen_width() - return [int(x * factor), int(y * factor)] + + grid_x = round(x * factor) - 1 + grid_y = round(y * factor) - 1 + + return [grid_x, grid_y] def set_constraints(self, component, x, y, width=-1, height=-1): if isinstance(component, gtk.Window): |