make label respect alignment
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-05-23 06:14:37 +09:00
commit add02b695b

View file

@ -336,6 +336,7 @@ static void draw_normal(MwWidget handle) {
r.width -= MwGetInteger(handle, MwNleftPadding); r.width -= MwGetInteger(handle, MwNleftPadding);
#if 0
if(align == MwALIGNMENT_CENTER) { if(align == MwALIGNMENT_CENTER) {
p.x = r.width / 2; p.x = r.width / 2;
} else if(align == MwALIGNMENT_BEGINNING) { } else if(align == MwALIGNMENT_BEGINNING) {
@ -343,17 +344,20 @@ static void draw_normal(MwWidget handle) {
} else if(align == MwALIGNMENT_END) { } else if(align == MwALIGNMENT_END) {
p.x = r.width - MwTextWidth(handle, NULL, str) / 2; p.x = r.width - MwTextWidth(handle, NULL, str) / 2;
} }
#else
p.x = 0;
#endif
p.y = r.height / 2; p.y = r.height / 2;
p.x += MwGetInteger(handle, MwNleftPadding); p.x += MwGetInteger(handle, MwNleftPadding);
p.x += 1; p.x += 1;
p.y += 1; p.y += 1;
MwDrawText(handle, NULL, &p, str, MwALIGNMENT_CENTER, shadow); MwDrawText(handle, NULL, &p, str, MwALIGNMENT_BEGINNING, shadow);
p.x -= 1; p.x -= 1;
p.y -= 1; p.y -= 1;
MwDrawText(handle, NULL, &p, str, MwALIGNMENT_CENTER, text); MwDrawText(handle, NULL, &p, str, MwALIGNMENT_BEGINNING, text);
MwLLFreeColor(shadow); MwLLFreeColor(shadow);
MwLLFreeColor(text); MwLLFreeColor(text);