1 /* 2 * Copyright (c) 2021-2023 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_COMMON_EVENT_MANAGER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_EVENT_MANAGER_H 18 19 #include <unordered_map> 20 21 #include "base/memory/ace_type.h" 22 #include "base/memory/referenced.h" 23 #include "core/common/event_dump.h" 24 #include "core/common/key_event_manager.h" 25 #include "core/components/common/layout/constants.h" 26 #include "core/components_ng/event/response_ctrl.h" 27 #include "core/components_ng/gestures/gesture_referee.h" 28 #include "core/components_ng/gestures/recognizers/gesture_recognizer.h" 29 #include "core/event/axis_event.h" 30 #include "core/event/key_event.h" 31 #include "core/event/mouse_event.h" 32 #include "core/event/pointer_event.h" 33 #include "core/event/non_pointer_event.h" 34 #include "core/event/rotation_event.h" 35 #include "core/event/touch_event.h" 36 #include "core/focus/focus_node.h" 37 #include "core/gestures/gesture_referee.h" 38 #include "core/event/resample_algo.h" 39 40 namespace OHOS::Ace { 41 namespace NG { 42 class FrameNode; 43 class SelectOverlayManager; 44 class ResponseCtrl; 45 class TouchDelegate : public virtual AceType { 46 DECLARE_ACE_TYPE(TouchDelegate, AceType); 47 public: DelegateTouchEvent(const TouchEvent & point)48 virtual void DelegateTouchEvent(const TouchEvent& point) {}; 49 }; 50 } // namespace NG 51 class RenderNode; 52 class Element; 53 class TextOverlayManager; 54 using MouseHoverTestList = std::list<WeakPtr<RenderNode>>; 55 using OutOfRectGetRectCallback = std::function<void(std::vector<Rect>&)>; 56 using OutOfRectTouchCallback = std::function<void(void)>; 57 using OutOfRectMouseCallback = std::function<void(void)>; 58 using TouchDelegates = std::vector<RefPtr<NG::TouchDelegate>>; 59 using TouchDelegatesIter = TouchDelegates::const_iterator; 60 61 struct RectCallback final { RectCallbackfinal62 RectCallback(OutOfRectGetRectCallback rectGetCallback, OutOfRectTouchCallback touchCallback, 63 OutOfRectMouseCallback mouseCallback) 64 : rectGetCallback(std::move(rectGetCallback)), touchCallback(std::move(touchCallback)), 65 mouseCallback(std::move(mouseCallback)) 66 {} 67 ~RectCallback() = default; 68 OutOfRectGetRectCallback rectGetCallback; 69 OutOfRectTouchCallback touchCallback; 70 OutOfRectMouseCallback mouseCallback; 71 }; 72 73 struct TouchDelegateHdl { TouchDelegateHdlTouchDelegateHdl74 TouchDelegateHdl(int32_t touchId, TouchDelegatesIter iter) : touchId(touchId), iter(iter) {} 75 ~TouchDelegateHdl() = default; 76 int32_t touchId = -1; 77 TouchDelegatesIter iter; 78 }; 79 80 struct MarkProcessedEventInfo { 81 int32_t eventId = -1; 82 int64_t lastLogTimeStamp = 0; 83 }; 84 85 class EventManager : virtual public NG::KeyEventManager { 86 DECLARE_ACE_TYPE(EventManager, KeyEventManager); 87 88 public: 89 EventManager(); 90 ~EventManager() override = default; 91 // After the touch down event is triggered, the touch test is performed to collect the corresponding 92 // touch event target list. 93 void TouchTest(const TouchEvent& touchPoint, const RefPtr<RenderNode>& renderNode, 94 TouchRestrict& touchRestrict, const Offset& offset = Offset(), 95 float viewScale = 1.0f, bool needAppend = false); 96 97 void TouchTest(const TouchEvent& touchPoint, const RefPtr<NG::FrameNode>& frameNode, 98 TouchRestrict& touchRestrict, const Offset& offset = Offset(), 99 float viewScale = 1.0f, bool needAppend = false); 100 101 bool PostEventTouchTest(const TouchEvent& touchPoint, const RefPtr<NG::UINode>& uiNode, 102 TouchRestrict& touchRestrict); 103 104 void TouchTest(const AxisEvent& event, const RefPtr<RenderNode>& renderNode, TouchRestrict& touchRestrict); 105 106 void TouchTest(const AxisEvent& event, const RefPtr<NG::FrameNode>& frameNode, TouchRestrict& touchRestrict); 107 108 bool HasDifferentDirectionGesture(); 109 110 bool OnNonPointerEvent(const NonPointerEvent& event); 111 ACE_NON_VIRTUAL bool DispatchTouchEvent(const TouchEvent& point, bool sendOnTouch = true); 112 bool DispatchTouchEvent(const AxisEvent& event, bool sendOnTouch = true); 113 void DispatchTouchCancelToRecognizer( 114 TouchEventTarget* touchEventTarget, const std::vector<std::pair<int32_t, TouchTestResult::iterator>>& items); 115 bool PostEventDispatchTouchEvent(const TouchEvent& point); 116 void FlushTouchEventsBegin(const std::list<TouchEvent>& touchEvents); 117 void FlushTouchEventsEnd(const std::list<TouchEvent>& touchEvents); 118 void PostEventFlushTouchEventEnd(const TouchEvent& touchEvent); 119 120 // Distribute the rotation event to the corresponding render tree or requested render node. If the render is not 121 // processed, return false and the platform will handle it. 122 static bool DispatchRotationEvent( 123 const RotationEvent& event, const RefPtr<RenderNode>& renderNode, const RefPtr<RenderNode>& requestFocusNode); 124 125 // mouse event target list. 126 void MouseTest(const MouseEvent& touchPoint, const RefPtr<RenderNode>& renderNode); 127 bool DispatchMouseEvent(const MouseEvent& event); 128 void DispatchMouseHoverAnimation(const MouseEvent& event); 129 bool DispatchMouseHoverEvent(const MouseEvent& event); 130 void LogPrintLastHoverTestResultsEntry(const HoverTestResult& results); 131 void LogPrintLastHoverTestResults(); 132 void LogPrintCurrHoverTestResultsEntry(const HoverTestResult& results); 133 void LogPrintCurrHoverTestResults(); 134 135 void LogPrintCurrMouseTestResultsEntry(const MouseTestResult& results); 136 void LogPrintMouseTest(); 137 void MouseTest(const MouseEvent& event, const RefPtr<NG::FrameNode>& frameNode, TouchRestrict& touchRestrict); 138 void AccessibilityHoverTest( 139 const TouchEvent& event, const RefPtr<NG::FrameNode>& frameNode, TouchRestrict& touchRestrict); 140 void UpdateAccessibilityHoverNode(const TouchEvent& event, const TouchTestResult& testResult); 141 void PenHoverTest(const TouchEvent& event, const RefPtr<NG::FrameNode>& frameNode, TouchRestrict& touchRestrict); 142 void UpdatePenHoverNode(const TouchEvent& event, const TouchTestResult& testResult); 143 void UpdatePenHoverMoveNode(const TouchEvent& event, const TouchTestResult& testResult); 144 void UpdateHoverNode(const MouseEvent& event, const TouchTestResult& testResult); 145 bool DispatchMouseEventNG(const MouseEvent& event); 146 void DispatchMouseHoverAnimationNG(const MouseEvent& event, bool isMockEvent = false); 147 bool DispatchMouseHoverEventNG(const MouseEvent& event); 148 void DispatchHoverEffectEvent(const MouseEvent& event); 149 void DispatchAccessibilityHoverEventNG(const TouchEvent& event); 150 void DispatchPenHoverEventNG(const TouchEvent& event); 151 void DispatchPenHoverMoveEventNG(const TouchEvent& event); 152 153 void AxisTest(const AxisEvent& event, const RefPtr<RenderNode>& renderNode); 154 bool DispatchAxisEvent(const AxisEvent& event); 155 156 void AxisTest(const AxisEvent& event, const RefPtr<NG::FrameNode>& frameNode); 157 bool DispatchAxisEventNG(const AxisEvent& event); 158 159 void ClearResults(); SetInstanceId(int32_t instanceId)160 void SetInstanceId(int32_t instanceId) 161 { 162 instanceId_ = instanceId; 163 } GetInstanceId()164 int32_t GetInstanceId() override 165 { 166 return instanceId_; 167 } 168 void HandleGlobalEvent(const TouchEvent& touchPoint, const RefPtr<TextOverlayManager>& textOverlayManager); 169 void HandleGlobalEventNG(const TouchEvent& touchPoint, const RefPtr<NG::SelectOverlayManager>& selectOverlayManager, 170 const NG::OffsetF& rootOffset); 171 172 void CollectTabIndexNodes(const RefPtr<FocusNode>& rootNode); 173 174 void AdjustTabIndexNodes(); 175 176 bool HandleFocusByTabIndex( 177 const KeyEvent& event, const RefPtr<FocusNode>& focusNode, const RefPtr<FocusGroup>& curPage); 178 179 void HandleOutOfRectCallback(const Point& point, std::vector<RectCallback>& rectCallbackList); 180 GetGestureReferee()181 RefPtr<GestureReferee> GetGestureReferee() 182 { 183 return referee_; 184 } 185 GetGestureRefereeNG(const RefPtr<NG::NGGestureRecognizer> & recognizer)186 RefPtr<NG::GestureReferee> GetGestureRefereeNG(const RefPtr<NG::NGGestureRecognizer>& recognizer) 187 { 188 if (recognizer && recognizer->IsPostEventResult()) { 189 return postEventRefereeNG_; 190 } 191 return refereeNG_; 192 } 193 GetMouseStyleManager()194 RefPtr<MouseStyleManager> GetMouseStyleManager() const 195 { 196 return mouseStyleManager_; 197 } 198 FlushCursorStyleRequests()199 void FlushCursorStyleRequests() 200 { 201 CHECK_NULL_VOID(mouseStyleManager_); 202 mouseStyleManager_->VsyncMouseFormat(); 203 } 204 205 bool TryResampleTouchEvent(std::vector<TouchEvent>& history, 206 const std::vector<TouchEvent>& current, uint64_t nanoTimeStamp, TouchEvent& resample); 207 208 bool GetResampleTouchEvent(const std::vector<TouchEvent>& history, 209 const std::vector<TouchEvent>& current, uint64_t nanoTimeStamp, TouchEvent& newTouchEvent); 210 211 TouchEvent GetLatestPoint(const std::vector<TouchEvent>& current, uint64_t nanoTimeStamp); 212 213 DragPointerEvent GetResamplePointerEvent(const std::vector<DragPointerEvent>& history, 214 const std::vector<DragPointerEvent>& current, uint64_t nanoTimeStamp); 215 216 DragPointerEvent GetPointerLatestPoint(const std::vector<DragPointerEvent>& current, uint64_t nanoTimeStamp); 217 218 MouseEvent GetResampleMouseEvent( 219 const std::vector<MouseEvent>& history, const std::vector<MouseEvent>& current, uint64_t nanoTimeStamp); 220 221 MouseEvent GetMouseLatestPoint(const std::vector<MouseEvent>& current, uint64_t nanoTimeStamp); 222 223 void DoMouseActionRelease(); 224 SetIsDragging(bool isDragging)225 void SetIsDragging(bool isDragging) 226 { 227 isDragging_ = isDragging; 228 } 229 IsDragging()230 bool IsDragging() const 231 { 232 return isDragging_; 233 } 234 SetLastMoveBeforeUp(bool isLastMoveBeforeUp)235 void SetLastMoveBeforeUp(bool isLastMoveBeforeUp) 236 { 237 isLastMoveBeforeUp_ = isLastMoveBeforeUp; 238 } 239 IsLastMoveBeforeUp()240 bool IsLastMoveBeforeUp() const 241 { 242 return isLastMoveBeforeUp_; 243 } 244 GetEventTreeRecord(NG::EventTreeType treeType)245 NG::EventTreeRecord& GetEventTreeRecord(NG::EventTreeType treeType) 246 { 247 switch (treeType) { 248 case NG::EventTreeType::TOUCH : 249 return eventTree_; 250 case NG::EventTreeType::POST_EVENT : 251 return postEventTree_; 252 } 253 } 254 255 void DumpEvent(NG::EventTreeType type, bool hasJson = false); 256 257 void DumpEventWithCount(const std::vector<std::string>& params, NG::EventTreeType type, bool hasJson = false); 258 259 void AddGestureSnapshot( 260 int32_t finger, int32_t depth, const RefPtr<TouchEventTarget>& target, NG::EventTreeType type); 261 GetResponseCtrl()262 RefPtr<NG::ResponseCtrl> GetResponseCtrl() 263 { 264 return responseCtrl_; 265 } 266 267 void CheckDownEvent(const TouchEvent& touchEvent); 268 void CheckUpEvent(const TouchEvent& touchEvent); 269 std::unordered_map<size_t, TouchTestResult> touchTestResults_; 270 std::unordered_map<size_t, TouchTestResult> postEventTouchTestResults_; 271 GetAxisTouchTestResults()272 const std::unordered_map<size_t, TouchTestResult>& GetAxisTouchTestResults() const 273 { 274 return axisTouchTestResults_; 275 } 276 SetAxisTouchTestResults(std::unordered_map<size_t,TouchTestResult> & axisTouchTestResults)277 void SetAxisTouchTestResults(std::unordered_map<size_t, TouchTestResult>& axisTouchTestResults) 278 { 279 axisTouchTestResults_ = axisTouchTestResults; 280 } 281 SetInnerFlag(bool value)282 void SetInnerFlag(bool value) 283 { 284 innerEventWin_ = value; 285 } 286 GetInnerFlag()287 bool GetInnerFlag() const 288 { 289 return innerEventWin_; 290 } 291 GetLastTouchEventEndTimestamp()292 int64_t GetLastTouchEventEndTimestamp() 293 { 294 return lastTouchEventEndTimestamp_; 295 } 296 297 void RecordHitEmptyMessage( 298 const TouchEvent& touchPoint, const std::string& resultInfo, const RefPtr<NG::FrameNode>& frameNode); 299 300 void CheckAndLogLastReceivedTouchEventInfo(int32_t eventId, TouchType type); 301 302 void CheckAndLogLastConsumedTouchEventInfo(int32_t eventId, TouchType type); 303 304 void CheckAndLogLastReceivedMouseEventInfo(int32_t eventId, MouseAction action); 305 306 void CheckAndLogLastConsumedMouseEventInfo(int32_t eventId, MouseAction action); 307 308 void CheckAndLogLastReceivedAxisEventInfo(int32_t eventId, AxisAction action); 309 310 void CheckAndLogLastConsumedAxisEventInfo(int32_t eventId, AxisAction action); 311 312 void CheckAndLogLastReceivedEventInfo(int32_t eventId, bool logImmediately = false); 313 314 void CheckAndLogLastConsumedEventInfo(int32_t eventId, bool logImmediately = false); 315 316 void ClearTouchTestTargetForPenStylus(TouchEvent& touchEvent); 317 GetDownFingerIds()318 inline const std::unordered_map<int32_t, int32_t>& GetDownFingerIds() const 319 { 320 return downFingerIds_; 321 } 322 GetIdToTouchPoint()323 inline const std::unordered_map<int32_t, TouchEvent>& GetIdToTouchPoint() const 324 { 325 return idToTouchPoints_; 326 } 327 EraseFingerId(int32_t id)328 inline void EraseFingerId(int32_t id) 329 { 330 idToTouchPoints_.erase(id); 331 } 332 SetIdToTouchPoint(std::unordered_map<int32_t,TouchEvent> && idToTouchPoint)333 inline void SetIdToTouchPoint(std::unordered_map<int32_t, TouchEvent>&& idToTouchPoint) 334 { 335 idToTouchPoints_ = std::move(idToTouchPoint); 336 } 337 GetLastDispatchTime()338 inline std::unordered_map<int32_t, uint64_t>& GetLastDispatchTime() 339 { 340 return lastDispatchTime_; 341 } 342 SetLastDispatchTime(std::unordered_map<int32_t,uint64_t> && lastDispatchTime)343 inline void SetLastDispatchTime(std::unordered_map<int32_t, uint64_t>&& lastDispatchTime) 344 { 345 lastDispatchTime_ = std::move(lastDispatchTime); 346 } 347 348 TouchEvent ConvertAxisEventToTouchEvent(const AxisEvent& axisEvent); 349 350 void CleanRecognizersForDragBegin(TouchEvent& touchEvent); 351 352 void CleanHoverStatusForDragBegin(); 353 354 void RegisterDragTouchEventListener(int32_t uniqueIdentify, std::function<void(const TouchEvent&)> callback); 355 356 void UnRegisterDragTouchEventListener(int32_t uniqueIdentify); 357 358 void NotifyDragTouchEventListener(const TouchEvent& dragPointerEvent); 359 360 void AddToMousePendingRecognizers(const WeakPtr<NG::NGGestureRecognizer>& recognizer); 361 GetPassThroughResult()362 bool GetPassThroughResult() const 363 { 364 return passThroughResult_; 365 } 366 367 template<typename T> 368 bool CheckDifferentTargetDisplay(const std::vector<T>& historyEvents, const std::vector<T>& events); 369 370 std::unordered_map<int32_t, TouchDelegates> touchDelegatesMap_; 371 372 TouchDelegateHdl AddTouchDelegate(const int32_t touchId, const RefPtr<NG::TouchDelegate>& delegater); 373 374 TouchDelegateHdl UpdateTouchDelegate(const int32_t touchId, const RefPtr<NG::TouchDelegate>& delegater); 375 376 void UnregisterTouchDelegate(TouchDelegateHdl handler); 377 378 void UnregisterTouchDelegate(int32_t touchId); 379 380 void DelegateTouchEvent(const TouchEvent& point); 381 382 void AddTouchDoneFrameNode(const WeakPtr<NG::FrameNode>& frameNode); 383 GetCurrentMouseStyle()384 MouseFormat GetCurrentMouseStyle() 385 { 386 CHECK_NULL_RETURN(mouseStyleManager_, MouseFormat::DEFAULT); 387 return mouseStyleManager_->GetCurrentMouseStyle(); 388 } 389 IsDragCancelPending()390 bool IsDragCancelPending() const 391 { 392 return isDragCancelPending_; 393 } 394 395 #if defined(SUPPORT_TOUCH_TARGET_TEST) 396 bool TouchTargetHitTest(const TouchEvent& touchPoint, const RefPtr<NG::FrameNode>& frameNode, 397 TouchRestrict& touchRestrict, const Offset& offset = Offset(), float viewScale = 1.0f, 398 bool needAppend = false, const std::string& target = ""); 399 #endif 400 private: 401 void SetHittedFrameNode(const std::list<RefPtr<NG::NGGestureRecognizer>>& touchTestResults); 402 void CleanGestureEventHub(); 403 void GetTouchTestIds(const TouchEvent& touchPoint, std::vector<std::string>& touchTestIds, 404 bool& isMousePressAtSelectedNode, int32_t selectedNodeId); 405 void CheckMouseTestResults(bool& isMousePressAtSelectedNode, int32_t selectedNodeId, int32_t fingerId); 406 void CleanRefereeBeforeTouchTest(TouchEvent touchPoint, bool needAppend); 407 void LogTouchTestResultInfo(const TouchEvent& touchPoint, const RefPtr<NG::FrameNode>& frameNode, 408 TouchRestrict& touchRestrict, const Offset& offset = Offset(), 409 float viewScale = 1.0f, bool needAppend = false); 410 void LogTouchTestResultRecognizers(const TouchTestResult& result, int32_t touchEventId); 411 void LogTouchTestRecognizerStates(int32_t touchEventId); 412 void CheckRefereeStateAndReTouchTest(const TouchEvent& touchPoint, const RefPtr<NG::FrameNode>& frameNode, 413 TouchRestrict& touchRestrict, const Offset& offset = Offset(), 414 float viewScale = 1.0f, bool needAppend = false); 415 bool DispatchMultiContainerEvent(const TouchEvent& point); 416 void DispatchTouchEventAndCheck(const TouchEvent& event, bool sendOnTouch = true); 417 void DispatchTouchEventInOldPipeline(const TouchEvent& point, bool dispatchSuccess); 418 void DispatchTouchEventToTouchTestResult(const TouchEvent& touchEvent, TouchTestResult touchTestResult, 419 bool sendOnTouch); 420 void SetResponseLinkRecognizers(const TouchTestResult& result, const ResponseLinkResult& responseLinkRecognizers); 421 void FalsifyCancelEventAndDispatch(const TouchEvent& touchPoint, bool sendOnTouch = true); 422 void FalsifyCancelEventAndDispatch(const AxisEvent& axisEvent, bool sendOnTouch = true); 423 void FalsifyHoverCancelEventAndDispatch(const TouchEvent& touchPoint); 424 void UpdateDragInfo(TouchEvent& point); 425 void UpdateInfoWhenFinishDispatch(const TouchEvent& point, bool sendOnTouch); 426 void DoSingleMouseActionRelease(const PressMouseInfo& pressMouseInfo); 427 bool DispatchMouseEventInGreatOrEqualAPI13(const MouseEvent& event); 428 bool DispatchMouseEventInLessAPI13(const MouseEvent& event); 429 void DispatchMouseEventToPressResults(const MouseEvent& event, const MouseTestResult& targetResults, 430 MouseTestResult& handledResults, bool& isStopPropagation); 431 bool DispatchMouseEventToCurResults( 432 const MouseEvent& event, const MouseTestResult& handledResults, bool& isStopPropagation); 433 bool DispatchMouseEventToCurResultsInLessAPI13( 434 const MouseEvent& event, const MouseTestResult& handledResults, bool isStopPropagation); 435 void CheckMousePendingRecognizersState(const TouchEvent& event); 436 void ExecuteTouchTestDoneCallback(const TouchEvent& touchEvent, const ResponseLinkResult& responseLinkRecognizers); 437 void ExecuteTouchTestDoneCallback(const AxisEvent& axisEvent, const ResponseLinkResult& responseLinkRecognizers); 438 bool innerEventWin_ = false; 439 std::unordered_map<size_t, TouchTestResult> mouseTestResults_; 440 std::unordered_map<int32_t, MouseTestResult> currMouseTestResultsMap_; 441 // used less than API13 442 MouseTestResult pressMouseTestResults_; 443 // used great or equal API13 444 std::unordered_map<PressMouseInfo, MouseTestResult, PressMouseInfoHashFunc> pressMouseTestResultsMap_; 445 std::unordered_map<int32_t, HoverTestResult> currHoverTestResultsMap_; 446 std::unordered_map<int32_t, HoverTestResult> lastHoverTestResultsMap_; 447 HoverTestResult curAccessibilityHoverResults_; 448 HoverTestResult lastAccessibilityHoverResults_; 449 std::unordered_map<int32_t, HoverTestResult> curPenHoverResultsMap_; 450 std::unordered_map<int32_t, HoverTestResult> curPenHoverMoveResultsMap_; 451 std::unordered_map<int32_t, HoverTestResult> lastPenHoverResultsMap_; 452 std::unordered_map<int32_t, AxisTestResult> axisTestResultsMap_; 453 WeakPtr<NG::FrameNode> lastHoverNode_; 454 WeakPtr<NG::FrameNode> currHoverNode_; 455 std::unordered_map<size_t, TouchTestResult> axisTouchTestResults_; 456 /** 457 * One mechanism to let someone can receive all touch events beyond the controllers and recognizers' dispatching 458 * process. This only can be used for some models which have global status, such as drag and drop manager, it's 459 * handling does not belong to any controller in general 460 */ 461 std::unordered_map<int32_t, std::function<void(const TouchEvent&)>> dragTouchEventListener_; 462 MouseHoverTestList mouseHoverTestResults_; 463 MouseHoverTestList mouseHoverTestResultsPre_; 464 WeakPtr<RenderNode> mouseHoverNodePre_; 465 WeakPtr<RenderNode> mouseHoverNode_; 466 WeakPtr<RenderNode> axisNode_; 467 int32_t instanceId_ = 0; 468 uint32_t lastHoverDispatchLength_ = 0; 469 uint32_t lastAccessibilityHoverDispatchLength_ = 0; 470 uint32_t lastPenHoverDispatchLength_ = 0; 471 bool inSelectedRect_ = false; 472 bool isDragging_ = false; 473 bool isLastMoveBeforeUp_ = false; 474 RefPtr<GestureReferee> referee_; 475 RefPtr<NG::GestureReferee> refereeNG_; 476 RefPtr<NG::GestureReferee> postEventRefereeNG_; 477 RefPtr<MouseStyleManager> mouseStyleManager_; 478 NG::EventTreeRecord eventTree_; 479 NG::EventTreeRecord postEventTree_; 480 RefPtr<NG::ResponseCtrl> responseCtrl_; 481 TimeStamp lastEventTime_; 482 int64_t lastTouchEventEndTimestamp_ = 0; 483 std::unordered_map<int32_t, int32_t> downFingerIds_; 484 std::set<WeakPtr<NG::FrameNode>> hittedFrameNode_; 485 MarkProcessedEventInfo lastReceivedEvent_; 486 MarkProcessedEventInfo lastConsumedEvent_; 487 int32_t lastDownFingerNumber_ = 0; 488 SourceTool lastSourceTool_ = SourceTool::UNKNOWN; 489 // used to pseudo cancel event. 490 TouchEvent lastTouchEvent_; 491 // used to pseudo hover out event. 492 MouseEvent lastMouseEvent_; 493 std::unordered_map<int32_t, TouchEvent> idToTouchPoints_; 494 std::unordered_map<int32_t, uint64_t> lastDispatchTime_; 495 std::vector<WeakPtr<NG::NGGestureRecognizer>> mousePendingRecognizers_; 496 std::vector<WeakPtr<NG::FrameNode>> onTouchTestDoneFrameNodeList_; 497 bool passThroughResult_ = false; 498 bool isDragCancelPending_ = false; 499 }; 500 501 } // namespace OHOS::Ace 502 503 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_EVENT_MANAGER_H 504