-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScrollPane offsets widget by bar size #2777
Labels
Comments
Can you please edit scroll pane test to show the problem? |
badlogic
added
bug
need more info
needs more info. Likely to be closed when no reaction given.
labels
Feb 2, 2015
I didn't get the package com.badlogic.gdx.tests;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable;
import com.badlogic.gdx.utils.viewport.ExtendViewport;
public class ScrollPaneTest extends GdxTest implements Screen {
private Stage stage;
public ScrollPaneTest() {
stage = new Stage(new ExtendViewport(320, 568, 568, 0));
Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
Table table = new Table(skin);
table.setFillParent(true);
stage.addActor(table);
// achievement list
VerticalGroup achievements = new VerticalGroup();
achievements.fill();
for(int i = 0; i < 10; i++) {
String name;
switch(i) {
case 0:
name = "Warming Up: Played 5 times";
break;
case 1:
name = "Committed: Played 10 minutes";
break;
case 2:
name = "One Good Deed A Day: Donated $1 to charity!";
break;
default:
name = "-";
}
Label label = new Label(String.valueOf(i + 1).concat(". ").concat(name), skin);
Image medal = new Image(new BaseDrawable() {{
setMinWidth(25);
setMinHeight(25);
}});
Table inner = new Table();
inner.add(label).expand().left();
inner.add(medal);
achievements.addActor(inner);
}
ScrollPane achievementsPane = new ScrollPane(achievements, skin);
// GPGS button
TextButton gpgs = new TextButton("GPGS", skin);
// dare button
TextButton dare = new TextButton("Dare!", skin);
// build table
table.add("Achievements").top().pad(10).colspan(2).row();
table.add(achievementsPane).expand().fill().colspan(2).row();
table.add(gpgs);
table.add(dare);
}
@Override
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act();
stage.draw();
}
@Override
public void resize (int width, int height) {
stage.getViewport().update(width, height, true);
}
@Override
public void dispose () {
stage.dispose();
}
public boolean needsGL20 () {
return false;
}
// if used as screen
@Override
public void show() {
create();
}
@Override
public void render(float delta) {
render();
}
@Override
public void hide() {}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
This bug was introduced in 1.5.3. Here's a comparision between 1.5.2 (left) and 1.5.3 (right):
The bar for scrolling on x is not currently visible but notice the widget is offset by its height in 1.5.3.
I believe this commit introduced the problem. Since this commit
scrollbarHeight
is only subtracted fromareaHeight
if scrolling on both axes is enabled which in my picture is not the case. Undoing the changes toScrollPane
in this commit should fix the issue.The text was updated successfully, but these errors were encountered: