From dd3a08f47dcfebcf111105bbac11198da23ee347 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 13 Feb 2025 20:56:18 +0700 Subject: [PATCH] Fix sizeToContents not working properly when childrens are not docked --- .../mc/otm/client/screen/panels/EditablePanel.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt index 4b998974c..182de36ea 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/screen/panels/EditablePanel.kt @@ -1404,7 +1404,14 @@ open class EditablePanel( for (child in visibleChildrenInternal) { when (child.dock) { - Dock.NONE, Dock.FILL -> {} // do nothing + Dock.NONE -> { + width = maxOf(width, child.x + child.width) + height = maxOf(height, child.y + child.height) + } + + Dock.FILL -> { + throw RuntimeException() + } // do nothing Dock.LEFT, Dock.RIGHT -> { if (previousDock != 1) {