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 text1Width;
|
||||||
private float text2Width;
|
private float text2Width;
|
||||||
|
|
||||||
|
private boolean dupFirstText;
|
||||||
private boolean scrollOnHover;
|
private boolean scrollOnHover;
|
||||||
private boolean scroll;
|
private boolean scroll;
|
||||||
|
|
||||||
@ -104,13 +105,25 @@ public class ScrollText extends Widget {
|
|||||||
public void act(float delta) {
|
public void act(float delta) {
|
||||||
setSize(getWidth(), textHeight + 4);
|
setSize(getWidth(), textHeight + 4);
|
||||||
clipBounds.setSize(getWidth()-2, getHeight()*1.5f);
|
clipBounds.setSize(getWidth()-2, getHeight()*1.5f);
|
||||||
if (text1Width + text2Width > clipBounds.getWidth()) {
|
if (dupFirstText) {
|
||||||
if (scrollOnHover) {
|
if (text1Width > clipBounds.getWidth()) {
|
||||||
if (scroll || text1Offset < 0 || text1Offset > 2) {
|
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);
|
scroll(delta);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
scroll(delta);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
@ -179,6 +192,7 @@ public class ScrollText extends Widget {
|
|||||||
gLayout = new GlyphLayout(font, text2);
|
gLayout = new GlyphLayout(font, text2);
|
||||||
text2Width = gLayout.width;
|
text2Width = gLayout.width;
|
||||||
} else {
|
} else {
|
||||||
|
dupFirstText = true;
|
||||||
this.text2 = text1;
|
this.text2 = text1;
|
||||||
this.text2Width = text1Width;
|
this.text2Width = text1Width;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user