World wrap scrolling fix (#8903)

This commit is contained in:
Gualdimar 2023-03-15 08:37:09 +02:00 committed by GitHub
parent d3a419f8f8
commit 988f404ebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))