From cee355ff57e859466e4f74d1f57d68eeedb54ce1 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 7 Jul 2024 14:40:27 +0200 Subject: protoboard: fix column label alignment --- gerbonara/cad/primitives.py | 5 +++-- gerbonara/cad/protoboard.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'gerbonara/cad') diff --git a/gerbonara/cad/primitives.py b/gerbonara/cad/primitives.py index a5c5209..c659274 100644 --- a/gerbonara/cad/primitives.py +++ b/gerbonara/cad/primitives.py @@ -322,6 +322,7 @@ class Text(Positioned): xs = [x for points in strokes for x, _y in points] ys = [y for points in strokes for _x, y in points] min_x, min_y, max_x, max_y = min(xs), min(ys), max(xs), max(ys) + h = (max_y - min_y) if self.h_align == 'left': x0 = 0 @@ -333,9 +334,9 @@ class Text(Positioned): raise ValueError('h_align must be one of "left", "center", or "right".') if self.v_align == 'bottom': - y0 = -(max_y - min_y) + y0 = h elif self.v_align == 'middle': - y0 = (max_y - min_y)/2 + y0 = h/2 elif self.v_align == 'top': y0 = 0 else: diff --git a/gerbonara/cad/protoboard.py b/gerbonara/cad/protoboard.py index cc1ab9e..ebc8151 100644 --- a/gerbonara/cad/protoboard.py +++ b/gerbonara/cad/protoboard.py @@ -263,7 +263,7 @@ class PatternProtoArea: yield Text(t_x, t_y, lno_i, self.font_size, self.font_stroke, 'center', 'top', flip=True, unit=self.unit) if border_text[0]: - t_y = y + h + off_y + t_y = y + h - off_y yield Text(t_x, t_y, lno_i, self.font_size, self.font_stroke, 'center', 'bottom', unit=self.unit) if not self.single_sided: yield Text(t_x, t_y, lno_i, self.font_size, self.font_stroke, 'center', 'bottom', flip=True, unit=self.unit) -- cgit