From 1f9719ceab8af08a15e2f274ae390293883ba37c Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Mon, 17 Feb 2025 19:47:54 +0700 Subject: [PATCH] Don't decide whenever widen device controls panel before parent properly determines its dimensions --- .../dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt index e47742a7d..71295e837 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/button/Buttons.kt @@ -353,8 +353,10 @@ class DeviceControls>( var totalWidth = 0f var totalHeight = 0f + val parent = parent!! + for (button in buttons) { - if (y != 0f && button.height + y > parent!!.height) { + if (y != 0f && button.height + y > parent.height && (parent.dock == Dock.NONE || !parent.layoutInvalidated)) { totalHeight = totalHeight.coerceAtLeast(y - 2f) y = 0f x += currentWidth + 2f