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

Fix incorrect widget LEFT state #559

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dczheng
Copy link
Contributor

@dczheng dczheng commented May 30, 2023

No description provided.

Copy link

@xzn xzn left a comment

Choose a reason for hiding this comment

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

Not that I'm a maintainer but the changes look good 👍

src/nuklear_color_picker.c Outdated Show resolved Hide resolved
@RobLoach
Copy link
Contributor

Thanks for pushing this forwards! Could you indicate how we can test this out? Would love to get it in, but I'm not sure how to properly test it.

@@ -34,8 +34,7 @@ nk_widget_text(struct nk_command_buffer *o, struct nk_rect b,
label.w = NK_MAX(1, 2 * t->padding.x + (float)text_width);
label.x = (b.x + t->padding.x + ((b.w - 2 * t->padding.x) - label.w) / 2);
label.x = NK_MAX(b.x + t->padding.x, label.x);
label.w = NK_MIN(b.x + b.w, label.x + label.w);
if (label.w >= label.x) label.w -= label.x;
label.w = NK_MIN(b.w, label.w);
Copy link
Contributor

Choose a reason for hiding this comment

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

This change looks unrelated?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
label.w = NK_MIN(b.w, label.w);
label.w = NK_MIN(b.x + b.w, label.x + label.w);
if (label.w >= label.x) label.w -= label.x;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

x+w is the coordinate, w is the distance, and the physical meaning of associating these two quantities seems incorrect

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

Successfully merging this pull request may close these issues.

None yet

3 participants