Skip to content

Commit

Permalink
Fix cropping when using integers number in price input text
Browse files Browse the repository at this point in the history
  • Loading branch information
axpoems committed Jan 8, 2025
1 parent 4913c40 commit c4ff75d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@Slf4j
public class PriceInputBox extends MaterialTextField {
public static final int AMOUNT_BOX_HEIGHT = 127;
private static final int INPUT_TEXT_MAX_LENGTH = 15;
private static final int INPUT_TEXT_MAX_LENGTH = 14;
private static final String INPUT_TEXT_9_STYLE_CLASS = "input-text-9";
private static final String INPUT_TEXT_10_STYLE_CLASS = "input-text-10";
private static final String INPUT_TEXT_11_STYLE_CLASS = "input-text-11";
Expand Down Expand Up @@ -71,7 +71,11 @@ public PriceInputBox(String description, String prompt) {
|| !newValue.matches(BisqEasyViewUtils.NUMERIC_WITH_DECIMAL_REGEX)) {
textInputControl.setText(oldValue);
}
applyFontStyle(textInputControl.getLength());
// If using an integer we need to count one more char since a dot occupies much less space.
int calculatedLength = !textInputControl.getText().contains(".")
? textInputControl.getLength() + 1
: textInputControl.getLength();
applyFontStyle(calculatedLength);
};
initialize();
}
Expand Down

0 comments on commit c4ff75d

Please sign in to comment.