Mercurial > nagslang
diff tools/area_editor.py @ 436:7079c3214d72
Scale lines when we zoom out
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 07 Sep 2013 14:19:31 +0200 |
parents | 27d74e58151d |
children | 4c60df80b91b |
line wrap: on
line diff
--- a/tools/area_editor.py Sat Sep 07 14:14:41 2013 +0200 +++ b/tools/area_editor.py Sat Sep 07 14:19:31 2013 +0200 @@ -115,9 +115,10 @@ self.lines.append([startpoint, endpoint]) def draw(self, mouse_pos, mouse_poly, filled, draw_cand_line, start_pos, - move_point_mode, move_point): + move_point_mode, move_point, zoom_factor): self._draw_background(True) # Draw polygons as needed for the editor + line_width = int(2 * zoom_factor) if filled: self._draw_exterior(True) for index, polygon in self.polygons.items(): @@ -126,11 +127,13 @@ pointlist = [p for p in polygon] 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) + pygame.draw.lines(self._surface, color, False, pointlist, + line_width) break if len(polygon) > 1: pointlist = [self.point_to_pygame(p) for p in polygon] - pygame.draw.lines(self._surface, color, False, pointlist, 2) + pygame.draw.lines(self._surface, color, False, pointlist, + line_width) if index == mouse_poly and mouse_pos: endpoint = self.point_to_pymunk(mouse_pos) pygame.draw.line(self._surface, color, @@ -144,7 +147,8 @@ line_found = True pointlist.remove(self.point_to_pygame(move_point)) pointlist.append(mouse_pos) - pygame.draw.lines(self._surface, LINE_COLOR, False, pointlist, 2) + pygame.draw.lines(self._surface, LINE_COLOR, False, pointlist, + line_width) if draw_cand_line and start_pos and mouse_pos: endpoint = self.snap_to_grid(mouse_pos) pointlist = [start_pos, @@ -471,7 +475,8 @@ mouse_pos = None level_surface = level.draw(mouse_pos, self.cur_poly, self.filled_mode, self._draw_lines, self._start_pos, - self._move_point_mode, self._move_point) + self._move_point_mode, self._move_point, + self._zoom_factor) if self._draw_objects: for thing in self.level.drawables: if not isinstance(thing, ne.Enemy):