Fix root frame children outside frame bounds not receiving isHovered flag

This commit is contained in:
DBotThePony 2023-08-20 20:35:20 +07:00
parent f26e336785
commit 464e1aa579
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -925,10 +925,20 @@ open class EditablePanel<out S : Screen> @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) {