Started implementing hover and did some additional implementation with the draw code

This commit is contained in:
2012-04-17 21:59:40 -04:00
parent 824bf6c889
commit 8976349450
3 changed files with 67 additions and 23 deletions

View File

@ -180,23 +180,6 @@ class GUI:
self.update()
def do_hover(self, event):
x, y = event.pos
row = y / self.board_inc
col = x / self.board_inc
if _magnitude(event.rel) < 3:
if x < self.board_size and y < self.board_size:
self.goban.set_hover((row,col))
else:
self.goban.clear_hover()
elif self.goban.hover != self.goban._real_pos((row,col)):
self.goban.clear_hover()
def _magnitude(vector):
x,y = vector
return math.sqrt(x*x + y*y)