cancelTranslation method
Implementation
ScaleEndDetails cancelTranslation(double k) {
if (k <= 0) return this;
final scaleVel = scaleVelocity.abs();
if (scaleVel < cancelTranslationThreshold) return this;
final excess = scaleVel - cancelTranslationThreshold;
final amount = (k * (cancelTranslationBaseline + excess * excess))
.clamp(0.0, 1.0);
final factor = 1.0 - amount;
if (factor == 1.0) return this;
return ScaleEndDetails(
velocity: Velocity(pixelsPerSecond: velocity.pixelsPerSecond * factor),
scaleVelocity: scaleVelocity,
pointerCount: pointerCount,
);
}