Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

centered text widgets with negative x #40

Closed
richi opened this issue Jan 14, 2016 · 1 comment
Closed

centered text widgets with negative x #40

richi opened this issue Jan 14, 2016 · 1 comment
Labels

Comments

@richi
Copy link

richi commented Jan 14, 2016

If you move a button (or any other widget with centered text) out of the left side of the screen, x will get negative and the "center" calculation will give wrong results.

    zr_widget_text, line ~3808

    label.x = (b.x + t->padding.x + ((b.w - 2 * t->padding.x)/2));
    if (label.x >= label.w/2) label.x -= (label.w/2);

replacing those two lines with:

    label.x = (b.x + t->padding.x + ((b.w - 2 * t->padding.x) - label.w) / 2);

might (maybe) solve the problem?

@vurtun vurtun added the bug label Jan 14, 2016
@vurtun vurtun closed this as completed in 127124c Jan 14, 2016
@vurtun
Copy link
Owner

vurtun commented Jan 14, 2016

Thanks, so far it seems that everything works fine with the fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants