1 /* 2 * Copyright (c) 2022-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_COMPONENTS_NG_EVENT_GESTURE_EVENT_HUB_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_EVENT_HUB_H 18 19 #include <list> 20 #include <vector> 21 22 #include "base/geometry/ng/point_t.h" 23 #include "base/memory/referenced.h" 24 #include "core/common/interaction/interaction_data.h" 25 #include "core/components/common/layout/constants.h" 26 #include "core/components_ng/event/click_event.h" 27 #include "core/components_ng/event/drag_event.h" 28 #include "core/components_ng/event/long_press_event.h" 29 #include "core/components_ng/event/pan_event.h" 30 #include "core/components_ng/event/scrollable_event.h" 31 #include "core/components_ng/event/target_component.h" 32 #include "core/components_ng/event/touch_event.h" 33 #include "core/components_ng/gestures/gesture_info.h" 34 #include "core/components_ng/gestures/recognizers/exclusive_recognizer.h" 35 #include "core/components_ng/gestures/recognizers/parallel_recognizer.h" 36 #include "core/components_ng/manager/drag_drop/drag_drop_proxy.h" 37 #include "core/gestures/gesture_info.h" 38 39 namespace OHOS::Ace { 40 struct DragNotifyMsg; 41 class UnifiedData; 42 } 43 44 enum class MenuPreviewMode { 45 NONE, 46 IMAGE, 47 CUSTOM, 48 }; 49 namespace OHOS::Ace::NG { 50 51 enum class HitTestMode { 52 /** 53 * Both self and children respond to the hit test for touch events, 54 * but block hit test of the other nodes which is masked by this node. 55 */ 56 HTMDEFAULT = 0, 57 58 /** 59 * Self respond to the hit test for touch events, 60 * but block hit test of children and other nodes which is masked by this node. 61 */ 62 HTMBLOCK, 63 64 /** 65 * Self and child respond to the hit test for touch events, 66 * and allow hit test of other nodes which is masked by this node. 67 */ 68 HTMTRANSPARENT, 69 70 /** 71 * Self not respond to the hit test for touch events, 72 * but children respond to the hit test for touch events. 73 */ 74 HTMNONE, 75 76 /** 77 * Self and child respond to the hit test for touch events, 78 * when self consumed allow hit test of other nodes which is masked by this node, 79 * when child consumed block hit test of other nodes. 80 */ 81 HTMTRANSPARENT_SELF, 82 }; 83 84 enum class TouchTestStrategy { 85 DEFAULT = 0, 86 FORWARD_COMPETITION, 87 FORWARD 88 }; 89 90 struct TouchTestInfo { 91 PointF windowPoint; 92 PointF currentCmpPoint; 93 PointF subCmpPoint; 94 RectF subRect; 95 std::string id; 96 }; 97 98 struct TouchResult { 99 TouchTestStrategy strategy; 100 std::string id; 101 }; 102 103 enum class HitTestResult { 104 // The touch point is located outside the current component area; 105 OUT_OF_REGION, 106 // node consumption events and prevent bubbling; 107 STOP_BUBBLING, 108 // node process events and bubble; 109 BUBBLING, 110 // node process events and bubble; 111 SELF_TRANSPARENT, 112 }; 113 114 struct DragDropBaseInfo { 115 RefPtr<AceType> node; 116 RefPtr<PixelMap> pixelMap; 117 std::string extraInfo; 118 }; 119 120 using OnDragStartFunc = std::function<DragDropBaseInfo(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)>; 121 using OnDragDropFunc = std::function<void(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)>; 122 using OnChildTouchTestFunc = std::function<TouchResult(const std::vector<TouchTestInfo>& touchInfo)>; 123 using OnReponseRegionFunc = std::function<void(const std::vector<DimensionRect>&)>; 124 struct DragDropInfo { 125 RefPtr<UINode> customNode; 126 RefPtr<PixelMap> pixelMap; 127 std::string extraInfo; 128 }; 129 130 using DragNotifyMsgCore = OHOS::Ace::DragNotifyMsg; 131 using OnDragCallbackCore = std::function<void(const DragNotifyMsgCore&)>; 132 constexpr float PIXELMAP_WIDTH_RATE = -0.5f; 133 constexpr float PIXELMAP_HEIGHT_RATE = -0.2f; 134 constexpr float PIXELMAP_DEFALUT_LIMIT_SCALE = 0.5f; 135 constexpr float PIXELMAP_DRAG_WGR_TEXT_SCALE = 2.0f; 136 constexpr float PIXELMAP_DRAG_WGR_SCALE = 3.0f; 137 constexpr float DEFALUT_DRAG_PPIXELMAP_SCALE = 1.05f; 138 constexpr float PIXELMAP_DRAG_DEFAULT_HEIGHT = -28.0f; 139 140 class EventHub; 141 142 // The gesture event hub is mainly used to handle common gesture events. 143 class ACE_FORCE_EXPORT GestureEventHub : public Referenced { 144 public: 145 explicit GestureEventHub(const WeakPtr<EventHub>& eventHub); 146 ~GestureEventHub() override = default; 147 AddGesture(const RefPtr<NG::Gesture> & gesture)148 void AddGesture(const RefPtr<NG::Gesture>& gesture) 149 { 150 if (!recreateGesture_) { 151 gestures_.clear(); 152 } 153 gestures_.emplace_back(gesture); 154 backupGestures_.emplace_back(gesture); 155 recreateGesture_ = true; 156 } 157 AddScrollableEvent(const RefPtr<ScrollableEvent> & scrollableEvent)158 void AddScrollableEvent(const RefPtr<ScrollableEvent>& scrollableEvent) 159 { 160 if (!scrollableActuator_) { 161 scrollableActuator_ = MakeRefPtr<ScrollableActuator>(WeakClaim(this)); 162 } 163 scrollableActuator_->AddScrollableEvent(scrollableEvent); 164 } 165 RemoveScrollableEvent(const RefPtr<ScrollableEvent> & scrollableEvent)166 void RemoveScrollableEvent(const RefPtr<ScrollableEvent>& scrollableEvent) 167 { 168 if (!scrollableActuator_) { 169 return; 170 } 171 scrollableActuator_->RemoveScrollableEvent(scrollableEvent); 172 } 173 AddScrollEdgeEffect(const Axis & axis,RefPtr<ScrollEdgeEffect> & scrollEffect)174 void AddScrollEdgeEffect(const Axis& axis, RefPtr<ScrollEdgeEffect>& scrollEffect) 175 { 176 if (!scrollableActuator_) { 177 scrollableActuator_ = MakeRefPtr<ScrollableActuator>(WeakClaim(this)); 178 } 179 scrollableActuator_->AddScrollEdgeEffect(axis, scrollEffect); 180 } 181 RemoveScrollEdgeEffect(const RefPtr<ScrollEdgeEffect> & scrollEffect)182 void RemoveScrollEdgeEffect(const RefPtr<ScrollEdgeEffect>& scrollEffect) 183 { 184 if (!scrollableActuator_) { 185 return; 186 } 187 scrollableActuator_->RemoveScrollEdgeEffect(scrollEffect); 188 } 189 AddPreviewMenuHandleDragEnd(GestureEventFunc && actionEnd)190 void AddPreviewMenuHandleDragEnd(GestureEventFunc&& actionEnd) 191 { 192 if (!scrollableActuator_) { 193 scrollableActuator_ = MakeRefPtr<ScrollableActuator>(WeakClaim(this)); 194 } 195 scrollableActuator_->AddPreviewMenuHandleDragEnd(std::move(actionEnd)); 196 } 197 198 // Set by user define, which will replace old one. SetTouchEvent(TouchEventFunc && touchEventFunc)199 void SetTouchEvent(TouchEventFunc&& touchEventFunc) 200 { 201 if (!touchEventActuator_) { 202 touchEventActuator_ = MakeRefPtr<TouchEventActuator>(); 203 } 204 touchEventActuator_->ReplaceTouchEvent(std::move(touchEventFunc)); 205 } 206 207 // Set by node container. SetOnTouchEvent(TouchEventFunc && touchEventFunc)208 void SetOnTouchEvent(TouchEventFunc&& touchEventFunc) 209 { 210 if (!touchEventActuator_) { 211 touchEventActuator_ = MakeRefPtr<TouchEventActuator>(); 212 } 213 touchEventActuator_->SetOnTouchEvent(std::move(touchEventFunc)); 214 } 215 AddTouchEvent(const RefPtr<TouchEventImpl> & touchEvent)216 void AddTouchEvent(const RefPtr<TouchEventImpl>& touchEvent) 217 { 218 if (!touchEventActuator_) { 219 touchEventActuator_ = MakeRefPtr<TouchEventActuator>(); 220 } 221 touchEventActuator_->AddTouchEvent(touchEvent); 222 } 223 RemoveTouchEvent(const RefPtr<TouchEventImpl> & touchEvent)224 void RemoveTouchEvent(const RefPtr<TouchEventImpl>& touchEvent) 225 { 226 if (!touchEventActuator_) { 227 return; 228 } 229 touchEventActuator_->RemoveTouchEvent(touchEvent); 230 } 231 232 void SetFocusClickEvent(GestureEventFunc&& clickEvent); 233 IsClickable()234 bool IsClickable() const 235 { 236 return clickEventActuator_ != nullptr; 237 } 238 239 bool IsAccessibilityClickable(); 240 bool IsAccessibilityLongClickable(); 241 242 bool ActClick(std::shared_ptr<JsonValue> secComphandle = nullptr); 243 244 void CheckClickActuator(); 245 // Set by user define, which will replace old one. 246 void SetUserOnClick(GestureEventFunc&& clickEvent); 247 248 void SetOnGestureJudgeBegin(GestureJudgeFunc&& gestureJudgeFunc); 249 250 void SetOnGestureJudgeNativeBegin(GestureJudgeFunc&& gestureJudgeFunc); 251 GetOnGestureJudgeBeginCallback()252 GestureJudgeFunc GetOnGestureJudgeBeginCallback() const 253 { 254 return gestureJudgeFunc_; 255 } 256 GetOnGestureJudgeNativeBeginCallback()257 GestureJudgeFunc GetOnGestureJudgeNativeBeginCallback() const 258 { 259 return gestureJudgeNativeFunc_; 260 } 261 262 // When the event param is undefined, it will clear the callback. 263 void ClearUserOnClick(); 264 void ClearUserOnTouch(); 265 266 void AddClickEvent(const RefPtr<ClickEvent>& clickEvent); 267 RemoveClickEvent(const RefPtr<ClickEvent> & clickEvent)268 void RemoveClickEvent(const RefPtr<ClickEvent>& clickEvent) 269 { 270 if (!clickEventActuator_) { 271 return; 272 } 273 clickEventActuator_->RemoveClickEvent(clickEvent); 274 } 275 IsClickEventsEmpty()276 bool IsClickEventsEmpty() const 277 { 278 if (!clickEventActuator_) { 279 return true; 280 } 281 return clickEventActuator_->IsClickEventsEmpty(); 282 } 283 284 void BindMenu(GestureEventFunc&& showMenu); 285 IsLongClickable()286 bool IsLongClickable() const 287 { 288 return longPressEventActuator_ != nullptr; 289 } 290 291 bool ActLongClick(); 292 293 void SetLongPressEvent(const RefPtr<LongPressEvent>& event, bool isForDrag = false, bool isDisableMouseLeft = false, 294 int32_t duration = 500) 295 { 296 if (!longPressEventActuator_) { 297 longPressEventActuator_ = MakeRefPtr<LongPressEventActuator>(WeakClaim(this)); 298 longPressEventActuator_->SetOnAccessibility(GetOnAccessibilityEventFunc()); 299 } 300 longPressEventActuator_->SetLongPressEvent(event, isForDrag, isDisableMouseLeft); 301 longPressEventActuator_->SetDuration(duration); 302 } 303 304 // Set by user define, which will replace old one. SetPanEvent(const RefPtr<PanEvent> & panEvent,PanDirection direction,int32_t fingers,Dimension distance)305 void SetPanEvent(const RefPtr<PanEvent>& panEvent, PanDirection direction, int32_t fingers, Dimension distance) 306 { 307 if (!panEventActuator_) { 308 panEventActuator_ = 309 MakeRefPtr<PanEventActuator>(WeakClaim(this), direction, fingers, distance.ConvertToPx()); 310 } 311 panEventActuator_->ReplacePanEvent(panEvent); 312 } 313 AddPanEvent(const RefPtr<PanEvent> & panEvent,PanDirection direction,int32_t fingers,Dimension distance)314 void AddPanEvent(const RefPtr<PanEvent>& panEvent, PanDirection direction, int32_t fingers, Dimension distance) 315 { 316 if (!panEventActuator_ || direction.type != panEventActuator_->GetDirection().type) { 317 panEventActuator_ = 318 MakeRefPtr<PanEventActuator>(WeakClaim(this), direction, fingers, distance.ConvertToPx()); 319 } 320 panEventActuator_->AddPanEvent(panEvent); 321 } 322 RemovePanEvent(const RefPtr<PanEvent> & panEvent)323 void RemovePanEvent(const RefPtr<PanEvent>& panEvent) 324 { 325 if (!panEventActuator_) { 326 return; 327 } 328 panEventActuator_->RemovePanEvent(panEvent); 329 } 330 SetPanEventType(GestureTypeName typeName)331 void SetPanEventType(GestureTypeName typeName) 332 { 333 CHECK_NULL_VOID(panEventActuator_); 334 panEventActuator_->SetPanEventType(typeName); 335 } 336 337 // Set by user define, which will replace old one. SetDragEvent(const RefPtr<DragEvent> & dragEvent,PanDirection direction,int32_t fingers,Dimension distance)338 void SetDragEvent(const RefPtr<DragEvent>& dragEvent, PanDirection direction, int32_t fingers, Dimension distance) 339 { 340 if (!dragEventActuator_) { 341 dragEventActuator_ = 342 MakeRefPtr<DragEventActuator>(WeakClaim(this), direction, fingers, distance.ConvertToPx()); 343 } 344 dragEventActuator_->ReplaceDragEvent(dragEvent); 345 } 346 SetCustomDragEvent(const RefPtr<DragEvent> & dragEvent,PanDirection direction,int32_t fingers,Dimension distance)347 void SetCustomDragEvent( 348 const RefPtr<DragEvent>& dragEvent, PanDirection direction, int32_t fingers, Dimension distance) 349 { 350 if (!dragEventActuator_) { 351 dragEventActuator_ = 352 MakeRefPtr<DragEventActuator>(WeakClaim(this), direction, fingers, distance.ConvertToPx()); 353 } 354 dragEventActuator_->SetCustomDragEvent(dragEvent); 355 } 356 357 // the return value means prevents event bubbling. 358 bool ProcessTouchTestHit(const OffsetF& coordinateOffset, const TouchRestrict& touchRestrict, 359 TouchTestResult& innerTargets, TouchTestResult& finalResult, int32_t touchId, const PointF& localPoint, 360 const RefPtr<TargetComponent>& targetComponent); 361 362 RefPtr<FrameNode> GetFrameNode() const; 363 OnContextAttached()364 void OnContextAttached() {} 365 366 std::string GetHitTestModeStr() const; 367 GetHitTestMode()368 HitTestMode GetHitTestMode() const 369 { 370 return hitTestMode_; 371 } 372 SetHitTestMode(HitTestMode hitTestMode)373 void SetHitTestMode(HitTestMode hitTestMode) 374 { 375 hitTestMode_ = hitTestMode; 376 } 377 RemoveDragEvent()378 void RemoveDragEvent() 379 { 380 if (!dragEventActuator_) { 381 return; 382 } 383 dragEventActuator_->ClearDragEvent(); 384 } 385 386 void CombineIntoExclusiveRecognizer( 387 const PointF& globalPoint, const PointF& localPoint, TouchTestResult& result, int32_t touchId); 388 GetResponseRegion()389 const std::vector<DimensionRect>& GetResponseRegion() const 390 { 391 return responseRegion_; 392 } 393 GetMouseResponseRegion()394 const std::vector<DimensionRect>& GetMouseResponseRegion() const 395 { 396 return mouseResponseRegion_; 397 } 398 SetResponseRegionFunc(const OnReponseRegionFunc & func)399 void SetResponseRegionFunc(const OnReponseRegionFunc& func) 400 { 401 responseRegionFunc_ = func; 402 } 403 SetResponseRegion(const std::vector<DimensionRect> & responseRegion)404 void SetResponseRegion(const std::vector<DimensionRect>& responseRegion) 405 { 406 responseRegion_ = responseRegion; 407 if (!responseRegion_.empty()) { 408 isResponseRegion_ = true; 409 } 410 if (responseRegionFunc_) { 411 responseRegionFunc_(responseRegion_); 412 } 413 } 414 SetOnTouchTestFunc(OnChildTouchTestFunc && callback)415 void SetOnTouchTestFunc(OnChildTouchTestFunc&& callback) 416 { 417 onChildTouchTestFunc_ = callback; 418 } 419 GetOnTouchTestFunc()420 const OnChildTouchTestFunc& GetOnTouchTestFunc() 421 { 422 return onChildTouchTestFunc_; 423 } 424 SetMouseResponseRegion(const std::vector<DimensionRect> & mouseResponseRegion)425 void SetMouseResponseRegion(const std::vector<DimensionRect>& mouseResponseRegion) 426 { 427 mouseResponseRegion_ = mouseResponseRegion; 428 if (!mouseResponseRegion_.empty()) { 429 isResponseRegion_ = true; 430 } 431 } 432 AddResponseRect(const DimensionRect & responseRect)433 void AddResponseRect(const DimensionRect& responseRect) 434 { 435 responseRegion_.emplace_back(responseRect); 436 isResponseRegion_ = true; 437 438 if (responseRegionFunc_) { 439 responseRegionFunc_(responseRegion_); 440 } 441 } 442 RemoveLastResponseRect()443 void RemoveLastResponseRect() 444 { 445 if (responseRegion_.empty()) { 446 isResponseRegion_ = false; 447 return; 448 } 449 responseRegion_.pop_back(); 450 if (responseRegion_.empty()) { 451 isResponseRegion_ = false; 452 } 453 454 if (responseRegionFunc_) { 455 responseRegionFunc_(responseRegion_); 456 } 457 } 458 GetTouchable()459 bool GetTouchable() const 460 { 461 return touchable_; 462 } 463 SetTouchable(bool touchable)464 void SetTouchable(bool touchable) 465 { 466 touchable_ = touchable; 467 } 468 SetThumbnailCallback(std::function<void (Offset)> && callback)469 void SetThumbnailCallback(std::function<void(Offset)>&& callback) 470 { 471 if (dragEventActuator_) { 472 dragEventActuator_->SetThumbnailCallback(std::move(callback)); 473 } 474 } 475 GetTextDraggable()476 bool GetTextDraggable() const 477 { 478 return textDraggable_; 479 } 480 SetTextDraggable(bool draggable)481 void SetTextDraggable(bool draggable) 482 { 483 textDraggable_ = draggable; 484 } 485 SetIsTextDraggable(bool isTextDraggable)486 void SetIsTextDraggable(bool isTextDraggable) 487 { 488 isTextDraggable_ = isTextDraggable; 489 } 490 GetIsTextDraggable()491 bool GetIsTextDraggable() 492 { 493 return isTextDraggable_; 494 } 495 SetPreviewMode(MenuPreviewMode mode)496 void SetPreviewMode(MenuPreviewMode mode) 497 { 498 previewMode_ = mode; 499 } 500 GetPreviewMode()501 MenuPreviewMode GetPreviewMode() 502 { 503 return previewMode_; 504 } 505 SetPixelMap(RefPtr<PixelMap> pixelMap)506 void SetPixelMap(RefPtr<PixelMap> pixelMap) 507 { 508 pixelMap_ = pixelMap; 509 } 510 GetPixelMap()511 RefPtr<PixelMap> GetPixelMap() 512 { 513 return pixelMap_; 514 } 515 SetDragPreviewPixelMap(RefPtr<PixelMap> pixelMap)516 void SetDragPreviewPixelMap(RefPtr<PixelMap> pixelMap) 517 { 518 dragPreviewPixelMap_ = pixelMap; 519 } 520 GetLongPressRecognizer()521 RefPtr<LongPressRecognizer> GetLongPressRecognizer() const 522 { 523 CHECK_NULL_RETURN(longPressEventActuator_, nullptr); 524 return longPressEventActuator_->GetLongPressRecognizer(); 525 } 526 SetIsAllowMouse(bool isAllowMouse)527 void SetIsAllowMouse(bool isAllowMouse) const 528 { 529 CHECK_NULL_VOID(panEventActuator_); 530 panEventActuator_->SetIsAllowMouse(isAllowMouse); 531 } 532 GetUserClickEventActuator()533 const RefPtr<ClickEventActuator>& GetUserClickEventActuator() 534 { 535 return userParallelClickEventActuator_; 536 } 537 538 int32_t SetDragData(const RefPtr<UnifiedData>& unifiedData, std::string& udKey); 539 OnDragCallbackCore GetDragCallback(const RefPtr<PipelineBase>& context, const WeakPtr<EventHub>& hub); 540 void GenerateMousePixelMap(const GestureEvent& info); 541 OffsetF GetPixelMapOffset( 542 const GestureEvent& info, const SizeF& size, const float scale = 1.0f, const bool needScale = false) const; 543 float GetPixelMapScale(const int32_t height, const int32_t width) const; 544 bool IsPixelMapNeedScale() const; 545 void InitDragDropEvent(); 546 void HandleOnDragStart(const GestureEvent& info); 547 void HandleOnDragUpdate(const GestureEvent& info); 548 void HandleOnDragEnd(const GestureEvent& info); 549 void HandleOnDragCancel(); 550 551 void StartLongPressActionForWeb(); 552 void CancelDragForWeb(); 553 void StartDragTaskForWeb(); 554 void ResetDragActionForWeb(); 555 556 void OnModifyDone(); 557 bool KeyBoardShortCutClick(const KeyEvent& event, const WeakPtr<NG::FrameNode>& node); 558 bool IsAllowedDrag(RefPtr<EventHub> eventHub); 559 void HandleNotallowDrag(const GestureEvent& info); 560 GetDragEventActuator()561 RefPtr<DragEventActuator> GetDragEventActuator() 562 { 563 return dragEventActuator_; 564 } 565 566 bool GetMonopolizeEvents() const; 567 568 void SetMonopolizeEvents(bool monopolizeEvents); 569 virtual RefPtr<NGGestureRecognizer> PackInnerRecognizer( 570 const Offset& offset, std::list<RefPtr<NGGestureRecognizer>>& innerRecognizers, int32_t touchId, 571 const RefPtr<TargetComponent>& targetComponent); 572 CleanExternalRecognizers()573 void CleanExternalRecognizers() 574 { 575 externalParallelRecognizer_.clear(); 576 externalExclusiveRecognizer_.clear(); 577 } 578 579 bool parallelCombineClick = false; 580 RefPtr<ParallelRecognizer> innerParallelRecognizer_; 581 582 void CopyGestures(const RefPtr<GestureEventHub>& gestureEventHub); 583 584 void CopyEvent(const RefPtr<GestureEventHub>& gestureEventHub); 585 586 int32_t RegisterCoordinationListener(const RefPtr<PipelineBase>& context); 587 588 private: 589 void ProcessTouchTestHierarchy(const OffsetF& coordinateOffset, const TouchRestrict& touchRestrict, 590 std::list<RefPtr<NGGestureRecognizer>>& innerRecognizers, TouchTestResult& finalResult, int32_t touchId, 591 const RefPtr<TargetComponent>& targetComponent); 592 593 void UpdateGestureHierarchy(); 594 595 // old path. 596 void UpdateExternalNGGestureRecognizer(); 597 598 OnAccessibilityEventFunc GetOnAccessibilityEventFunc(); 599 600 void OnDragStart(const GestureEvent& info, const RefPtr<PipelineBase>& context, const RefPtr<FrameNode> frameNode, 601 const DragDropInfo dragDropInfo, const RefPtr<OHOS::Ace::DragEvent>& dragEvent); 602 603 WeakPtr<EventHub> eventHub_; 604 RefPtr<ScrollableActuator> scrollableActuator_; 605 RefPtr<TouchEventActuator> touchEventActuator_; 606 RefPtr<ClickEventActuator> clickEventActuator_; 607 RefPtr<ClickEventActuator> userParallelClickEventActuator_; 608 RefPtr<LongPressEventActuator> longPressEventActuator_; 609 RefPtr<PanEventActuator> panEventActuator_; 610 RefPtr<DragEventActuator> dragEventActuator_; 611 RefPtr<ExclusiveRecognizer> innerExclusiveRecognizer_; 612 RefPtr<ExclusiveRecognizer> nodeExclusiveRecognizer_; 613 RefPtr<ParallelRecognizer> nodeParallelRecognizer_; 614 std::vector<RefPtr<ExclusiveRecognizer>> externalExclusiveRecognizer_; 615 std::vector<RefPtr<ParallelRecognizer>> externalParallelRecognizer_; 616 RefPtr<DragDropProxy> dragDropProxy_; 617 618 // Set by use gesture, priorityGesture and parallelGesture attribute function. 619 std::list<RefPtr<NG::Gesture>> gestures_; 620 std::list<RefPtr<NG::Gesture>> backupGestures_; 621 std::list<RefPtr<NGGestureRecognizer>> gestureHierarchy_; 622 623 // used in bindMenu, need to delete the old callback when bindMenu runs again 624 RefPtr<ClickEvent> showMenu_; 625 626 HitTestMode hitTestMode_ = HitTestMode::HTMDEFAULT; 627 bool recreateGesture_ = true; 628 bool isResponseRegion_ = false; 629 std::vector<DimensionRect> responseRegion_; 630 std::vector<DimensionRect> mouseResponseRegion_; 631 bool touchable_ = true; 632 RefPtr<PixelMap> pixelMap_; 633 634 // Save dragPreview pixelMap of user setting, transfer to drag framework on drag start. 635 RefPtr<PixelMap> dragPreviewPixelMap_; 636 637 OffsetF frameNodeOffset_; 638 SizeF frameNodeSize_; 639 GestureEvent gestureInfoForWeb_; 640 bool isReceivedDragGestureInfo_ = false; 641 OnChildTouchTestFunc onChildTouchTestFunc_; 642 OnReponseRegionFunc responseRegionFunc_; 643 644 GestureJudgeFunc gestureJudgeFunc_; 645 GestureJudgeFunc gestureJudgeNativeFunc_; 646 647 MenuPreviewMode previewMode_ = MenuPreviewMode::NONE; 648 bool textDraggable_ = false; 649 bool isTextDraggable_ = false; 650 bool monopolizeEvents_ = false; 651 }; 652 653 } // namespace OHOS::Ace::NG 654 655 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_EVENT_HUB_H 656