From 53ac3732720177f6922c66420f066e66fd092ab4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 6 Feb 2019 23:28:36 +0100 Subject: [PATCH] fix some degree overflowing --- .../simplemobiletools/gallery/pro/fragments/PhotoFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 678688f88..bef05133e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -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)