Skip to content

Commit

Permalink
[bgw-gui] Enabled animations for menu scenes (#397)
Browse files Browse the repository at this point in the history
* Animations also in MenuScenes

* codestyle refactoring
  • Loading branch information
abouzerda authored Nov 21, 2023
1 parent ce07f5e commit b818038
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions bgw-gui/src/main/kotlin/tools/aqua/bgw/builder/SceneBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b818038

Please sign in to comment.