fix some degree overflowing

This commit is contained in:
tibbi 2019-02-06 23:28:36 +01:00
parent 17e2e5ccfa
commit 53ac373272
1 changed files with 2 additions and 2 deletions

View File

@ -454,7 +454,7 @@ class PhotoFragment : ViewPagerFragment() {
maxScale = 10f
beVisible()
isOneToOneZoomEnabled = config.allowOneToOneZoom
orientation = rotation + mCurrentRotationDegrees
orientation = (rotation + mCurrentRotationDegrees) % 360
setImage(path)
onImageEventListener = object : SubsamplingScaleImageView.OnImageEventListener {
override fun onReady() {
@ -473,7 +473,7 @@ class PhotoFragment : ViewPagerFragment() {
override fun onImageRotation(degrees: Int) {
if (mCurrentRotationDegrees != degrees) {
val fullRotation = rotation + degrees
val fullRotation = (rotation + degrees) % 360
val useWidth = if (fullRotation == 90 || fullRotation == 270) sHeight else sWidth
val useHeight = if (fullRotation == 90 || fullRotation == 270) sWidth else sHeight
doubleTapZoomScale = getDoubleTapZoomScale(useWidth, useHeight)