mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
World wrap scrolling fix (#8903)
This commit is contained in:
parent
d3a419f8f8
commit
988f404ebc
@ -80,6 +80,17 @@ open class ZoomableScrollPane(
|
|||||||
onViewportChanged()
|
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) {
|
override fun scrollY(pixelsY: Float) {
|
||||||
super.scrollY(pixelsY)
|
super.scrollY(pixelsY)
|
||||||
updateCulling()
|
updateCulling()
|
||||||
@ -293,15 +304,6 @@ open class ZoomableScrollPane(
|
|||||||
scrollX = restrictX(deltaX)
|
scrollX = restrictX(deltaX)
|
||||||
scrollY = restrictY(deltaY)
|
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
|
//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))
|
if ((isScrollX && deltaX != 0f || isScrollY && deltaY != 0f))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user