mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Make map symmetrical if it's not wrapped (#4461)
This commit is contained in:
parent
5a0eb11bd0
commit
4c9e15c0ea
@ -120,9 +120,11 @@ class TileGroupMap<T: TileGroup>(tileGroups: Collection<T>, private val leftAndR
|
|||||||
|
|
||||||
// there are tiles "below the zero",
|
// there are tiles "below the zero",
|
||||||
// so we zero out the starting position of the whole board so they will be displayed as well
|
// 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.
|
// 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.Screen
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.GL20
|
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.BitmapFont
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage
|
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.get(SelectBox.SelectBoxStyle::class.java).listStyle.font = Fonts.font.apply { data.setScale(20 / Fonts.ORIGINAL_FONT_SIZE) }
|
||||||
skin
|
skin
|
||||||
}
|
}
|
||||||
internal var batch: Batch = SpriteBatch()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onBackButtonClicked(action: () -> Unit) {
|
fun onBackButtonClicked(action: () -> Unit) {
|
||||||
|
@ -11,10 +11,6 @@ open class ZoomableScrollPane: ScrollPane(null) {
|
|||||||
var continuousScrollingX = false
|
var continuousScrollingX = false
|
||||||
|
|
||||||
init{
|
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()
|
addZoomListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +26,10 @@ open class ZoomableScrollPane: ScrollPane(null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addZoomListeners() {
|
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() {
|
addListener(object : InputListener() {
|
||||||
override fun scrolled(event: InputEvent?, x: Float, y: Float, amountX: Float, amountY: Float): Boolean {
|
override fun scrolled(event: InputEvent?, x: Float, y: Float, amountX: Float, amountY: Float): Boolean {
|
||||||
if (amountX > 0 || amountY > 0) zoomOut()
|
if (amountX > 0 || amountY > 0) zoomOut()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user