File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
WheelView/src/main/java/com/github/gzuliyujiang/wheelview/widget Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1080,7 +1080,24 @@ private void handleActionMove(MotionEvent event) {
1080
1080
if (Math .abs (move ) < 1 ) {
1081
1081
return ;
1082
1082
}
1083
- scrollOffsetYCoordinate += move ;
1083
+
1084
+ // Scroll limit
1085
+ float topLimit = (defaultItemPosition ) * itemHeight ;
1086
+ float bottomLimit = -(getItemCount () - 1 - defaultItemPosition ) * itemHeight ;
1087
+ boolean disableScrollTop = scrollOffsetYCoordinate >=topLimit && move > 0 ;
1088
+ boolean disableScrollBottom = scrollOffsetYCoordinate <= bottomLimit && move < 0 ;
1089
+ if (!cyclicEnabled )
1090
+ {
1091
+ if (!disableScrollBottom && !disableScrollTop )
1092
+ {
1093
+ scrollOffsetYCoordinate += move ;
1094
+ }
1095
+ }else
1096
+ {
1097
+ scrollOffsetYCoordinate += move ;
1098
+ }
1099
+ //
1100
+
1084
1101
lastPointYCoordinate = (int ) event .getY ();
1085
1102
invalidate ();
1086
1103
}
You can’t perform that action at this time.
0 commit comments