Logic layout bugfixes

This commit is contained in:
Anuken
2021-02-09 12:10:15 -05:00
parent 77dc959e4a
commit 0d0aef3dea
5 changed files with 53 additions and 15 deletions

View File

@@ -62,10 +62,10 @@ public abstract class LStatement{
showSelectTable(b, (t, hide) -> {
ButtonGroup<Button> group = new ButtonGroup<>();
int i = 0;
t.defaults().size(56f, 40f);
t.defaults().size(60f, 38f);
for(T p : values){
sizer.get(t.button(p.toString(), Styles.clearTogglet, () -> {
sizer.get(t.button(p.toString(), Styles.logicTogglet, () -> {
getter.get(p);
hide.run();
}).checked(current == p).group(group));
@@ -80,7 +80,18 @@ public abstract class LStatement{
}
protected void showSelectTable(Button b, Cons2<Table, Runnable> hideCons){
Table t = new Table(Tex.button);
Table t = new Table(Tex.paneSolid){
@Override
public float getPrefHeight(){
return Math.min(super.getPrefHeight(), Core.graphics.getHeight());
}
@Override
public float getPrefWidth(){
return Math.min(super.getPrefWidth(), Core.graphics.getWidth());
}
};
t.margin(4);
//triggers events behind the element to simulate deselection
Element hitter = new Element();
@@ -110,13 +121,15 @@ public abstract class LStatement{
if(t.getWidth() > Core.scene.getWidth()) t.setWidth(Core.graphics.getWidth());
if(t.getHeight() > Core.scene.getHeight()) t.setHeight(Core.graphics.getHeight());
t.keepInStage();
t.invalidateHierarchy();
t.pack();
});
t.actions(Actions.alpha(0), Actions.fadeIn(0.3f, Interp.fade));
t.top().pane(inner -> {
inner.top();
hideCons.get(inner, hide);
}).top();
}).pad(0f).top().get().setScrollingDisabled(true, false);
t.pack();
}

View File

@@ -531,7 +531,7 @@ public class LStatements{
t.parent.parent.pack();
t.parent.parent.invalidateHierarchy();
}).size(80f, 50f).growX().checked(selected == fi).group(group);
}).height(50f).growX().checked(selected == fi).group(group);
}
t.row();
t.add(stack).colspan(3).width(240f).left();
@@ -610,11 +610,17 @@ public class LStatements{
//"function"-type operations have the name at the left and arguments on the right
if(op.func){
opButton(table);
field(table, a, str -> a = str);
field(table, b, str -> b = str);
if(LCanvas.useRows()){
table.left();
table.row();
table.table(c -> {
c.color.set(color());
c.left();
funcs(c);
}).colspan(2).left();
}else{
funcs(table);
}
}else{
field(table, a, str -> a = str);
@@ -625,6 +631,14 @@ public class LStatements{
}
}
void funcs(Table table){
opButton(table);
field(table, a, str -> a = str);
field(table, b, str -> b = str);
}
void opButton(Table table){
table.button(b -> {
b.label(() -> op.symbol);
@@ -632,7 +646,7 @@ public class LStatements{
op = o;
rebuild(table);
}));
}, Styles.logict, () -> {}).size(65f, 40f).pad(4f).color(table.color);
}, Styles.logict, () -> {}).size(64f, 40f).pad(4f).color(table.color);
}
@Override