Mercurial > nagslang
changeset 411:ddff1f8668d5
Unbreak polygon drawing
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 07 Sep 2013 12:38:51 +0200 |
parents | d7bd9adb105a |
children | 23e751f26f81 |
files | tools/area_editor.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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