Centered NPC dialog text as good as I can without rewriting TextArea

This commit is contained in:
Collin Smith 2019-03-05 13:36:56 -08:00
parent e5418464fa
commit 5540c6436c
2 changed files with 5 additions and 3 deletions

View File

@ -54,6 +54,7 @@ public class NpcDialogBox extends Table implements Disposable {
scrollPane.setFlingTime(0);
scrollPane.setOverscroll(false, false);
scrollPane.setClamp(false);
scrollPane.setScrollX(-15); // FIXME: actual preferred width of text isn't calculated anywhere, this is best guess
add(scrollPane).size(330, 128);
pack();

View File

@ -445,7 +445,7 @@ public class ScrollPane extends WidgetGroup {
maxX -= scrollbarWidth;
}
}
scrollX(MathUtils.clamp(amountX, 0, maxX));
scrollX(amountX);
scrollY(amountY);
// Set the bounds and scroll knob sizes if scrollbars are needed.
@ -522,7 +522,7 @@ public class ScrollPane extends WidgetGroup {
y -= (int)(maxY - visualAmountY);
float x = widgetAreaBounds.x;
if (scrollX) x -= (int)visualAmountX;
/*if (scrollX) */x -= (int)visualAmountX;
if (!fadeScrollBars && scrollbarsOnTop) {
if (scrollX && hScrollOnBottom) {
@ -767,7 +767,8 @@ public class ScrollPane extends WidgetGroup {
}
public void setScrollX (float pixels) {
scrollX(MathUtils.clamp(pixels, 0, maxX));
//scrollX(MathUtils.clamp(pixels, 0, maxX));
scrollX(pixels);
}
/** Returns the x scroll position in pixels, where 0 is the left of the scroll pane. */