Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center Layouts menu items #173

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading