File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -985,10 +985,14 @@ void loadPageByOffset() {
985985 }
986986 }
987987
988+ public void performPageSnap () {
989+ performPageSnap (true );
990+ }
991+
988992 /**
989993 * Animate to the nearest snapping position for the current SnapPolicy
990994 */
991- public void performPageSnap () {
995+ public void performPageSnap (boolean withAnimation ) {
992996 if (!pageSnap || pdfFile == null || pdfFile .getPagesCount () == 0 ) {
993997 return ;
994998 }
@@ -1000,9 +1004,17 @@ public void performPageSnap() {
10001004
10011005 float offset = snapOffsetForPage (centerPage , edge );
10021006 if (swipeVertical ) {
1003- animationManager .startYAnimation (currentYOffset , -offset );
1007+ if (withAnimation ) {
1008+ animationManager .startYAnimation (currentYOffset , -offset );
1009+ } else {
1010+ moveTo (currentXOffset , -offset );
1011+ }
10041012 } else {
1005- animationManager .startXAnimation (currentXOffset , -offset );
1013+ if (withAnimation ) {
1014+ animationManager .startXAnimation (currentXOffset , -offset );
1015+ } else {
1016+ moveTo (-offset , currentYOffset );
1017+ }
10061018 }
10071019 }
10081020
You can’t perform that action at this time.
0 commit comments