mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04: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()
|
onViewportChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun sizeChanged() {
|
override fun sizeChanged() {
|
||||||
updatePadding()
|
updatePadding()
|
||||||
super.sizeChanged()
|
super.sizeChanged()
|
||||||
updateCulling()
|
updateCulling()
|
||||||
|
@ -134,11 +134,6 @@ class MapEditorScreen(map: TileMap? = null): BaseScreen(), RecreateOnResize {
|
|||||||
tileClickHandler?.invoke(it)
|
tileClickHandler?.invoke(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tileMap.mapParameters.worldWrap) {
|
|
||||||
result.sizeChanged()
|
|
||||||
result.zoom(result.minZoom)
|
|
||||||
}
|
|
||||||
|
|
||||||
stage.root.addActorAt(0, result)
|
stage.root.addActorAt(0, result)
|
||||||
stage.scrollFocus = result
|
stage.scrollFocus = result
|
||||||
|
|
||||||
|
@ -755,20 +755,23 @@ class WorldMapHolder(
|
|||||||
|
|
||||||
override fun reloadMaxZoom()
|
override fun reloadMaxZoom()
|
||||||
{
|
{
|
||||||
if (continuousScrollingX) {
|
val maxWorldZoomOut = UncivGame.Current.settings.maxWorldZoomOut
|
||||||
// For world-wrap we do not allow viewport to become bigger than the map size,
|
val mapRadius = tileMap.mapParameters.mapSize.radius
|
||||||
// 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 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(
|
minZoom = max(
|
||||||
(width + pad) * scaleX / maxX,
|
(width + pad) * scaleX / maxX,
|
||||||
1f / UncivGame.Current.settings.maxWorldZoomOut
|
1f / maxWorldZoomOut
|
||||||
)// add some extra padding offset
|
)// add some extra padding offset
|
||||||
|
|
||||||
// If the window becomes too wide and minZoom > maxZoom, we cannot zoom
|
// 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
|
else
|
||||||
super.reloadMaxZoom()
|
super.reloadMaxZoom()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user