File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ public struct ImageViewer: View {
8484 }
8585 . onEnded { value in
8686 if ( ( abs ( self . dragOffset. height) + abs( self . dragOffset. width) > 570 ) || ( ( abs ( self . dragOffsetPredicted. height) ) / ( abs ( self . dragOffset. height) ) > 3 ) || ( ( abs ( self . dragOffsetPredicted. width) ) / ( abs ( self . dragOffset. width) ) ) > 3 ) {
87+ withAnimation ( . spring( ) ) {
88+ self . dragOffset = self . dragOffsetPredicted
89+ }
8790 self . viewerShown = false
8891
8992 return
Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ public struct ImageViewerRemote: View {
7676 }
7777 . onEnded { value in
7878 if ( ( abs ( self . dragOffset. height) + abs( self . dragOffset. width) > 570 ) || ( ( abs ( self . dragOffsetPredicted. height) ) / ( abs ( self . dragOffset. height) ) > 3 ) || ( ( abs ( self . dragOffsetPredicted. width) ) / ( abs ( self . dragOffset. width) ) ) > 3 ) {
79+ withAnimation ( . spring( ) ) {
80+ self . dragOffset = self . dragOffsetPredicted
81+ }
7982 self . viewerShown = false
8083 return
8184 }
@@ -101,6 +104,9 @@ public struct ImageViewerRemote: View {
101104 }
102105 . onEnded { value in
103106 if ( ( abs ( self . dragOffset. height) + abs( self . dragOffset. width) > 570 ) || ( ( abs ( self . dragOffsetPredicted. height) ) / ( abs ( self . dragOffset. height) ) > 3 ) || ( ( abs ( self . dragOffsetPredicted. width) ) / ( abs ( self . dragOffset. width) ) ) > 3 ) {
107+ withAnimation ( . spring( ) ) {
108+ self . dragOffset = self . dragOffsetPredicted
109+ }
104110 self . viewerShown = false
105111 return
106112 }
You can’t perform that action at this time.
0 commit comments