From 59d7a81b26d049b89515c0a5cf8187e61309e268 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 17 Jul 2022 01:04:42 +0300 Subject: [PATCH] Keep progress in notification scroll when updating (#7447) * Keep progress in notification scroll when resizing * Don't use layout directly, as per docs --- core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt b/core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt index 44f9c13ace..c31dc4a3b4 100644 --- a/core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt +++ b/core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt @@ -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) {