scroll text now centers duplicate text rotations
This commit is contained in:
parent
46541d9747
commit
f5d3a01e76
@ -26,6 +26,7 @@ public class ScrollText extends Widget {
|
||||
private float text1Width;
|
||||
private float text2Width;
|
||||
|
||||
private boolean dupFirstText;
|
||||
private boolean scrollOnHover;
|
||||
private boolean scroll;
|
||||
|
||||
@ -104,13 +105,25 @@ public class ScrollText extends Widget {
|
||||
public void act(float delta) {
|
||||
setSize(getWidth(), textHeight + 4);
|
||||
clipBounds.setSize(getWidth()-2, getHeight()*1.5f);
|
||||
if (text1Width + text2Width > clipBounds.getWidth()) {
|
||||
if (scrollOnHover) {
|
||||
if (scroll || text1Offset < 0 || text1Offset > 2) {
|
||||
if (dupFirstText) {
|
||||
if (text1Width > clipBounds.getWidth()) {
|
||||
if (scrollOnHover) {
|
||||
if (scroll || text1Offset < 0 || text1Offset > 2) {
|
||||
scroll(delta);
|
||||
}
|
||||
} else {
|
||||
scroll(delta);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (text1Width + text2Width > clipBounds.getWidth()) {
|
||||
if (scrollOnHover) {
|
||||
if (scroll || text1Offset < 0 || text1Offset > 2) {
|
||||
scroll(delta);
|
||||
}
|
||||
} else {
|
||||
scroll(delta);
|
||||
}
|
||||
} else {
|
||||
scroll(delta);
|
||||
}
|
||||
}
|
||||
super.act(delta);
|
||||
@ -173,12 +186,13 @@ public class ScrollText extends Widget {
|
||||
gLayout = new GlyphLayout(font, text1);
|
||||
text1Width = gLayout.width;
|
||||
textHeight = gLayout.height;
|
||||
|
||||
|
||||
if (text2 != null) {
|
||||
this.text2 = text2;
|
||||
gLayout = new GlyphLayout(font, text2);
|
||||
text2Width = gLayout.width;
|
||||
} else {
|
||||
dupFirstText = true;
|
||||
this.text2 = text1;
|
||||
this.text2Width = text1Width;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user