Skip to content

Commit 5a7b71e

Browse files
committed
fix y flipping
1 parent fec4de0 commit 5a7b71e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

elkplot/renderer.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ def render(
3939
win = pygame.display.set_mode((int(dpi * width), int(dpi * height)))
4040
rng = np.random.default_rng()
4141
if layer_colors is not None:
42-
my_colors = layer_colors + [_random_color(rng) for _ in range(len(layers) - len(layer_colors))]
42+
my_colors = layer_colors + [
43+
_random_color(rng) for _ in range(len(layers) - len(layer_colors))
44+
]
4345
else:
44-
my_colors = COLORS + [_random_color(rng) for _ in range(len(layers) - len(COLORS))]
46+
my_colors = COLORS + [
47+
_random_color(rng) for _ in range(len(layers) - len(COLORS))
48+
]
4549
run = True
4650
first_run = True
4751
while run:
@@ -55,7 +59,7 @@ def render(
5559
color = my_colors[i]
5660
path: shapely.LineString
5761
for path in shapely.get_parts(layer):
58-
screen_coords = [(dpi * x, dpi * (height - y)) for x, y in path.coords]
62+
screen_coords = [(dpi * x, dpi * y) for x, y in path.coords]
5963
pygame.draw.aalines(win, color, False, screen_coords)
6064
pygame.display.flip()
6165
first_run = False

0 commit comments

Comments
 (0)