Skip to content

Commit 4d57ed3

Browse files
Persisting rotation on resetToValidBounds
This implementation doesn't perfectly make sure all parts of the image are within bounds because it doesn't take into account how the "bounds" rectangle expands due to the corners rotating around. However, it is a much more intuitive UX than having the rotation completely reset on every move.
1 parent 98a2978 commit 4d57ed3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

image/src/main/java/com/smarttoolfactory/image/zoom/EnhancedZoomStateImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ open class BaseEnhancedZoomState constructor(
212212
val zoom = zoom.coerceAtLeast(1f)
213213
val bounds = getBounds()
214214
val pan = pan.coerceIn(-bounds.x..bounds.x, -bounds.y..bounds.y)
215-
resetWithAnimation(pan = pan, zoom = zoom)
215+
resetWithAnimation(pan = pan, zoom = zoom, rotation = rotation)
216216
resetTracking()
217217
}
218218

0 commit comments

Comments
 (0)