mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-03 22:22:51 +07:00
World wrap scrolling fix (#8903)
This commit is contained in:
parent
d3a419f8f8
commit
988f404ebc
@ -80,6 +80,17 @@ open class ZoomableScrollPane(
|
||||
onViewportChanged()
|
||||
}
|
||||
|
||||
override fun setScrollX(pixels: Float) {
|
||||
var result = pixels
|
||||
|
||||
if (continuousScrollingX) {
|
||||
if (result < 0f) result += maxX
|
||||
else if (result > maxX) result -= maxX
|
||||
}
|
||||
|
||||
super.setScrollX(result)
|
||||
}
|
||||
|
||||
override fun scrollY(pixelsY: Float) {
|
||||
super.scrollY(pixelsY)
|
||||
updateCulling()
|
||||
@ -293,15 +304,6 @@ open class ZoomableScrollPane(
|
||||
scrollX = restrictX(deltaX)
|
||||
scrollY = restrictY(deltaY)
|
||||
|
||||
when {
|
||||
continuousScrollingX && scrollPercentX >= 1 && deltaX < 0 -> {
|
||||
scrollPercentX = 0f
|
||||
}
|
||||
continuousScrollingX && scrollPercentX <= 0 && deltaX > 0-> {
|
||||
scrollPercentX = 1f
|
||||
}
|
||||
}
|
||||
|
||||
//clamp() call is missing here but it doesn't seem to make any big difference in this case
|
||||
|
||||
if ((isScrollX && deltaX != 0f || isScrollY && deltaY != 0f))
|
||||
|
Loading…
Reference in New Issue
Block a user