From ead57e567d862c527078a6bb54d8ae6052c47102 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 2 Jan 2022 13:08:23 +0700 Subject: [PATCH] Fix double hover --- .../mc/otm/client/screen/panels/EditablePanel.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 f9c572cd5..a9dcc6a74 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 @@ -273,9 +273,9 @@ open class EditablePanel @JvmOverloads constructor( } else { isHovered = parent.isHovered && mouse_x >= absoluteX && - mouse_x <= absoluteX + width && + mouse_x < absoluteX + width && mouse_y >= absoluteY && - mouse_y <= absoluteY + height + mouse_y < absoluteY + height } val scissor = this.scissor @@ -681,12 +681,12 @@ open class EditablePanel @JvmOverloads constructor( fun withinBounds(mouse_x: Double, mouse_y: Double): Boolean { val pos: ScreenPos = localToScreen() - return pos.x <= mouse_x && pos.x + width >= mouse_x && pos.y <= mouse_y && pos.y + height >= mouse_y + return pos.x <= mouse_x && pos.x + width > mouse_x && pos.y <= mouse_y && pos.y + height > mouse_y } fun withinExtendedBounds(mouse_x: Double, mouse_y: Double): Boolean { val pos: ScreenPos = localToScreen(boundingX, boundingY) - return pos.x <= mouse_x && pos.x + boundingWidth >= mouse_x && pos.y <= mouse_y && pos.y + boundingHeight >= mouse_y + return pos.x <= mouse_x && pos.x + boundingWidth > mouse_x && pos.y <= mouse_y && pos.y + boundingHeight > mouse_y } final override fun mouseClicked(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {