1 /* 2 * Copyright (c) 2022-2024 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_drop_event.h" 28 #include "core/components_ng/event/event_constants.h" 29 #include "core/components_ng/event/long_press_event.h" 30 #include "core/components_ng/event/pan_event.h" 31 #include "core/components_ng/event/scrollable_event.h" 32 #include "core/components_ng/event/target_component.h" 33 #include "core/components_ng/event/touch_event.h" 34 #include "core/components_ng/gestures/gesture_info.h" 35 #include "core/components_ng/gestures/recognizers/exclusive_recognizer.h" 36 #include "core/components_ng/gestures/recognizers/parallel_recognizer.h" 37 #include "core/components_ng/manager/drag_drop/drag_drop_proxy.h" 38 #include "core/event/pointer_event.h" 39 #include "core/gestures/gesture_info.h" 40 41 namespace OHOS::Ace { 42 struct DragNotifyMsg; 43 struct KeyEvent; 44 class UnifiedData; 45 class Subwindow; 46 } 47 48 namespace OHOS::Ace::NG { 49 using TouchInterceptFunc = std::function<NG::HitTestMode(TouchEventInfo&)>; 50 51 using ShouldBuiltInRecognizerParallelWithFunc = std::function<RefPtr<NGGestureRecognizer>( 52 const RefPtr<NGGestureRecognizer>&, const std::vector<RefPtr<NGGestureRecognizer>>&)>; 53 54 struct TouchTestInfo { 55 PointF windowPoint; 56 PointF currentCmpPoint; 57 PointF subCmpPoint; 58 RectF subRect; 59 std::string id; 60 }; 61 62 struct TouchResult { 63 TouchTestStrategy strategy; 64 std::string id; 65 }; 66 67 struct DragDropBaseInfo { 68 RefPtr<AceType> node; 69 RefPtr<PixelMap> pixelMap; 70 std::string extraInfo; 71 }; 72 73 struct BindMenuStatus { 74 bool isBindCustomMenu = false; 75 bool isBindLongPressMenu = false; 76 bool isShow = false; 77 MenuPreviewMode isShowPreviewMode = MenuPreviewMode::NONE; 78 MenuPreviewMode longPressPreviewMode = MenuPreviewMode::NONE; IsNotNeedShowPreviewBindMenuStatus79 bool IsNotNeedShowPreview() const 80 { 81 return (isBindCustomMenu && isShow) || isBindLongPressMenu; 82 } 83 }; 84 85 struct PreparedInfoForDrag { 86 bool isMenuShow = false; 87 int32_t badgeNumber = 0; 88 float previewScale = 1.0f; 89 bool isNeedCreateTiled = false; 90 OffsetF dragPreviewOffsetToScreen = { 0.0f, 0.0f }; 91 OffsetF dragMovePosition = { 0.0f, 0.0f }; 92 RefPtr<PixelMap> pixelMap; 93 RefPtr<FrameNode> imageNode; 94 RefPtr<FrameNode> relativeContainerNode { nullptr }; 95 RefPtr<FrameNode> menuPreviewNode { nullptr }; 96 RefPtr<FrameNode> textNode { nullptr }; 97 RefPtr<FrameNode> gatherNode { nullptr }; 98 RectF menuPreviewRect; 99 RectF dragPreviewRect; 100 BorderRadiusProperty borderRadius = BorderRadiusProperty(0.0_vp); 101 }; 102 103 struct PreparedAsyncCtxForAnimate { 104 int32_t containerId = -1; 105 bool hasTouchPoint = false; 106 DragPointerEvent dragPointerEvent; 107 DragPreviewOption dragPreviewOption; 108 DimensionOffset touchPoint = DimensionOffset(0.0_vp, 0.0_vp); 109 std::vector<std::shared_ptr<Media::PixelMap>> pixelMapList; 110 }; 111 112 struct DragframeNodeInfo { 113 WeakPtr<FrameNode> frameNode; 114 std::vector<RefPtr<FrameNode>> gatherFrameNode; 115 }; 116 117 using OnDragStartFunc = std::function<DragDropBaseInfo(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)>; 118 using OnDragDropFunc = std::function<void(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)>; 119 using OnChildTouchTestFunc = std::function<TouchResult(const std::vector<TouchTestInfo>& touchInfo)>; 120 using OnReponseRegionFunc = std::function<void(const std::vector<DimensionRect>&)>; 121 struct DragDropInfo { 122 RefPtr<UINode> customNode; 123 RefPtr<PixelMap> pixelMap; 124 std::string extraInfo; 125 // The inspectorId acts as a preview surrogate identifier which is used 126 // to retrieve a preview image for the item being dragged. 127 std::string inspectorId; 128 std::function<RefPtr<UINode>()> buildFunc; 129 bool onlyForLifting = false; 130 bool delayCreating = false; 131 }; 132 133 using DragNotifyMsgCore = OHOS::Ace::DragNotifyMsg; 134 using OnDragCallbackCore = std::function<void(const DragNotifyMsgCore&)>; 135 constexpr float PIXELMAP_WIDTH_RATE = -0.5f; 136 constexpr float PIXELMAP_HEIGHT_RATE = -0.2f; 137 constexpr float PIXELMAP_DEFALUT_LIMIT_SCALE = 0.5f; 138 constexpr float PIXELMAP_DRAG_WGR_TEXT_SCALE = 2.0f; 139 constexpr float PIXELMAP_DRAG_WGR_SCALE = 3.0f; 140 constexpr float DEFALUT_DRAG_PPIXELMAP_SCALE = 1.05f; 141 constexpr float PIXELMAP_DRAG_DEFAULT_HEIGHT = -28.0f; 142 143 class EventHub; 144 class PipelineContext; 145 146 // The gesture event hub is mainly used to handle common gesture events. 147 class ACE_FORCE_EXPORT GestureEventHub : public Referenced { 148 public: 149 explicit GestureEventHub(const WeakPtr<EventHub>& eventHub); 150 ~GestureEventHub() override = default; 151 152 void AddGesture(const RefPtr<NG::Gesture>& gesture); 153 // call by CAPI do distinguish with AddGesture called by ARKUI; 154 void ClearGesture(); 155 void AttachGesture(const RefPtr<NG::Gesture>& gesture); 156 void RemoveGesture(const RefPtr<NG::Gesture>& gesture); 157 void RemoveGesturesByTag(const std::string& gestureTag); 158 void ClearModifierGesture(); 159 void AddScrollableEvent(const RefPtr<ScrollableEvent>& scrollableEvent); 160 void RemoveScrollableEvent(const RefPtr<ScrollableEvent>& scrollableEvent); 161 void AddScrollEdgeEffect(const Axis& axis, RefPtr<ScrollEdgeEffect>& scrollEffect); 162 void RemoveScrollEdgeEffect(const RefPtr<ScrollEdgeEffect>& scrollEffect); 163 void AddPreviewMenuHandleDragEnd(GestureEventFunc&& actionEnd); 164 // Set by user define, which will replace old one. 165 void SetTouchEvent(TouchEventFunc&& touchEventFunc); 166 // Set by node container. 167 void SetOnTouchEvent(TouchEventFunc&& touchEventFunc); 168 // Set by JS FrameNode. 169 void SetJSFrameNodeOnTouchEvent(TouchEventFunc&& touchEventFunc); 170 void AddTouchEvent(const RefPtr<TouchEventImpl>& touchEvent); 171 void AddTouchAfterEvent(const RefPtr<TouchEventImpl>& touchEvent); 172 void RemoveTouchEvent(const RefPtr<TouchEventImpl>& touchEvent); 173 void SetFocusClickEvent(GestureEventFunc&& clickEvent); 174 bool IsClickable() const; 175 bool IsUserClickable() const; 176 bool IsAccessibilityClickable(); 177 bool IsAccessibilityLongClickable(); 178 bool ActClick(std::shared_ptr<JsonValue> secComphandle = nullptr); 179 void CheckClickActuator(); 180 // Set by user define, which will replace old one. 181 void SetUserOnClick(GestureEventFunc&& clickEvent, 182 double distanceThreshold = std::numeric_limits<double>::infinity()); 183 void SetNodeClickDistance(double distanceThreshold = std::numeric_limits<double>::infinity()); 184 // Set by JS FrameNode. 185 void SetJSFrameNodeOnClick(GestureEventFunc&& clickEvent); 186 void SetOnGestureJudgeBegin(GestureJudgeFunc&& gestureJudgeFunc); 187 void SetOnTouchIntercept(TouchInterceptFunc&& touchInterceptFunc); 188 TouchInterceptFunc GetOnTouchIntercept() const; 189 void SetShouldBuildinRecognizerParallelWithFunc(ShouldBuiltInRecognizerParallelWithFunc&& parallelGestureToFunc); 190 ShouldBuiltInRecognizerParallelWithFunc GetParallelInnerGestureToFunc() const; 191 void SetOnGestureRecognizerJudgeBegin(GestureRecognizerJudgeFunc&& gestureRecognizerJudgeFunc); 192 GestureRecognizerJudgeFunc GetOnGestureRecognizerJudgeBegin() const; 193 void SetOnGestureJudgeNativeBegin(GestureJudgeFunc&& gestureJudgeFunc); 194 GestureJudgeFunc GetOnGestureJudgeBeginCallback() const; 195 GestureJudgeFunc GetOnGestureJudgeNativeBeginCallback() const; 196 // When the event param is undefined, it will clear the callback. 197 void ClearUserOnClick(); 198 void ClearUserOnTouch(); 199 void ClearJSFrameNodeOnClick(); 200 void ClearJSFrameNodeOnTouch(); 201 void AddClickEvent(const RefPtr<ClickEvent>& clickEvent); 202 void AddClickAfterEvent(const RefPtr<ClickEvent>& clickEvent); 203 void RemoveClickEvent(const RefPtr<ClickEvent>& clickEvent); 204 bool IsClickEventsEmpty() const; 205 GestureEventFunc GetClickEvent(); 206 void BindMenu(GestureEventFunc&& showMenu); 207 void RegisterMenuOnTouch(TouchEventFunc&& callback); 208 bool IsLongClickable() const; 209 void SetRedirectClick(bool redirectClick); 210 bool ActLongClick(); 211 void SetLongPressEvent(const RefPtr<LongPressEvent>& event, bool isForDrag = false, bool isDisableMouseLeft = false, 212 int32_t duration = 500); 213 // Set by user define, which will replace old one. 214 void SetPanEvent(const RefPtr<PanEvent>& panEvent, PanDirection direction, int32_t fingers, Dimension distance); 215 void AddPanEvent(const RefPtr<PanEvent>& panEvent, PanDirection direction, int32_t fingers, Dimension distance); 216 void RemovePanEvent(const RefPtr<PanEvent>& panEvent); 217 void SetPanEventType(GestureTypeName typeName); 218 // Set by user define, which will replace old one. 219 void SetDragEvent(const RefPtr<DragEvent>& dragEvent, PanDirection direction, int32_t fingers, Dimension distance); 220 void SetDragDropEvent(); 221 void SetCustomDragEvent( 222 const RefPtr<DragEvent>& dragEvent, PanDirection direction, int32_t fingers, Dimension distance); 223 bool HasDragEvent() const; 224 // the return value means prevents event bubbling. 225 bool ProcessTouchTestHit(const OffsetF& coordinateOffset, const TouchRestrict& touchRestrict, 226 TouchTestResult& innerTargets, TouchTestResult& finalResult, int32_t touchId, const PointF& localPoint, 227 const RefPtr<TargetComponent>& targetComponent, ResponseLinkResult& responseLinkResult); 228 bool ProcessEventTouchTestHit(const OffsetF& coordinateOffset, const TouchRestrict& touchRestrict, 229 TouchTestResult& innerTargets, TouchTestResult& finalResult, int32_t touchId, const PointF& localPoint, 230 const RefPtr<TargetComponent>& targetComponent, ResponseLinkResult& responseLinkResult); 231 bool ProcessDragEventTouchTestHit(const OffsetF& coordinateOffset, const TouchRestrict& touchRestrict, 232 TouchTestResult& innerTargets, TouchTestResult& finalResult, int32_t touchId, const PointF& localPoint, 233 const RefPtr<TargetComponent>& targetComponent, ResponseLinkResult& responseLinkResult); 234 RefPtr<FrameNode> GetFrameNode() const; OnContextAttached()235 void OnContextAttached() {} 236 static std::string GetHitTestModeStr(const RefPtr<GestureEventHub>& GestureEventHub); 237 HitTestMode GetHitTestMode() const; 238 void SetHitTestMode(HitTestMode hitTestMode); 239 void RemoveDragEvent(); 240 void CombineIntoExclusiveRecognizer( 241 const PointF& globalPoint, const PointF& localPoint, TouchTestResult& result, int32_t touchId); 242 const std::vector<DimensionRect>& GetResponseRegion() const; 243 const std::vector<DimensionRect>& GetMouseResponseRegion() const; 244 void SetResponseRegionFunc(const OnReponseRegionFunc& func); 245 void SetResponseRegion(const std::vector<DimensionRect>& responseRegion); 246 void SetOnTouchTestFunc(OnChildTouchTestFunc&& callback); 247 const OnChildTouchTestFunc& GetOnTouchTestFunc(); 248 void SetMouseResponseRegion(const std::vector<DimensionRect>& mouseResponseRegion); 249 void AddResponseRect(const DimensionRect& responseRect); 250 void RemoveLastResponseRect(); 251 bool GetTouchable() const; 252 void SetTouchable(bool touchable); 253 void SetThumbnailCallback(std::function<void(Offset)>&& callback); 254 bool IsDragForbidden() const; 255 void SetDragForbiddenForcely(bool isDragForbidden); 256 bool GetTextDraggable() const; 257 void SetTextDraggable(bool draggable); 258 void SetIsTextDraggable(bool isTextDraggable); 259 bool GetIsTextDraggable(); 260 void SetPreviewMode(MenuPreviewMode mode); 261 MenuPreviewMode GetPreviewMode(); 262 void SetContextMenuShowStatus(bool contextMenuShowStatus); 263 bool GetContextMenuShowStatus(); 264 void SetMenuBindingType(MenuBindingType menuBindingType); 265 MenuBindingType GetMenuBindingType(); 266 void SetPixelMap(RefPtr<PixelMap> pixelMap); 267 RefPtr<PixelMap> GetPixelMap(); 268 void SetDragPreviewPixelMap(RefPtr<PixelMap> pixelMap); 269 RefPtr<LongPressRecognizer> GetLongPressRecognizer() const; 270 void SetIsAllowMouse(bool isAllowMouse) const; 271 const RefPtr<ClickEventActuator>& GetUserClickEventActuator(); 272 int32_t SetDragData(const RefPtr<UnifiedData>& unifiedData, std::string& udKey); 273 OnDragCallbackCore GetDragCallback(const RefPtr<PipelineBase>& context, const WeakPtr<EventHub>& hub); 274 void GenerateMousePixelMap(const GestureEvent& info); 275 OffsetF GetPixelMapOffset(const GestureEvent& info, const SizeF& size, const PreparedInfoForDrag& dragInfoData, 276 const float scale = 1.0f, const RectF& innerRect = RectF()) const; 277 void CalcFrameNodeOffsetAndSize(const RefPtr<FrameNode> frameNode, bool isMenuShow); 278 OffsetF GetDragPreviewInitPositionToScreen(const RefPtr<PipelineBase>& context, PreparedInfoForDrag& data); 279 int32_t GetBadgeNumber(const RefPtr<UnifiedData>& unifiedData); 280 bool TryDoDragStartAnimation(const RefPtr<PipelineBase>& context, const RefPtr<Subwindow>& subwindow, 281 const GestureEvent& info, PreparedInfoForDrag& data); 282 float GetDefaultPixelMapScale( 283 const RefPtr<FrameNode>& frameNode, const GestureEvent& info, bool isMenuShow, RefPtr<PixelMap> pixelMap); 284 RefPtr<PixelMap> GetPreScaledPixelMapIfExist(float targetScale, RefPtr<PixelMap> defaultPixelMap); 285 float GetPixelMapScale(const int32_t height, const int32_t width) const; 286 bool IsPixelMapNeedScale() const; 287 bool CheckAllowDrag(const GestureEvent& info, const RefPtr<PipelineBase>& context, 288 const RefPtr<FrameNode>& frameNode); 289 RefPtr<OHOS::Ace::DragEvent> CreateDragEvent(const GestureEvent& info, const RefPtr<PipelineBase>& context, 290 const RefPtr<FrameNode>& frameNode); 291 void InitDragDropEvent(); 292 void HandleOnDragStart(const GestureEvent& info); 293 void HandleDragThroughMouse(const RefPtr<FrameNode> frameNode); 294 void HandleDragThroughTouch(const RefPtr<FrameNode> frameNode); 295 void HandleDragEndAction(const DragframeNodeInfo& info); 296 void HandleOnDragUpdate(const GestureEvent& info); 297 void HandleOnDragEnd(const GestureEvent& info); 298 void HandleOnDragCancel(); 299 void StartLongPressActionForWeb(); 300 void CancelDragForWeb(); 301 bool StartDragTaskForWeb(); 302 void ResetDragActionForWeb(); 303 void OnModifyDone(); 304 bool KeyBoardShortCutClick(const KeyEvent& event, const WeakPtr<NG::FrameNode>& node); 305 bool IsAllowedDrag(RefPtr<EventHub> eventHub); 306 void HandleNotAllowDrag(const GestureEvent& info); 307 RefPtr<DragEventActuator> GetDragEventActuator(); 308 bool GetMonopolizeEvents() const; 309 void SetMonopolizeEvents(bool monopolizeEvents); 310 virtual RefPtr<NGGestureRecognizer> PackInnerRecognizer( 311 const Offset& offset, std::list<RefPtr<NGGestureRecognizer>>& innerRecognizers, int32_t touchId, 312 const RefPtr<TargetComponent>& targetComponent); 313 void CleanExternalRecognizers(); 314 void CleanInnerRecognizer(); 315 void CleanNodeRecognizer(); 316 void CopyGestures(const RefPtr<GestureEventHub>& gestureEventHub); 317 void CopyEvent(const RefPtr<GestureEventHub>& gestureEventHub); 318 int32_t RegisterCoordinationListener(const RefPtr<PipelineBase>& context); 319 bool IsTextCategoryComponent(const std::string& frameTag); 320 DragDropInfo GetDragDropInfo(const GestureEvent& info, const RefPtr<FrameNode> frameNode, 321 DragDropInfo& dragPreviewInfo, const RefPtr<OHOS::Ace::DragEvent>& dragEvent); 322 RefPtr<UnifiedData> GetUnifiedData(const std::string& frameTag, DragDropInfo& dragDropInfo, 323 const RefPtr<OHOS::Ace::DragEvent>& dragEvent); 324 int32_t GetSelectItemSize(); 325 bool IsNeedSwitchToSubWindow(const PreparedInfoForDrag& dragInfoData) const; 326 RefPtr<PixelMap> GetDragPreviewPixelMap(); 327 void SetDragGatherPixelMaps(const GestureEvent& info); 328 void SetMouseDragGatherPixelMaps(); 329 void SetNotMouseDragGatherPixelMaps(); 330 void FireCustomerOnDragEnd(const RefPtr<PipelineBase>& context, const WeakPtr<EventHub>& hub); 331 void SetMouseDragMonitorState(bool state); 332 bool ParsePixelMapAsync(DragDropInfo& dragDropInfo, const DragDropInfo& dragPreviewInfo, 333 const GestureEvent& info); 334 void DoOnDragStartHandling(const GestureEvent& info, const RefPtr<FrameNode> frameNode, 335 DragDropInfo dragDropInfo, const RefPtr<OHOS::Ace::DragEvent>& event, 336 DragDropInfo dragPreviewInfo, const RefPtr<PipelineContext>& pipeline); 337 void HideMenu(); 338 #if defined(PIXEL_MAP_SUPPORTED) 339 static void PrintBuilderNode(const RefPtr<UINode>& customNode); 340 static void PrintIfImageNode( 341 const RefPtr<UINode>& builderNode, int32_t depth, bool& hasImageNode, std::list<RefPtr<FrameNode>>& imageNodes); 342 static void CheckImageDecode(std::list<RefPtr<FrameNode>>& imageNodes); 343 bool StartDragForCustomBuilderSync(const GestureEvent& info, const RefPtr<PipelineBase>& pipeline, 344 const RefPtr<FrameNode> frameNode, DragDropInfo dragDropInfo, const RefPtr<OHOS::Ace::DragEvent>& event); 345 void StartDragForCustomBuilder(const GestureEvent& info, const RefPtr<PipelineBase>& pipeline, 346 const RefPtr<FrameNode> frameNode, DragDropInfo dragDropInfo, const RefPtr<OHOS::Ace::DragEvent>& event); 347 #endif 348 void SetMenuPreviewScale(float menuPreviewScale); 349 float GetMenuPreviewScale() const; 350 void SetBindMenuStatus(bool setIsShow, bool isShow, MenuPreviewMode previewMode); 351 const BindMenuStatus& GetBindMenuStatus() const; 352 bool WillRecreateGesture() const; 353 354 bool parallelCombineClick = false; 355 RefPtr<ParallelRecognizer> innerParallelRecognizer_; 356 357 bool IsGestureEmpty() const; 358 359 bool IsPanEventEmpty() const; 360 361 void SetExcludedAxisForPanEvent(bool isExcludedAxis); 362 363 void DumpVelocityInfoFroPanEvent(int32_t fingerId); 364 365 bool IsDragNewFwk() const; 366 private: 367 void ProcessTouchTestHierarchy(const OffsetF& coordinateOffset, const TouchRestrict& touchRestrict, 368 std::list<RefPtr<NGGestureRecognizer>>& innerRecognizers, TouchTestResult& finalResult, int32_t touchId, 369 const RefPtr<TargetComponent>& targetComponent, ResponseLinkResult& responseLinkResult); 370 371 void UpdateGestureHierarchy(); 372 void UpdateModifierGestureHierarchy(); 373 374 void AddGestureToGestureHierarchy(const RefPtr<NG::Gesture>& gesture, bool isModifier); 375 376 // old path. 377 void UpdateExternalNGGestureRecognizer(); 378 379 OnAccessibilityEventFunc GetOnAccessibilityEventFunc(); 380 381 void OnDragStart(const GestureEvent& info, const RefPtr<PipelineBase>& context, const RefPtr<FrameNode> frameNode, 382 DragDropInfo dragDropInfo, const RefPtr<OHOS::Ace::DragEvent>& dragEvent); 383 void PrepareDragStartInfo(RefPtr<PipelineContext>& pipeline, PreparedInfoForDrag& data); 384 void StartVibratorByDrag(const RefPtr<FrameNode>& frameNode); 385 void UpdateExtraInfo(const RefPtr<FrameNode>& frameNode, std::unique_ptr<JsonValue>& arkExtraInfoJson, float scale, 386 const PreparedInfoForDrag& dragInfoData); 387 void ProcessMenuPreviewScale(const RefPtr<FrameNode> imageNode, float& scale, float previewScale, 388 float windowScale, float defaultMenuPreviewScale); 389 390 template<typename T> 391 const RefPtr<T> GetAccessibilityRecognizer(); 392 393 template<typename T> 394 const RefPtr<T> AccessibilityRecursionSearchRecognizer(const RefPtr<NGGestureRecognizer>& recognizer); 395 396 void ProcessParallelPriorityGesture(const Offset& offset, int32_t touchId, 397 const RefPtr<TargetComponent>& targetComponent, const RefPtr<FrameNode>& host, 398 RefPtr<NGGestureRecognizer>& current, std::list<RefPtr<NGGestureRecognizer>>& recognizers, 399 int32_t& parallelIndex); 400 401 void ProcessExternalExclusiveRecognizer(const Offset& offset, int32_t touchId, 402 const RefPtr<TargetComponent>& targetComponent, const RefPtr<FrameNode>& host, GesturePriority priority, 403 RefPtr<NGGestureRecognizer>& current, std::list<RefPtr<NGGestureRecognizer>>& recognizers, 404 int32_t& exclusiveIndex); 405 406 void UpdateNodePositionBeforeStartAnimation(const RefPtr<FrameNode>& frameNode, 407 PreparedInfoForDrag& data, const OffsetF& subWindowOffset); 408 409 WeakPtr<EventHub> eventHub_; 410 RefPtr<ScrollableActuator> scrollableActuator_; 411 RefPtr<TouchEventActuator> touchEventActuator_; 412 RefPtr<ClickEventActuator> clickEventActuator_; 413 RefPtr<ClickEventActuator> userParallelClickEventActuator_; 414 RefPtr<LongPressEventActuator> longPressEventActuator_; 415 RefPtr<PanEventActuator> panEventActuator_; 416 RefPtr<DragEventActuator> dragEventActuator_; 417 RefPtr<ExclusiveRecognizer> innerExclusiveRecognizer_; 418 RefPtr<ExclusiveRecognizer> nodeExclusiveRecognizer_; 419 RefPtr<ParallelRecognizer> nodeParallelRecognizer_; 420 std::vector<RefPtr<ExclusiveRecognizer>> externalExclusiveRecognizer_; 421 std::vector<RefPtr<ParallelRecognizer>> externalParallelRecognizer_; 422 RefPtr<DragDropProxy> dragDropProxy_; 423 424 // Set by use gesture, priorityGesture and parallelGesture attribute function. 425 std::list<RefPtr<NG::Gesture>> gestures_; 426 // set by CAPI or modifier do distinguish with gestures_; 427 std::list<RefPtr<NG::Gesture>> modifierGestures_; 428 std::list<RefPtr<NG::Gesture>> backupGestures_; 429 std::list<RefPtr<NG::Gesture>> backupModifierGestures_; 430 std::list<RefPtr<NGGestureRecognizer>> gestureHierarchy_; 431 std::list<RefPtr<NGGestureRecognizer>> modifierGestureHierarchy_; 432 433 // used in bindMenu, need to delete the old callback when bindMenu runs again 434 RefPtr<ClickEvent> showMenu_; 435 RefPtr<TouchEventImpl> bindMenuTouch_; 436 437 HitTestMode hitTestMode_ = HitTestMode::HTMDEFAULT; 438 bool recreateGesture_ = true; 439 bool needRecollect_ = false; 440 bool isResponseRegion_ = false; 441 std::vector<DimensionRect> responseRegion_; 442 std::vector<DimensionRect> mouseResponseRegion_; 443 bool touchable_ = true; 444 RefPtr<PixelMap> pixelMap_; 445 446 // Save dragPreview pixelMap of user setting, transfer to drag framework on drag start. 447 RefPtr<PixelMap> dragPreviewPixelMap_; 448 449 OffsetF frameNodeOffset_; 450 SizeF frameNodeSize_; 451 std::shared_ptr<GestureEvent> gestureInfoForWeb_; 452 bool isReceivedDragGestureInfo_ = false; 453 OnChildTouchTestFunc onChildTouchTestFunc_; 454 OnReponseRegionFunc responseRegionFunc_; 455 bool redirectClick_ = false; 456 457 GestureJudgeFunc gestureJudgeFunc_; 458 GestureJudgeFunc gestureJudgeNativeFunc_; 459 460 TouchInterceptFunc touchInterceptFunc_; 461 462 ShouldBuiltInRecognizerParallelWithFunc shouldBuildinRecognizerParallelWithFunc_; 463 GestureRecognizerJudgeFunc gestureRecognizerJudgeFunc_; 464 465 MenuPreviewMode previewMode_ = MenuPreviewMode::NONE; 466 // the value from show parameter of context menu, which is controlled by caller manually 467 bool contextMenuShowStatus_ = false; 468 MenuBindingType menuBindingType_ = MenuBindingType::LONG_PRESS; 469 BindMenuStatus bindMenuStatus_; 470 DragframeNodeInfo dragframeNodeInfo_; 471 // disable drag for the node itself and its all children 472 bool isDragForbiddenForWholeSubTree_ = false; 473 bool textDraggable_ = false; 474 bool isTextDraggable_ = false; 475 bool monopolizeEvents_ = false; 476 float menuPreviewScale_ = DEFALUT_DRAG_PPIXELMAP_SCALE; 477 bool isDragNewFwk_ = false; 478 }; 479 480 } // namespace OHOS::Ace::NG 481 482 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_GESTURE_EVENT_HUB_H 483