use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.Interpol in project skin-composer by raeleus.
the class GeneralListeners method interpolationListener.
public static PopTableClickListener interpolationListener(final DialogSceneComposer dialogSceneComposer, InterpolationSelected interpolationSelected) {
var graphDrawerDrawables = new Array<GraphDrawerDrawable>();
var table = new Table();
var scrollPane = new ScrollPane(table, skin, "scene");
var listener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ESCAPE, popTable::hide);
}
@Override
public void tableShown(Event event) {
dialogSceneComposer.getStage().setScrollFocus(scrollPane);
for (var graphDrawerDrawable : graphDrawerDrawables) {
graphDrawerDrawable.setColor(Color.BLACK);
}
}
@Override
public void tableHidden(Event event) {
for (var graphDrawerDrawable : graphDrawerDrawables) {
graphDrawerDrawable.setColor(Color.CLEAR);
}
}
};
var popTable = listener.getPopTable();
scrollPane.setFadeScrollBars(false);
popTable.add(scrollPane);
table.defaults().space(5);
for (Interpol interpol : Interpol.values()) {
var button = new Button(skin, "scene-med");
table.add(button).growX();
var stack = new Stack();
button.add(stack).size(50);
var image = new Image(skin.getDrawable("white"));
stack.add(image);
var graphDrawerDrawable = new GraphDrawerDrawable(graphDrawer);
graphDrawerDrawable.setColor(Color.BLACK);
graphDrawerDrawable.setInterpolation(interpol.interpolation);
graphDrawerDrawable.setSamples(10);
graphDrawerDrawables.add(graphDrawerDrawable);
image = new Image(graphDrawerDrawable);
var container = new Container(image);
container.pad(5).fill();
stack.add(container);
var label = new Label(interpol.toString(), skin, "scene-label");
button.add(label).expandX().left().space(5);
button.addListener(handListener);
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
popTable.hide();
interpolationSelected.selected(interpol);
}
});
table.row();
}
dialogSceneComposer.getStage().setScrollFocus(scrollPane);
return listener;
}
Aggregations