mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-12-11 10:01:58 +00:00
!40226 Slider的Click事件异常发送处理挑单5.0release
Merge pull request !40226 from FredTT/cherry-pick-1723445948
This commit is contained in:
commit
c6acb4627b
@ -36,20 +36,29 @@ public:
|
||||
|
||||
void FireChangeEvent(float value, int32_t mode)
|
||||
{
|
||||
constexpr int32_t BEGIN_MODE = 0;
|
||||
constexpr int32_t END_MODE = 2;
|
||||
if (mode == END_MODE) {
|
||||
inAction_ = false;
|
||||
}
|
||||
if (mode == BEGIN_MODE) {
|
||||
inAction_ = true;
|
||||
}
|
||||
if (onChangeEvent_) {
|
||||
onChangeEvent_(value);
|
||||
}
|
||||
constexpr int32_t BEGIN_MODE = 0;
|
||||
CHECK_NULL_VOID(changeEvent_);
|
||||
changeEvent_(value, mode);
|
||||
if (mode > BEGIN_MODE) {
|
||||
SetValue(value);
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
void SetValue(float value)
|
||||
{
|
||||
value_ = value;
|
||||
if (!inAction_) {
|
||||
value_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
float GetValue() const
|
||||
@ -63,6 +72,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool inAction_ = false;
|
||||
SliderOnChangeEvent changeEvent_;
|
||||
SliderOnValueChangeEvent onChangeEvent_;
|
||||
float value_ = .0f;
|
||||
|
@ -54,6 +54,9 @@ void SliderModelNG::SetSliderValue(float value)
|
||||
auto pattern = frameNode->GetPattern<SliderPattern>();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
pattern->UpdateValue(value);
|
||||
auto sliderEventHub = frameNode->GetEventHub<SliderEventHub>();
|
||||
CHECK_NULL_VOID(sliderEventHub);
|
||||
sliderEventHub->SetValue(value);
|
||||
}
|
||||
void SliderModelNG::SetSliderMode(const SliderMode& value)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user