mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
!45957 增加是否是此次拖拽的实时判断
Merge pull request !45957 from Zenix/fixDragSummary
This commit is contained in:
commit
e144e8392f
@ -520,6 +520,7 @@ void ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent,
|
||||
event.rawPointerEvent = pointerEvent;
|
||||
event.pointerEventId = pointerEvent->GetId();
|
||||
event.pointerId = pointerEvent->GetPointerId();
|
||||
event.pullId = pointerEvent->GetPullId();
|
||||
MMI::PointerEvent::PointerItem pointerItem;
|
||||
pointerEvent->GetPointerItem(pointerEvent->GetPointerId(), pointerItem);
|
||||
event.pressed = pointerItem.IsPressed();
|
||||
|
@ -712,6 +712,7 @@ void DragDropManager::HandleOnDragMove(const PointerEvent& pointerEvent, const s
|
||||
void DragDropManager::OnDragMove(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& node)
|
||||
{
|
||||
RequireSummaryIfNecessary(pointerEvent);
|
||||
Point point = pointerEvent.GetPoint();
|
||||
auto container = Container::Current();
|
||||
CHECK_NULL_VOID(container);
|
||||
@ -766,8 +767,7 @@ void DragDropManager::ResetDragDropStatus(const Point& point, const DragDropRet&
|
||||
}
|
||||
InteractionInterface::GetInstance()->StopDrag(dragDropRet);
|
||||
NotifyDragFrameNode(point, DragEventType::DROP, dragDropRet.result);
|
||||
summaryMap_.clear();
|
||||
parentHitNodes_.clear();
|
||||
ResetPullId();
|
||||
dragCursorStyleCore_ = DragCursorStyleCore::DEFAULT;
|
||||
}
|
||||
|
||||
@ -1052,8 +1052,7 @@ void DragDropManager::OnDragDrop(RefPtr<OHOS::Ace::DragEvent>& event, const RefP
|
||||
});
|
||||
NotifyDragFrameNode(point, DragEventType::DROP, event->GetResult());
|
||||
dragFrameNode->MarkDirtyNode();
|
||||
summaryMap_.clear();
|
||||
parentHitNodes_.clear();
|
||||
ResetPullId();
|
||||
dragCursorStyleCore_ = DragCursorStyleCore::DEFAULT;
|
||||
pipeline->RequestFrame();
|
||||
}
|
||||
@ -1111,8 +1110,7 @@ Rect DragDropManager::GetDragWindowRect(const Point& point)
|
||||
void DragDropManager::ClearSummary()
|
||||
{
|
||||
previewRect_ = Rect(-1, -1, -1, -1);
|
||||
summaryMap_.clear();
|
||||
parentHitNodes_.clear();
|
||||
ResetPullId();
|
||||
ResetRecordSize();
|
||||
}
|
||||
|
||||
@ -2291,4 +2289,17 @@ bool DragDropManager::IsAllAnimationFinished()
|
||||
currentAnimationCnt_--;
|
||||
return currentAnimationCnt_ == 0;
|
||||
}
|
||||
|
||||
bool DragDropManager::CheckIsNewDrag(const PointerEvent& pointerEvent) const
|
||||
{
|
||||
return (pointerEvent.pullId != -1) && (pointerEvent.pullId != currentPullId_);
|
||||
}
|
||||
|
||||
void DragDropManager::RequireSummaryIfNecessary(const PointerEvent& pointerEvent)
|
||||
{
|
||||
if (CheckIsNewDrag(pointerEvent)) {
|
||||
currentPullId_ = pointerEvent.pullId;
|
||||
RequireSummary();
|
||||
}
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -470,6 +470,17 @@ public:
|
||||
menuWrapperNode_ = frameNode;
|
||||
}
|
||||
|
||||
bool CheckIsNewDrag(const PointerEvent& pointerEvent) const;
|
||||
|
||||
void RequireSummaryIfNecessary(const PointerEvent& pointerEvent);
|
||||
|
||||
inline void ResetPullId()
|
||||
{
|
||||
summaryMap_.clear();
|
||||
parentHitNodes_.clear();
|
||||
currentPullId_ = -1;
|
||||
}
|
||||
|
||||
private:
|
||||
double CalcDragPreviewDistanceWithPoint(
|
||||
const OHOS::Ace::Dimension& preserverHeight, int32_t x, int32_t y, const DragPreviewInfo& info);
|
||||
@ -541,6 +552,7 @@ private:
|
||||
uint32_t recordSize_ = 0;
|
||||
int64_t currentId_ = -1;
|
||||
int32_t currentPointerId_ = -1;
|
||||
int32_t currentPullId_ = -1;
|
||||
bool draggingPressedState_ = false;
|
||||
|
||||
std::function<void(void)> notifyInDraggedCallback_ = nullptr;
|
||||
|
@ -58,6 +58,7 @@ enum class PointerAction : int32_t {
|
||||
struct PointerEvent final {
|
||||
int32_t pointerEventId = 0;
|
||||
int32_t pointerId = 0;
|
||||
int32_t pullId = -1;
|
||||
bool pressed = false;
|
||||
int32_t windowX = 0;
|
||||
int32_t windowY = 0;
|
||||
|
@ -4405,7 +4405,7 @@ void PipelineContext::OnDragEvent(const PointerEvent& pointerEvent, DragEventAct
|
||||
|
||||
if (action == DragEventAction::DRAG_EVENT_START) {
|
||||
manager->ResetPreTargetFrameNode(GetInstanceId());
|
||||
manager->RequireSummary();
|
||||
manager->RequireSummaryIfNecessary(pointerEvent);
|
||||
manager->SetDragCursorStyleCore(DragCursorStyleCore::DEFAULT);
|
||||
TAG_LOGI(AceLogTag::ACE_DRAG, "start drag, current windowId is %{public}d", container->GetWindowId());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user