Skip to content

Commit

Permalink
fix: major rework of TextBox
Browse files Browse the repository at this point in the history
more vanilla-like, less broken :P
  • Loading branch information
desht committed Mar 8, 2024
1 parent 069e063 commit db5b96c
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ private class EditField extends TextBox {
public EditField() {
super(EditStringConfigOverlay.this);

setText(config.getStringFromValue(currentValue));
setText(config.getStringFromValue(EditStringConfigOverlay.this.currentValue));
textColor = Color4I.WHITE; //config.getColor(currentValue);
setCursorPosition(getText().length());
setSelectionPos(0);
setCursorPos(0);
setSelectionPos(getText().length());
setFocused(true);
}

Expand Down Expand Up @@ -138,7 +138,7 @@ public void onEnterPressed() {
public boolean mouseScrolled(double scroll) {
return config.scrollValue(currentValue, scroll > 0).map(v -> {
textBox.setText(config.getStringFromValue(v));
textBox.setSelectionPos(textBox.getCursorPosition());
textBox.setSelectionPos(textBox.getCursorPos());
return true;
}).orElse(super.mouseScrolled(scroll));
}
Expand Down
Loading

0 comments on commit db5b96c

Please sign in to comment.