mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 721125 - Prevent the edge resistance from being negative, which can wreak havoc on the viewport. r=pcwalton
This commit is contained in:
parent
c40ebd5017
commit
4f628e8540
@ -185,7 +185,12 @@ abstract class Axis {
|
||||
*/
|
||||
float getEdgeResistance() {
|
||||
float excess = getExcess();
|
||||
return (excess > 0.0f) ? SNAP_LIMIT - excess / getViewportLength() : 1.0f;
|
||||
if (excess > 0.0f) {
|
||||
// excess can be greater than viewport length, but the resistance
|
||||
// must never drop below 0.0
|
||||
return Math.max(0.0f, SNAP_LIMIT - excess / getViewportLength());
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
/* Returns the velocity. If the axis is locked, returns 0. */
|
||||
|
Loading…
Reference in New Issue
Block a user