diff --git a/bgw-gui/src/main/kotlin/tools/aqua/bgw/animation/Animation.kt b/bgw-gui/src/main/kotlin/tools/aqua/bgw/animation/Animation.kt index a573eefe67..14bea24879 100644 --- a/bgw-gui/src/main/kotlin/tools/aqua/bgw/animation/Animation.kt +++ b/bgw-gui/src/main/kotlin/tools/aqua/bgw/animation/Animation.kt @@ -30,6 +30,7 @@ sealed class Animation(val duration: Int) { /** [Boolean] indicating whether the [Animation] is currently running. */ var isRunning: Boolean = false + internal set /** Gets invoked when [Animation] has finished. */ var onFinished: ((AnimationFinishedEvent) -> Unit)? = null diff --git a/bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/AnimationBuilder.kt b/bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/AnimationBuilder.kt index 89aea12ead..623e1c2f0c 100644 --- a/bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/AnimationBuilder.kt +++ b/bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/AnimationBuilder.kt @@ -270,7 +270,7 @@ object AnimationBuilder { /** Removes [anim] from animations list and invokes [Animation.onFinished]. */ private fun onFinished(scene: Scene, anim: Animation) { - scene.animations.remove(anim) + scene.animations.remove(anim.also { it.isRunning = false }) Platform.runLater { anim.onFinished?.invoke(AnimationFinishedEvent()) } }