allow slight overscrolling in optionsmenu

This commit is contained in:
yugecin
2017-01-29 16:23:52 +01:00
parent ac398bf2ad
commit 82bbb4299d
2 changed files with 23 additions and 9 deletions

View File

@@ -61,6 +61,12 @@ public class KineticScrolling {
/** The speed multiplier (divides {@link #TIME_CONST}). */
private float speedMultiplier = 1f;
private boolean allowOverScroll;
public void setAllowOverScroll(boolean allowOverScroll) {
this.allowOverScroll = allowOverScroll;
}
/**
* Returns the current position.
* @return the position
@@ -94,13 +100,23 @@ public class KineticScrolling {
target = position;
deltaPosition = 0;
}
if (position > max) {
amplitude = 0;
target = position = max;
if (allowOverScroll && pressed) {
return;
}
if (position < min) {
amplitude = 0;
target = position = min;
if (position > max) {
if (allowOverScroll) {
scrollToPosition(max);
} else {
amplitude = 0;
target = position = max;
}
} else if (position < min) {
if (allowOverScroll) {
scrollToPosition(min);
} else {
amplitude = 0;
target = position = min;
}
}
}