• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_PATTERNS_OVERLAY_SHEET_PRESENTATION_PATTERN_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_SHEET_PRESENTATION_PATTERN_H
18 
19 #include <functional>
20 #include <utility>
21 
22 #include "base/memory/ace_type.h"
23 #include "base/memory/referenced.h"
24 #include "core/common/autofill/auto_fill_trigger_state_holder.h"
25 #include "core/components/common/properties/alignment.h"
26 #include "core/components_ng/manager/avoid_info/avoid_info_manager.h"
27 #include "core/components_ng/manager/focus/focus_view.h"
28 #include "core/components_ng/pattern/linear_layout/linear_layout_algorithm.h"
29 #include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h"
30 #include "core/components_ng/pattern/linear_layout/linear_layout_property.h"
31 #include "core/components_ng/pattern/overlay/popup_base_pattern.h"
32 #include "core/components_ng/pattern/overlay/sheet_presentation_layout_algorithm.h"
33 #include "core/components_ng/pattern/overlay/sheet_presentation_property.h"
34 #include "core/components_ng/pattern/overlay/sheet_style.h"
35 #include "core/components_ng/pattern/scrollable/nestable_scroll_container.h"
36 #include "core/components_ng/pattern/sheet/content_cover/sheet_content_cover_layout_algorithm.h"
37 #include "core/components_ng/pattern/sheet/content_cover/sheet_content_cover_object.h"
38 #include "core/components_ng/pattern/sheet/sheet_object.h"
39 #include "core/components_ng/pattern/sheet/side/sheet_presentation_side_layout_algorithm.h"
40 #include "core/components_ng/pattern/sheet/side/sheet_side_object.h"
41 #include "core/pipeline_ng/pipeline_context.h"
42 
43 namespace OHOS::Ace::NG {
44 
45 enum class BindSheetDismissReason {
46     BACK_PRESSED = 0,
47     TOUCH_OUTSIDE,
48     CLOSE_BUTTON,
49     SLIDE_DOWN,
50     SLIDE,
51 };
52 class ACE_EXPORT SheetPresentationPattern : public LinearLayoutPattern,
53                                             public PopupBasePattern,
54                                             public FocusView,
55                                             public NestableScrollContainer,
56                                             public AutoFillTriggerStateHolder,
57                                             public IAvoidInfoListener {
58     DECLARE_ACE_TYPE(SheetPresentationPattern, LinearLayoutPattern, PopupBasePattern, FocusView,
59         NestableScrollContainer, AutoFillTriggerStateHolder, IAvoidInfoListener);
60 
61 public:
SheetPresentationPattern(int32_t targetId,const std::string & targetTag,std::function<void (const std::string &)> && callback)62     SheetPresentationPattern(
63         int32_t targetId, const std::string& targetTag, std::function<void(const std::string&)>&& callback)
64         : LinearLayoutPattern(true)
65     {
66         targetId_ = targetId;
67         targetTag_ = targetTag;
68         callback_ = std::move(callback);
69     }
70 
71     ~SheetPresentationPattern() override = default;
72 
IsMeasureBoundary()73     bool IsMeasureBoundary() const override
74     {
75         return true;
76     }
77 
SetOverlay(const WeakPtr<OverlayManager> & overlayManager)78     void SetOverlay(const WeakPtr<OverlayManager>& overlayManager)
79     {
80         overlayManager_ = overlayManager;
81     }
82 
GetOverlay()83     WeakPtr<OverlayManager> GetOverlay()
84     {
85         return overlayManager_;
86     }
87 
IsAtomicNode()88     bool IsAtomicNode() const override
89     {
90         return false;
91     }
92 
CreateLayoutAlgorithm()93     RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override
94     {
95         auto sheetType = sheetType_;
96         if (sheetType == SheetType::SHEET_SIDE) {
97             return MakeRefPtr<SheetPresentationSideLayoutAlgorithm>();
98         }
99         if (sheetType == SheetType::SHEET_CONTENT_COVER) {
100             return MakeRefPtr<SheetContentCoverLayoutAlgorithm>();
101         }
102         return MakeRefPtr<SheetPresentationLayoutAlgorithm>(sheetType, sheetPopupInfo_);
103     }
104 
CreateLayoutProperty()105     RefPtr<LayoutProperty> CreateLayoutProperty() override
106     {
107         return MakeRefPtr<SheetPresentationProperty>();
108     }
109 
110     RefPtr<RenderContext> GetRenderContext();
111 
GetTargetId()112     int32_t GetTargetId() const override
113     {
114         return targetId_;
115     }
116 
GetTargetTag()117     const std::string& GetTargetTag() const
118     {
119         return targetTag_;
120     }
121 
FireCallback(const std::string & value)122     void FireCallback(const std::string& value)
123     {
124         if (callback_) {
125             callback_(value);
126         }
127     }
128 
UpdateShouldDismiss(std::function<void ()> && shouldDismiss)129     void UpdateShouldDismiss(std::function<void()>&& shouldDismiss)
130     {
131         shouldDismiss_ = std::move(shouldDismiss);
132     }
133 
HasShouldDismiss()134     bool HasShouldDismiss()
135     {
136         if (shouldDismiss_) {
137             return true;
138         }
139         return false;
140     }
141 
CallShouldDismiss()142     void CallShouldDismiss()
143     {
144         if (shouldDismiss_) {
145             shouldDismiss_();
146         }
147     }
148 
UpdateOnDisappear(std::function<void ()> && onDisappear)149     void UpdateOnDisappear(std::function<void()>&& onDisappear)
150     {
151         onDisappear_ = std::move(onDisappear);
152         isExecuteOnDisappear_ = false;
153     }
154 
155     void OnDisappear();
156 
UpdateOnWillDisappear(std::function<void ()> && onWillDisappear)157     void UpdateOnWillDisappear(std::function<void()>&& onWillDisappear)
158     {
159         onWillDisappear_ = std::move(onWillDisappear);
160     }
161 
162     void OnWillDisappear();
163 
UpdateOnAppear(std::function<void ()> && onAppear)164     void UpdateOnAppear(std::function<void()>&& onAppear)
165     {
166         onAppear_ = std::move(onAppear);
167     }
168 
169     void OnAppear();
170 
UpdateOnWillAppear(std::function<void ()> && onWillAppear)171     void UpdateOnWillAppear(std::function<void()>&& onWillAppear)
172     {
173         onWillAppear_ = std::move(onWillAppear);
174     }
175 
176     void OnWillAppear();
177 
IsOnAppearing()178     bool IsOnAppearing() const
179     {
180         return isOnAppearing_;
181     }
182 
IsOnDisappearing()183     bool IsOnDisappearing() const
184     {
185         return isOnDisappearing_;
186     }
187 
UpdateOnHeightDidChange(std::function<void (const float)> && onHeightDidChange)188     void UpdateOnHeightDidChange(std::function<void(const float)>&& onHeightDidChange)
189     {
190         onHeightDidChange_ = std::move(onHeightDidChange);
191     }
192 
OnHeightDidChange(float currentHeight)193     void OnHeightDidChange(float currentHeight) const
194     {
195         if (onHeightDidChange_) {
196             onHeightDidChange_(currentHeight);
197         }
198     }
199 
200     void FireOnHeightDidChange();
201 
HasOnHeightDidChange()202     bool HasOnHeightDidChange()
203     {
204         if (onHeightDidChange_) {
205             return true;
206         }
207         return false;
208     }
209 
UpdateOnDetentsDidChange(std::function<void (const float)> && onDetentsDidChange)210     void UpdateOnDetentsDidChange(std::function<void(const float)>&& onDetentsDidChange)
211     {
212         onDetentsDidChange_ = std::move(onDetentsDidChange);
213     }
214 
OnDetentsDidChange(float currentHeight)215     void OnDetentsDidChange(float currentHeight) const
216     {
217         if (onDetentsDidChange_) {
218             onDetentsDidChange_(currentHeight);
219         }
220     }
221 
222     void FireOnDetentsDidChange(float height);
223 
UpdateOnWidthDidChange(std::function<void (const float)> && onWidthDidChange)224     void UpdateOnWidthDidChange(std::function<void(const float)>&& onWidthDidChange)
225     {
226         onWidthDidChange_ = std::move(onWidthDidChange);
227     }
228 
onWidthDidChange(float currentWidth)229     void onWidthDidChange(float currentWidth) const
230     {
231         if (onWidthDidChange_) {
232             onWidthDidChange_(currentWidth);
233         }
234     }
235 
236     void FireOnWidthDidChange();
237 
UpdateOnTypeDidChange(std::function<void (const float)> && onTypeDidChange)238     void UpdateOnTypeDidChange(std::function<void(const float)>&& onTypeDidChange)
239     {
240         onTypeDidChange_ = std::move(onTypeDidChange);
241     }
242 
onTypeDidChange(float currentType)243     void onTypeDidChange(float currentType) const
244     {
245         if (onTypeDidChange_) {
246             onTypeDidChange_(currentType);
247         }
248     }
249 
250     void FireOnTypeDidChange();
251 
UpdateOnWillDismiss(std::function<void (const int32_t)> && onWillDismiss)252     void UpdateOnWillDismiss(std::function<void(const int32_t)>&& onWillDismiss)
253     {
254         onWillDismiss_ = std::move(onWillDismiss);
255     }
256 
HasOnWillDismiss()257     bool HasOnWillDismiss() const
258     {
259         if (onWillDismiss_) {
260             return true;
261         }
262         return false;
263     }
264 
CallOnWillDismiss(const int32_t reason)265     void CallOnWillDismiss(const int32_t reason)
266     {
267         if (onWillDismiss_) {
268             onWillDismiss_(reason);
269         }
270     }
271 
UpdateSheetSpringBack(std::function<void ()> && sheetSpringBack)272     void UpdateSheetSpringBack(std::function<void()>&& sheetSpringBack)
273     {
274         sheetSpringBack_ = std::move(sheetSpringBack);
275     }
276 
HasSheetSpringBack()277     bool HasSheetSpringBack() const
278     {
279         if (sheetSpringBack_) {
280             return true;
281         }
282         return false;
283     }
284 
CallSheetSpringBack()285     void CallSheetSpringBack()
286     {
287         if (sheetSpringBack_) {
288             sheetSpringBack_();
289         }
290     }
291 
292     void OverlaySheetSpringBack();
293     void OverlayDismissSheet();
DismissSheet()294     void DismissSheet()
295     {
296         DismissTransition(false);
297     }
298 
SheetSpringBack()299     void SheetSpringBack()
300     {
301         isDismissProcess_ = false;
302         SheetTransition(true);
303     }
304 
305     void InitialLayoutProps();
306     void UpdateDragBarStatus();
307     bool IsSingleDetents(const NG::SheetStyle& sheetStyle);
308     bool IsScrollable() const;
309     void AvoidAiBar();
310 
311     void BeforeCreateLayoutWrapper() override;
312     void AvoidSafeArea(bool forceAvoid = false);
313     void AvoidKeyboard(bool forceAvoid);
314     void CheckBuilderChange();
315     float GetSheetHeightChange();
316     void ScrollTo(float height);
317     bool AdditionalScrollTo(const RefPtr<FrameNode>& scroll, float height);
318     void SetColumnMinSize(bool reset = false);
319     float InitialSingleGearHeight(NG::SheetStyle& sheetStyle);
320     float GetSheetTopSafeArea();
321     float UpdateSheetTransitionOffset();
322 
323     // initial drag gesture event
324     void InitPanEvent();
325     void RemovePanEvent();
326     void InitOnkeyEvent(const RefPtr<FocusHub>& focusHub);
327     void HandleFocusEvent();
328     void HandleBlurEvent();
329 
330     void HandleDragStart();
331 
332     void HandleDragUpdate(const GestureEvent& info);
333 
334     void HandleDragEnd(float dragVelocity);
335 
336     void InitHorizontalPanEvent();
337 
338     void OnCoordScrollStart();
339 
340     bool OnCoordScrollUpdate(float scrollOffset);
341 
342     void OnCoordScrollEnd(float dragVelocity);
343 
344     void SheetTransition(bool isTransitionIn, float dragVelocity = 0.0f);
345 
346     void SideSheetTransition(bool isTransitionIn);
347 
348     void ModifyFireSheetTransition(float dragVelocity = 0.0f);
349 
350     void SheetInteractiveDismiss(BindSheetDismissReason dismissReason, float dragVelocity = 0.0f);
351 
352     void SetSheetBorderWidth(bool isPartialUpdate = false);
353 
SetCurrentOffset(float currentOffset)354     void SetCurrentOffset(float currentOffset)
355     {
356         currentOffset_ = currentOffset;
357     }
358 
GetCurrentOffset()359     float GetCurrentOffset()
360     {
361         return currentOffset_;
362     }
363 
SetCurrentHeight(float currentHeight)364     void SetCurrentHeight(float currentHeight)
365     {
366         if (height_ != currentHeight || typeChanged_) {
367             height_ = currentHeight;
368             ChangeScrollHeight(height_);
369         }
370     }
371 
372     bool GetWindowButtonRect(NG::RectF& floatButtons);
373     bool GetWindowButtonRectForAllAPI(NG::RectF& floatButtons);
374 
SetBottomOffset(const SheetStyle & sheetStyle)375     void SetBottomOffset(const SheetStyle &sheetStyle)
376     {
377         DeviceType deviceType = SystemProperties::GetDeviceType();
378         if (deviceType != DeviceType::TWO_IN_ONE) {
379             TAG_LOGI(AceLogTag::ACE_SHEET, "Bottom offset invalid");
380             return;
381         }
382         if (sheetStyle.bottomOffset.has_value() &&
383             sheetStyle.sheetType.value_or(SheetType::SHEET_BOTTOM) == SheetType::SHEET_BOTTOM) {
384             bottomOffsetX_ = sheetStyle.bottomOffset->GetX();
385             bottomOffsetY_ = sheetStyle.bottomOffset->GetY();
386         } else {
387             bottomOffsetX_ = 0;
388             bottomOffsetY_ = 0;
389         }
390     }
391 
SetCurrentHeightToOverlay(float height)392     void SetCurrentHeightToOverlay(float height)
393     {
394         auto overlayManager = GetOverlayManager();
395         CHECK_NULL_VOID(overlayManager);
396         overlayManager->SetSheetHeight(height);
397     }
398 
399     void ChangeScrollHeight(float height);
400 
GetFocusPattern()401     FocusPattern GetFocusPattern() const override
402     {
403         return { FocusType::SCOPE, true };
404     }
405 
GetRouteOfFirstScope()406     std::list<int32_t> GetRouteOfFirstScope() override
407     {
408         return { 1, 0 };
409     }
410 
IsExecuteOnDisappear()411     bool IsExecuteOnDisappear() const
412     {
413         return isExecuteOnDisappear_;
414     }
415 
AvoidKeyboard()416     bool AvoidKeyboard() const override
417     {
418         return false;
419     }
420 
421     bool IsWindowSizeChangedWithUndefinedReason(int32_t width, int32_t height, WindowSizeChangeReason type);
422 
423     void OnWindowSizeChanged(int32_t width, int32_t height, WindowSizeChangeReason type) override;
424 
HasTitleNode()425     bool HasTitleNode() const
426     {
427         return titleId_.has_value();
428     }
429 
SetTitleId(const int32_t id)430     bool SetTitleId(const int32_t id)
431     {
432         if (HasTitleNode()) {
433             return false;
434         }
435         titleId_ = id;
436         return true;
437     }
438 
GetTitleId()439     int32_t GetTitleId()
440     {
441         if (!titleId_.has_value()) {
442             titleId_ = ElementRegister::GetInstance()->MakeUniqueId();
443         }
444         return titleId_.value();
445     }
446 
HasSubtitleNode()447     bool HasSubtitleNode() const
448     {
449         return titleId_.has_value();
450     }
451 
SetSubtitleId(const int32_t id)452     bool SetSubtitleId(const int32_t id)
453     {
454         if (HasSubtitleNode()) {
455             return false;
456         }
457         subtitleId_ = id;
458         return true;
459     }
460 
GetSubtitleId()461     int32_t GetSubtitleId()
462     {
463         if (!subtitleId_.has_value()) {
464             subtitleId_ = ElementRegister::GetInstance()->MakeUniqueId();
465         }
466         return subtitleId_.value();
467     }
468 
CalculateFriction(float gamma,float ratio)469     static float CalculateFriction(float gamma, float ratio)
470     {
471         if (GreatOrEqual(gamma, 1.0)) {
472             gamma = 1.0f;
473         }
474         return exp(-ratio * gamma);
475     }
476 
477     SheetType GetSheetType() const;
478     bool IsPhoneInLandScape();
479     bool IsShowCloseIcon();
480     void InitSheetMode();
481     void GetSheetTypeWithAuto(SheetType& sheetType) const;
482     void GetSheetTypeWithPopup(SheetType& sheetType) const;
483     void GetSheetTypeWithCenter(SheetType& sheetType) const;
484 
485     void SetUIFirstSwitch(bool isFirstTransition, bool isNone);
486 
487     void BubbleStyleSheetTransition(bool isTransitionIn);
488 
489     void StartOffsetEnteringAnimation();
490 
491     void StartAlphaEnteringAnimation(std::function<void()> finish);
492 
493     void StartOffsetExitingAnimation();
494 
495     void StartAlphaExitingAnimation(std::function<void()> finish);
496 
497     void ResetToInvisible();
498 
499     bool IsFoldExpand() const;
500 
SetSheetKey(const SheetKey & sheetKey)501     void SetSheetKey(const SheetKey& sheetKey)
502     {
503         sheetKey_ = sheetKey;
504     }
505 
GetSheetKey()506     SheetKey GetSheetKey() const
507     {
508         return sheetKey_;
509     }
510 
GetAnimationBreak()511     bool GetAnimationBreak() const
512     {
513         return isAnimationBreak_;
514     }
515 
SetAnimationBreak(bool value)516     void SetAnimationBreak(bool value)
517     {
518         isAnimationBreak_ = value;
519     }
520 
SetAnimationProcess(bool isProcess)521     void SetAnimationProcess(bool isProcess)
522     {
523         isAnimationProcess_ = isProcess;
524     }
525 
526     // Indicates whether the entrance or exit animation is currently in progress.
527     // It will only be false after the entrance or exit animation ends.
528     // But when true, it cannot distinguish whether it is the entrance or exit animation.
GetAnimationProcess()529     bool GetAnimationProcess()
530     {
531         return isAnimationProcess_;
532     }
533 
SetDismissProcess(bool isProcess)534     void SetDismissProcess(bool isProcess)
535     {
536         isDismissProcess_ = isProcess;
537     }
538 
GetDismissProcess()539     bool GetDismissProcess()
540     {
541         return isDismissProcess_;
542     }
543 
GetSheetTopSafeAreaNoProcess()544     float GetSheetTopSafeAreaNoProcess() const
545     {
546         return sheetTopSafeArea_;
547     }
548 
GetPageHeightWithoutOffset()549     float GetPageHeightWithoutOffset() const
550     {
551         return pageHeight_;
552     }
553 
SetPageHeight(float height)554     void SetPageHeight(float height)
555     {
556         pageHeight_ = height;
557     }
558 
SetCenterHeight(float height)559     void SetCenterHeight(float height)
560     {
561         centerHeight_ = height;
562     }
563 
GetCenterHeight()564     float GetCenterHeight() const
565     {
566         return centerHeight_;
567     }
568 
GetSheetOffsetX()569     float GetSheetOffsetX() const
570     {
571         return sheetOffsetX_;
572     }
573 
GetSheetOffsetY()574     float GetSheetOffsetY() const
575     {
576         return sheetOffsetY_;
577     }
578 
SetSheetOffsetX(float offsetX)579     void SetSheetOffsetX(float offsetX)
580     {
581         sheetOffsetX_ = offsetX;
582     }
583 
SetSheetOffsetY(float offsetY)584     void SetSheetOffsetY(float offsetY)
585     {
586         sheetOffsetY_ = offsetY;
587     }
588 
IsWindowRotate()589     bool IsWindowRotate() const
590     {
591         return windowRotate_;
592     }
593 
SetWindowRotate(bool windowRotate)594     void SetWindowRotate(bool windowRotate)
595     {
596         windowRotate_ = windowRotate;
597     }
598 
SetWindowChanged(bool change)599     void SetWindowChanged(bool change)
600     {
601         windowChanged_ = change;
602     }
603 
GetHeight()604     float GetHeight() const
605     {
606         return height_;
607     }
608 
SetSheetHeightUp(float value)609     void SetSheetHeightUp(float value)
610     {
611         sheetHeightUp_ = value;
612     }
613 
GetSheetHeightUp()614     float GetSheetHeightUp() const
615     {
616         return sheetHeightUp_;
617     }
618 
GetIsScrolling()619     bool GetIsScrolling() const
620     {
621        return isScrolling_;
622     }
623 
SetIsScrolling(bool value)624     void SetIsScrolling(bool value)
625     {
626        isScrolling_ = value;
627     }
628 
GetKeyboardAvoidMode()629     SheetKeyboardAvoidMode GetKeyboardAvoidMode() const
630     {
631         return keyboardAvoidMode_;
632     }
633 
GetScrollHeightNoProcess()634     float GetScrollHeightNoProcess() const
635     {
636        return scrollHeight_;
637     }
638 
GetAnimation()639     std::shared_ptr<AnimationUtils::Animation> GetAnimation()
640     {
641         return animation_;
642     }
643 
SetAnimation(const std::shared_ptr<AnimationUtils::Animation> & ptr)644     void SetAnimation(const std::shared_ptr<AnimationUtils::Animation>& ptr)
645     {
646         animation_ = ptr;
647     }
648 
GetIsDirectionUp()649     bool GetIsDirectionUp() const
650     {
651         return isDirectionUp_;
652     }
653 
SetIsDirectionUp(bool value)654     void SetIsDirectionUp(bool value)
655     {
656         isDirectionUp_ = value;
657     }
658 
GetSheetDetentHeight()659     std::vector<float>& GetSheetDetentHeight()
660     {
661         return sheetDetentHeight_;
662     }
663 
GetScrollSizeMode()664     ScrollSizeMode GetScrollSizeMode()
665     {
666         return scrollSizeMode_;
667     }
668 
SetScrollSizeMode(ScrollSizeMode mode)669     void SetScrollSizeMode(ScrollSizeMode mode)
670     {
671         scrollSizeMode_ = mode;
672     }
673 
SetIsNeedProcessHeight(bool value)674     void SetIsNeedProcessHeight(bool value)
675     {
676         isNeedProcessHeight_ = value;
677     }
678 
SetStartProp(double value)679     void SetStartProp(double value)
680     {
681         start_ = value;
682     }
683 
GetStartProp()684     double GetStartProp() const
685     {
686         return start_;
687     }
688 
SetDetentsIndex(uint32_t value)689     void SetDetentsIndex(uint32_t value)
690     {
691         detentsIndex_ = value;
692     }
693 
GetDetentsIndex()694     uint32_t GetDetentsIndex() const
695     {
696         return detentsIndex_;
697     }
698 
GetUnSortedSheetDentents()699     std::vector<float>& GetUnSortedSheetDentents()
700     {
701         return unSortedSheetDentents_;
702     }
703 
GetProperty()704     RefPtr<NodeAnimatablePropertyFloat> GetProperty()
705     {
706         return property_;
707     }
708 
SetProperty(const RefPtr<NodeAnimatablePropertyFloat> & property)709     void SetProperty(const RefPtr<NodeAnimatablePropertyFloat>& property)
710     {
711         property_ = property;
712     }
713 
GetPreDidHeight()714     float GetPreDidHeight() const
715     {
716         return preDidHeight_;
717     }
718 
SetPreDidHeight(float height)719     void SetPreDidHeight(float height)
720     {
721         preDidHeight_ = height;
722     }
723 
GetPageHeight()724     float GetPageHeight()
725     {
726         // OnTransformTranslateUpdate's offset is the relative to the upper left corner of the father
727         // Therefore, if the father is a PageNode, need to obtain the offsetY of the Page relative to the window
728         // On the basis of the normally calculated offset, move parentOffsetY up,
729         // It can be considered as the offset relative to the window
730         auto parentOffsetY = GetRootOffsetYToWindow();
731         return pageHeight_ - parentOffsetY;
732     }
733 
GetSheetMaxHeight()734     float GetSheetMaxHeight()
735     {
736         // pageHeight - sheetTopSafeArea
737         return sheetMaxHeight_;
738     }
739 
SetSheetMaxHeight(float height)740     void SetSheetMaxHeight(float height)
741     {
742         sheetMaxHeight_ = height;
743     }
744 
SetSheetMaxWidth(float width)745     void SetSheetMaxWidth(float width)
746     {
747         sheetMaxWidth_ = width;
748     }
749 
GetSheetOffset()750     float GetSheetOffset()
751     {
752         return sheetOffsetY_;
753     }
754 
755     bool IsShowInSubWindowTwoInOne();
756     bool IsShowInSubWindow() const;
757     SheetType ComputeSheetTypeInSubWindow() const;
758     void SheetTransitionAction(float offset, bool isFirstTransition, bool isTransitionIn);
759     float ComputeTransitionOffset(float sheetHeight);
760     void InitSheetTransitionAction(float offset);
761     int32_t GetSubWindowId() const;
762 
GetSheetArrowOffset()763     OffsetF GetSheetArrowOffset() const
764     {
765         return arrowOffset_;
766     }
767 
SetSheetArrowOffset(const OffsetF & offsetF)768     void SetSheetArrowOffset(const OffsetF& offsetF)
769     {
770         arrowOffset_ = offsetF;
771     }
772 
773     float GetFitContentHeight();
774 
775     void UpdateTitleColumnSize();
776 
777     float GetTitleBuilderHeight() const;
778 
779     static Dimension GetDragBarHeight(const RefPtr<FrameNode>& dragBarNode = nullptr);
780 
WillSpringBack()781     bool WillSpringBack() const
782     {
783         return isSpringBack_;
784     }
785 
SetSpringBack(bool value)786     void SetSpringBack(bool value)
787     {
788         isSpringBack_ = value;
789     }
790 
SetShowState(bool show)791     void SetShowState(bool show)
792     {
793         show_ = show;
794     }
795 
GetShowState()796     bool GetShowState() const
797     {
798         return show_;
799     }
800 
SetIsDragging(bool isDrag)801     void SetIsDragging(bool isDrag)
802     {
803         isDrag_ = isDrag;
804     }
805 
IsDragging()806     bool IsDragging() const
807     {
808         return isDrag_;
809     }
810 
811     void UpdateMaskBackgroundColor();
812 
813     void UpdateMaskBackgroundColorRender();
814 
815     void UpdateTitleTextColor();
816     void UpdateSheetCloseIcon();
817     void UpdateSheetBackgroundColor();
818 
GetMaskBackgroundColor()819     Color GetMaskBackgroundColor() const
820     {
821         return sheetMaskColor_;
822     }
823 
InitFoldState()824     void InitFoldState()
825     {
826         auto container = Container::Current();
827         CHECK_NULL_VOID(container);
828         container->InitIsFoldable();
829         if (container->IsFoldable()) {
830             currentFoldStatus_ = container->GetCurrentFoldStatus();
831         }
832     }
833 
IsFoldStatusChanged()834     bool IsFoldStatusChanged()
835     {
836         auto container = Container::Current();
837         CHECK_NULL_RETURN(container, false);
838         if (!container->IsFoldable()) {
839             return false;
840         }
841         auto foldStatus = container->GetCurrentFoldStatus();
842         TAG_LOGI(AceLogTag::ACE_SHEET, "newFoldStatus: %{public}d, currentFoldStatus: %{public}d.",
843             static_cast<int32_t>(foldStatus), static_cast<int32_t>(currentFoldStatus_));
844         if (foldStatus != currentFoldStatus_) {
845             currentFoldStatus_ = foldStatus;
846             return true;
847         }
848         return false;
849     }
850 
UpdateHoverModeChangedCallbackId(const std::optional<int32_t> & id)851     void UpdateHoverModeChangedCallbackId(const std::optional<int32_t>& id)
852     {
853         hoverModeChangedCallbackId_ = id;
854     }
855 
HasHoverModeChangedCallbackId()856     bool HasHoverModeChangedCallbackId()
857     {
858         return hoverModeChangedCallbackId_.has_value();
859     }
860 
861     // Get ScrollHeight before avoid keyboard
GetScrollHeight()862     float GetScrollHeight() const
863     {
864         auto titleHeight = GetTitleBuilderHeight();
865         if (sheetType_ == SheetType::SHEET_CENTER) {
866             return centerHeight_ - titleHeight;
867         }
868         return height_ - titleHeight;
869     }
870 
871     RefPtr<OverlayManager> GetOverlayManager();
872     RefPtr<FrameNode> GetOverlayRoot();
873     float GetRootOffsetYToWindow();
874 
IsAvoidingKeyboard()875     bool IsAvoidingKeyboard() const
876     {
877         return Positive(keyboardHeight_);
878     }
879 
SetKeyboardHeight(uint32_t height)880     void SetKeyboardHeight(uint32_t height)
881     {
882         keyboardHeight_ = height;
883     }
884 
GetKeyboardHeight()885     uint32_t GetKeyboardHeight()
886     {
887         return keyboardHeight_;
888     }
889 
GetSheetTypeNoProcess()890     SheetType GetSheetTypeNoProcess()
891     {
892         return sheetType_;
893     }
894 
895     bool IsTypeNeedAvoidAiBar();
896     void IsNeedPlayTransition(const SheetStyle& sheetStyle);
897 
898     RefPtr<FrameNode> GetFirstFrameNodeOfBuilder() const;
899     void GetBuilderInitHeight();
900     void ChangeSheetPage(float height);
901     void DumpAdvanceInfo() override;
902     void DumpAdvanceInfo(std::unique_ptr<JsonValue>& json) override;
903 
GetDetentsFinalIndex()904     uint32_t GetDetentsFinalIndex() const
905     {
906         return detentsFinalIndex_;
907     }
908 
SetDetentsFinalIndex(uint32_t index)909     void SetDetentsFinalIndex(uint32_t index)
910     {
911         detentsFinalIndex_ = index;
912     }
913 
914     bool IsScrollOutOfBoundary();
915 
916     void UpdateSheetType();
917 
918     // Used for isolation of SHEET_BOTTOMLANDSPACE after version 12, such as support for height setting callback,
919     // support for detents setting and callback for SHEET_BOTTOMLANDSPACE
IsSheetBottomStyle()920     bool IsSheetBottomStyle()
921     {
922         // sheetType_ is invalid before onModifyDone
923         if (AceApplicationInfo::GetInstance().GreatOrEqualTargetAPIVersion(PlatformVersion::VERSION_TWELVE)) {
924             return sheetType_ == SheetType::SHEET_BOTTOM || sheetType_ == SheetType::SHEET_BOTTOM_FREE_WINDOW ||
925                    sheetType_ == SheetType::SHEET_BOTTOMLANDSPACE;
926         }
927         return sheetType_ == SheetType::SHEET_BOTTOM || sheetType_ == SheetType::SHEET_BOTTOM_FREE_WINDOW;
928     }
929 
930     // If has dispute about version isolation, suggest use the following. And it does not support SHEET_BOTTOM_OFFSET
IsSheetBottom()931     bool IsSheetBottom() const
932     {
933         auto sheetType = sheetType_;
934         return !(sheetType == SheetType::SHEET_CENTER || sheetType == SheetType::SHEET_POPUP ||
935                  sheetType == SheetType::SHEET_BOTTOM_OFFSET);
936     }
937 
938     // Nestable Scroll
GetAxis()939     Axis GetAxis() const override
940     {
941         return Axis::VERTICAL;
942     }
943     ScrollResult HandleScroll(float scrollOffset, int32_t source,
944         NestedState state = NestedState::GESTURE, float velocity = 0.f) override;
945     void OnScrollStartRecursive(
946         WeakPtr<NestableScrollContainer> child, float position, float dragVelocity = 0.0f) override;
947     void OnScrollEndRecursive (const std::optional<float>& velocity) override;
948     bool HandleScrollVelocity(float velocity, const RefPtr<NestableScrollContainer>& child = nullptr) override;
949     ScrollResult HandleScrollWithSheet(float scrollOffset);
950     Shadow GetShadowFromTheme(ShadowStyle shadowStyle);
951     void SetShadowStyle(bool isFocused);
952     bool IsCurSheetNeedHalfFoldHover();
953     bool IsWaterfallWindowMode();
954     float GetMaxSheetHeightBeforeDragUpdate();
955     float GetSheetHeightBeforeDragUpdate();
956     void FireHoverModeChangeCallback();
957     void InitFoldCreaseRegion();
958     Rect GetFoldScreenRect() const;
959     void RecoverHalfFoldOrAvoidStatus();
960     bool UpdateAccessibilityDetents(float height);
961     void CalculateSheetRadius(BorderRadiusProperty& sheetRadius);
962     void InitSheetObject();
963     void UpdateSheetObject(SheetType newType);
964     void ResetLayoutInfo();
965     void ResetScrollUserDefinedIdealSize(const RefPtr<SheetObject>& oldObject, const RefPtr<SheetObject>& newObject);
UpdateSheetPopupInfo(const SheetPopupInfo & sheetPopupInfo)966     void UpdateSheetPopupInfo(const SheetPopupInfo& sheetPopupInfo)
967     {
968         if (!NearEqual(sheetPopupInfo_.sheetOffsetY, sheetPopupInfo.sheetOffsetY)) {
969             sheetOffsetYChanged_ = true;
970         }
971         sheetPopupInfo_ = sheetPopupInfo;
972     }
973 
GetSheetPopupInfo()974     SheetPopupInfo GetSheetPopupInfo() const
975     {
976         return sheetPopupInfo_;
977     }
978 
979     bool UpdateIndexByDetentSelection(const SheetStyle& sheetStyle, bool isFirstTransition);
980 
GetIsPlayTransition()981     bool GetIsPlayTransition() const
982     {
983         return isPlayTransition_;
984     }
985     void OnFontScaleConfigurationUpdate() override;
986 
987     void FireCommonCallback();
988 
SetCloseButtonNode(const WeakPtr<FrameNode> & node)989     void SetCloseButtonNode(const WeakPtr<FrameNode>& node) {
990         closeButtonNode_ = node;
991     }
992 
SetDragBarNode(const WeakPtr<FrameNode> & node)993     void SetDragBarNode(const WeakPtr<FrameNode>& node)
994     {
995         dragBarNode_ = node;
996     }
997 
SetScrollNode(const WeakPtr<FrameNode> & node)998     void SetScrollNode(const WeakPtr<FrameNode>& node) {
999         scrolNode_ = node;
1000     }
1001 
SetTitleBuilderNode(const WeakPtr<FrameNode> & node)1002     void SetTitleBuilderNode(const WeakPtr<FrameNode>& node) {
1003         titleBuilderNode_ = node;
1004     }
1005 
GetDragBarNode()1006     RefPtr<FrameNode> GetDragBarNode() const
1007     {
1008         return dragBarNode_.Upgrade();
1009     }
1010 
GetSheetCloseIcon()1011     RefPtr<FrameNode> GetSheetCloseIcon() const
1012     {
1013         auto closeButtonNode = closeButtonNode_.Upgrade();
1014         return closeButtonNode;
1015     }
1016 
GetTitleBuilderNode()1017     RefPtr<FrameNode> GetTitleBuilderNode() const
1018     {
1019         auto titleBuilderNode = titleBuilderNode_.Upgrade();
1020         return titleBuilderNode;
1021     }
1022 
GetSheetScrollNode()1023     RefPtr<FrameNode> GetSheetScrollNode() const
1024     {
1025         auto scrollNode = scrolNode_.Upgrade();
1026         return scrollNode;
1027     }
1028 
GetSheetEffectEdge()1029     const SheetEffectEdge& GetSheetEffectEdge() const
1030     {
1031         return sheetEffectEdge_;
1032     }
1033 
1034     void SetBottomStyleHotAreaInSubwindow();
1035 
IsNotBottomStyleInSubwindow()1036     bool IsNotBottomStyleInSubwindow() const
1037     {
1038         return IsShowInSubWindow() && !IsSheetBottom();
1039     }
1040     void SetWindowUseImplicitAnimation(FrameNode* sheetNode, bool useImplicit);
1041     void SendMessagesBeforeFirstTransitionIn(bool isFirstTransition);
1042     void SendMessagesAfterFirstTransitionIn(bool isFirstTransition);
1043     void SendMessagesBeforeTransitionOut();
1044     void SendMessagesAfterTransitionOut(FrameNode* sheetNode);
1045 
GetSheetObject()1046     RefPtr<SheetObject> GetSheetObject() const
1047     {
1048         return sheetObject_;
1049     }
1050 
SetSheetObject(const RefPtr<SheetObject> & sheetObject)1051     void SetSheetObject(const RefPtr<SheetObject>& sheetObject)
1052     {
1053         sheetObject_ = sheetObject;
1054     }
1055 
GetRadio()1056     float GetRadio() const
1057     {
1058         return sheetType_ == SheetType::SHEET_BOTTOM_OFFSET ? 5.0f : 1.848f;
1059     }
1060 
GetWindowSize()1061     std::optional<SizeT<int32_t>> GetWindowSize()
1062     {
1063         return windowSize_;
1064     }
1065 
1066     void TranslateTo(float height);
1067     void GetArrowOffsetByPlacement(const RefPtr<SheetPresentationLayoutAlgorithm>& layoutAlgorithm);
1068     void DismissSheetShadow(const RefPtr<RenderContext>& context);
1069     void ResetClipShape();
1070     std::string GetPopupStyleSheetClipPath(const SizeF& sheetSize, const BorderRadiusProperty& sheetRadius);
1071     void SheetTransitionForOverlay(bool isTransitionIn, bool isFirstTransition);
1072     void OnLanguageConfigurationUpdate() override;
1073     bool AvoidKeyboardBeforeTranslate();
1074     void AvoidKeyboardAfterTranslate(float height);
1075     void HandleFitContontChange(float height);
1076     void GetCurrentScrollHeight();
1077     void RecoverScrollOrResizeAvoidStatus();
1078     bool IsNeedChangeScrollHeight(float height);
1079     bool IsResizeWhenAvoidKeyboard();
1080     uint32_t GetCurrentBroadcastDetentsIndex();
1081     void HandleFollowAccessibilityEvent(float currHeight);
1082     void ComputeDetentsPos(float currentSheetHeight, float& upHeight, float& downHeight, uint32_t& detentsLowerPos,
1083         uint32_t& detentsUpperPos);
1084     void ChangeSheetHeight(float height);
1085     void CreatePropertyCallback();
1086     void HandleDragEndAccessibilityEvent();
1087     void DismissTransition(bool isTransitionIn, float dragVelocity = 0.0f);
1088 
1089     // Create Dark Light Resource Method.
1090     void UpdateSheetParamResource(const RefPtr<FrameNode>& sheetNode, NG::SheetStyle& sheetStyle);
1091     void RegisterWidthRes(const RefPtr<FrameNode>& sheetNode, RefPtr<ResourceObject>& resObj);
1092     void RegisterHeightRes(const RefPtr<FrameNode>& sheetNode, RefPtr<ResourceObject>& sheetHeightResObj);
1093     void UpdateSheetDetents(const RefPtr<ResourceObject>& resObj,
1094         const WeakPtr<FrameNode>& sheetNodeWK, const WeakPtr<OverlayManager>& overlayWk);
1095     void RegisterDetentsRes(const RefPtr<FrameNode>& sheetNode,
1096         std::vector<RefPtr<ResourceObject>>& sheetHeightResObj);
1097     void RegisterBgColorRes(const RefPtr<FrameNode>& sheetNode, RefPtr<ResourceObject>& colorResObj);
1098     void UpdateBgColor(const RefPtr<ResourceObject>& resObj, const WeakPtr<FrameNode>& sheetNodeWK);
1099     void RegisterTitleRes(const RefPtr<FrameNode>& sheetNode, RefPtr<ResourceObject>& mainTitleResObj);
1100     void RegisterDetentSelectionRes(const RefPtr<FrameNode>& sheetNode, RefPtr<ResourceObject>& resObj);
1101     void RegisterShowCloseRes(const RefPtr<FrameNode>& sheetNode, RefPtr<ResourceObject>& resObj);
1102     void RegisterRadiusRes(const RefPtr<FrameNode>& sheetNode);
1103     void RegisterShadowRes(const RefPtr<FrameNode>& sheetNode);
1104     void UpdateBorderWidth(const RefPtr<FrameNode>& sheetNodeWK);
1105     void UpdateBorderColor(const RefPtr<FrameNode>& sheetNodeWK);
1106     void RegisterBorderWidthOrColorRes(const RefPtr<FrameNode>& sheetNode);
1107     void HandleMultiDetentKeyboardAvoid();
1108 
1109 protected:
1110     void OnDetachFromFrameNode(FrameNode* sheetNode) override;
1111 
1112 private:
1113     void OnModifyDone() override;
1114     void OnAttachToFrameNode() override;
1115     void OnColorConfigurationUpdate() override;
1116     bool OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) override;
1117     void OnAvoidInfoChange(const ContainerModalAvoidInfo& info) override;
1118     void RegisterAvoidInfoChangeListener(const RefPtr<FrameNode>& hostNode);
1119     void UnRegisterAvoidInfoChangeListener(FrameNode* hostNode);
1120 
1121     void RegisterHoverModeChangeCallback();
1122     void InitPageHeight();
1123     void UpdateCloseIconStatus();
1124     void UpdateTitlePadding();
1125     RefPtr<FrameNode> GetTitleNode();
1126     float GetCloseIconPosX(const SizeF& sheetSize, const RefPtr<SheetTheme>& sheetTheme);
1127     void UpdateSheetTitle();
1128     void UpdateFontScaleStatus();
1129 
1130     bool PostTask(const TaskExecutor::Task& task, const std::string& name);
1131     void CheckSheetHeightChange();
1132     float GetWrapperHeight();
1133     float GetWrapperWidth();
1134     bool SheetHeightNeedChanged();
1135     bool SheetWidthNeedChanged();
1136     void PopupSheetChanged();
1137     void InitSheetDetents();
1138     void InitDetents(SheetStyle sheetStyle, float height, double mediumSize, float largeHeightOfTheme,
1139         double largeHeight);
1140     void StartSheetTransitionAnimation(const AnimationOption& option, bool isTransitionIn, float offset);
1141     void ClipSheetNode();
1142     void IsCustomDetentsChanged(SheetStyle sheetStyle);
1143     void CalculateAloneSheetRadius(
1144         std::optional<Dimension>& sheetRadius, const std::optional<Dimension>& sheetStyleRadius);
1145     std::string GetPopupStyleSheetClipPathNew(const SizeF& sheetSize, const BorderRadiusProperty& sheetRadius);
1146     std::string GetCenterStyleSheetClipPath(SizeF sheetSize, Dimension sheetRadius);
1147     std::string GetBottomStyleSheetClipPath(SizeF sheetSize, Dimension sheetRadius);
1148     std::string MoveTo(double x, double y);
1149     std::string LineTo(double x, double y);
1150     std::string ArcTo(double rx, double ry, double rotation, int32_t arc_flag, double x, double y);
1151     float GetTopAreaInWindow() const;
1152     void MarkSheetPageNeedRender();
1153     void SetSheetOuterBorderWidth(const RefPtr<SheetTheme>& sheetTheme, const NG::SheetStyle& sheetStyle);
1154     PipelineContext* GetSheetMainPipeline() const;
1155     float GetBottomSafeArea();
1156     void StopModifySheetTransition();
1157     void AvoidKeyboardBySheetMode(bool forceAvoid = false);
1158     void DecreaseScrollHeightInSheet(float decreaseHeight);
1159     void UpdateSheetWhenSheetTypeChanged();
1160     void RecoverAvoidKeyboardStatus();
1161 
1162     // broadcast
1163     void SendTextUpdateEvent();
1164     void SendSelectedEvent();
1165     void RegisterElementInfoCallBack();
1166 
1167     std::string DrawClipPathBottom(const SizeF&, const BorderRadiusProperty&);
1168     std::string DrawClipPathTop(const SizeF&, const BorderRadiusProperty&);
1169     std::string DrawClipPathLeft(const SizeF&, const BorderRadiusProperty&);
1170     std::string DrawClipPathRight(const SizeF&, const BorderRadiusProperty&);
1171 
1172     SheetType GetSheetTypeFromSheetManager() const;
1173 
1174     uint32_t broadcastPreDetentsIndex_ = 0;
1175     SheetAccessibilityDetents sheetDetents_ = SheetAccessibilityDetents::HIGH;
1176 
1177     uint32_t keyboardHeight_ = 0;
1178     int32_t targetId_ = -1;
1179     SheetKey sheetKey_;
1180     std::optional<int32_t> titleId_;
1181     std::optional<int32_t> subtitleId_;
1182     std::string targetTag_;
1183     std::function<void(const std::string&)> callback_;
1184     std::function<void()> onDisappear_;
1185     std::function<void()> onWillDisappear_;
1186     std::function<void()> shouldDismiss_;
1187     std::function<void(const int32_t info)> onWillDismiss_;
1188     std::function<void()> sheetSpringBack_;
1189     std::function<void(const float)> onHeightDidChange_;
1190     std::function<void(const float)> onDetentsDidChange_;
1191     std::function<void(const float)> onWidthDidChange_;
1192     std::function<void(const float)> onTypeDidChange_;
1193     std::function<void()> onAppear_;
1194     std::function<void()> onWillAppear_;
1195     RefPtr<PanEvent> panEvent_;
1196     OffsetF arrowOffset_;
1197     float currentOffset_ = 0.0f;
1198 
1199     float preDidHeight_ = 0.0f;
1200     float sheetHeightUp_ = 0.0f; // sheet offset to move up when avoiding keyboard
1201     float height_ = 0.0f; // sheet height, start from the bottom, before avoiding keyboard
1202     float sheetWidth_ = 0.0f; // sheet frameSize Width
1203     float wrapperHeight_ = 0.0f; // sheetWrapper frameSize Height
1204     float wrapperWidth_ = 0.0f; // sheetWrapper frameSize Width
1205     float pageHeight_ = 0.0f; // root Height, = maxSize.Height()
1206     float scrollHeight_ = 0.0f; // not scroll frameHeight, it is scroll Height after ScrollTo.
1207     float preWidth_ = 0.0f;
1208     int32_t preType_ = -1;
1209     float sheetTopSafeArea_ = .0f;
1210     bool isExecuteOnDisappear_ = false;
1211     bool windowRotate_ = false;
1212     bool isScrolling_ = false;
1213     float builderHeight_ = 0.0f;
1214     float sheetMaxHeight_ = 0.0f; // start from the bottom, pageHeight - sheetTopSafeArea
1215     float sheetMaxWidth_ = 0.0f;
1216     float centerHeight_ = 0.0f; // node height, not translate height
1217     float sheetFitContentHeight_ = 0.0f;
1218     float sheetOffsetX_ = 0.0f;
1219     float sheetOffsetY_ = 0.0f;
1220     float bottomOffsetX_ = 0.0f; // offset x with SHEET_BOTTOM_OFFSET
1221     float bottomOffsetY_ = 0.0f; // offset y with SHEET_BOTTOM_OFFSET, <= 0
1222     bool isFirstInit_ = true;
1223     bool isAnimationBreak_ = false;
1224     bool isAnimationProcess_ = false;
1225     bool isDismissProcess_ = false;
1226     SheetType sheetType_ = SheetType::SHEET_BOTTOM;
1227     bool windowChanged_ = false;
1228     bool isDirectionUp_ = true;
1229     bool topSafeAreaChanged_ = false;
1230     bool typeChanged_ = false;
1231     bool isOnAppearing_ = false;
1232     bool isOnDisappearing_ = false;
1233     ScrollSizeMode scrollSizeMode_ = ScrollSizeMode::FOLLOW_DETENT;
1234     SheetEffectEdge sheetEffectEdge_ = SheetEffectEdge::ALL;
1235 
1236     //record sheet sored detent index
1237     uint32_t detentsIndex_ = 0;
1238 
1239     //record sheet unsoreddetent index
1240     uint32_t detentsFinalIndex_ = 0;
1241     std::string sheetThemeType_ = "auto";
1242 
1243     WeakPtr<OverlayManager> overlayManager_ = nullptr;
1244 
1245     std::vector<SheetHeight> preDetents_;
1246     std::vector<float> sheetDetentHeight_;
1247     std::vector<float> unSortedSheetDentents_;
1248     std::vector<Rect> currentFoldCreaseRegion_;
1249 
1250     std::shared_ptr<AnimationUtils::Animation> animation_;
1251     std::optional<int32_t> foldDisplayModeChangedCallbackId_;
1252     std::optional<int32_t> hoverModeChangedCallbackId_;
1253 
1254     bool show_ = true;
1255     bool isDrag_ = false;
1256     FoldStatus currentFoldStatus_ = FoldStatus::UNKNOWN;
1257     bool isNeedProcessHeight_ = false;
1258     bool isSpringBack_ = false; // sheet rebound
1259 
1260     double start_ = 0.0; // start position of detents changed
1261     RefPtr<NodeAnimatablePropertyFloat> property_;
1262 
1263     ACE_DISALLOW_COPY_AND_MOVE(SheetPresentationPattern);
1264 
1265     float preDetentsHeight_ = 0.0f;
1266     std::optional<SizeT<int32_t>> windowSize_;
1267     float scale_ = 1.0;
1268 
1269     Color sheetMaskColor_ = Color::TRANSPARENT;
1270     SheetKeyboardAvoidMode keyboardAvoidMode_ = SheetKeyboardAvoidMode::TRANSLATE_AND_SCROLL;
1271     float resizeDecreasedHeight_ = 0.f;
1272     bool isPlayTransition_ = false;
1273     Placement finalPlacement_ = Placement::BOTTOM;
1274     bool showArrow_ = true;
1275     bool sheetOffsetYChanged_ = false;
1276     SheetArrowPosition arrowPosition_ = SheetArrowPosition::NONE;
1277     SheetPopupInfo sheetPopupInfo_;
1278     WeakPtr<FrameNode> closeButtonNode_;
1279     WeakPtr<FrameNode> scrolNode_;
1280     WeakPtr<FrameNode> titleBuilderNode_;
1281     RefPtr<SheetObject> sheetObject_;
1282     WeakPtr<FrameNode> dragBarNode_;
1283 };
1284 } // namespace OHOS::Ace::NG
1285 
1286 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_SHEET_PRESENTATION_PATTERN_H
1287