Started implementing hover and did some additional implementation with the draw code
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user