mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 23:21:05 +00:00
!37799 修复TextInput手写笔输入点击清除按钮无效
Merge pull request !37799 from kangshihui/text_dev
This commit is contained in:
commit
85ecbea640
@ -318,7 +318,7 @@ RefPtr<NG::FrameNode> StylusDetectorMgr::FindTextInputFrameNodeByPosition(float
|
||||
auto globalFrameRect = geometryNode->GetFrameRect() + NG::SizeF(0, HOT_AREA_ADJUST_SIZE.ConvertToPx() * 2);
|
||||
globalFrameRect.SetOffset(frameNode->CalculateCachedTransformRelativeOffset(nanoTimestamp) +
|
||||
NG::OffsetF(0, -HOT_AREA_ADJUST_SIZE.ConvertToPx()));
|
||||
if (globalFrameRect.IsInRegion(point)) {
|
||||
if (globalFrameRect.IsInRegion(point) && !IsHitCleanNodeResponseArea(point, frameNode, nanoTimestamp)) {
|
||||
hitFrameNodes.insert(frameNode);
|
||||
}
|
||||
}
|
||||
@ -344,4 +344,30 @@ bool StylusDetectorMgr::IsStylusTouchEvent(const TouchEvent& touchEvent) const
|
||||
{
|
||||
return touchEvent.sourceTool == SourceTool::PEN && touchEvent.type == TouchType::DOWN;
|
||||
}
|
||||
|
||||
bool StylusDetectorMgr::IsHitCleanNodeResponseArea(
|
||||
const NG::PointF& point, const RefPtr<NG::FrameNode>& frameNode, uint64_t nanoTimestamp)
|
||||
{
|
||||
CHECK_NULL_RETURN(frameNode, false);
|
||||
if (frameNode->GetTag() != V2::TEXTINPUT_ETS_TAG) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto textFieldPattern = frameNode->GetPattern<NG::TextFieldPattern>();
|
||||
CHECK_NULL_RETURN(textFieldPattern, false);
|
||||
auto responseArea = textFieldPattern->GetCleanNodeResponseArea();
|
||||
CHECK_NULL_RETURN(responseArea, false);
|
||||
auto cleanNodeResponseArea = AceType::DynamicCast<NG::CleanNodeResponseArea>(responseArea);
|
||||
if (!cleanNodeResponseArea->IsShow()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto cleanNodeFrameNode = cleanNodeResponseArea->GetFrameNode();
|
||||
CHECK_NULL_RETURN(cleanNodeFrameNode, false);
|
||||
auto cleanNodeGeometryNode = cleanNodeFrameNode->GetGeometryNode();
|
||||
CHECK_NULL_RETURN(cleanNodeGeometryNode, false);
|
||||
auto globalFrameRect = cleanNodeGeometryNode->GetFrameRect();
|
||||
globalFrameRect.SetOffset(cleanNodeFrameNode->CalculateCachedTransformRelativeOffset(nanoTimestamp));
|
||||
return globalFrameRect.IsInRegion(point);
|
||||
}
|
||||
} // namespace OHOS::Ace
|
@ -82,4 +82,10 @@ bool StylusDetectorMgr::IsStylusTouchEvent(const TouchEvent& touchEvent) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StylusDetectorMgr::IsHitCleanNodeResponseArea(
|
||||
const NG::PointF& point, const RefPtr<NG::FrameNode>& frameNode, uint64_t nanoTimestamp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} // namespace OHOS::Ace
|
@ -75,6 +75,8 @@ private:
|
||||
};
|
||||
|
||||
bool IsStylusTouchEvent(const TouchEvent& touchEvent) const;
|
||||
bool IsHitCleanNodeResponseArea(
|
||||
const NG::PointF& point, const RefPtr<NG::FrameNode>& frameNode, uint64_t nanoTimestamp);
|
||||
|
||||
RefPtr<NG::FrameNode> FindTextInputFrameNodeByPosition(float globalX, float globalY);
|
||||
|
||||
|
@ -82,4 +82,10 @@ bool StylusDetectorMgr::IsStylusTouchEvent(const TouchEvent& touchEvent) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StylusDetectorMgr::IsHitCleanNodeResponseArea(
|
||||
const NG::PointF& point, const RefPtr<NG::FrameNode>& frameNode, uint64_t nanoTimestamp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} // namespace OHOS::Ace
|
Loading…
Reference in New Issue
Block a user