diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index d42c5c304e..13f80fb71c 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -152,7 +152,7 @@ class UncivGame( // Maybe this will solve the resume error on chrome OS, issue 322? Worth a shot override fun resize(width: Int, height: Int) { - resume() + screen.resize(width, height) } override fun dispose() { diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt b/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt index 90651574ad..2f63a25fb9 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorScreen.kt @@ -23,15 +23,15 @@ class MapEditorScreen(): CameraStageBaseScreen() { private val showHideEditorOptionsButton = ">".toTextButton() - constructor(mapNameToLoad: String?): this() { + constructor(mapNameToLoad: String?) : this() { var mapToLoad = mapNameToLoad if (mapToLoad == null) { val existingSaves = MapSaver.getMaps() - if(existingSaves.isNotEmpty()) + if (existingSaves.isNotEmpty()) mapToLoad = existingSaves.first() } - if(mapToLoad != null){ + if (mapToLoad != null) { mapName = mapToLoad tileMap = MapSaver.loadMap(mapName) } @@ -39,7 +39,7 @@ class MapEditorScreen(): CameraStageBaseScreen() { initialize() } - constructor(map: TileMap): this() { + constructor(map: TileMap) : this() { tileMap = map initialize() } @@ -73,7 +73,7 @@ class MapEditorScreen(): CameraStageBaseScreen() { val optionsMenuButton = "Menu".toTextButton() optionsMenuButton.onClick { - if(popups.any { it is MapEditorMenuPopup }) + if (popups.any { it is MapEditorMenuPopup }) return@onClick // already open MapEditorMenuPopup(this).open(force = true) } @@ -84,7 +84,7 @@ class MapEditorScreen(): CameraStageBaseScreen() { optionsMenuButton.y = 30f stage.addActor(optionsMenuButton) - mapHolder.addCaptureListener(object: InputListener() { + mapHolder.addCaptureListener(object : InputListener() { var isDragging = false var isPainting = false var touchDownTime = System.currentTimeMillis() @@ -141,6 +141,12 @@ class MapEditorScreen(): CameraStageBaseScreen() { } }) } + + override fun resize(width: Int, height: Int) { + if (stage.viewport.screenWidth != width || stage.viewport.screenHeight != height) { + game.setScreen(MapEditorScreen(mapHolder.tileMap)) + } + } } diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 780195a302..3f6fbb7969 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -572,7 +572,6 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { override fun resize(width: Int, height: Int) { if (stage.viewport.screenWidth != width || stage.viewport.screenHeight != height) { - super.resize(width, height) game.worldScreen = WorldScreen(viewingCiv) // start over. game.setWorldScreen() }