Make center zoom start vertically centered too (#8849)

Update ReaderPageImageView.kt

"true center" Zoom start position #8747.
Changed zoom position to get true center value.
This commit is contained in:
RS156 2023-04-02 00:22:15 +05:30 committed by GitHub
parent c7d6509565
commit 274218cf22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
val point = when (config!!.zoomStartPosition) { val point = when (config!!.zoomStartPosition) {
ZoomStartPosition.LEFT -> if (forward) PointF(0F, 0F) else PointF(sWidth.toFloat(), 0F) ZoomStartPosition.LEFT -> if (forward) PointF(0F, 0F) else PointF(sWidth.toFloat(), 0F)
ZoomStartPosition.RIGHT -> if (forward) PointF(sWidth.toFloat(), 0F) else PointF(0F, 0F) ZoomStartPosition.RIGHT -> if (forward) PointF(sWidth.toFloat(), 0F) else PointF(0F, 0F)
ZoomStartPosition.CENTER -> center.also { it?.y = 0F } ZoomStartPosition.CENTER -> center
} }
val targetScale = height.toFloat() / sHeight.toFloat() val targetScale = height.toFloat() / sHeight.toFloat()
@ -249,7 +249,7 @@ open class ReaderPageImageView @JvmOverloads constructor(
when (config?.zoomStartPosition) { when (config?.zoomStartPosition) {
ZoomStartPosition.LEFT -> setScaleAndCenter(scale, PointF(0F, 0F)) ZoomStartPosition.LEFT -> setScaleAndCenter(scale, PointF(0F, 0F))
ZoomStartPosition.RIGHT -> setScaleAndCenter(scale, PointF(sWidth.toFloat(), 0F)) ZoomStartPosition.RIGHT -> setScaleAndCenter(scale, PointF(sWidth.toFloat(), 0F))
ZoomStartPosition.CENTER -> setScaleAndCenter(scale, center.also { it?.y = 0F }) ZoomStartPosition.CENTER -> setScaleAndCenter(scale, center)
null -> {} null -> {}
} }
} }