[swell-foop] Fixed keyboard navigation glitch (bgo#736368)



commit c791021d0d789ebf31929d896a286aeffd1fec58
Author: Robert Roth <robert roth off gmail com>
Date:   Thu Jan 8 19:59:52 2015 +0200

    Fixed keyboard navigation glitch (bgo#736368)

 src/game-view.vala |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index f6f21dd..b605c84 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -260,6 +260,15 @@ public class GameView : Clutter.Group
         return false;
     }
 
+    private TileActor? find_tile_at_position (int position_x, int position_y)
+    {
+        foreach (TileActor actor in tiles)
+            if (actor.tile.grid_x == position_x &&
+                actor.tile.grid_y == position_y)
+                return actor;
+        return null;
+    }
+
     /* Move Keyboard cursor */
     public void cursor_move (int x, int y)
     {
@@ -268,8 +277,10 @@ public class GameView : Clutter.Group
         opacity_for_connected_tiles (highlighted, 180);
         cursor_x += x;
         cursor_y += y;
-        highlighted = tiles[cursor_x, cursor_y];
-        opacity_for_connected_tiles (highlighted, 255);
+        highlighted = find_tile (cursor_x, cursor_y);
+
+        if (highlighted != null)
+            opacity_for_connected_tiles (highlighted, 255);
 
         float xx, yy;
         xx = cursor_x * tile_size;


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