Skip to content

Commit

Permalink
Fix scrollbar being in wrong position on schem dialogs
Browse files Browse the repository at this point in the history
Previously, to reproduce: filter schematics such that only 1 or 2 rows remain, exit dialog and reenter. Requires schematic ui carry over to be enabled.
  • Loading branch information
zxtej committed Dec 28, 2024
1 parent 48d3abc commit dede7f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions core/src/mindustry/client/ui/SchematicBrowserDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,9 @@ public void setCullingArea(Rect cullingArea) {
var pane = cont.pane(t[0]).grow().scrollX(false).get();
if(Core.settings.getBool("schematicuicarryover") && this.pane != null){
float scroll = this.pane.getVisualScrollY();
Core.app.post(() -> {
pane.setScrollYForce(scroll);
pane.updateVisualScroll();
});
pane.invalidate();
pane.setScrollYForce(scroll);
pane.updateVisualScroll();
}
this.pane = pane;
}
Expand Down
7 changes: 3 additions & 4 deletions core/src/mindustry/ui/dialogs/SchematicsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,9 @@ public Element hit(float x, float y, boolean touchable){
}).grow().scrollX(false).get();
if(Core.settings.getBool("schematicuicarryover") && this.pane != null){
float scroll = this.pane.getVisualScrollY();
Core.app.post(() -> {
pane.setScrollYForce(scroll);
pane.updateVisualScroll();
});
pane.invalidate();
pane.setScrollYForce(scroll);
pane.updateVisualScroll();
}
this.pane = pane;
}
Expand Down

0 comments on commit dede7f7

Please sign in to comment.