Skip to content

Commit

Permalink
Fixing resizing of properties panel (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Siebeneicker authored Mar 1, 2021
1 parent de265b3 commit a47df44
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
10 changes: 8 additions & 2 deletions DelvEdit/src/com/interrupt/dungeoneer/editor/ui/EditorUi.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ public boolean handle(Event event) {

if(resetScroll) entityPropertiesPane.setScrollY(0f);

propertiesSize.set(propertiesMenu.getWidth(), propertiesMenu.getHeight());
resize(stage.getWidth(), stage.getHeight());
resize();

sidebarTable.setVisible(true);
}
Expand All @@ -435,6 +434,10 @@ else if(entityPropertiesPane != null) {
}
}

public void resize() {
resize(stage.getWidth(), stage.getHeight());
}

public void resize(float width, float height) {
viewport.setWorldSize(width, height);
viewport.update((int)width, (int)height, true);
Expand All @@ -444,6 +447,9 @@ public void resize(float width, float height) {
mainTable.pack();

if(entityPropertiesPane != null && propertiesMenu != null) {
propertiesSize.set(Math.min(propertiesMenu.getWidth(), stage.getWidth() * 0.25f),
propertiesMenu.getHeight());

boolean fillsStage = propertiesSize.y > stage.getHeight() - menuBar.getHeight();

entityPropertiesPane.setSize(propertiesSize.x + (fillsStage ? 60f : 30f), propertiesSize.y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,8 @@ public void applyChanges(final Field currentField, String val) {
for (Entity entity : selectedEntities) {
currentField.set(entity, Integer.parseInt(val));
}

updateSize();
}
}
catch(Exception ex) {
Expand All @@ -590,6 +592,8 @@ public void applyChanges(final Field currentField, Material val) {
for (Entity entity : selectedEntities) {
currentField.set(entity, new Material(val.texAtlas, val.tex));
}

updateSize();
}
}
catch(Exception ex) {
Expand Down Expand Up @@ -712,12 +716,19 @@ else if(currentField.getType() == Color.class) {
((ProjectedDecal) entity).refresh();
}
}

updateSize();
}
catch(Exception ex) {
Gdx.app.error("DelvEdit", ex.getMessage());
}
}

private void updateSize() {
pack();
Editor.app.ui.resize();
}

static public class DecimalsFilter implements TextField.TextFieldFilter {
@Override
public boolean acceptChar (TextField textField, char c) {
Expand Down

0 comments on commit a47df44

Please sign in to comment.