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 d8360abcd..b18ff638d 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 @@ -925,10 +925,20 @@ open class EditablePanel @JvmOverloads constructor( if (isRemoved) return false - if (parent == null) - updateAbsolutePosition() + val potentiallyHovered: Boolean - if (mouseX in absoluteX ..< absoluteX + childrenRectWidth.coerceAtLeast(width) && mouseY in absoluteY ..< absoluteY + childrenRectHeight.coerceAtLeast(height)) { + if (parent == null) { + updateAbsolutePosition() + potentiallyHovered = + mouseX in absoluteX + childrenRectX.coerceAtMost(0f) ..< absoluteX + childrenRectWidth.coerceAtLeast(width) && + mouseY in absoluteY + childrenRectY.coerceAtMost(0f) ..< absoluteY + childrenRectHeight.coerceAtLeast(height) + } else { + potentiallyHovered = + mouseX in absoluteX ..< absoluteX + width && + mouseY in absoluteY ..< absoluteY + height + } + + if (potentiallyHovered) { var hit = false for (child in visibleChildrenInternal) {