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 text on timer button #2229

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tituscmd
Copy link
Contributor

@tituscmd tituscmd commented Jan 18, 2025

Hey everybody!

This PR is made to center the "Start"/"Pause" text on the button in the timer app. The previous implementation created the text object and aligned it to the button object, this implementation creates the text object with a pointer to the button object and thus makes it centered at all times!

Here's a screenshot of InfiniEmu running it:
Screenshot_2025-01-18_15-29-43

Copy link

github-actions bot commented Jan 18, 2025

Build size and comparison to main:

Section Size Difference
text 373104B -16B
data 948B 0B
bss 22536B 0B

Run in InfiniEmu

@tituscmd tituscmd changed the title Center timer button correctly Center text on timer button Jan 18, 2025
@mark9064 mark9064 added enhancement Enhancement to an existing app/feature maintenance Background work labels Jan 23, 2025
Copy link
Member

@mark9064 mark9064 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely a nicer way to do it

txtPlayPause = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(txtPlayPause, btnPlayPause, LV_ALIGN_CENTER, 0, 0);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
// lv_obj_align(txtPlayPause, btnPlayPause, LV_ALIGN_CENTER, 0, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's now auto aligned I think this line can be fully deleted. Maybe if you would like to point out the alignment a comment above the label creation would work nicely

@mark9064 mark9064 added this to the 1.16.0 milestone Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to an existing app/feature maintenance Background work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants