Skip to content

Commit

Permalink
Add autoWidth support to GuiText.
Browse files Browse the repository at this point in the history
  • Loading branch information
covers1624 committed Jul 3, 2024
1 parent 32f2860 commit 54bca18
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public GuiText autoHeight() {
return this;
}

public GuiText autoWidth() {
constrain(GeoParam.WIDTH, dynamic(() -> (double) font().width(getText())));
return this;
}

public GuiText setTextSupplier(@NotNull Supplier<@Nullable Component> textSupplier) {
this.text = textSupplier;
return this;
Expand Down

0 comments on commit 54bca18

Please sign in to comment.