Skip to content

Commit

Permalink
Center Layouts menu items
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Jun 26, 2024
1 parent 3e978ce commit 4426fa9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/app_components/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def draw(self, ctx, focused=False):
# Draw label
label_lines = utils.wrap_text(ctx, self.label, tokens.label_font_size)
for line in label_lines:
ctx.move_to(0, self.height)
width = ctx.text_width(line)
ctx.move_to(115 - width / 2, self.height)
ctx.text(line)
self.height += ctx.font_size

Expand All @@ -114,7 +115,8 @@ def draw(self, ctx, focused=False):
ctx.font_size = tokens.ten_pt
value_lines = utils.wrap_text(ctx, self.value, tokens.label_font_size, 230)
for line in value_lines:
ctx.move_to(10, self.height)
width = ctx.text_width(line)
ctx.move_to(115 - width / 2, self.height)
ctx.text(line)
self.height += ctx.font_size

Expand Down

0 comments on commit 4426fa9

Please sign in to comment.