v0.9.2: fixed layout issues with recent styledbutton changes

This commit is contained in:
Evan Debenham 2021-02-22 12:46:40 -05:00
parent 4a31acf50e
commit 33e70fa89d
3 changed files with 5 additions and 1 deletions

View File

@ -119,6 +119,7 @@ public class NewsScene extends PixelScene {
boolean rightCol = false;
for (NewsArticle article : articles) {
StyledButton b = new ArticleButton(article);
b.multiline = true;
if (!rightCol) {
top += gap;
b.setRect( left, top, BTN_WIDTH, BTN_HEIGHT);

View File

@ -35,6 +35,8 @@ public class StyledButton extends Button {
protected NinePatch bg;
protected RenderedTextBlock text;
protected Image icon;
public boolean multiline;
public StyledButton(Chrome.Type type, String label ) {
this(type, label, 9);
@ -65,7 +67,7 @@ public class StyledButton extends Button {
if (icon != null) componentWidth += icon.width() + 2;
if (text != null && !text.text().equals("")){
text.maxWidth( (int)(width - componentWidth - bg.marginHor() - 2));
if (multiline) text.maxWidth( (int)(width - componentWidth - bg.marginHor() - 2));
componentWidth += text.width() + 2;
text.setPos(

View File

@ -74,6 +74,7 @@ public class WndCombo extends Window {
};
ic.tint(move.tintColor);
moveBtn.icon(ic);
moveBtn.multiline = true;
moveBtn.setSize(width, moveBtn.reqHeight());
moveBtn.setRect(0, pos, width, moveBtn.reqHeight());
moveBtn.enable(combo.canUseMove(move));