Keep progress in notification scroll when updating (#7447)

* Keep progress in notification scroll when resizing

* Don't use layout directly, as per docs
This commit is contained in:
Yair Morgenstern 2022-07-17 01:04:42 +03:00 committed by GitHub
parent c2ae9e3145
commit 59d7a81b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,6 @@
package com.unciv.ui.worldscreen
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Cell
import com.badlogic.gdx.scenes.scene2d.ui.Table
@ -51,8 +50,14 @@ class NotificationsScroll(
maxNotificationsHeight: Float,
tileInfoTableHeight: Float
) {
val previousScrollY = scrollY
updateContent(notifications)
updateLayout(maxNotificationsHeight, tileInfoTableHeight)
scrollY = previousScrollY
updateVisualScroll()
}
private fun updateContent(notifications: MutableList<Notification>) {