Fix longpress triggering when an onClick discards its actor (#10052)

This commit is contained in:
SomeTroglodyte 2023-09-05 18:02:27 +02:00 committed by GitHub
parent eec3732c96
commit 5bccc4abf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,8 @@ class ActivationListener : ActorGestureListener(20f, 0.25f, 1.1f, Int.MAX_VALUE.
override fun longPress(actor: Actor?, x: Float, y: Float): Boolean {
if (actor == null) return false
// See #10050 - when a tap discards its actor or ascendants, Gdx can't cancel the longpress timer
if (actor.stage == null) return false
return actor.activate(ActivationTypes.Longpress)
}
}