Skip to content

Commit

Permalink
Taking another look at #13 ...
Browse files Browse the repository at this point in the history
It still seems to be working when making proper use of scene2d.ui's "preferred size" inside a Table cell or Container.
  • Loading branch information
tommyettinger committed Aug 29, 2023
1 parent 374c14a commit 513c6b8
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/test/java/com/github/tommyettinger/textra/Issue13Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,24 @@ public class Issue13Test extends ApplicationAdapter {
@Override
public void create () {
stage = new Stage(new ScreenViewport());

stage.setDebugAll(true);
skin = new Skin(Gdx.files.internal("uiskin.json"));

int fitOneLineCount = 25;
int extraLines = 10;
int extraSpaces = 10;

StringBuilder text = new StringBuilder();
for (int count = 0; count < fitOneLineCount + extraLines; count++) {
text.append(' ');
}

text.append("OK.");

TextraLabel label = new TextraLabel(text.toString(), skin);
// for (int count = 0; count < fitOneLineCount + extraSpaces; count++) {
// text.append(' ');
// }
// text.append("OK.");

// This seems to work here.
// https://i.imgur.com/LFYLAPc.png
text.append("this is a normal text test test test!");
// It works for TextraLabel and TypingLabel, in the same way.
// TextraLabel label = new TextraLabel(text.toString(), skin);
TypingLabel label = new TypingLabel(text.toString(), skin);
label.setWrap(true);

// Runs in the next render thread so the layout is ready.
Expand All @@ -69,7 +73,6 @@ public void create () {
// Gdx.app.postRunnable(() -> System.out.println("Lines: " + label.workingLayout.lines()));

Table table = new Table();
table.debug();
table.add(label).prefWidth(100).row();

Stack stack = new Stack(table);
Expand Down

0 comments on commit 513c6b8

Please sign in to comment.