1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MANAGER_DRAG_DROP_DRAG_DROP_MANAGER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MANAGER_DRAG_DROP_DRAG_DROP_MANAGER_H 18 19 #include <cstdint> 20 #include <string> 21 22 #include "base/memory/ace_type.h" 23 #include "base/utils/noncopyable.h" 24 #include "base/window/drag_window.h" 25 #include "core/common/interaction/interaction_data.h" 26 #include "core/components_ng/base/frame_node.h" 27 #include "core/components_ng/manager/drag_drop/drag_drop_proxy.h" 28 #include "core/gestures/velocity_tracker.h" 29 #include "core/components_ng/manager/drag_drop/utils/internal_drag_action.h" 30 31 namespace OHOS::Ace { 32 class UnifiedData; 33 class GridColumnInfo; 34 } 35 namespace OHOS::Ace::NG { 36 enum class DragDropMgrState : int32_t { 37 IDLE, 38 ABOUT_TO_PREVIEW, 39 DRAGGING 40 }; 41 42 struct GatherAnimationInfo { 43 float scale = 0.0f; 44 float width = 0.0f; 45 float height = 0.0f; 46 OffsetF gatherNodeCenter; 47 std::optional<BorderRadiusProperty> borderRadius; 48 }; 49 50 class ACE_EXPORT DragDropManager : public virtual AceType { 51 DECLARE_ACE_TYPE(DragDropManager, AceType); 52 53 public: 54 DragDropManager() = default; 55 ~DragDropManager() override = default; 56 57 RefPtr<DragDropProxy> CreateAndShowDragWindow(const RefPtr<PixelMap>& pixelMap, const GestureEvent& info); 58 RefPtr<DragDropProxy> CreateAndShowDragWindow(const RefPtr<UINode>& customNode, const GestureEvent& info); 59 RefPtr<DragDropProxy> CreateTextDragDropProxy(); 60 AddDragFrameNode(int32_t id,const WeakPtr<FrameNode> & dragFrameNode)61 void AddDragFrameNode(int32_t id, const WeakPtr<FrameNode>& dragFrameNode) 62 { 63 dragFrameNodes_.try_emplace(id, dragFrameNode); 64 } 65 66 void RemoveDragFrameNode(int32_t id); 67 AddGridDragFrameNode(int32_t id,const WeakPtr<FrameNode> & dragFrameNode)68 void AddGridDragFrameNode(int32_t id, const WeakPtr<FrameNode>& dragFrameNode) 69 { 70 gridDragFrameNodes_.try_emplace(id, dragFrameNode); 71 } 72 AddListDragFrameNode(int32_t id,const WeakPtr<FrameNode> & dragFrameNode)73 void AddListDragFrameNode(int32_t id, const WeakPtr<FrameNode>& dragFrameNode) 74 { 75 listDragFrameNodes_.try_emplace(id, dragFrameNode); 76 } 77 AddTextFieldDragFrameNode(int32_t id,const WeakPtr<FrameNode> & dragFrameNode)78 void AddTextFieldDragFrameNode(int32_t id, const WeakPtr<FrameNode>& dragFrameNode) 79 { 80 textFieldDragFrameNodes_.try_emplace(id, dragFrameNode); 81 } 82 SetEventStrictReportingEnabled(bool dragEventStrictReportingEnabled)83 void SetEventStrictReportingEnabled(bool dragEventStrictReportingEnabled) 84 { 85 eventStrictReportingEnabled_ = dragEventStrictReportingEnabled; 86 } 87 IsEventStrictReportingEnabled()88 bool IsEventStrictReportingEnabled() 89 { 90 return eventStrictReportingEnabled_; 91 } 92 93 void UpdateDragWindowPosition(int32_t globalX, int32_t globalY); 94 void OnDragStart(const Point& point); 95 void OnDragStart(const Point& point, const RefPtr<FrameNode>& frameNode); 96 void OnDragMove(const PointerEvent& pointerEvent, const std::string& extraInfo, 97 const RefPtr<FrameNode>& node = nullptr); 98 void OnDragEnd(const PointerEvent& pointerEvent, const std::string& extraInfo, 99 const RefPtr<FrameNode>& node = nullptr); 100 void HandleOnDragMove(const PointerEvent& pointerEvent, const std::string& extraInfo, 101 const RefPtr<FrameNode>& dragFrameNode); 102 void HandleOnDragEnd(const PointerEvent& pointerEvent, const std::string& extraInfo, 103 const RefPtr<FrameNode>& dragFrameNode); 104 void DoDragReset(); 105 void DoDropAction(const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent, 106 const RefPtr<UnifiedData>& unifiedData, const std::string& udKey); 107 void RequestDragSummaryInfoAndPrivilege(); 108 RefPtr<UnifiedData> RequestUDMFDataWithUDKey(const std::string& udKey); 109 void TryGetDataBackGround( 110 const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent, 111 const std::string& udKey, int32_t count = 0); 112 void OnDragDrop(RefPtr<OHOS::Ace::DragEvent>& event, const RefPtr<FrameNode>& dragFrameNode, 113 const OHOS::Ace::PointerEvent& pointerEvent); 114 void ResetDragDropStatus(const Point& point, const DragDropRet& dragDropRet, int32_t windowId); 115 bool CheckRemoteData( 116 const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent, const std::string& udKey); 117 void OnDragMoveOut(const PointerEvent& pointerEvent); 118 void OnTextDragEnd(float globalX, float globalY, const std::string& extraInfo); 119 void onDragCancel(); 120 void OnItemDragStart(float globalX, float globalY, const RefPtr<FrameNode>& frameNode); 121 void OnItemDragMove(float globalX, float globalY, int32_t draggedIndex, DragType dragType); 122 void OnItemDragEnd(float globalX, float globalY, int32_t draggedIndex, DragType dragType); 123 void onItemDragCancel(); 124 void AddDataToClipboard(const std::string& extraInfo); 125 void GetExtraInfoFromClipboard(std::string& extraInfo); 126 void RestoreClipboardData(); 127 void DestroyDragWindow(); 128 void CancelItemDrag(); 129 std::string GetExtraInfo(); 130 void SetExtraInfo(const std::string& extraInfo); 131 void ClearExtraInfo(); 132 float GetWindowScale() const; 133 void UpdateDragStyle( 134 const DragCursorStyleCore& dragCursorStyleCore = DragCursorStyleCore::DEFAULT, const int32_t eventId = -1); 135 void UpdateDragAllowDrop(const RefPtr<FrameNode>& dragFrameNode, const DragBehavior dragBehavior, 136 const int32_t eventId = -1, bool isCapi = false); 137 void RequireSummary(); 138 void ClearSummary(); SetSummaryMap(const std::map<std::string,int64_t> & summaryMap)139 void SetSummaryMap(const std::map<std::string, int64_t>& summaryMap) 140 { 141 summaryMap_ = summaryMap; 142 } 143 void ResetRecordSize(uint32_t recordSize = 0); 144 uint32_t GetRecordSize() const; 145 Rect GetDragWindowRect(const Point& point); 146 RefPtr<DragDropProxy> CreateFrameworkDragDropProxy(); 147 void HideDragPreviewOverlay(); 148 void HideDragPreviewWindow(int32_t containerId); 149 bool IsMSDPDragging() const; 150 void UpdateDragEvent(RefPtr<OHOS::Ace::DragEvent>& event, const OHOS::Ace::PointerEvent& pointerEvent); 151 void UpdateNotifyDragEvent( 152 RefPtr<NotifyDragEvent>& notifyEvent, const Point& point, const DragEventType dragEventType); 153 bool CheckDragDropProxy(int64_t id) const; 154 void NotifyEnterTextEditorArea(); 155 void FireOnEditableTextComponent(const RefPtr<FrameNode>& frameNode, DragEventType type); 156 void FireOnDragLeave(const RefPtr<FrameNode>& preTargetFrameNode_, const PointerEvent& pointerEvent, 157 const std::string& extraInfo); 158 IsWindowConsumed()159 bool IsWindowConsumed() const 160 { 161 return isWindowConsumed_; 162 } 163 SetIsWindowConsumed(bool consumed)164 void SetIsWindowConsumed(bool consumed) 165 { 166 isWindowConsumed_ = consumed; 167 } 168 IsDragged()169 bool IsDragged() const 170 { 171 return isDragged_; 172 } 173 174 void SetIsDragged(bool isDragged); 175 SetDragDampStartPoint(const Point & point)176 void SetDragDampStartPoint(const Point& point) 177 { 178 dragDampStartPoint_ = point; 179 } 180 GetDragDampStartPoint()181 const Point& GetDragDampStartPoint() const 182 { 183 return dragDampStartPoint_; 184 } 185 SetIsDragCancel(bool isDragCancel)186 void SetIsDragCancel(bool isDragCancel) 187 { 188 isDragCancel_ = isDragCancel; 189 } 190 SetIsMouseDrag(bool isMouseDragged)191 void SetIsMouseDrag(bool isMouseDragged) 192 { 193 isMouseDragged_ = isMouseDragged; 194 } 195 SetIsDragWindowShow(bool isDragWindowShow)196 void SetIsDragWindowShow(bool isDragWindowShow) 197 { 198 isDragWindowShow_ = isDragWindowShow; 199 } 200 IsDragWindowShow()201 bool IsDragWindowShow() const 202 { 203 return isDragWindowShow_; 204 } 205 SetPreviewRect(const Rect & rect)206 void SetPreviewRect(const Rect& rect) 207 { 208 previewRect_ = rect; 209 } 210 GetPreviewRect()211 Rect GetPreviewRect() const 212 { 213 return previewRect_; 214 } 215 SetDragCursorStyleCore(DragCursorStyleCore dragCursorStyleCore)216 void SetDragCursorStyleCore(DragCursorStyleCore dragCursorStyleCore) 217 { 218 dragCursorStyleCore_ = dragCursorStyleCore; 219 } 220 GetDragAction()221 std::shared_ptr<OHOS::Ace::NG::ArkUIInteralDragAction> GetDragAction() 222 { 223 return dragAction_; 224 } 225 226 RefPtr<FrameNode> FindTargetInChildNodes(const RefPtr<UINode> parentNode, 227 std::vector<RefPtr<FrameNode>> hitFrameNodes, bool findDrop); 228 229 bool CheckFrameNodeCanDrop(const RefPtr<FrameNode>& node); 230 231 RefPtr<FrameNode> FindTargetDropNode(const RefPtr<UINode> parentNode, PointF localPoint); 232 233 std::unordered_set<int32_t> FindHitFrameNodes(const Point& point); 234 235 void UpdateDragListener(const Point& point); 236 237 void NotifyDragRegisterFrameNode(std::unordered_map<int32_t, WeakPtr<FrameNode>> nodes, DragEventType dragEventType, 238 RefPtr<NotifyDragEvent>& notifyEvent); 239 240 void RegisterDragStatusListener(int32_t nodeId, const WeakPtr<FrameNode>& node); 241 UnRegisterDragStatusListener(int32_t nodeId)242 void UnRegisterDragStatusListener(int32_t nodeId) 243 { 244 nodesForDragNotify_.erase(nodeId); 245 } 246 SetNotifyInDraggedCallback(const std::function<void (void)> & callback)247 void SetNotifyInDraggedCallback(const std::function<void(void)>& callback) 248 { 249 notifyInDraggedCallback_ = callback; 250 } 251 IsDragging()252 bool IsDragging() const 253 { 254 return dragDropState_ == DragDropMgrState::DRAGGING; 255 } 256 IsItemDragging()257 bool IsItemDragging() const 258 { 259 return dragDropState_ == DragDropMgrState::DRAGGING && draggedGridFrameNode_ != nullptr; 260 } 261 IsAboutToPreview()262 bool IsAboutToPreview() const 263 { 264 return dragDropState_ == DragDropMgrState::ABOUT_TO_PREVIEW; 265 } 266 267 void ResetDragging(DragDropMgrState dragDropMgrState = DragDropMgrState::IDLE) 268 { 269 dragDropState_ = dragDropMgrState; 270 } 271 272 void ResetPreTargetFrameNode(int32_t instanceId); 273 SetDraggingPressedState(bool pointerPressed)274 void SetDraggingPressedState(bool pointerPressed) 275 { 276 draggingPressedState_ = pointerPressed; 277 } 278 279 bool IsDraggingPressed(int32_t currentPointerId) const; 280 IsSameDraggingPointer(int32_t currentPointerId)281 bool IsSameDraggingPointer(int32_t currentPointerId) const 282 { 283 return currentPointerId_ == currentPointerId; 284 } 285 SetDraggingPointer(int32_t currentPointerId)286 void SetDraggingPointer(int32_t currentPointerId) 287 { 288 currentPointerId_ = currentPointerId; 289 } 290 IsEditableTextComponent(const std::string & frameTag)291 static inline bool IsEditableTextComponent(const std::string& frameTag) 292 { 293 if (frameTag != V2::TEXTINPUT_ETS_TAG && frameTag != V2::TEXTAREA_ETS_TAG && 294 frameTag != V2::RICH_EDITOR_ETS_TAG && frameTag != V2::SEARCH_Field_ETS_TAG) { 295 return false; 296 } 297 return true; 298 } 299 300 typedef struct DragPreviewInfo { 301 double width { 0.0 }; 302 double height { 0.0 }; 303 double maxWidth { 0.0 }; 304 double scale { -1.0 }; 305 VectorF originScale { 1.0f, 1.0f }; 306 OffsetF originOffset; 307 RefPtr<FrameNode> imageNode { nullptr }; 308 RefPtr<FrameNode> textNode { nullptr }; 309 } DragPreviewInfo; 310 bool IsNeedScaleDragPreview(); 311 void DoDragMoveAnimate(const PointerEvent& pointerEvent); 312 void DragMoveAnimation(const Offset& newOffset, const RefPtr<OverlayManager>& overlayManager, Point point); 313 void DoDragStartAnimation(const RefPtr<OverlayManager>& overlayManager, 314 const GestureEvent& event, const RefPtr<GestureEventHub>& gestureHub, bool isSubwindowOverlay = false); 315 void DragStartAnimation(const Offset& newOffset, const RefPtr<OverlayManager>& overlayManager, 316 const OffsetF& gatherNodeCenter, Point point = { 1, 1 }); 317 void SetDragResult(const DragNotifyMsgCore& notifyMessage, const RefPtr<OHOS::Ace::DragEvent>& dragEvent); 318 void SetDragBehavior(const DragNotifyMsgCore& notifyMessage, const RefPtr<OHOS::Ace::DragEvent>& dragEvent); ResetDragPreviewInfo()319 void ResetDragPreviewInfo() 320 { 321 info_ = DragPreviewInfo(); 322 } 323 324 void ResetPullMoveReceivedForCurrentDrag(bool isPullMoveReceivedForCurrentDrag = false) 325 { 326 isPullMoveReceivedForCurrentDrag_ = isPullMoveReceivedForCurrentDrag; 327 } 328 IsPullMoveReceivedForCurrentDrag()329 bool IsPullMoveReceivedForCurrentDrag() const 330 { 331 return isPullMoveReceivedForCurrentDrag_; 332 } 333 SetPrepareDragFrameNode(const WeakPtr<FrameNode> & prepareDragFrameNode)334 void SetPrepareDragFrameNode(const WeakPtr<FrameNode>& prepareDragFrameNode) 335 { 336 prepareDragFrameNode_ = prepareDragFrameNode; 337 } 338 GetPrepareDragFrameNode()339 const WeakPtr<FrameNode> GetPrepareDragFrameNode() const 340 { 341 return prepareDragFrameNode_; 342 } 343 SetPreDragStatus(PreDragStatus preDragStatus)344 void SetPreDragStatus(PreDragStatus preDragStatus) 345 { 346 preDragStatus_ = preDragStatus; 347 } 348 GetPreDragStatus()349 PreDragStatus GetPreDragStatus() const 350 { 351 return preDragStatus_; 352 } 353 354 static RectF GetMenuPreviewRect(); 355 static void UpdateGatherNodeAttr(const RefPtr<OverlayManager>& overlayManager, const GatherAnimationInfo& info); 356 static void UpdateGatherNodePosition(const RefPtr<OverlayManager>& overlayManager, 357 const RefPtr<FrameNode>& imageNode); 358 static void UpdateTextNodePosition(const RefPtr<FrameNode>& textNode, const Offset& localPoint); 359 double CalcGatherNodeMaxDistanceWithPoint(const RefPtr<OverlayManager>& overlayManager, int32_t x, int32_t y); 360 SetPixelMapOffset(OffsetF pixelMapOffset)361 void SetPixelMapOffset(OffsetF pixelMapOffset) 362 { 363 pixelMapOffset_ = pixelMapOffset; 364 } 365 366 bool IsNeedDisplayInSubwindow(); ClearGatherPixelMap()367 void ClearGatherPixelMap() 368 { 369 gatherPixelMaps_.clear(); 370 } 371 372 void PushGatherPixelMap(const RefPtr<PixelMap>& pixelMap); 373 void GetGatherPixelMap(DragDataCore& dragData, float scale, float previewWidth = 0.0f, float previewHeight = 0.0f); HasGatherNode()374 bool HasGatherNode() const 375 { 376 return hasGatherNode_; 377 } 378 SetHasGatherNode(bool hasGatherNode)379 void SetHasGatherNode(bool hasGatherNode) 380 { 381 hasGatherNode_ = hasGatherNode; 382 } 383 GetDragDropPointerEvent()384 const PointerEvent& GetDragDropPointerEvent() const 385 { 386 return dragDropPointerEvent_; 387 } 388 SetDragDropPointerEvent(const PointerEvent & dragDropPointerEvent)389 void SetDragDropPointerEvent(const PointerEvent& dragDropPointerEvent) 390 { 391 dragDropPointerEvent_ = dragDropPointerEvent; 392 } 393 SetIsShowBadgeAnimation(bool isShowBadgeAnimation)394 void SetIsShowBadgeAnimation(bool isShowBadgeAnimation) 395 { 396 isShowBadgeAnimation_ = isShowBadgeAnimation; 397 } 398 IsShowBadgeAnimation()399 bool IsShowBadgeAnimation() 400 { 401 return isShowBadgeAnimation_; 402 } 403 IsDragWithContextMenu()404 bool IsDragWithContextMenu() const 405 { 406 return isDragWithContextMenu_; 407 } 408 SetIsDragWithContextMenu(bool isDragWithContextMenu)409 void SetIsDragWithContextMenu(bool isDragWithContextMenu) 410 { 411 isDragWithContextMenu_ = isDragWithContextMenu; 412 } 413 414 void SetIsDragNodeNeedClean(bool isDragNodeNeedClean = false) 415 { 416 isDragNodeNeedClean_ = isDragNodeNeedClean; 417 } 418 IsDragNodeNeedClean()419 bool IsDragNodeNeedClean() const 420 { 421 return isDragNodeNeedClean_; 422 } 423 424 void UpdateDragMovePosition(const NG::OffsetF& offset, bool isRedragStart = false); 425 426 void ResetContextMenuDragPosition(); 427 428 void ResetContextMenuRedragPosition(); 429 GetUpdateDragMovePosition()430 OffsetF GetUpdateDragMovePosition() const 431 { 432 return dragTotalMovePosition_; 433 } 434 435 bool IsDropAllowed(const RefPtr<FrameNode>& dragFrameNode); 436 SetDragAction(const std::shared_ptr<OHOS::Ace::NG::ArkUIInteralDragAction> & dragAction)437 void SetDragAction(const std::shared_ptr<OHOS::Ace::NG::ArkUIInteralDragAction>& dragAction) 438 { 439 dragAction_ = dragAction; 440 } 441 442 void AddNewDragAnimation(); 443 444 bool IsAllAnimationFinished(); 445 446 float GetCurrentDistance(float x, float y); 447 448 static double GetMaxWidthBaseOnGridSystem(const RefPtr<PipelineBase>& pipeline); 449 GetDampingOverflowCount()450 uint32_t GetDampingOverflowCount() const 451 { 452 return dampingOverflowCount_ ; 453 } 454 SetDampingOverflowCount()455 void SetDampingOverflowCount() 456 { 457 dampingOverflowCount_++; 458 } 459 GetMenuWrapperNode()460 RefPtr<FrameNode> GetMenuWrapperNode() 461 { 462 return menuWrapperNode_.Upgrade(); 463 } 464 SetMenuWrapperNode(const RefPtr<FrameNode> & frameNode)465 void SetMenuWrapperNode(const RefPtr<FrameNode>& frameNode) 466 { 467 menuWrapperNode_ = frameNode; 468 } 469 470 bool CheckIsNewDrag(const PointerEvent& pointerEvent) const; 471 472 void RequireSummaryIfNecessary(const PointerEvent& pointerEvent); 473 ResetPullId()474 inline void ResetPullId() 475 { 476 summaryMap_.clear(); 477 parentHitNodes_.clear(); 478 currentPullId_ = -1; 479 } 480 481 void ResetDraggingStatus(const TouchEvent& touchPoint); 482 483 private: 484 double CalcDragPreviewDistanceWithPoint( 485 const OHOS::Ace::Dimension& preserverHeight, int32_t x, int32_t y, const DragPreviewInfo& info); 486 Offset CalcDragMoveOffset( 487 const OHOS::Ace::Dimension& preserverHeight, int32_t x, int32_t y, const DragPreviewInfo& info); 488 bool UpdateDragMovePositionFinished( 489 bool needDoDragMoveAnimate, bool isMenuShow, const Offset& newOffset, int32_t containerId); 490 void UpdateDragPreviewScale(); 491 bool GetDragPreviewInfo(const OHOS::Ace::RefPtr<OHOS::Ace::NG::OverlayManager>& overlayManager, 492 DragPreviewInfo& dragPreviewInfo, const RefPtr<GestureEventHub>& gestureHub); 493 bool IsNeedDoDragMoveAnimate(const PointerEvent& pointerEvent); 494 const RefPtr<NG::OverlayManager> GetDragAnimationOverlayManager(int32_t containerId); 495 RefPtr<FrameNode> FindDragFrameNodeByPosition(float globalX, float globalY, 496 const RefPtr<FrameNode>& node = nullptr); 497 void FireOnDragEvent( 498 const RefPtr<FrameNode>& frameNode, const PointerEvent& pointerEvent, 499 DragEventType type, const std::string& extraInfo); 500 void FireOnItemDragEvent(const RefPtr<FrameNode>& frameNode, DragType dragType, 501 const ItemDragInfo& itemDragInfo, DragEventType type, int32_t draggedIndex, int32_t insertIndex = 0); 502 bool FireOnItemDropEvent(const RefPtr<FrameNode>& frameNode, DragType dragType, 503 const ItemDragInfo& itemDragInfo, int32_t draggedIndex, int32_t insertIndex, bool isSuccess); 504 int32_t GetItemIndex(const RefPtr<FrameNode>& frameNode, DragType dragType, float globalX, float globalY); 505 void CreateDragWindow(const GestureEvent& info, uint32_t width, uint32_t height); 506 RefPtr<FrameNode> CreateDragRootNode(const RefPtr<UINode>& customNode); 507 void ClearVelocityInfo(); 508 void UpdateVelocityTrackerPoint(const Point& point, bool isEnd = false); 509 void PrintDragFrameNode(const OHOS::Ace::PointerEvent& pointerEvent, const RefPtr<FrameNode>& dragFrameNode); 510 void PrintGridDragFrameNode(const float globalX, const float globalY, const RefPtr<FrameNode>& dragFrameNode); 511 void FireOnDragEventWithDragType(const RefPtr<EventHub>& eventHub, DragEventType type, 512 RefPtr<OHOS::Ace::DragEvent>& event, const std::string& extraParams); 513 void NotifyDragFrameNode( 514 const Point& point, const DragEventType& dragEventType, const DragRet& dragRet = DragRet::DRAG_DEFAULT); 515 void TransDragWindowToDragFwk(int32_t windowContainerId); 516 void ResetDragDrop(int32_t windowId, const Point& point); 517 bool isDistanceLimited(const Point& point); 518 bool isTimeLimited(const PointerEvent& pointerEvent, const Point& point); 519 bool ReachMoveLimit(const PointerEvent& pointerEvent, const Point& point); 520 bool IsUIExtensionShowPlaceholder(const RefPtr<NG::UINode>& node); 521 bool IsUIExtensionComponent(const RefPtr<NG::UINode>& node); 522 int32_t GetWindowId(); 523 524 std::map<int32_t, WeakPtr<FrameNode>> dragFrameNodes_; 525 std::map<int32_t, WeakPtr<FrameNode>> gridDragFrameNodes_; 526 std::map<int32_t, WeakPtr<FrameNode>> listDragFrameNodes_; 527 std::map<int32_t, WeakPtr<FrameNode>> textFieldDragFrameNodes_; 528 RefPtr<DragWindow> dragWindow_; 529 RefPtr<FrameNode> draggedFrameNode_; 530 RefPtr<FrameNode> preTargetFrameNode_; 531 RefPtr<FrameNode> draggedGridFrameNode_; 532 RefPtr<FrameNode> preGridTargetFrameNode_; 533 RefPtr<FrameNode> dragWindowRootNode_; 534 RefPtr<Clipboard> clipboard_; 535 Point preMovePoint_ = Point(0, 0); 536 uint64_t preTimeStamp_ = 0L; 537 WeakPtr<FrameNode> prepareDragFrameNode_; 538 std::function<void(const std::string&)> addDataCallback_ = nullptr; 539 std::function<void(const std::string&)> getDataCallback_ = nullptr; 540 std::function<void(const std::string&)> deleteDataCallback_ = nullptr; 541 std::string extraInfo_; 542 std::unique_ptr<JsonValue> newData_ = nullptr; 543 bool isDragCancel_ = false; 544 std::unordered_map<int32_t, WeakPtr<FrameNode>> nodesForDragNotify_; 545 std::unordered_set<int32_t> parentHitNodes_; 546 DragCursorStyleCore dragCursorStyleCore_ = DragCursorStyleCore::DEFAULT; 547 std::map<std::string, int64_t> summaryMap_; 548 uint32_t recordSize_ = 0; 549 int64_t currentId_ = -1; 550 int32_t currentPointerId_ = -1; 551 int32_t currentPullId_ = -1; 552 bool draggingPressedState_ = false; 553 554 std::function<void(void)> notifyInDraggedCallback_ = nullptr; 555 bool isDragged_ = false; 556 bool isMouseDragged_ = false; 557 bool isWindowConsumed_ = false; 558 bool isDragWindowShow_ = false; 559 bool hasNotifiedTransformation_ = false; 560 bool isPullMoveReceivedForCurrentDrag_ = false; 561 bool isDragWindowSubWindow_ = false; 562 bool isDragNodeNeedClean_ = false; 563 VelocityTracker velocityTracker_; 564 PreDragStatus preDragStatus_ = PreDragStatus::ACTION_DETECTING_STATUS; 565 Rect previewRect_ { -1, -1, -1, -1 }; 566 DragDropMgrState dragDropState_ = DragDropMgrState::IDLE; 567 DragPreviewInfo info_; 568 PointerEvent dragDropPointerEvent_; 569 bool isDragFwkShow_ = true; 570 OffsetF pixelMapOffset_; 571 OffsetF curPointerOffset_; 572 std::vector<RefPtr<PixelMap>> gatherPixelMaps_; 573 bool hasGatherNode_ = false; 574 bool isShowBadgeAnimation_ = true; 575 bool eventStrictReportingEnabled_ = false; 576 int32_t badgeNumber_ = -1; 577 int32_t currentAnimationCnt_ = 0; 578 int32_t allAnimationCnt_ = 0; 579 bool isDragWithContextMenu_ = false; 580 Point dragDampStartPoint_ { 1, 1 }; 581 OffsetF dragMovePosition_ = OffsetF(0.0f, 0.0f); 582 OffsetF lastDragMovePosition_ = OffsetF(0.0f, 0.0f); 583 OffsetF dragTotalMovePosition_ = OffsetF(0.0f, 0.0f); 584 RefPtr<GridColumnInfo> columnInfo_; 585 uint32_t dampingOverflowCount_ = 0; 586 WeakPtr<FrameNode> menuWrapperNode_; 587 std::shared_ptr<OHOS::Ace::NG::ArkUIInteralDragAction> dragAction_; 588 589 ACE_DISALLOW_COPY_AND_MOVE(DragDropManager); 590 }; 591 } // namespace OHOS::Ace::NG 592 593 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MANAGER_DRAG_DROP_DRAG_DROP_MANAGER_H 594