Bug 1091128 - Ensure that large negative velocities are also clamped to the velocity cap. r=botond

This commit is contained in:
Kartikaya Gupta 2014-10-29 15:40:02 -04:00
Родитель 763598b2af
Коммит 675248424e
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -49,9 +49,16 @@ void Axis::UpdateWithTouchAtDevicePoint(ScreenCoord aPos, uint32_t aTimestampMs)
float newVelocity = mAxisLocked ? 0.0f : (float)(mPos - aPos) / (float)(aTimestampMs - mPosTimeMs);
if (gfxPrefs::APZMaxVelocity() > 0.0f) {
bool velocityIsNegative = (newVelocity < 0);
newVelocity = fabs(newVelocity);
ScreenPoint maxVelocity = MakePoint(gfxPrefs::APZMaxVelocity() * APZCTreeManager::GetDPI());
mAsyncPanZoomController->ToLocalScreenCoordinates(&maxVelocity, mAsyncPanZoomController->PanStart());
newVelocity = std::min(newVelocity, maxVelocity.Length());
if (velocityIsNegative) {
newVelocity = -newVelocity;
}
}
mVelocity = newVelocity;