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