Fix double hover

This commit is contained in:
DBotThePony 2022-01-02 13:08:23 +07:00
parent a0450a9e39
commit ead57e567d
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -273,9 +273,9 @@ open class EditablePanel @JvmOverloads constructor(
} else { } else {
isHovered = parent.isHovered && isHovered = parent.isHovered &&
mouse_x >= absoluteX && mouse_x >= absoluteX &&
mouse_x <= absoluteX + width && mouse_x < absoluteX + width &&
mouse_y >= absoluteY && mouse_y >= absoluteY &&
mouse_y <= absoluteY + height mouse_y < absoluteY + height
} }
val scissor = this.scissor val scissor = this.scissor
@ -681,12 +681,12 @@ open class EditablePanel @JvmOverloads constructor(
fun withinBounds(mouse_x: Double, mouse_y: Double): Boolean { fun withinBounds(mouse_x: Double, mouse_y: Double): Boolean {
val pos: ScreenPos = localToScreen() 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 { fun withinExtendedBounds(mouse_x: Double, mouse_y: Double): Boolean {
val pos: ScreenPos = localToScreen(boundingX, boundingY) 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 { final override fun mouseClicked(mouse_x: Double, mouse_y: Double, flag: Int): Boolean {