comparison gamelib/gamescreen.py @ 195:c56a0170f0cb

Right click (and middle click) clears current tool.
author Jeremy Thurgood <firxen@gmail.com>
date Thu, 26 Aug 2010 08:38:06 +0200
parents fbfd8e748ac0
children 9531a22721d1
comparison
equal deleted inserted replaced
194:9887c68110d8 195:c56a0170f0cb
62 62
63 def draw(self, surface): 63 def draw(self, surface):
64 self.state.draw(surface, self.screen) 64 self.state.draw(surface, self.screen)
65 65
66 def mouse_down(self, event): 66 def mouse_down(self, event):
67 if event.button != 1: # We have a right/middle click
68 self.state.set_tool(None)
69 return
67 if self.subwidgets: 70 if self.subwidgets:
68 self.remove(self.detail) 71 self.remove(self.detail)
69 self.state.set_current_detail(None) 72 self.state.set_current_detail(None)
70 self._mouse_move(event.pos) 73 self._mouse_move(event.pos)
71 else: 74 else:
125 128
126 def draw(self, surface): 129 def draw(self, surface):
127 self.state.draw_detail(surface.subsurface(self.image_rect), self.screen) 130 self.state.draw_detail(surface.subsurface(self.image_rect), self.screen)
128 131
129 def mouse_down(self, event): 132 def mouse_down(self, event):
133 if event.button != 1: # We have a right/middle click
134 self.state.set_tool(None)
135 return
130 result = self.state.interact_detail(self.global_to_local(event.pos)) 136 result = self.state.interact_detail(self.global_to_local(event.pos))
131 if result: 137 if result:
132 result.process(self) 138 result.process(self)
133 139
134 def mouse_move(self, event): 140 def mouse_move(self, event):