grid使用OnItemDrag拖拽切后台跟手图卡住

Signed-off-by: wangzhihao <wangzhihao42@huawei.com>
This commit is contained in:
wangzhihao 2024-10-28 19:26:26 +08:00
parent bed7e600c8
commit 7031b6287e
3 changed files with 15 additions and 8 deletions

View File

@ -813,6 +813,18 @@ void DragDropManager::DoDragReset()
isDragNodeNeedClean_ = false;
}
void DragDropManager::ResetDraggingStatus(const TouchEvent& touchPoint)
{
if (IsDraggingPressed(touchPoint.id)) {
SetDraggingPressedState(false);
}
if (!IsItemDragging() && IsDragging() && IsSameDraggingPointer(touchPoint.id)) {
OnDragEnd(
PointerEvent(touchPoint.touchEventId, touchPoint.x, touchPoint.y, touchPoint.screenX, touchPoint.screenY),
"");
}
}
void DragDropManager::HandleOnDragEnd(const PointerEvent& pointerEvent, const std::string& extraInfo,
const RefPtr<FrameNode>& dragFrameNode)
{

View File

@ -472,6 +472,8 @@ public:
currentPullId_ = -1;
}
void ResetDraggingStatus(const TouchEvent& touchPoint);
private:
double CalcDragPreviewDistanceWithPoint(
const OHOS::Ace::Dimension& preserverHeight, int32_t x, int32_t y, const DragPreviewInfo& info);

View File

@ -2904,14 +2904,7 @@ void PipelineContext::ResetDraggingStatus(const TouchEvent& touchPoint, const Re
{
auto manager = GetDragDropManager();
CHECK_NULL_VOID(manager);
if (manager->IsDraggingPressed(touchPoint.id)) {
manager->SetDraggingPressedState(false);
}
if (manager->IsDragging() && manager->IsSameDraggingPointer(touchPoint.id)) {
manager->OnDragEnd(
PointerEvent(touchPoint.touchEventId, touchPoint.x, touchPoint.y, touchPoint.screenX, touchPoint.screenY),
"");
}
manager->ResetDraggingStatus(touchPoint);
}
void PipelineContext::OnSurfaceDensityChanged(double density)