v1.2.0: fixed errors with window offsetting and text input window

This commit is contained in:
Evan Debenham 2022-02-04 15:36:51 -05:00
parent 7367248aa4
commit 0ef780c2c2

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.watabou.noosa.TextInput;
@ -33,6 +34,8 @@ public class WndTextInput extends Window {
private static final int MARGIN = 2;
private static final int BUTTON_HEIGHT = 16;
private TextInput textBox;
public WndTextInput(final String title, final String initialValue, final int maxLength,
final boolean multiLine, final String posTxt, final String negTxt) {
super();
@ -60,7 +63,7 @@ public class WndTextInput extends Window {
add(txtTitle);
int textSize = (int)PixelScene.uiCamera.zoom * (multiLine ? 6 : 9);
final TextInput textBox = new TextInput(Chrome.get(Chrome.Type.TOAST_WHITE), multiLine, textSize){
textBox = new TextInput(Chrome.get(Chrome.Type.TOAST_WHITE), multiLine, textSize){
@Override
public void enterPressed() {
//triggers positive action on enter pressed, only with non-multiline though.
@ -125,6 +128,12 @@ public class WndTextInput extends Window {
}
@Override
public void offset(int xOffset, int yOffset) {
super.offset(xOffset, yOffset);
textBox.setRect(textBox.left(), textBox.top(), textBox.width(), textBox.height());
}
public void onSelect(boolean positive, String text){ }
@Override