Skip to content

Commit f61f298

Browse files
authored
Merge pull request #27 from Isvvc/master
Restore animation when releasing pinch
2 parents 87a7a1d + 6f55312 commit f61f298

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Sources/ImageViewer/ImageViewer.swift

+6-4
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,12 @@ class PinchZoomView: UIView {
206206
offset = CGSize(width: location.x - startLocation.x, height: location.y - startLocation.y)
207207

208208
case .ended, .cancelled, .failed:
209-
isPinching = false
210-
scale = 1.0
211-
anchor = .center
212-
offset = .zero
209+
withAnimation(.interactiveSpring()) {
210+
isPinching = false
211+
scale = 1.0
212+
anchor = .center
213+
offset = .zero
214+
}
213215
default:
214216
break
215217
}

Sources/ImageViewerRemote/ImageViewerRemote.swift

+6-4
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ class PinchZoomView: UIView {
229229
offset = CGSize(width: location.x - startLocation.x, height: location.y - startLocation.y)
230230

231231
case .ended, .cancelled, .failed:
232-
isPinching = false
233-
scale = 1.0
234-
anchor = .center
235-
offset = .zero
232+
withAnimation(.interactiveSpring()) {
233+
isPinching = false
234+
scale = 1.0
235+
anchor = .center
236+
offset = .zero
237+
}
236238
default:
237239
break
238240
}

0 commit comments

Comments
 (0)