mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-20 20:59:18 +07:00
Make map symmetrical if it's not wrapped (#4461)
This commit is contained in:
@ -120,9 +120,11 @@ class TileGroupMap<T: TileGroup>(tileGroups: Collection<T>, private val leftAndR
|
||||
|
||||
// there are tiles "below the zero",
|
||||
// so we zero out the starting position of the whole board so they will be displayed as well
|
||||
// The width has to be lowered by groupSize because wrapped maps are missing a tile on the right.
|
||||
// Map's width is reduced by groupSize if it is wrapped, because wrapped map will miss a tile on the right.
|
||||
// This ensures that wrapped maps have a smooth transition.
|
||||
setSize(topX - bottomX + leftAndRightPadding * 2 - groupSize, topY - bottomY + topAndBottomPadding * 2)
|
||||
// If map is not wrapped, Map's width doesn't need to be reduce by groupSize
|
||||
if (worldWrap) setSize(topX - bottomX + leftAndRightPadding * 2 - groupSize, topY - bottomY + topAndBottomPadding * 2)
|
||||
else setSize(topX - bottomX + leftAndRightPadding * 2, topY - bottomY + topAndBottomPadding * 2)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,6 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Screen
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage
|
||||
@ -96,7 +95,6 @@ open class CameraStageBaseScreen : Screen {
|
||||
skin.get(SelectBox.SelectBoxStyle::class.java).listStyle.font = Fonts.font.apply { data.setScale(20 / Fonts.ORIGINAL_FONT_SIZE) }
|
||||
skin
|
||||
}
|
||||
internal var batch: Batch = SpriteBatch()
|
||||
}
|
||||
|
||||
fun onBackButtonClicked(action: () -> Unit) {
|
||||
|
@ -11,10 +11,6 @@ open class ZoomableScrollPane: ScrollPane(null) {
|
||||
var continuousScrollingX = false
|
||||
|
||||
init{
|
||||
// Remove the existing inputListener
|
||||
// which defines that mouse scroll = vertical movement
|
||||
val zoomListener = listeners.last { it is InputListener && it !in captureListeners }
|
||||
removeListener(zoomListener)
|
||||
addZoomListeners()
|
||||
}
|
||||
|
||||
@ -30,7 +26,10 @@ open class ZoomableScrollPane: ScrollPane(null) {
|
||||
}
|
||||
|
||||
private fun addZoomListeners() {
|
||||
|
||||
// At first, Remove the existing inputListener
|
||||
// which defines that mouse scroll = vertical movement
|
||||
val zoomListener = listeners.last { it is InputListener && it !in captureListeners }
|
||||
removeListener(zoomListener)
|
||||
addListener(object : InputListener() {
|
||||
override fun scrolled(event: InputEvent?, x: Float, y: Float, amountX: Float, amountY: Float): Boolean {
|
||||
if (amountX > 0 || amountY > 0) zoomOut()
|
||||
|
Reference in New Issue
Block a user