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