diff --git a/frameworks/base/geometry/least_square_impl.cpp b/frameworks/base/geometry/least_square_impl.cpp index bfe3f162329a84d62a57f3bdca63fbc3ff28eb87..f0217894a09d478148963e1d368c3978e7dbf865 100644 --- a/frameworks/base/geometry/least_square_impl.cpp +++ b/frameworks/base/geometry/least_square_impl.cpp @@ -21,7 +21,7 @@ namespace OHOS::Ace { bool LeastSquareImpl::GetLeastSquareParams(std::vector& params) { - if (xVals_.size() <= 1 || ((paramsNum_ != Matrix3::DIMENSION) && (paramsNum_ != Matrix4::DIMENSION))) { + if (xVals_.size() < paramsNum_ || ((paramsNum_ != Matrix3::DIMENSION) && (paramsNum_ != Matrix4::DIMENSION))) { return false; } params.resize(paramsNum_, 0); diff --git a/frameworks/core/gestures/velocity_tracker.cpp b/frameworks/core/gestures/velocity_tracker.cpp index e066bcb0341e5cb8c015fb054eb19a8ad245f9aa..5e43000d523e7e9c22738d2766e316dbf9a5bd3e 100644 --- a/frameworks/core/gestures/velocity_tracker.cpp +++ b/frameworks/core/gestures/velocity_tracker.cpp @@ -65,7 +65,10 @@ inline double GetLinearSlope(const LeastSquareImpl& axis) const auto& x = axis.GetXVals(); const auto& y = axis.GetYVals(); auto count = axis.GetTrackNum(); - return (y[count - 1] - y[count - 2]) / (x[count - 1] - x[count - 2]); // 2: const + double velocity = (y[count - 1] - y[count - 2]) / (x[count - 1] - x[count - 2]); // 2: const + LOGI("Linear velocity:%{public}f, startY:%{public}f, endY:%{public}f, startX:%{public}f, endX:%{public}f", + velocity, y[count - 2], y[count - 1], x[count - 2], x[count - 1]); + return velocity; } void CorrectMonotonicAxisVelocity(const LeastSquareImpl& axis, double& v, double extremX)