!46971 timepicker速度数据未清空

Merge pull request !46971 from zhaoyong/timepicker
This commit is contained in:
openharmony_ci 2024-10-31 03:30:37 +00:00 committed by Gitee
commit 52633dc31b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 17 additions and 0 deletions

View File

@ -207,6 +207,11 @@ void TimePickerHapticController::HandleDelta(double dy)
} }
} }
void TimePickerHapticController::ClearVelocityInfo()
{
velocityTracker_.Reset();
}
double TimePickerHapticController::ConvertPxToMillimeters(double px) const double TimePickerHapticController::ConvertPxToMillimeters(double px) const
{ {
auto& manager = ScreenSystemManager::GetInstance(); auto& manager = ScreenSystemManager::GetInstance();

View File

@ -48,6 +48,7 @@ public:
void PlayOnce() override; void PlayOnce() override;
void Stop() override; void Stop() override;
void HandleDelta(double dy) override; void HandleDelta(double dy) override;
void ClearVelocityInfo() override;
private: private:
void ThreadLoop(); void ThreadLoop();

View File

@ -50,4 +50,11 @@ void TimepickerAudioHapticImpl::HandleDelta(double dy)
} }
} }
void TimepickerAudioHapticImpl::ClearVelocityInfo()
{
if (handler_) {
handler_->ClearVelocityInfo();
}
}
} // namespace OHOS::Ace::NG } // namespace OHOS::Ace::NG

View File

@ -28,6 +28,7 @@ public:
void PlayOnce() override; void PlayOnce() override;
void Stop() override; void Stop() override;
void HandleDelta(double dy) override; void HandleDelta(double dy) override;
void ClearVelocityInfo() override;
private: private:
std::unique_ptr<TimePickerHapticController> handler_ = nullptr; std::unique_ptr<TimePickerHapticController> handler_ = nullptr;
}; };

View File

@ -27,6 +27,7 @@ public:
void PlayOnce() {} void PlayOnce() {}
void Stop() {} void Stop() {}
void HandleDelta(double dy) {} void HandleDelta(double dy) {}
void ClearVelocityInfo() {}
}; };
} // namespace OHOS::Ace::NG } // namespace OHOS::Ace::NG
#endif // FOUNDATION_ACE_ENGINE_ADAPTER_OHOS_TIMEPICKER_AUDIO_HAPTIC_STUB_H #endif // FOUNDATION_ACE_ENGINE_ADAPTER_OHOS_TIMEPICKER_AUDIO_HAPTIC_STUB_H

View File

@ -870,6 +870,7 @@ void TimePickerColumnPattern::HandleDragEnd()
{ {
if (hapticController_) { if (hapticController_) {
hapticController_->Stop(); hapticController_->Stop();
hapticController_->ClearVelocityInfo();
} }
pressed_ = false; pressed_ = false;
CHECK_NULL_VOID(GetHost()); CHECK_NULL_VOID(GetHost());

View File

@ -26,6 +26,7 @@ public:
virtual void PlayOnce() = 0; virtual void PlayOnce() = 0;
virtual void Stop() = 0; virtual void Stop() = 0;
virtual void HandleDelta(double dy) = 0; virtual void HandleDelta(double dy) = 0;
virtual void ClearVelocityInfo() = 0;
}; };
} // namespace OHOS::Ace::NG } // namespace OHOS::Ace::NG
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_TIME_PICKER_AUDIO_HAPTIC_INTERFACE_H #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_TIME_PICKER_AUDIO_HAPTIC_INTERFACE_H