Fix window flashing being eternal

This commit is contained in:
DBotThePony 2023-03-08 17:11:31 +07:00
parent b37df1c347
commit 33aadb2487
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -334,22 +334,29 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
private set
var isFlashing: Boolean
get() = (flashingSince?.seconds ?: Long.MAX_VALUE) <= 1
get() {
if (flashingSince == null) {
return false
}
if (flashingSince!!.millis >= 1200L) {
flashingSince = null
return false
}
return true
}
set(value) {
if (value) {
flashingSince = SystemTime()
popup()
} else {
flashingSince = null
}
}
fun flash() {
isFlashing = true
popup()
}
val isFlashFrame: Boolean
get() = flashingSince != null && flashingSince!!.millis % 400L <= 200L
get() = isFlashing && flashingSince!!.millis % 400L <= 200L
val isFlashFrameRecursive: Boolean
get() {
@ -375,7 +382,7 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
if (blockingWindow != null) {
if (doFlash) {
blockingWindow.flash()
blockingWindow.isFlashing = true
}
return true
@ -404,7 +411,7 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
}
if (doFlash) {
blockingWindow.flash()
blockingWindow.isFlashing = true
}
return true
@ -1566,6 +1573,8 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
for (child in Array(visibleChildrenInternal.size) { visibleChildrenInternal[it] }) {
child.tick()
}
}
var isRemoved = false