Skip to content

Commit aeda1b6

Browse files
clear ZoomState
1 parent c069110 commit aeda1b6

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

  • image/src/main/java/com/smarttoolfactory/image/zoom

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,7 @@ open class ZoomState internal constructor(
206206
gestureZoom: Float,
207207
gestureRotate: Float = 1f,
208208
) {
209-
var zoom = zoom
210-
211-
val boundPan = limitPan && !rotationEnabled
212-
209+
val zoom = (zoom * gestureZoom).coerceIn(zoomMin, zoomMax)
213210
val rotation = if (rotationEnabled) {
214211
rotation + gestureRotate
215212
} else {
@@ -219,6 +216,7 @@ open class ZoomState internal constructor(
219216
if (panEnabled) {
220217
val offset = pan
221218
var newOffset = offset + gesturePan.times(zoom)
219+
val boundPan = limitPan && !rotationEnabled
222220

223221
if (boundPan) {
224222
val maxX = (size.width * (zoom - 1) / 2f)
@@ -234,7 +232,6 @@ open class ZoomState internal constructor(
234232
}
235233

236234
if (zoomEnabled) {
237-
zoom = (zoom * gestureZoom).coerceIn(zoomMin, zoomMax)
238235
snapZoomTo(zoom)
239236
}
240237

0 commit comments

Comments
 (0)