diff --git a/bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/SceneBuilder.kt b/bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/SceneBuilder.kt index 2ab3773161..a7783c094b 100644 --- a/bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/SceneBuilder.kt +++ b/bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/SceneBuilder.kt @@ -49,16 +49,6 @@ object SceneBuilder { pane.setOnMouseDragged { scene.onMouseDragged(it) } pane.setOnMouseReleased { scene.onMouseReleased(it) } - // register animations - scene.animations.guiListener = { _, _ -> - scene.animations - .filter { t -> !t.isRunning } - .forEach { anim -> - AnimationBuilder.build(scene, anim).play() - anim.isRunning = true - } - } - // register lock pane @Suppress("DuplicatedCode", "DuplicatedCode") val lockPane = @@ -88,6 +78,15 @@ object SceneBuilder { /** Builds a [Scene] pane. */ private fun buildPane(scene: Scene<*>): Pane { + // register animations + scene.animations.guiListener = { _, _ -> + scene.animations + .filter { t -> !t.isRunning } + .forEach { anim -> + AnimationBuilder.build(scene, anim).play() + anim.isRunning = true + } + } val pane = Pane().apply { prefHeight = scene.height