From 199b0c16ecfb4286824526595760c3912e3313fc Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 26 Feb 2019 20:23:07 +0200 Subject: [PATCH] World map properly padded Fixed super weird error which I have no idea how it entered the code??? --- core/src/com/unciv/ui/worldscreen/TileMapHolder.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt index c1330cb02b..091c032701 100644 --- a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt @@ -37,7 +37,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: for(tileGroup in daTileGroups) tileGroups[tileGroup.tileInfo]=tileGroup - val allTiles = TileGroupMap(daTileGroups,600f) + val allTiles = TileGroupMap(daTileGroups,worldScreen.stage.width) for(tileGroup in tileGroups.values){ tileGroup.onClick{ onTileClicked(tileGroup.tileInfo)} @@ -123,7 +123,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: moveHereButton.onClick(""){onMoveButtonClick(dto)} else moveHereButton.color.a = 0.5f - addOverlayOnTileGroup(tileGroup, moveHereButton).apply { width = size; height = size } + addOverlayOnTileGroup(tileGroup, moveHereButton) moveHereButton.y += tileGroup.height moveToOverlay = moveHereButton } @@ -252,12 +252,12 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: val originalScrollX = scrollX val originalScrollY = scrollY - // We want to center on the middle of TG (TG.getX()+TG.getWidth()/2) - // and so the scroll position (== filter the screen starts) needs to be half a screen away - val finalScrollX = tileGroup.x + tileGroup.width / 2 - worldScreen.stage.width / 2 + // We want to center on the middle of the tilegroup (TG.getX()+TG.getWidth()/2) + // and so the scroll position (== filter the screen starts) needs to be half the ScrollMap away + val finalScrollX = tileGroup.x + tileGroup.width / 2 - width / 2 // Here it's the same, only the Y axis is inverted - when at 0 we're at the top, not bottom - so we invert it back. - val finalScrollY = maxY - (tileGroup.y + tileGroup.width / 2 - worldScreen.stage.height / 2) + val finalScrollY = maxY - (tileGroup.y + tileGroup.width / 2 - height / 2) addAction(object : FloatAction(0f,1f,0.4f){ override fun update(percent: Float) {