1 /* 2 * Copyright (c) 2022-2025 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_PATTERNS_SWIPER_INDICATOR_SWIPER_INDICATOR_PATTERN_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SWIPER_INDICATOR_SWIPER_INDICATOR_PATTERN_H 18 19 #include "base/memory/ace_type.h" 20 #include "base/utils/utils.h" 21 #include "core/components_ng/base/frame_node.h" 22 #include "core/components_ng/pattern/pattern.h" 23 #include "core/components_ng/pattern/swiper/swiper_pattern.h" 24 #include "core/components_ng/pattern/swiper_indicator/circle_dot_indicator/circle_dot_indicator_layout_algorithm.h" 25 #include "core/components_ng/pattern/swiper_indicator/circle_dot_indicator/circle_dot_indicator_paint_method.h" 26 #include "core/components_ng/pattern/swiper_indicator/digit_indicator/digit_indicator_layout_algorithm.h" 27 #include "core/components_ng/pattern/swiper_indicator/dot_indicator/overlength_dot_indicator_paint_method.h" 28 #include "core/components_ng/pattern/swiper_indicator/dot_indicator/dot_indicator_layout_algorithm.h" 29 #include "core/components_ng/pattern/swiper_indicator/dot_indicator/dot_indicator_paint_method.h" 30 #include "core/components_ng/pattern/swiper_indicator/indicator_common/swiper_indicator_accessibility_property.h" 31 #include "core/components_ng/pattern/swiper_indicator/indicator_common/swiper_indicator_layout_property.h" 32 #include "core/components_ng/pattern/swiper_indicator/indicator_common/swiper_indicator_utils.h" 33 #include "core/components_ng/pattern/text/text_layout_property.h" 34 #include "core/components_ng/pattern/text/text_pattern.h" 35 namespace OHOS::Ace::NG { 36 class SwiperIndicatorPattern : public Pattern { 37 DECLARE_ACE_TYPE(SwiperIndicatorPattern, Pattern); 38 public: 39 SwiperIndicatorPattern() = default; 40 ~SwiperIndicatorPattern() override = default; SwiperIndicatorPattern(SwiperIndicatorType indicatorType)41 SwiperIndicatorPattern(SwiperIndicatorType indicatorType): swiperIndicatorType_(indicatorType) 42 {} 43 CreateLayoutProperty()44 RefPtr<LayoutProperty> CreateLayoutProperty() override 45 { 46 return MakeRefPtr<SwiperIndicatorLayoutProperty>(); 47 } 48 CreatePaintProperty()49 RefPtr<PaintProperty> CreatePaintProperty() override 50 { 51 if (swiperIndicatorType_ == SwiperIndicatorType::DOT) { 52 return MakeRefPtr<DotIndicatorPaintProperty>(); 53 } else { 54 return MakeRefPtr<PaintProperty>(); 55 } 56 } 57 CreateAccessibilityProperty()58 RefPtr<AccessibilityProperty> CreateAccessibilityProperty() override 59 { 60 return MakeRefPtr<SwiperIndicatorAccessibilityProperty>(); 61 } 62 CreateLayoutAlgorithm()63 RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override 64 { 65 auto swiperNode = GetSwiperNode(); 66 CHECK_NULL_RETURN(swiperNode, nullptr); 67 auto swiperPattern = swiperNode->GetPattern<SwiperPattern>(); 68 CHECK_NULL_RETURN(swiperPattern, nullptr); 69 if (GetIndicatorType() == SwiperIndicatorType::DOT) { 70 auto indicatorLayoutAlgorithm = MakeRefPtr<DotIndicatorLayoutAlgorithm>(); 71 indicatorLayoutAlgorithm->SetIsHoverOrPress(isHover_ || isPressed_); 72 indicatorLayoutAlgorithm->SetHoverPoint(hoverPoint_); 73 74 auto indicatorDisplayCount = Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_EIGHTEEN) ? 75 swiperPattern->DisplayIndicatorTotalCount() : swiperPattern->TotalCount(); 76 auto maxDisplayCount = swiperPattern->GetMaxDisplayCount(); 77 maxDisplayCount > 0 ? indicatorLayoutAlgorithm->SetIndicatorDisplayCount(maxDisplayCount) 78 : indicatorLayoutAlgorithm->SetIndicatorDisplayCount(indicatorDisplayCount); 79 indicatorLayoutAlgorithm->SetMaxDisplayCount(maxDisplayCount); 80 indicatorLayoutAlgorithm->SetIsBindIndicator(swiperPattern->IsBindIndicator()); 81 indicatorLayoutAlgorithm->SetIndicatorInteractive(swiperPattern->IsIndicatorInteractive()); 82 return indicatorLayoutAlgorithm; 83 } else if (swiperPattern->GetIndicatorType() == SwiperIndicatorType::ARC_DOT) { 84 auto indicatorLayoutAlgorithm = MakeRefPtr<CircleDotIndicatorLayoutAlgorithm>(); 85 return indicatorLayoutAlgorithm; 86 } else { 87 auto indicatorLayoutAlgorithm = MakeRefPtr<DigitIndicatorLayoutAlgorithm>(); 88 indicatorLayoutAlgorithm->SetIsHoverOrPress(isHover_ || isPressed_); 89 indicatorLayoutAlgorithm->SetHoverPoint(hoverPoint_); 90 return indicatorLayoutAlgorithm; 91 } 92 } 93 SetDotIndicatorPaintMethodInfo(const RefPtr<SwiperPattern> & swiperPattern,RefPtr<DotIndicatorPaintMethod> & paintMethod,RefPtr<SwiperLayoutProperty> & swiperLayoutProperty)94 void SetDotIndicatorPaintMethodInfo(const RefPtr<SwiperPattern>& swiperPattern, 95 RefPtr<DotIndicatorPaintMethod>& paintMethod, 96 RefPtr<SwiperLayoutProperty>& swiperLayoutProperty) 97 { 98 CHECK_NULL_VOID(swiperPattern); 99 CHECK_NULL_VOID(paintMethod); 100 CHECK_NULL_VOID(swiperLayoutProperty); 101 paintMethod->SetAxis(swiperPattern->GetDirection()); 102 paintMethod->SetCurrentIndex(swiperPattern->GetLoopIndex(swiperPattern->GetCurrentFirstIndex())); 103 paintMethod->SetCurrentIndexActual(swiperPattern->GetLoopIndex(swiperPattern->GetCurrentIndex())); 104 paintMethod->SetNextValidIndex(swiperPattern->GetNextValidIndex()); 105 paintMethod->SetHorizontalAndRightToLeft(swiperLayoutProperty->GetNonAutoLayoutDirection()); 106 paintMethod->SetItemCount(swiperPattern->DisplayIndicatorTotalCount()); 107 paintMethod->SetTotalItemCount(swiperPattern->TotalCount()); 108 paintMethod->SetSwipeByGroup(swiperLayoutProperty->GetSwipeByGroup().value_or(false)); 109 paintMethod->SetDisplayCount(swiperLayoutProperty->GetDisplayCount().value_or(1)); 110 gestureState_ = swiperPattern->GetGestureState(); 111 paintMethod->SetGestureState(gestureState_); 112 paintMethod->SetTurnPageRate(swiperPattern->GetTurnPageRate()); 113 paintMethod->SetGroupTurnPageRate(swiperPattern->GetGroupTurnPageRate()); 114 paintMethod->SetIsLoop(swiperPattern->IsLoop()); 115 paintMethod->SetTouchBottomTypeLoop(swiperPattern->GetTouchBottomTypeLoop()); 116 paintMethod->SetIsHover(isHover_); 117 paintMethod->SetIsPressed(isPressed_); 118 paintMethod->SetHoverPoint(hoverPoint_); 119 if (mouseClickIndex_) { 120 mouseClickIndex_ = swiperPattern->GetLoopIndex(mouseClickIndex_.value()); 121 } 122 paintMethod->SetMouseClickIndex(mouseClickIndex_); 123 paintMethod->SetIsTouchBottom(touchBottomType_); 124 paintMethod->SetTouchBottomRate(swiperPattern->GetTouchBottomRate()); 125 auto currentTurnPageRate = Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_EIGHTEEN) && 126 swiperLayoutProperty->GetSwipeByGroup().value_or(false) ? 127 swiperPattern->CalculateGroupTurnPageRate(0.0f) : swiperPattern->CalcCurrentTurnPageRate(true); 128 paintMethod->SetTouchBottomPageRate(currentTurnPageRate); 129 paintMethod->SetFirstIndex(swiperPattern->GetLoopIndex(swiperPattern->GetFirstIndexInVisibleArea())); 130 mouseClickIndex_ = std::nullopt; 131 } 132 CreateCircleDotIndicatorPaintMethod(RefPtr<SwiperPattern> swiperPattern)133 RefPtr<CircleDotIndicatorPaintMethod> CreateCircleDotIndicatorPaintMethod(RefPtr<SwiperPattern> swiperPattern) 134 { 135 auto swiperLayoutProperty = swiperPattern->GetLayoutProperty<SwiperLayoutProperty>(); 136 CHECK_NULL_RETURN(swiperLayoutProperty, nullptr); 137 auto paintMethod = MakeRefPtr<CircleDotIndicatorPaintMethod>(circleDotIndicatorModifier_); 138 paintMethod->SetAxis(swiperPattern->GetDirection()); 139 paintMethod->SetCurrentIndex(swiperPattern->GetLoopIndex(swiperPattern->GetCurrentFirstIndex())); 140 paintMethod->SetCurrentIndexActual(swiperPattern->GetLoopIndex(swiperPattern->GetCurrentIndex())); 141 paintMethod->SetNextValidIndex(swiperPattern->GetNextValidIndex()); 142 paintMethod->SetItemCount(swiperPattern->RealTotalCount()); 143 paintMethod->SetHorizontalAndRightToLeft(swiperLayoutProperty->GetNonAutoLayoutDirection()); 144 paintMethod->SetGestureState(swiperPattern->GetGestureState()); 145 paintMethod->SetTurnPageRate(swiperPattern->GetTurnPageRate()); 146 paintMethod->SetTouchBottomTypeLoop(swiperPattern->GetTouchBottomTypeLoop()); 147 paintMethod->SetIsLongPressed(isLongPressed_); 148 if (mouseClickIndex_) { 149 mouseClickIndex_ = swiperPattern->GetLoopIndex(mouseClickIndex_.value()); 150 } 151 paintMethod->SetIsTouchBottom(touchBottomType_); 152 paintMethod->SetMouseClickIndex(mouseClickIndex_); 153 paintMethod->SetTouchBottomRate(swiperPattern->GetTouchBottomRate()); 154 mouseClickIndex_ = std::nullopt; 155 return paintMethod; 156 } 157 CreateNodePaintMethod()158 RefPtr<NodePaintMethod> CreateNodePaintMethod() override 159 { 160 auto swiperNode = GetSwiperNode(); 161 CHECK_NULL_RETURN(swiperNode, nullptr); 162 auto swiperPattern = swiperNode->GetPattern<SwiperPattern>(); 163 CHECK_NULL_RETURN(swiperPattern, nullptr); 164 if (GetIndicatorType() == SwiperIndicatorType::DOT) { 165 if (swiperPattern->GetMaxDisplayCount() > 0) { 166 SetIndicatorInteractive(false); 167 return CreateOverlongDotIndicatorPaintMethod(swiperPattern); 168 } 169 170 SetIndicatorInteractive(swiperPattern->IsIndicatorInteractive()); 171 return CreateDotIndicatorPaintMethod(swiperPattern); 172 } else if (swiperPattern->GetIndicatorType() == SwiperIndicatorType::ARC_DOT) { 173 if (!circleDotIndicatorModifier_) { 174 circleDotIndicatorModifier_ = AceType::MakeRefPtr<CircleDotIndicatorModifier>(); 175 circleDotIndicatorModifier_->SetLongPointHeadCurve(swiperPattern->GetCurveIncludeMotion()); 176 } 177 178 auto paintMethod = CreateCircleDotIndicatorPaintMethod(swiperPattern); 179 return paintMethod; 180 } 181 return nullptr; 182 } 183 GetSwiperNode()184 virtual RefPtr<FrameNode> GetSwiperNode() const 185 { 186 auto host = GetHost(); 187 CHECK_NULL_RETURN(host, nullptr); 188 auto swiperNode = host->GetParent(); 189 CHECK_NULL_RETURN(swiperNode, nullptr); 190 return DynamicCast<FrameNode>(swiperNode); 191 } 192 GetFocusPattern()193 FocusPattern GetFocusPattern() const override 194 { 195 FocusPattern focusPattern = { FocusType::NODE, true, FocusStyleType::INNER_BORDER }; 196 auto pipelineContext = PipelineBase::GetCurrentContext(); 197 CHECK_NULL_RETURN(pipelineContext, FocusPattern()); 198 auto swiperTheme = pipelineContext->GetTheme<SwiperIndicatorTheme>(); 199 CHECK_NULL_RETURN(swiperTheme, FocusPattern()); 200 FocusPaintParam paintParam; 201 paintParam.SetPaintWidth(swiperTheme->GetFocusedBorderWidth()); 202 paintParam.SetPaintColor(swiperTheme->GetFocusedColor()); 203 focusPattern.SetFocusPaintParams(paintParam); 204 if (swiperIndicatorType_ != SwiperIndicatorType::DOT) { 205 return focusPattern; 206 } 207 auto focusStyleType = static_cast<FocusStyleType>(swiperTheme->GetFocusStyleType()); 208 focusPattern.SetStyleType(focusStyleType); 209 return focusPattern; 210 } 211 SetChangeIndexWithAnimation(bool withAnimation)212 void SetChangeIndexWithAnimation(bool withAnimation) 213 { 214 changeIndexWithAnimation_ = withAnimation; 215 } 216 SetJumpIndex(std::optional<int32_t> jumpIndex)217 void SetJumpIndex(std::optional<int32_t> jumpIndex) 218 { 219 jumpIndex_ = jumpIndex; 220 } 221 SetStartIndex(std::optional<int32_t> startIndex)222 void SetStartIndex(std::optional<int32_t> startIndex) 223 { 224 startIndex_ = startIndex; 225 } 226 227 void DumpAdvanceInfo() override; 228 void DumpAdvanceInfo(std::unique_ptr<JsonValue>& json) override; 229 void SetIndicatorInteractive(bool isInteractive); SetArcIndicatorHotRegion(const RefPtr<LayoutWrapper> & dirty,const DirtySwapConfig & config)230 virtual bool SetArcIndicatorHotRegion(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) 231 { 232 return false; 233 } GetCenterPointF()234 virtual PointF GetCenterPointF() 235 { 236 return PointF(0.0, 0.0); 237 } GetAngleWithPoint(const PointF & conter,const PointF & point)238 virtual float GetAngleWithPoint(const PointF& conter, const PointF& point) 239 { 240 return 0.0; 241 } GetEndAngle(const PointF & conter,const PointF & point,float startAngle)242 virtual float GetEndAngle(const PointF& conter, const PointF& point, float startAngle) 243 { 244 return 0.0; 245 } UpadateStartAngle()246 virtual void UpadateStartAngle() {}; InitAccessibilityFocusEvent()247 virtual void InitAccessibilityFocusEvent(){}; 248 virtual Axis GetDirection() const; 249 virtual bool GetDotCurrentOffset(OffsetF& offset, float indicatorWidth, float indicatorHeight); 250 void OnModifyDone() override; 251 void IndicatorOnChange(); 252 void InitIndicatorEvent(); 253 virtual bool GetDigitFrameSize(RefPtr<GeometryNode>& geoNode, SizeF& frameSize) const; 254 virtual int32_t RealTotalCount() const; 255 virtual int32_t GetCurrentIndex() const; 256 void ResetDotModifier(); 257 258 private: 259 void OnAttachToFrameNode() override; 260 bool OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) override; 261 void InitClickEvent(const RefPtr<GestureEventHub>& gestureHub); 262 void HandleClick(const GestureEvent& info); 263 void HandleMouseClick(const GestureEvent& info); 264 void HandleTouchClick(const GestureEvent& info); 265 void InitHoverMouseEvent(); 266 void InitTouchEvent(const RefPtr<GestureEventHub>& gestureHub); 267 void HandleMouseEvent(const MouseInfo& info); 268 void HandleHoverEvent(bool isHover); 269 void HoverInAnimation(const Color& hoverColor); 270 void HoverOutAnimation(const Color& normalColor); 271 void HandleTouchEvent(const TouchEventInfo& info); 272 void HandleTouchDown(); 273 void HandleTouchUp(); 274 void HandleDragStart(const GestureEvent& info); 275 virtual void HandleDragEnd(double dragVelocity); 276 void GetMouseClickIndex(); 277 void UpdateTextContent(const RefPtr<SwiperIndicatorLayoutProperty>& layoutProperty, 278 const RefPtr<FrameNode>& firstTextNode, const RefPtr<FrameNode>& lastTextNode); 279 void UpdateTextContentSub( 280 const RefPtr<SwiperIndicatorLayoutProperty>& layoutProperty, 281 const RefPtr<FrameNode>& firstTextNode, const RefPtr<FrameNode>& lastTextNode); 282 bool CheckIsTouchBottom(const GestureEvent& info); 283 void InitLongPressEvent(const RefPtr<GestureEventHub>& gestureHub); 284 void HandleLongPress(GestureEvent& info); 285 bool CheckIsTouchBottom(const TouchLocationInfo& info); 286 float HandleTouchClickMargin(); 287 int32_t GetInitialIndex() const; 288 void GetInnerFocusPaintRect(RoundRect& paintRect); 289 void InitFocusEvent(); 290 void HandleFocusEvent(); 291 void HandleBlurEvent(); 292 void AddIsFocusActiveUpdateEvent(); 293 void RemoveIsFocusActiveUpdateEvent(); 294 void OnIsFocusActiveUpdate(bool isFocusAcitve); 295 RefPtr<OverlengthDotIndicatorPaintMethod> CreateOverlongDotIndicatorPaintMethod( 296 RefPtr<SwiperPattern> swiperPattern); 297 RefPtr<DotIndicatorPaintMethod> CreateDotIndicatorPaintMethod(RefPtr<SwiperPattern> swiperPattern); 298 void UpdateOverlongPaintMethod( 299 const RefPtr<SwiperPattern>& swiperPattern, RefPtr<OverlengthDotIndicatorPaintMethod>& overlongPaintMethod); 300 int32_t GetDisplayCurrentIndex() const; 301 void UpdateDigitalIndicator(); 302 void RegisterIndicatorChangeEvent(); 303 std::pair<int32_t, int32_t> CalculateStepAndItemCount() const; 304 std::pair<int32_t, int32_t> CalculateStepAndItemCountDefault() const; 305 void UpdateFocusable() const; 306 void CheckDragAndUpdate( 307 const RefPtr<SwiperPattern>& swiperPattern, int32_t animationStartIndex, int32_t animationEndIndex); 308 309 double GetIndicatorDragAngleThreshold(bool isMaxAngle); 310 RefPtr<ClickEvent> clickEvent_; 311 RefPtr<InputEvent> hoverEvent_; 312 RefPtr<TouchEventImpl> touchEvent_; 313 RefPtr<InputEvent> mouseEvent_; 314 RefPtr<LongPressEvent> longPressEvent_; 315 bool isHover_ = false; 316 bool isPressed_ = false; 317 bool isLongPressed_ = false; 318 PointF hoverPoint_; 319 PointF dragStartPoint_; 320 TouchBottomType touchBottomType_ = TouchBottomType::NONE; 321 bool isClicked_ = false; 322 bool isRepeatClicked_ = false; 323 bool focusEventInitialized_ = false; 324 std::function<void(bool)> isFocusActiveUpdateEvent_; 325 326 std::optional<int32_t> mouseClickIndex_ = std::nullopt; 327 RefPtr<DotIndicatorModifier> dotIndicatorModifier_; 328 RefPtr<CircleDotIndicatorModifier> circleDotIndicatorModifier_; 329 RefPtr<OverlengthDotIndicatorModifier> overlongDotIndicatorModifier_; 330 SwiperIndicatorType swiperIndicatorType_ = SwiperIndicatorType::DOT; 331 332 std::optional<int32_t> jumpIndex_; 333 std::optional<int32_t> startIndex_; 334 std::optional<bool> changeIndexWithAnimation_; 335 GestureState gestureState_ = GestureState::GESTURE_STATE_INIT; 336 ACE_DISALLOW_COPY_AND_MOVE(SwiperIndicatorPattern); 337 338 protected: 339 OffsetF CalculateAngleOffset(float centerX, float centerY, float radius, double angle); 340 OffsetF CalculateRectLayout(double angle, float radius, OffsetF angleOffset, Dimension& width, Dimension& height); FireChangeEvent()341 virtual void FireChangeEvent() const {} FireIndicatorIndexChangeEvent(int32_t index)342 virtual void FireIndicatorIndexChangeEvent(int32_t index) const {} 343 virtual void SwipeTo(std::optional<int32_t> mouseClickIndex); 344 virtual void ShowPrevious(); 345 virtual void ShowNext(); 346 virtual void ChangeIndex(int32_t index, bool useAnimation); 347 virtual bool IsHorizontalAndRightToLeft() const; 348 virtual TextDirection GetNonAutoLayoutDirection() const; 349 virtual void GetTextContentSub(std::string& firstContent, std::string& lastContent) const; 350 virtual int32_t GetCurrentShownIndex() const; 351 virtual int32_t DisplayIndicatorTotalCount() const; 352 virtual bool IsLoop() const; 353 virtual int32_t GetTouchCurrentIndex() const; 354 virtual std::pair<int32_t, int32_t> CalMouseClickIndexStartAndEnd(int32_t itemCount, int32_t currentIndex); 355 virtual void HandleLongDragUpdate(const TouchLocationInfo& info); 356 GetSwiperPattern()357 RefPtr<SwiperPattern> GetSwiperPattern() const 358 { 359 auto swiperNode = GetSwiperNode(); 360 CHECK_NULL_RETURN(swiperNode, nullptr); 361 return swiperNode->GetPattern<SwiperPattern>(); 362 } 363 GetIndicatorType()364 virtual SwiperIndicatorType GetIndicatorType() const 365 { 366 auto swiperPattern = GetSwiperPattern(); 367 CHECK_NULL_RETURN(swiperPattern, SwiperIndicatorType::DOT); 368 return swiperPattern->GetIndicatorType(); 369 } 370 IsHover()371 const bool& IsHover() const 372 { 373 return isHover_; 374 } 375 IsPressed()376 const bool& IsPressed() const 377 { 378 return isPressed_; 379 } 380 GetHoverPoint()381 const PointF& GetHoverPoint() const 382 { 383 return hoverPoint_; 384 } 385 GetOptinalMouseClickIndex()386 std::optional<int32_t> GetOptinalMouseClickIndex() const 387 { 388 return mouseClickIndex_; 389 } 390 SetMouseClickIndex(int32_t mouseClickIndex)391 void SetMouseClickIndex(int32_t mouseClickIndex) 392 { 393 if (mouseClickIndex_) { 394 mouseClickIndex_ = mouseClickIndex; 395 } 396 } 397 ResetOptinalMouseClickIndex()398 void ResetOptinalMouseClickIndex() 399 { 400 mouseClickIndex_ = std::nullopt; 401 } 402 GetTouchBottomType()403 const TouchBottomType& GetTouchBottomType() const 404 { 405 return touchBottomType_; 406 } 407 SetTouchBottomType(TouchBottomType touchBottomType)408 void SetTouchBottomType(TouchBottomType touchBottomType) 409 { 410 touchBottomType_ = touchBottomType; 411 } 412 GetDotIndicatorModifier()413 const RefPtr<DotIndicatorModifier>& GetDotIndicatorModifier() const 414 { 415 return dotIndicatorModifier_; 416 } 417 SetDotIndicatorModifier(RefPtr<DotIndicatorModifier> dotIndicatorModifier)418 void SetDotIndicatorModifier(RefPtr<DotIndicatorModifier> dotIndicatorModifier) 419 { 420 dotIndicatorModifier_ = dotIndicatorModifier; 421 } 422 GetOverlengthDotIndicatorModifier()423 const RefPtr<OverlengthDotIndicatorModifier>& GetOverlengthDotIndicatorModifier() const 424 { 425 return overlongDotIndicatorModifier_; 426 } 427 SetOverlengthDotIndicatorModifier(RefPtr<OverlengthDotIndicatorModifier> overlongDotIndicatorModifier)428 void SetOverlengthDotIndicatorModifier(RefPtr<OverlengthDotIndicatorModifier> overlongDotIndicatorModifier) 429 { 430 overlongDotIndicatorModifier_ = overlongDotIndicatorModifier; 431 } 432 GetDragStartPoint()433 const PointF& GetDragStartPoint() const 434 { 435 return dragStartPoint_; 436 } 437 SetDragStartPoint(PointF dragStartPoint)438 void SetDragStartPoint(PointF dragStartPoint) 439 { 440 dragStartPoint_ = dragStartPoint; 441 } 442 443 RectF CalcBoundsRect() const; 444 int32_t GetLoopIndex(int32_t originalIndex) const; 445 void ResetOverlongModifier(); 446 }; 447 } // namespace OHOS::Ace::NG 448 449 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SWIPER_INDICATOR_SWIPER_INDICATOR_PATTERN_H 450