Add autoscroll
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-12-28 11:48:45 +01:00
Ursprung 118b258244
Commit 2cbf095826

Datei anzeigen

@ -332,6 +332,7 @@ public class ScriptEditScreen extends Screen {
savedCursorY = -1; savedCursorY = -1;
savedCursorX = -1; savedCursorX = -1;
} }
autoScroll();
} }
@Override @Override
@ -360,6 +361,7 @@ public class ScriptEditScreen extends Screen {
boolean valid = insert(chr + ""); boolean valid = insert(chr + "");
savedCursorY = -1; savedCursorY = -1;
savedCursorX = -1; savedCursorX = -1;
autoScroll();
return valid; return valid;
} }
@ -540,6 +542,14 @@ public class ScriptEditScreen extends Screen {
return true; return true;
} }
private void autoScroll() {
if (cursorY < scroll) {
scroll = cursorY;
} else if (cursorY >= scroll + ((this.height - 25 - 66) / 9)) {
scroll = cursorY - ((this.height - 25 - 66) / 9);
}
}
private boolean isAtEndOfLine() { private boolean isAtEndOfLine() {
return cursorX == lines.get(cursorY).length(); return cursorX == lines.get(cursorY).length();
} }