Skip to content

Commit

Permalink
WDynamicLabel: Rename alignment + getter/setter -> horizontalAlignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Oct 23, 2024
1 parent a51dd5e commit d24c0b6
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
public class WDynamicLabel extends WWidget {
protected Supplier<String> text;
protected HorizontalAlignment alignment = HorizontalAlignment.LEFT;
protected HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT;
protected VerticalAlignment verticalAlignment = VerticalAlignment.TOP;
protected int color;
protected int darkmodeColor;
Expand Down Expand Up @@ -66,9 +66,9 @@ public void paint(DrawContext context, int x, int y, int mouseX, int mouseY) {
String tr = text.get();

if (getDrawShadows()) {
ScreenDrawing.drawStringWithShadow(context, tr, alignment, x, y + yOffset, this.getWidth(), shouldRenderInDarkMode() ? darkmodeColor : color);
ScreenDrawing.drawStringWithShadow(context, tr, horizontalAlignment, x, y + yOffset, this.getWidth(), shouldRenderInDarkMode() ? darkmodeColor : color);
} else {
ScreenDrawing.drawString(context, tr, alignment, x, y + yOffset, this.getWidth(), shouldRenderInDarkMode() ? darkmodeColor : color);
ScreenDrawing.drawString(context, tr, horizontalAlignment, x, y + yOffset, this.getWidth(), shouldRenderInDarkMode() ? darkmodeColor : color);
}
}

Expand Down Expand Up @@ -153,10 +153,9 @@ public WDynamicLabel setText(Supplier<String> text) {
* Gets the horizontal text alignment of this label.
*
* @return the alignment
* @since 11.1.0
*/
public HorizontalAlignment getAlignment() {
return alignment;
public HorizontalAlignment getHorizontalAlignment() {
return horizontalAlignment;
}

/**
Expand All @@ -165,8 +164,8 @@ public HorizontalAlignment getAlignment() {
* @param align the new text alignment
* @return this label
*/
public WDynamicLabel setAlignment(HorizontalAlignment align) {
this.alignment = align;
public WDynamicLabel setHorizontalAlignment(HorizontalAlignment align) {
this.horizontalAlignment = align;
return this;
}

Expand Down

0 comments on commit d24c0b6

Please sign in to comment.