mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Option to disable max zoom limit (#8702)
* Option to disable max zoom limit * Reverted old flickering fix * Reworked * Removed redundant import * Added comment
This commit is contained in:
parent
f99c322319
commit
0b507422f0
@ -86,7 +86,7 @@ open class ZoomableScrollPane(
|
||||
onViewportChanged()
|
||||
}
|
||||
|
||||
public override fun sizeChanged() {
|
||||
override fun sizeChanged() {
|
||||
updatePadding()
|
||||
super.sizeChanged()
|
||||
updateCulling()
|
||||
|
@ -134,11 +134,6 @@ class MapEditorScreen(map: TileMap? = null): BaseScreen(), RecreateOnResize {
|
||||
tileClickHandler?.invoke(it)
|
||||
}
|
||||
|
||||
if (tileMap.mapParameters.worldWrap) {
|
||||
result.sizeChanged()
|
||||
result.zoom(result.minZoom)
|
||||
}
|
||||
|
||||
stage.root.addActorAt(0, result)
|
||||
stage.scrollFocus = result
|
||||
|
||||
|
@ -755,20 +755,23 @@ class WorldMapHolder(
|
||||
|
||||
override fun reloadMaxZoom()
|
||||
{
|
||||
if (continuousScrollingX) {
|
||||
// For world-wrap we do not allow viewport to become bigger than the map size,
|
||||
// because we don't want to render the same tiles multiple times (they will be
|
||||
// flickering because of movement).
|
||||
// Hence we limit minimal possible zoom to content width + some extra offset.
|
||||
val maxWorldZoomOut = UncivGame.Current.settings.maxWorldZoomOut
|
||||
val mapRadius = tileMap.mapParameters.mapSize.radius
|
||||
|
||||
val pad = width / tileMap.mapParameters.mapSize.radius * 0.7f
|
||||
// Limit max zoom out by the map width
|
||||
val enableZoomLimit = (mapRadius < 21 && maxWorldZoomOut < 3f) || (mapRadius > 20 && maxWorldZoomOut < 4f)
|
||||
|
||||
if (enableZoomLimit) {
|
||||
// For world-wrap we limit minimal possible zoom to content width + some extra offset
|
||||
// to hide one column of tiles so that the player doesn't see it teleporting from side to side
|
||||
val pad = if (continuousScrollingX) width / mapRadius * 0.7f else 0f
|
||||
minZoom = max(
|
||||
(width + pad) * scaleX / maxX,
|
||||
1f / UncivGame.Current.settings.maxWorldZoomOut
|
||||
1f / maxWorldZoomOut
|
||||
)// add some extra padding offset
|
||||
|
||||
// If the window becomes too wide and minZoom > maxZoom, we cannot zoom
|
||||
maxZoom = max(2f * minZoom, UncivGame.Current.settings.maxWorldZoomOut)
|
||||
maxZoom = max(2f * minZoom, maxWorldZoomOut)
|
||||
}
|
||||
else
|
||||
super.reloadMaxZoom()
|
||||
|
Loading…
Reference in New Issue
Block a user