23 virtual void NativeConstruct()
override;
24 virtual void NativeDestruct()
override;
27 virtual FReply NativeOnMouseButtonDown(
const FGeometry& InGeometry,
const FPointerEvent& InMouseEvent)
override;
30 virtual FReply NativeOnMouseButtonUp(
const FGeometry& InGeometry,
const FPointerEvent& InMouseEvent)
override;
33 virtual FReply NativeOnMouseMove(
const FGeometry& InGeometry,
const FPointerEvent& InMouseEvent)
override;
39 UFUNCTION(BlueprintCallable, Category =
"PageScrollView")
40 void MovePage(int32 PageIndex,
bool bAnimate =
true);
44 UFUNCTION(BlueprintCallable, Category =
"PageScrollView")
45 void SetNumberOfPages(int32 ItemCount);
48 UFUNCTION(BlueprintCallable, Category =
"PageScrollView")
52 UFUNCTION(BlueprintCallable, Category =
"PageScrollView")
57 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"PageScrollView")
58 int32 GetCurrentPage()
const {
return CurPageIndex; }
62 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"PageScrollView")
63 int32 GetTotalPages()
const {
return pageItemList.Num(); }
68 UFUNCTION(BlueprintCallable, BlueprintPure, Category =
"PageScrollView")
71 return pageItemList.IsValidIndex(Index) ? pageItemList[Index] :
nullptr;
79 int32 CalculateTargetPage(FVector2D DragDelta,
float Velocity)
const;
82 void TickSnapAnimation();
90 FVector2D GetPagePosition(int32 PageIndex)
const;
96 return (ScrollDirection == EPageScrollDirection::Horizontal)
97 ? (PageSize.X + PageSpacing)
98 : (PageSize.Y + PageSpacing);
103 void SetContainerPosition(FVector2D Position);
106 void UpdatePageDotIndicator();
109 void UpdateItemScales();
112 void UpdateContainerPositionDuringDrag();
116 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category =
"PageScrollView|Layout")
120 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Layout")
121 FVector2D PageSize = FVector2D(1920.0f, 1080.0f);
124 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Layout")
125 float PageSpacing = 0.0f;
128 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Behavior")
129 float FastSwipeThreshold = 500.0f;
132 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Behavior")
133 float SnapAnimationSpeed = 0.3f;
136 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Behavior")
137 bool bEnableScaleEffect = false;
140 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Behavior", meta=(EditCondition="bEnableScaleEffect"))
141 float FocusScale = 1.0f;
144 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Behavior", meta=(EditCondition="bEnableScaleEffect"))
145 float SideScale = 0.8f;
148 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Data")
152 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "PageScrollView|Data")
153 int32 DefaultPageIndex = 0;
156 UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
157 TObjectPtr<class UCanvasPanel> PageContainer;
160 UPROPERTY(BlueprintReadOnly, meta = (BindWidgetOptional))
164 UPROPERTY(BlueprintAssignable, Category = "PageScrollView|Events")
165 FOnPageChanged OnPageChanged;
169 int32 CurPageIndex = 0;
172 int32 PrevPageIndex = 0;
179 bool bIsDragging = false;
180 FVector2D dragStartPosition = FVector2D::ZeroVector;
181 FVector2D dragCurrentPosition = FVector2D::ZeroVector;
182 float dragStartTime = 0.0f;
185 FTimerHandle snapAnimTimerHandle;
186 FVector2D animStartPosition = FVector2D::ZeroVector;
187 FVector2D animTargetPosition = FVector2D::ZeroVector;
188 float animElapsedTime = 0.0f;
189 bool bIsAnimating = false;
192 FVector2D ViewportSize = FVector2D::ZeroVector;