From dede7f7f4957a3fb7ec8431b1479f1aaf9dccc45 Mon Sep 17 00:00:00 2001 From: zxtej <83355748+zxtej@users.noreply.github.com> Date: Sat, 28 Dec 2024 16:27:12 +0000 Subject: [PATCH] Fix scrollbar being in wrong position on schem dialogs 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. --- core/src/mindustry/client/ui/SchematicBrowserDialog.java | 7 +++---- core/src/mindustry/ui/dialogs/SchematicsDialog.java | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/client/ui/SchematicBrowserDialog.java b/core/src/mindustry/client/ui/SchematicBrowserDialog.java index 9af0c87e69..414b7e9dd4 100644 --- a/core/src/mindustry/client/ui/SchematicBrowserDialog.java +++ b/core/src/mindustry/client/ui/SchematicBrowserDialog.java @@ -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; } diff --git a/core/src/mindustry/ui/dialogs/SchematicsDialog.java b/core/src/mindustry/ui/dialogs/SchematicsDialog.java index 507ad444cd..5331c16002 100644 --- a/core/src/mindustry/ui/dialogs/SchematicsDialog.java +++ b/core/src/mindustry/ui/dialogs/SchematicsDialog.java @@ -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; }