From 89df69a0cc577799a522986f1f3d1edf3ebeb232 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 6 Aug 2012 21:08:22 +0200 Subject: [PATCH] Keep track of whether the mouse is inside the actual grid, not just mousing over the canvas --- map_isometric.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/map_isometric.js b/map_isometric.js index d20a0f2..34d1c3c 100644 --- a/map_isometric.js +++ b/map_isometric.js @@ -8,6 +8,7 @@ if(RadiumEngine !== undefined) this.height = 6; this.mouse_tile = undefined; this.mouse_over = false; + this.mouse_in = false; this.fill_screen = false; this.canvas = canvas @@ -31,6 +32,18 @@ if(RadiumEngine !== undefined) var coords = event.data.self.TileFromPosition(mouse_x, mouse_y); self.mouse_tile = coords; + + if(coords.x >= 0 && coords.x < self.width && coords.y >= 0 && coords.y < self.height) + { + self.mouse_in = true; + $('#status').html("in"); + } + else + { + self.mouse_in = false; + $('#status').html("out"); + } + /*$('#status').html(coords.x + " , " + coords.y);*/ self.Redraw();