From 06e2a97cfc067eaa334d6b6b5c4cb9df09aba3a5 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 25 Feb 2025 12:02:00 +0700 Subject: [PATCH] Make FramePanel take into account title width --- .../ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt index 6a262ab8f..ffd174fd4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/FramePanel.kt @@ -279,6 +279,11 @@ open class FramePanel( protected val tabs: ArrayList.AbstractTab> = ArrayList() + override fun sizeToContents() { + super.sizeToContents() + width = maxOf(width, dockPaddingLeft + dockPaddingRight + (helpButton?.width ?: 0f) + (closeButton?.width ?: 0f) + (title?.let { font.width(it).toFloat() } ?: 0f)) + } + override fun performLayout() { for ((i, tab) in tabs.withIndex()) { tab.setPos(i * 28f, -28f)