• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PATTERNS_SCROLL_INNER_SCROLL_BAR_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SCROLL_INNER_SCROLL_BAR_H
18 
19 #include <cmath>
20 
21 #include "base/geometry/dimension.h"
22 #include "base/geometry/offset.h"
23 #include "base/geometry/rect.h"
24 #include "base/utils/utils.h"
25 #include "core/animation/friction_motion.h"
26 #include "core/components/common/layout/constants.h"
27 #include "core/components/common/properties/color.h"
28 #include "core/components/common/properties/edge.h"
29 #include "core/components/scroll/scroll_bar_theme.h"
30 #include "core/components_ng/base/frame_scene_status.h"
31 #include "core/components_ng/event/input_event.h"
32 #include "core/components_ng/event/touch_event.h"
33 #include "core/components_ng/gestures/recognizers/pan_recognizer.h"
34 #include "core/components_ng/pattern/scroll/inner/scroll_bar_overlay_modifier.h"
35 #include "core/components_ng/pattern/scrollable/scrollable_properties.h"
36 #include "core/components_ng/property/border_property.h"
37 #include "core/components_ng/gestures/recognizers/long_press_recognizer.h"
38 
39 namespace OHOS::Ace::NG {
40 
41 constexpr double FACTOR_HALF = 0.5;
42 constexpr double DEFAULT_TOPANGLE = 60.0;
43 constexpr double DEFAULT_BOTTOMANGLE = 120.0;
44 constexpr double DEFAULT_MINANGLE = 10.0;
45 constexpr double STRAIGHT_ANGLE = 180.0;
46 constexpr double BAR_FRICTION = 0.9;
47 constexpr Color PRESSED_BLEND_COLOR = Color(0x19000000);
48 using DragFRCSceneCallback = std::function<void(double velocity, NG::SceneStatus sceneStatus)>;
49 using ScrollBarPositionCallback = std::function<bool(double, int32_t source, bool isMouseWheelScroll)>;
50 
51 enum class BarDirection {
52     BAR_NONE = 0,
53     PAGE_UP,
54     PAGE_DOWN,
55 };
56 
57 class ScrollBar : public AceType {
58     DECLARE_ACE_TYPE(ScrollBar, AceType);
59 
60 public:
61     ScrollBar();
62     ScrollBar(DisplayMode displayMode, ShapeMode shapeMode = ShapeMode::RECT,
63         PositionMode positionMode = PositionMode::RIGHT);
64     ~ScrollBar() override = default;
65 
GetShapeMode()66     ShapeMode GetShapeMode() const
67     {
68         return shapeMode_;
69     }
GetDisplayMode()70     DisplayMode GetDisplayMode() const
71     {
72         return displayMode_;
73     }
GetPositionMode()74     PositionMode GetPositionMode() const
75     {
76         return positionMode_;
77     }
SetPadding(const Edge & padding)78     void SetPadding(const Edge& padding)
79     {
80         padding_ = padding;
81     }
GetPadding()82     const Edge& GetPadding() const
83     {
84         return padding_;
85     }
SetBackgroundColor(const Color & backgroundColor)86     void SetBackgroundColor(const Color& backgroundColor)
87     {
88         backgroundColor_ = backgroundColor;
89     }
GetBackgroundColor()90     const Color& GetBackgroundColor() const
91     {
92         return backgroundColor_;
93     }
SetForegroundColor(const Color & foregroundColor)94     void SetForegroundColor(const Color& foregroundColor)
95     {
96         foregroundColor_ = foregroundColor;
97     }
GetTopAngle()98     double GetTopAngle() const
99     {
100         return topAngle_;
101     }
GetBottomAngle()102     double GetBottomAngle() const
103     {
104         return bottomAngle_;
105     }
GetTrickStartAngle()106     double GetTrickStartAngle() const
107     {
108         return trickStartAngle_;
109     }
GetTrickSweepAngle()110     double GetTrickSweepAngle() const
111     {
112         return trickSweepAngle_;
113     }
SetMinHeight(const Dimension & minHeight)114     void SetMinHeight(const Dimension& minHeight)
115     {
116         minHeight_ = minHeight;
117     }
GetMinHeight()118     const Dimension& GetMinHeight() const
119     {
120         return minHeight_;
121     }
SetMinDynamicHeight(const Dimension & minDynamicHeight)122     void SetMinDynamicHeight(const Dimension& minDynamicHeight)
123     {
124         minDynamicHeight_ = minDynamicHeight;
125     }
GetMinDynamicHeight()126     const Dimension& GetMinDynamicHeight() const
127     {
128         return minDynamicHeight_;
129     }
SetInactiveWidth(const Dimension & inactiveWidth)130     void SetInactiveWidth(const Dimension& inactiveWidth)
131     {
132         inactiveWidth_ = inactiveWidth;
133     }
SetActiveWidth(const Dimension & activeWidth)134     void SetActiveWidth(const Dimension& activeWidth)
135     {
136         activeWidth_ = activeWidth;
137     }
GetActiveWidth()138     const Dimension& GetActiveWidth() const
139     {
140         return activeWidth_;
141     }
GetActiveRect()142     const Rect& GetActiveRect() const
143     {
144         return activeRect_;
145     }
SetTouchWidth(const Dimension & touchWidth)146     void SetTouchWidth(const Dimension& touchWidth)
147     {
148         touchWidth_ = touchWidth;
149     }
GetTouchWidth()150     const Dimension& GetTouchWidth() const
151     {
152         return touchWidth_;
153     }
GetBarRect()154     const Rect& GetBarRect() const
155     {
156         return barRect_;
157     }
IsScrollable()158     bool IsScrollable() const
159     {
160         return isScrollable_;
161     }
GetPositionModeUpdate()162     bool GetPositionModeUpdate() const
163     {
164         return positionModeUpdate_;
165     }
SetShapeMode(ShapeMode shapeMode)166     void SetShapeMode(ShapeMode shapeMode)
167     {
168         shapeMode_ = shapeMode;
169     }
GetOutBoundary()170     double GetOutBoundary() const
171     {
172         return outBoundary_;
173     }
SetOutBoundary(double outBoundary)174     void SetOutBoundary(double outBoundary)
175     {
176         outBoundary_ = outBoundary;
177     }
SetPosition(const Dimension & position)178     void SetPosition(const Dimension& position)
179     {
180         position_ = position;
181     }
GetPosition()182     const Dimension& GetPosition() const
183     {
184         return position_;
185     }
SetPressed(bool press)186     void SetPressed(bool press)
187     {
188         isPressed_ = press;
189     }
IsPressed()190     bool IsPressed() const
191     {
192         return isPressed_;
193     }
IsDriving()194     bool IsDriving() const
195     {
196         return isDriving_;
197     }
SetHover(bool hover)198     void SetHover(bool hover)
199     {
200         isHover_ = hover;
201     }
IsHover()202     bool IsHover() const
203     {
204         return isHover_;
205     }
GetOpacityAnimationType()206     OpacityAnimationType GetOpacityAnimationType() const
207     {
208         return opacityAnimationType_;
209     }
SetOpacityAnimationType(OpacityAnimationType opacityAnimationType)210     void SetOpacityAnimationType(OpacityAnimationType opacityAnimationType)
211     {
212         opacityAnimationType_ = opacityAnimationType;
213     }
GetHoverAnimationType()214     HoverAnimationType GetHoverAnimationType() const
215     {
216         return hoverAnimationType_;
217     }
SetHoverAnimationType(HoverAnimationType hoverAnimationType)218     void SetHoverAnimationType(HoverAnimationType hoverAnimationType)
219     {
220         hoverAnimationType_ = hoverAnimationType;
221     }
GetNeedAdaptAnimation()222     bool GetNeedAdaptAnimation() const
223     {
224         return needAdaptAnimation_;
225     }
SetMarkNeedRenderFunc(std::function<void ()> && func)226     void SetMarkNeedRenderFunc(std::function<void()>&& func)
227     {
228         markNeedRenderFunc_ = func;
229     }
GetTouchEvent()230     RefPtr<TouchEventImpl> GetTouchEvent()
231     {
232         return touchEvent_;
233     }
GetMouseEvent()234     RefPtr<InputEvent> GetMouseEvent()
235     {
236         return mouseEvent_;
237     }
GetHoverEvent()238     RefPtr<InputEvent> GetHoverEvent() const
239     {
240         return hoverEvent_;
241     }
SetIsUserNormalWidth(bool isUserNormalWidth)242     void SetIsUserNormalWidth(bool isUserNormalWidth)
243     {
244         isUserNormalWidth_ = isUserNormalWidth;
245     }
GetIsUserNormalWidth()246     bool GetIsUserNormalWidth() const
247     {
248         return isUserNormalWidth_;
249     }
SetStartReservedHeight(const Dimension & startReservedHeight)250     void SetStartReservedHeight(const Dimension& startReservedHeight)
251     {
252         startReservedHeight_ = startReservedHeight;
253     }
GetStartReservedHeight()254     const Dimension& GetStartReservedHeight() const
255     {
256         return startReservedHeight_;
257     }
SetEndReservedHeight(const Dimension & endReservedHeight)258     void SetEndReservedHeight(const Dimension& endReservedHeight)
259     {
260         endReservedHeight_ = endReservedHeight;
261     }
GetEndReservedHeight()262     const Dimension& GetEndReservedHeight() const
263     {
264         return endReservedHeight_;
265     }
SetHostBorderRadius(const BorderRadiusProperty & hostBorderRadius)266     void SetHostBorderRadius(const BorderRadiusProperty& hostBorderRadius)
267     {
268         hostBorderRadius_ = hostBorderRadius;
269     }
GetHostBorderRadius()270     const BorderRadiusProperty& GetHostBorderRadius() const
271     {
272         return hostBorderRadius_;
273     }
SetScrollPositionCallback(ScrollBarPositionCallback && callback)274     void SetScrollPositionCallback(ScrollBarPositionCallback&& callback)
275     {
276         scrollPositionCallback_ = std::move(callback);
277     }
GetScrollPositionCallback()278     const ScrollBarPositionCallback& GetScrollPositionCallback() const
279     {
280         return scrollPositionCallback_;
281     }
SetScrollEndCallback(ScrollEndCallback && scrollEndCallback)282     void SetScrollEndCallback(ScrollEndCallback&& scrollEndCallback)
283     {
284         scrollEndCallback_ = std::move(scrollEndCallback);
285     }
GetScrollEndCallback()286     const ScrollEndCallback& GetScrollEndCallback() const
287     {
288         return scrollEndCallback_;
289     }
SetStartSnapAnimationCallback(StartSnapAnimationCallback && startSnapAnimationCallback)290     void SetStartSnapAnimationCallback(StartSnapAnimationCallback&& startSnapAnimationCallback)
291     {
292         startSnapAnimationCallback_ = std::move(startSnapAnimationCallback);
293     }
SetDragFRCSceneCallback(DragFRCSceneCallback && dragFRCSceneCallback)294     void SetDragFRCSceneCallback(DragFRCSceneCallback&& dragFRCSceneCallback)
295     {
296         dragFRCSceneCallback_ = std::move(dragFRCSceneCallback);
297     }
SetDragStartPosition(float position)298     void SetDragStartPosition(float position)
299     {
300         dragStartPosition_ = position;
301     }
SetDragEndPosition(float position)302     void SetDragEndPosition(float position)
303     {
304         dragEndPosition_ = position;
305     }
GetDragOffset()306     float GetDragOffset()
307     {
308         return dragEndPosition_ - dragStartPosition_;
309     }
IsReverse()310     bool IsReverse()
311     {
312         return isReverse_;
313     }
GetTouchRegion()314     Rect GetTouchRegion() const
315     {
316         return touchRegion_;
317     }
GetClickEvent()318     RefPtr<ClickEvent> GetClickEvent()
319     {
320         return clickevent_;
321     }
SetAxis(Axis axis)322     void SetAxis(Axis axis)
323     {
324         axis_ = axis;
325     }
SetScrollPageCallback(ScrollPageCallback && scrollPageCallback)326     void SetScrollPageCallback(ScrollPageCallback&& scrollPageCallback)
327     {
328         scrollPageCallback_ = std::move(scrollPageCallback);
329     }
330     void OnCollectTouchTarget(const OffsetF& coordinateOffset, const GetEventTargetImpl& getEventTargetImpl,
331         TouchTestResult& result, const RefPtr<FrameNode>& frameNode, const RefPtr<TargetComponent>& targetComponent,
332         ResponseLinkResult& responseLinkResult, bool inBarRect = false);
333     void OnCollectLongPressTarget(const OffsetF& coordinateOffset, const GetEventTargetImpl& getEventTargetImpl,
334         TouchTestResult& result, const RefPtr<FrameNode>& frameNode, const RefPtr<TargetComponent>& targetComponent,
335         ResponseLinkResult& responseLinkResult);
336     virtual bool InBarTouchRegion(const Point& point) const;
337     virtual bool InBarHoverRegion(const Point& point) const;
338     virtual bool InBarRectRegion(const Point& point) const;
339     bool NeedScrollBar() const;
340     bool NeedPaint() const;
341     void UpdateScrollBarRegion(
342         const Offset& offset, const Size& size, const Offset& lastOffset, double estimatedHeight, int32_t scrollSource);
343     double GetNormalWidthToPx() const;
344     virtual float CalcPatternOffset(float scrollBarOffset) const;
345     Color GetForegroundColor() const;
346     void SetHoverWidth(const RefPtr<ScrollBarTheme>& theme);
347     void SetNormalWidth(const Dimension& normalWidth);
348     void SetScrollable(bool isScrollable);
349     void SetPositionMode(PositionMode positionMode);
350     void SetDisplayMode(DisplayMode displayMode);
351     void PlayScrollBarDisappearAnimation();
352     void PlayScrollBarAppearAnimation();
353     void PlayScrollBarGrowAnimation();
354     void PlayScrollBarShrinkAnimation();
355     void PlayScrollBarAdaptAnimation();
356     void MarkNeedRender();
357     void SetGestureEvent();
358     void SetMouseEvent();
359     void SetHoverEvent();
360     void FlushBarWidth();
361     virtual void CalcReservedHeight();
362     void ScheduleDisappearDelayTask();
363     float GetMainOffset(const Offset& offset) const;
364     float GetMainSize(const Size& size) const;
365     void SetReverse(bool reverse);
366     BarDirection CheckBarDirection(const Point& point);
367     void InitLongPressEvent();
368     void HandleLongPress(bool smooth);
369     bool AnalysisUpOrDown(Point point, bool& reverse);
370     void ScheduleCaretLongPress();
371     Axis GetPanDirection() const;
372     // infos for dump
373     void AddScrollBarLayoutInfo();
374     void GetShapeModeDumpInfo();
375     void GetShapeModeDumpInfo(std::unique_ptr<JsonValue>& json);
376     void GetPositionModeDumpInfo();
377     void GetPositionModeDumpInfo(std::unique_ptr<JsonValue>& json);
378     void GetAxisDumpInfo();
379     void GetAxisDumpInfo(std::unique_ptr<JsonValue>& json);
380     void GetPanDirectionDumpInfo();
381     void GetPanDirectionDumpInfo(std::unique_ptr<JsonValue>& json);
382     void DumpAdvanceInfo();
383     void DumpAdvanceInfo(std::unique_ptr<JsonValue>& json);
384     void StopFlingAnimation();
385 
SetActiveBackgroundWidth(const Dimension & activeBackgroundWidth)386     void SetActiveBackgroundWidth(const Dimension& activeBackgroundWidth)
387     {
388         activeBackgroundWidth_ = activeBackgroundWidth;
389     }
390 
SetActiveScrollBarWidth(const Dimension & activeScrollBarWidth)391     void SetActiveScrollBarWidth(const Dimension& activeScrollBarWidth)
392     {
393         activeScrollBarWidth_ = activeScrollBarWidth;
394     }
395 
SetArcBackgroundColor(const Color & backgroundColor)396     void SetArcBackgroundColor(const Color& backgroundColor)
397     {
398         arcBackgroundColor_ = backgroundColor;
399     }
GetArcBackgroundColor()400     const Color& GetArcBackgroundColor() const
401     {
402         return arcBackgroundColor_;
403     }
404 
SetArcForegroundColor(const Color & foregroundColor)405     void SetArcForegroundColor(const Color& foregroundColor)
406     {
407         arcForegroundColor_ = foregroundColor;
408     }
409 
GetArcForegroundColor()410     Color GetArcForegroundColor() const
411     {
412         return IsPressed() ? arcForegroundColor_.BlendColor(PRESSED_BLEND_COLOR) : arcForegroundColor_;
413     }
414 
415 protected:
416     void InitTheme();
417     virtual void SetBarRegion(const Offset& offset, const Size& size);
418     virtual void SetRoundTrickRegion(const Offset& offset, const Size& size, const Offset& lastOffset,
419         double mainScrollExtent);
420     double NormalizeToPx(const Dimension& dimension) const;
GetNormalWidth()421     Dimension GetNormalWidth()
422     {
423         return normalWidth_;
424     }
425 
SetMouseEventMember(RefPtr<InputEvent> mouseEvent)426     void SetMouseEventMember(RefPtr<InputEvent> mouseEvent)
427     {
428         mouseEvent_ = mouseEvent;
429     }
430 
GetIsMousePressed()431     bool GetIsMousePressed()
432     {
433         return isMousePressed_;
434     }
435 
SetIsMousePressed(bool isMousePressed)436     void SetIsMousePressed(bool isMousePressed)
437     {
438         isMousePressed_ = isMousePressed;
439     }
440 
GetLocationInfo()441     Offset GetLocationInfo()
442     {
443         return locationInfo_;
444     }
445 
SetLocationInfo(Offset locationInfo)446     void SetLocationInfo(Offset locationInfo)
447     {
448         locationInfo_ = locationInfo;
449     }
450 
GetLongPressRecognizer()451     RefPtr<LongPressRecognizer> GetLongPressRecognizer()
452     {
453         return longPressRecognizer_;
454     }
455 
SetLongPressRecognizer(RefPtr<LongPressRecognizer> longPressRecognizer)456     void SetLongPressRecognizer(RefPtr<LongPressRecognizer> longPressRecognizer)
457     {
458         longPressRecognizer_ = longPressRecognizer;
459     }
460 
SetTouchEvent(RefPtr<TouchEventImpl> touchEvent)461     void SetTouchEvent(RefPtr<TouchEventImpl> touchEvent)
462     {
463         touchEvent_ = touchEvent;
464     }
465 
SetPanRecognizer(RefPtr<PanRecognizer> panRecognizer)466     void SetPanRecognizer(RefPtr<PanRecognizer> panRecognizer)
467     {
468         panRecognizer_ = panRecognizer;
469     }
470 
GetPanRecognizer()471     RefPtr<PanRecognizer> GetPanRecognizer()
472     {
473         return panRecognizer_;
474     }
475 
CallInitPanRecognizer()476     void CallInitPanRecognizer()
477     {
478         InitPanRecognizer();
479     }
480 
GetEstimatedHeigh()481     double GetEstimatedHeigh() const
482     {
483         return estimatedHeight_;
484     }
485 
GetViewPortSize()486     Size GetViewPortSize() const
487     {
488         return viewPortSize_;
489     }
490 
IsDriving_()491     bool IsDriving_() const
492     {
493         return isDriving_;
494     }
495 
GetThemeNormalWidth()496     Dimension GetThemeNormalWidth()
497     {
498         return themeNormalWidth_;
499     }
500 
GetBarRegionSize()501     double GetBarRegionSize() const
502     {
503         return barRegionSize_;
504     }
505 
SetBarRegionSize(double barRegionSize)506     void SetBarRegionSize(double barRegionSize)
507     {
508         barRegionSize_ = barRegionSize;
509     }
510 
GetOffsetScale()511     double GetOffsetScale() const
512     {
513         return offsetScale_;
514     }
515 
SetOffsetScale(double offsetScale)516     void SetOffsetScale(double offsetScale)
517     {
518         offsetScale_ = offsetScale;
519     }
520 
SetNormalBackgroundWidth(const Dimension & normalBackgroundWidth)521     void SetNormalBackgroundWidth(const Dimension& normalBackgroundWidth)
522     {
523         normalBackgroundWidth_ = normalBackgroundWidth;
524     }
525 
GetNormalBackgroundWidth()526     const Dimension& GetNormalBackgroundWidth() const
527     {
528         return normalBackgroundWidth_;
529     }
530 
GetActiveBackgroundWidth()531     const Dimension& GetActiveBackgroundWidth() const
532     {
533         return activeBackgroundWidth_;
534     }
535 
SetNormaMaxOffsetAngle(double normaMaxOffsetAngle)536     void SetNormaMaxOffsetAngle(double normaMaxOffsetAngle)
537     {
538         normaMaxOffsetAngle_ = normaMaxOffsetAngle;
539     }
540 
GetNormaMaxOffsetAngle()541     double GetNormaMaxOffsetAngle() const
542     {
543         return normaMaxOffsetAngle_;
544     }
545 
SetNormalStartAngle(double normalStartAngle)546     void SetNormalStartAngle(double normalStartAngle)
547     {
548         normalStartAngle_ = normalStartAngle;
549     }
550 
GetNormalStartAngle()551     double GetNormalStartAngle() const
552     {
553         if (positionMode_ == PositionMode::LEFT) {
554             return -normalStartAngle_ - STRAIGHT_ANGLE;
555         }
556         return normalStartAngle_;
557     }
558 
SetActiveStartAngle(double activeStartAngle)559     void SetActiveStartAngle(double activeStartAngle)
560     {
561         activeStartAngle_ = activeStartAngle;
562     }
563 
GetActiveStartAngle()564     double GetActiveStartAngle() const
565     {
566         if (positionMode_ == PositionMode::LEFT) {
567             return -activeStartAngle_ - STRAIGHT_ANGLE;
568         }
569         return activeStartAngle_;
570     }
571 
SetActiveMaxOffsetAngle(double activeMaxOffsetAngle)572     void SetActiveMaxOffsetAngle(double activeMaxOffsetAngle)
573     {
574         activeMaxOffsetAngle_ = activeMaxOffsetAngle;
575     }
576 
GetActiveMaxOffsetAngle()577     double GetActiveMaxOffsetAngle() const
578     {
579         return activeMaxOffsetAngle_;
580     }
581 
SetNormalScrollBarWidth(const Dimension & normalScrollBarWidth)582     void SetNormalScrollBarWidth(const Dimension& normalScrollBarWidth)
583     {
584         normalScrollBarWidth_ = normalScrollBarWidth;
585     }
586 
GetNormalScrollBarWidth()587     const Dimension& GetNormalScrollBarWidth() const
588     {
589         return normalScrollBarWidth_;
590     }
591 
GetActiveScrollBarWidth()592     const Dimension& GetActiveScrollBarWidth() const
593     {
594         return activeScrollBarWidth_;
595     }
596 
GetMinAngle()597     double GetMinAngle() const
598     {
599         return minAngle_;
600     }
601 
602 private:
603     void SetRectTrickRegion(const Offset& offset, const Size& size, const Offset& lastOffset, double mainScrollExtent,
604         int32_t scrollSource);
605     void SetRectTrickRegion(const Offset& offset, const Size& size, const Offset& lastOffset, double mainScrollExtent);
606 
607     void UpdateActiveRectSize(double activeSize);
608     void UpdateActiveRectOffset(double activeMainOffset);
609 
610     void InitPanRecognizer();
611     void HandleDragStart(const GestureEvent& info);
612     void HandleDragUpdate(const GestureEvent& info);
613     void HandleDragEnd(const GestureEvent& info);
614     void ProcessFrictionMotion(double value);
615     void ProcessFrictionMotionStop();
616     void CalcScrollBarRegion(double activeMainOffset, double activeSize, const Offset& offset, const Size& size,
617         double& inactiveMainOffset, double& inactiveSize);
618     void GetRadiusAndPadding(float& startRadius, float& endRadius, float& padding);
619     DisplayMode displayMode_ = DisplayMode::AUTO;
620     ShapeMode shapeMode_ = ShapeMode::RECT;
621     PositionMode positionMode_ = PositionMode::RIGHT;
622     BorderRadiusProperty hostBorderRadius_;
623     Edge padding_;
624     Color backgroundColor_;
625     Color foregroundColor_;
626     Rect touchRegion_;
627     Rect hoverRegion_;
628     Rect barRect_;
629     Rect activeRect_;
630     Dimension minHeight_;           // this is min static height
631     Dimension minDynamicHeight_;    // this is min dynamic height when on the top or bottom
632     Dimension startReservedHeight_; // this is reservedHeight on the start
633     Dimension endReservedHeight_;   // this is reservedHeight on the end
634     Dimension inactiveWidth_;
635     Dimension activeWidth_;
636     Dimension normalWidth_; // user-set width of the scrollbar
637     Dimension themeNormalWidth_;
638     Dimension touchWidth_;
639     Dimension hoverWidth_;
640     double barWidth_ = 0.0; // actual width of the scrollbar
641     Dimension position_;
642     double trickStartAngle_ = 0.0;
643     double trickSweepAngle_ = 0.0;
644     double topAngle_ = DEFAULT_TOPANGLE;
645     double bottomAngle_ = DEFAULT_BOTTOMANGLE;
646     double minAngle_ = DEFAULT_MINANGLE;
647     double outBoundary_ = 0.0;
648     double offsetScale_ = 1.0f;
649     double scrollableOffset_ = 0.0;
650     double barRegionSize_ = 0.0;
651     double friction_ = BAR_FRICTION;
652     double frictionPosition_ = 0.0;
653     float dragStartPosition_ = 0.0f;
654     float dragEndPosition_ = 0.0f;
655     bool isScrollable_ = false;
656     bool isPressed_ = false;
657     bool isDriving_ = false; // false: scroll driving; true: bar driving
658     bool isHover_ = false;
659     bool positionModeUpdate_ = false;
660     bool normalWidthUpdate_ = false;
661     bool isUserNormalWidth_ = false;
662     bool needAdaptAnimation_ = false;
663     bool isReverse_ = false;
664     bool isReverseUpdate_ = false;
665     bool isShowScrollBar_ = false;
666     Offset paintOffset_;
667     Size viewPortSize_;
668     Offset lastOffset_;
669     double estimatedHeight_ = 0.0;
670     RefPtr<TouchEventImpl> touchEvent_;
671     RefPtr<InputEvent> mouseEvent_;
672     RefPtr<InputEvent> hoverEvent_;
673     RefPtr<PanRecognizer> panRecognizer_;
674     RefPtr<Animator> frictionController_;
675     RefPtr<FrictionMotion> frictionMotion_;
676     std::function<void()> markNeedRenderFunc_;
677     ScrollBarPositionCallback scrollPositionCallback_;
678     ScrollEndCallback scrollEndCallback_;
679     StartSnapAnimationCallback startSnapAnimationCallback_;
680     ScrollPageCallback scrollPageCallback_;
681     OpacityAnimationType opacityAnimationType_ = OpacityAnimationType::NONE;
682     HoverAnimationType hoverAnimationType_ = HoverAnimationType::NONE;
683     CancelableCallback<void()> disappearDelayTask_;
684     DragFRCSceneCallback dragFRCSceneCallback_;
685     Axis axis_ = Axis::VERTICAL;
686     RefPtr<ClickEvent> clickevent_;
687     RefPtr<LongPressRecognizer> longPressRecognizer_;
688     Offset locationInfo_;
689     // dump info
690     std::list<InnerScrollBarLayoutInfo> innerScrollBarLayoutInfos_;
691     bool needAddLayoutInfo = false;
692     bool isMousePressed_ = false;
693 
694     Dimension normalBackgroundWidth_;
695     Dimension activeBackgroundWidth_;
696     double normalStartAngle_ = 0.0;
697     double activeStartAngle_ = 0.0;
698     double normaMaxOffsetAngle_ = 0.0;
699     double activeMaxOffsetAngle_ = 0.0;
700     Dimension normalScrollBarWidth_;
701     Dimension activeScrollBarWidth_;
702     Color arcBackgroundColor_;
703     Color arcForegroundColor_;
704 };
705 
706 } // namespace OHOS::Ace::NG
707 
708 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SCROLL_INNER_SCROLL_BAR_H
709