Make FramePanel take into account title width

This commit is contained in:
DBotThePony 2025-02-25 12:02:00 +07:00
parent 59200b2baa
commit 06e2a97cfc
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -279,6 +279,11 @@ open class FramePanel<out S : Screen>(
protected val tabs: ArrayList<FramePanel<*>.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)