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 86afe67c9..247ec9b5e 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 @@ -382,11 +382,15 @@ open class EditablePanel @JvmOverloads constructor( absoluteX = x absoluteY = y } else { - isHovered = parent.isHovered && - mouseX >= absoluteX && - mouseX < absoluteX + width && - mouseY >= absoluteY && - mouseY < absoluteY + height + if (x < 0f || y < 0f || x + width > parent.width || y + height > parent.height) { + // no op - we updated ourselves in tickHover + } else { + isHovered = parent.isHovered && + mouseX >= absoluteX && + mouseX < absoluteX + width && + mouseY >= absoluteY && + mouseY < absoluteY + height + } } val scissor = this.scissor @@ -426,6 +430,23 @@ open class EditablePanel @JvmOverloads constructor( } open fun tickHover(mouse_x: Float, mouse_y: Float): Boolean { + if (boundingHeight > height || boundingWidth > width || boundingX < 0 || boundingY < 0) { + var hit = false + + for (child in children) { + if (child.tickHover(mouse_x, mouse_y)) { + hit = true + } + } + + isHovered = mouse_x >= absoluteX && + mouse_x <= absoluteX + width && + mouse_y >= absoluteY && + mouse_y <= absoluteY + height + + return hit + } + isHovered = mouse_x >= absoluteX && mouse_x <= absoluteX + width &&