From cbeac8e995a40b10d2dcb2c1a28b27152a3d32b0 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 29 Jan 2025 15:08:54 -0500 Subject: [PATCH] Fixed mobile menu layout issues --- .../mindustry/ui/fragments/HudFragment.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/ui/fragments/HudFragment.java b/core/src/mindustry/ui/fragments/HudFragment.java index 87733e627c..0b414e59d4 100644 --- a/core/src/mindustry/ui/fragments/HudFragment.java +++ b/core/src/mindustry/ui/fragments/HudFragment.java @@ -290,8 +290,19 @@ public class HudFragment{ Table wavesMain, editorMain; - cont.stack(wavesMain = new Table(), editorMain = new Table()).height(wavesMain.getPrefHeight()) - .name("waves/editor"); + cont.stack(wavesMain = new Table(), editorMain = new Table(), new Element(){ + //this may seem insane, but adding an empty element of a specific height to this stack fixes layout issues on mobile. + + { + visible = false; + touchable = Touchable.disabled; + } + + @Override + public float getPrefHeight(){ + return Scl.scl(120f); + } + }).name("waves/editor"); wavesMain.visible(() -> shown && !state.isEditor()); wavesMain.top().left().name = "waves"; @@ -342,11 +353,7 @@ public class HudFragment{ .size(45f).update(m -> m.getStyle().imageUp = (Core.settings.getBool("editor-blocks-shown") ? Icon.upOpen : Icon.downOpen)); }).top().left().row(); - t.collapser(blocks -> { - addBlockSelection(blocks); - }, () -> Core.settings.getBool("editor-blocks-shown")); - - + t.collapser(this::addBlockSelection, () -> Core.settings.getBool("editor-blocks-shown")); }).width(dsize * 5 + 4f).top(); if(mobile){