!48293 bugfix for indicator region check

Merge pull request !48293 from LiYi/branch1112
This commit is contained in:
openharmony_ci 2024-11-12 08:33:39 +00:00 committed by Gitee
commit 9ecf8cc47f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 23 additions and 13 deletions

View File

@ -2725,25 +2725,34 @@ void SwiperPattern::HandleTouchEvent(const TouchEventInfo& info)
}
}
bool SwiperPattern::InsideIndicatorRegion(const TouchLocationInfo& locationInfo)
{
if (!HasIndicatorNode()) {
return false;
}
auto indicatorNode = GetCommonIndicatorNode();
if (!indicatorNode || !IsIndicator(indicatorNode->GetTag())) {
return false;
}
auto geometryNode = indicatorNode->GetGeometryNode();
CHECK_NULL_RETURN(geometryNode, false);
auto hotRegion = geometryNode->GetFrameRect();
auto touchPoint = PointF(static_cast<float>(locationInfo.GetLocalLocation().GetX()),
static_cast<float>(locationInfo.GetLocalLocation().GetY()));
return hotRegion.IsInRegion(touchPoint);
}
void SwiperPattern::HandleTouchDown(const TouchLocationInfo& locationInfo)
{
ACE_SCOPED_TRACE("Swiper HandleTouchDown");
TAG_LOGI(AceLogTag::ACE_SWIPER, "Swiper HandleTouchDown");
isTouchDown_ = true;
isTouchDownOnOverlong_ = true;
if (HasIndicatorNode()) {
auto indicatorNode = GetCommonIndicatorNode();
CHECK_NULL_VOID(indicatorNode);
if (IsIndicator(indicatorNode->GetTag())) {
auto geometryNode = indicatorNode->GetGeometryNode();
CHECK_NULL_VOID(geometryNode);
auto hotRegion = geometryNode->GetFrameRect();
auto touchPoint = PointF(static_cast<float>(locationInfo.GetLocalLocation().GetX()),
static_cast<float>(locationInfo.GetLocalLocation().GetY()));
if (hotRegion.IsInRegion(touchPoint)) {
return;
}
}
if (InsideIndicatorRegion(locationInfo)) {
return;
}
if (childScrolling_) {

View File

@ -701,6 +701,7 @@ private:
void HandleDragUpdate(const GestureEvent& info);
void HandleDragEnd(double dragVelocity);
bool InsideIndicatorRegion(const TouchLocationInfo& locationInfo);
void HandleTouchEvent(const TouchEventInfo& info);
void HandleTouchDown(const TouchLocationInfo& locationInfo);
void HandleTouchUp();