mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-21 09:55:23 -04:00
Fix the problem of bindMenu that the menu does not disappear when click outside the menu.
Signed-off-by: xuzhidan <xuzhidan1@huawei.com> Change-Id: I743b5254cfd1cd4c1d4d78289dbd3cf5c8158e55
This commit is contained in:
@@ -35,6 +35,7 @@ RenderSelectPopup::RenderSelectPopup()
|
||||
rawDetector_->SetOnTouchDown([weak = WeakClaim(this)](const TouchEventInfo& info) {
|
||||
auto selectPopup = weak.Upgrade();
|
||||
if (selectPopup) {
|
||||
selectPopup->ProcessTouchDown(info);
|
||||
selectPopup->HandleRawEvent(info.GetTouches().front().GetLocalLocation());
|
||||
}
|
||||
});
|
||||
@@ -406,6 +407,12 @@ void RenderSelectPopup::ProcessTouchDown(const TouchEventInfo& info)
|
||||
return;
|
||||
}
|
||||
|
||||
auto clickPosition = touches.front().GetLocalLocation();
|
||||
if (!touchRegion_.ContainsInRegion(clickPosition.GetX(), clickPosition.GetY())) {
|
||||
LOGI("Do not contains the touch region.");
|
||||
return;
|
||||
}
|
||||
|
||||
firstFingerDownOffset_ = touches.front().GetGlobalLocation();
|
||||
}
|
||||
|
||||
@@ -418,6 +425,12 @@ void RenderSelectPopup::ProcessTouchUp(const TouchEventInfo& info)
|
||||
return;
|
||||
}
|
||||
|
||||
auto clickPosition = touches.front().GetLocalLocation();
|
||||
if (!touchRegion_.ContainsInRegion(clickPosition.GetX(), clickPosition.GetY())) {
|
||||
LOGI("Do not contains the touch region.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectPopup_->GetSelectOptions().empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -452,16 +465,6 @@ void RenderSelectPopup::OnTouchTestHit(
|
||||
clickDetector_ = AceType::MakeRefPtr<ClickRecognizer>();
|
||||
}
|
||||
|
||||
rawDetector_->SetOnTouchDown([weak = AceType::WeakClaim(this)](const TouchEventInfo& info) {
|
||||
auto ref = weak.Upgrade();
|
||||
if (!ref) {
|
||||
LOGE("renderSelectPopup upgrade fail.");
|
||||
return;
|
||||
}
|
||||
|
||||
ref->ProcessTouchDown(info);
|
||||
});
|
||||
|
||||
rawDetector_->SetOnTouchUp([weak = AceType::WeakClaim(this)](const TouchEventInfo& info) {
|
||||
auto ref = weak.Upgrade();
|
||||
if (!ref) {
|
||||
|
||||
Reference in New Issue
Block a user