# HG changeset patch # User Neil Muller # Date 1378550331 -7200 # Node ID ddff1f8668d52cfbd830f6a3fe904610e281160d # Parent d7bd9adb105aa2f688321a4e478df579d2830771 Unbreak polygon drawing diff -r d7bd9adb105a -r ddff1f8668d5 tools/area_editor.py --- a/tools/area_editor.py Sat Sep 07 12:33:35 2013 +0200 +++ b/tools/area_editor.py Sat Sep 07 12:38:51 2013 +0200 @@ -181,10 +181,11 @@ pointlist = [self.point_to_pygame(p) if p != move_point else mouse_pos for p in pointlist] pygame.draw.lines(self._surface, color, False, pointlist, 2) - elif len(polygon) > 1: + break + if len(polygon) > 1: pointlist = [self.point_to_pygame(p) for p in polygon] pygame.draw.lines(self._surface, color, False, pointlist, 2) - elif index == mouse_poly and mouse_pos: + if index == mouse_poly and mouse_pos: endpoint = self.fix_poly_angle(index, mouse_pos) pygame.draw.line(self._surface, color, self.point_to_pygame(polygon[-1]), @@ -593,6 +594,10 @@ else: # find the current point self._move_point = self.level.find_vertex(corrected_pos) + elif self.cur_poly and ev.button == 1: + # Add a point + self.level.add_point(self.cur_poly, + self._level_coordinates(corrected_pos)) elif ev.button == 1: if self._draw_lines: if self._start_pos is None: @@ -612,10 +617,6 @@ self._move_view((-10, 0)) elif ev.button == 7: # Scroll right self._move_view((10, 0)) - elif self.cur_poly and ev.button == 1: - # Add a point - self.level.add_point(self.cur_poly, - self._level_coordinates(ev.pos)) elif ev.button == 3: self._mouse_drag = True