1 /* 2 * Copyright (c) 2022 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_PATTERN_LIST_LIST_LAYOUT_ALGORITHM_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_LIST_LIST_LAYOUT_ALGORITHM_H 18 19 #include <cstdint> 20 #include <map> 21 #include <optional> 22 23 #include "base/geometry/axis.h" 24 #include "base/memory/referenced.h" 25 #include "core/components_ng/layout/layout_algorithm.h" 26 #include "core/components_ng/layout/layout_wrapper.h" 27 #include "core/components_ng/pattern/list/list_layout_property.h" 28 #include "core/components_ng/pattern/list/list_position_map.h" 29 #include "core/components_v2/list/list_component.h" 30 #include "core/components_v2/list/list_properties.h" 31 32 namespace OHOS::Ace::NG { 33 class PipelineContext; 34 class ListPositionMap; 35 36 struct ListItemGroupLayoutInfo { 37 bool atStart = false; 38 bool atEnd = false; 39 float averageHeight = -1; 40 }; 41 42 struct ListItemInfo { 43 int32_t id; 44 float startPos; 45 float endPos; 46 bool isGroup; 47 bool isPressed = false; 48 std::optional<ListItemGroupLayoutInfo> groupInfo; 49 }; 50 51 struct ListPredictLayoutParam { 52 std::list<int32_t> items; 53 LayoutConstraintF layoutConstraint; 54 }; 55 56 struct PredictLayoutItem { 57 int32_t index; 58 bool forward; 59 int32_t cached; 60 }; 61 62 struct ListPredictLayoutParamV2 { 63 std::list<PredictLayoutItem> items; 64 LayoutConstraintF layoutConstraint; 65 LayoutConstraintF groupLayoutConstraint; 66 }; 67 68 enum class ScrollAutoType { 69 NOT_CHANGE = 0, 70 START, 71 END, 72 }; 73 74 enum class LayoutDirection { 75 NONE = 0, 76 FORWARD, 77 BACKWARD, 78 }; 79 80 // TextLayoutAlgorithm acts as the underlying text layout. 81 class ACE_EXPORT ListLayoutAlgorithm : public LayoutAlgorithm { 82 DECLARE_ACE_TYPE(ListLayoutAlgorithm, LayoutAlgorithm); 83 84 public: 85 using PositionMap = std::map<int32_t, ListItemInfo>; 86 static constexpr int32_t LAST_ITEM = -1; 87 88 ListLayoutAlgorithm() = default; 89 90 ~ListLayoutAlgorithm() override = default; 91 OnReset()92 void OnReset() override {} 93 GetItemPosition()94 const PositionMap& GetItemPosition() const 95 { 96 return itemPosition_; 97 } 98 SetItemsPosition(const PositionMap & itemPosition)99 void SetItemsPosition(const PositionMap& itemPosition) 100 { 101 itemPosition_ = itemPosition; 102 } 103 GetRecycledItemPosition()104 const PositionMap& GetRecycledItemPosition() const 105 { 106 return recycledItemPosition_; 107 } 108 109 void ClearAllItemPosition(LayoutWrapper* layoutWrapper); 110 SetOverScrollFeature()111 void SetOverScrollFeature() 112 { 113 overScrollFeature_ = true; 114 } 115 SetCanOverScroll(bool canOverScroll)116 void SetCanOverScroll(bool canOverScroll) 117 { 118 canOverScroll_ = canOverScroll; 119 } 120 SetIsSpringEffect(bool isSpringEffect)121 void SetIsSpringEffect(bool isSpringEffect) 122 { 123 isSpringEffect_ = isSpringEffect; 124 } 125 SetIndex(int32_t index)126 void SetIndex(int32_t index) 127 { 128 jumpIndex_ = index; 129 } 130 SetTargetIndex(int32_t index)131 void SetTargetIndex(int32_t index) 132 { 133 targetIndex_ = index; 134 } 135 SetTargetIndexInGroup(int32_t targetIndexInGroup)136 void SetTargetIndexInGroup(int32_t targetIndexInGroup) 137 { 138 targetIndexInGroup_ = targetIndexInGroup; 139 } 140 GetTargetIndex()141 std::optional<int32_t> GetTargetIndex() const 142 { 143 return targetIndexStaged_; 144 } 145 SetPredictSnapOffset(float predictSnapOffset)146 void SetPredictSnapOffset(float predictSnapOffset) 147 { 148 predictSnapOffset_ = predictSnapOffset; 149 } 150 GetPredictSnapOffset()151 std::optional<float> GetPredictSnapOffset() const 152 { 153 return predictSnapOffset_; 154 } 155 SetPredictSnapEndPosition(float predictSnapEndPos)156 void SetPredictSnapEndPosition(float predictSnapEndPos) 157 { 158 predictSnapEndPos_ = predictSnapEndPos; 159 } 160 GetPredictSnapEndPosition()161 std::optional<float> GetPredictSnapEndPosition() 162 { 163 return predictSnapEndPos_; 164 } 165 SetScrollSnapVelocity(float velocity)166 void SetScrollSnapVelocity(float velocity) 167 { 168 scrollSnapVelocity_ = velocity; 169 } 170 SetIndexInGroup(int32_t index)171 void SetIndexInGroup(int32_t index) 172 { 173 jumpIndexInGroup_ = index; 174 } 175 SetIndexAlignment(ScrollAlign align)176 void SetIndexAlignment(ScrollAlign align) 177 { 178 scrollAlign_ = align; 179 } 180 SetCurrentDelta(float offset)181 void SetCurrentDelta(float offset) 182 { 183 currentDelta_ = offset; 184 currentOffset_ = offset; 185 } 186 GetCurrentOffset()187 float GetCurrentOffset() const 188 { 189 return currentOffset_ + adjustOffset_; 190 } 191 SetIsNeedCheckOffset(bool isNeedCheckOffset)192 void SetIsNeedCheckOffset(bool isNeedCheckOffset) 193 { 194 isNeedCheckOffset_ = isNeedCheckOffset; 195 } 196 SetTotalOffset(float totalOffset)197 void SetTotalOffset(float totalOffset) 198 { 199 totalOffset_ = totalOffset; 200 } 201 GetContentMainSize()202 float GetContentMainSize() const 203 { 204 return contentMainSize_; 205 } 206 SetPrevContentMainSize(float mainSize)207 void SetPrevContentMainSize(float mainSize) 208 { 209 prevContentMainSize_ = mainSize; 210 } 211 GetStartIndex()212 int32_t GetStartIndex() const 213 { 214 return itemPosition_.empty() ? -1 : itemPosition_.begin()->first; 215 } 216 GetEndIndex()217 int32_t GetEndIndex() const 218 { 219 return itemPosition_.empty() ? -1 : itemPosition_.rbegin()->first; 220 } 221 222 int32_t GetMidIndex(LayoutWrapper* layoutWrapper, bool usePreContentMainSize = false); 223 GetMaxListItemIndex()224 int32_t GetMaxListItemIndex() const 225 { 226 return totalItemCount_ - 1; 227 } 228 SetSpaceWidth(float spaceWidth)229 void SetSpaceWidth(float spaceWidth) 230 { 231 spaceWidth_ = spaceWidth; 232 } 233 GetSpaceWidth()234 float GetSpaceWidth() const 235 { 236 return spaceWidth_; 237 } 238 NeedEstimateOffset()239 bool NeedEstimateOffset() const 240 { 241 return needEstimateOffset_; 242 } 243 SetContentStartOffset(float startOffset)244 void SetContentStartOffset(float startOffset) 245 { 246 contentStartOffset_ = startOffset; 247 } 248 SetContentEndOffset(float endOffset)249 void SetContentEndOffset(float endOffset) 250 { 251 contentEndOffset_ = endOffset; 252 } 253 GetContentStartOffset()254 float GetContentStartOffset() const 255 { 256 return contentStartOffset_; 257 } 258 GetContentEndOffset()259 float GetContentEndOffset() const 260 { 261 return contentEndOffset_; 262 } 263 SetPrevContentStartOffset(float prevContentStartOffset)264 void SetPrevContentStartOffset(float prevContentStartOffset) 265 { 266 prevContentStartOffset_ = prevContentStartOffset; 267 } 268 SetPrevContentEndOffset(float prevContentEndOffset)269 void SetPrevContentEndOffset(float prevContentEndOffset) 270 { 271 prevContentEndOffset_ = prevContentEndOffset; 272 } 273 GetStartPosition()274 float GetStartPosition() const 275 { 276 if (itemPosition_.empty()) { 277 return 0.0f; 278 } 279 if (GetStartIndex() == 0) { 280 return itemPosition_.begin()->second.startPos; 281 } 282 return itemPosition_.begin()->second.startPos - spaceWidth_; 283 } 284 GetEndPosition()285 float GetEndPosition() const 286 { 287 if (itemPosition_.empty()) { 288 return 0.0f; 289 } 290 if (GetEndIndex() == totalItemCount_ - 1) { 291 return itemPosition_.rbegin()->second.endPos; 292 } 293 return itemPosition_.rbegin()->second.endPos + spaceWidth_; 294 } 295 296 float GetStartPositionWithChainOffset() const; 297 SetChainOffsetCallback(std::function<float (int32_t)> func)298 void SetChainOffsetCallback(std::function<float(int32_t)> func) 299 { 300 chainOffsetFunc_ = std::move(func); 301 } 302 GetChainOffset(int32_t index)303 float GetChainOffset(int32_t index) const 304 { 305 return chainOffsetFunc_ ? chainOffsetFunc_(index) : 0.0f; 306 } 307 SetChainInterval(float interval)308 void SetChainInterval(float interval) 309 { 310 chainInterval_ = interval; 311 } 312 IsCrossMatchChild()313 bool IsCrossMatchChild() const 314 { 315 return crossMatchChild_; 316 } 317 318 float GetChildMaxCrossSize(LayoutWrapper* layoutWrapper, Axis axis) const; 319 320 void Measure(LayoutWrapper* layoutWrapper) override; 321 322 void Layout(LayoutWrapper* layoutWrapper) override; 323 324 void LayoutForward(LayoutWrapper* layoutWrapper, int32_t startIndex, float startPos); 325 void LayoutBackward(LayoutWrapper* layoutWrapper, int32_t endIndex, float endPos); 326 327 void BeginLayoutForward(float startPos, LayoutWrapper* layoutWrapper); 328 329 void BeginLayoutBackward(float startPos, LayoutWrapper* layoutWrapper); 330 331 void HandleJumpAuto(LayoutWrapper* layoutWrapper, int32_t startIndex, int32_t endIndex); 332 333 void HandleJumpCenter(LayoutWrapper* layoutWrapper); 334 335 void HandleJumpStart(LayoutWrapper* layoutWrapper); 336 337 void HandleJumpEnd(LayoutWrapper* layoutWrapper); 338 339 bool NoNeedJump(LayoutWrapper* layoutWrapper, float startPos, float endPos, 340 int32_t startIndex, int32_t endIndex, int32_t jumpIndex, float jumpIndexStartPos); 341 342 bool CheckNoNeedJumpListItem(LayoutWrapper* layoutWrapper, float startPos, float endPos, 343 int32_t startIndex, int32_t endIndex, int32_t jumpIndex); 344 345 bool CheckNoNeedJumpListItemGroup(LayoutWrapper* layoutWrapper, int32_t startIndex, int32_t endIndex, 346 int32_t jumpIndex, float jumpIndexStartPos); 347 348 virtual float MeasureAndGetChildHeight(LayoutWrapper* layoutWrapper, int32_t childIndex, 349 bool groupLayoutAll = true); 350 GetChildHeight(LayoutWrapper * layoutWrapper,int32_t childIndex)351 virtual float GetChildHeight(LayoutWrapper* layoutWrapper, int32_t childIndex) 352 { 353 return childrenSize_->GetChildSize(childIndex); 354 } 355 GetLanes()356 virtual int32_t GetLanes() const 357 { 358 return 1; 359 } 360 SetLaneGutter(float laneGutter)361 void SetLaneGutter(float laneGutter) 362 { 363 laneGutter_ = laneGutter; 364 } 365 GetLaneGutter()366 float GetLaneGutter() const 367 { 368 return laneGutter_; 369 } 370 371 void OffScreenLayoutDirection(LayoutWrapper* layoutWrapper); 372 GetScrollAutoType()373 ScrollAutoType GetScrollAutoType() const 374 { 375 return scrollAutoType_; 376 } 377 378 bool CheckJumpValid(LayoutWrapper* layoutWrapper); 379 380 float GetListGroupItemHeight(const RefPtr<LayoutWrapper>& layoutWrapper, int32_t index); 381 382 bool JudgeInOfScreenScrollAutoType(const RefPtr<LayoutWrapper>& layoutWrapper, 383 const RefPtr<ListLayoutProperty>& layoutProperty, float topPos, float bottomPos); 384 385 void JudgeOutOfScreenScrollAutoType(const RefPtr<LayoutWrapper>& layoutWrapper, int32_t index, 386 const RefPtr<ListLayoutProperty>& layoutProperty, int32_t indexInGroup, int32_t judgeIndex, 387 int32_t startIndex, int32_t endIndex); 388 GetGroupLayoutConstraint()389 virtual LayoutConstraintF& GetGroupLayoutConstraint() 390 { 391 return childLayoutConstraint_; 392 } 393 394 void OnItemPositionAddOrUpdate(LayoutWrapper* layoutWrapper, int32_t index); 395 SetListChildrenMainSize(const RefPtr<ListChildrenMainSize> & childrenMainSize)396 void SetListChildrenMainSize(const RefPtr<ListChildrenMainSize>& childrenMainSize) 397 { 398 childrenSize_ = childrenMainSize; 399 } 400 SetListPositionMap(const RefPtr<ListPositionMap> & posMap)401 void SetListPositionMap(const RefPtr<ListPositionMap>& posMap) 402 { 403 posMap_ = posMap; 404 } 405 406 void ResetLayoutItem(LayoutWrapper* layoutWrapper); 407 408 std::pair<int32_t, float> GetSnapStartIndexAndPos(); 409 410 std::pair<int32_t, float> GetSnapEndIndexAndPos(); 411 412 protected: 413 virtual void UpdateListItemConstraint( 414 Axis axis, const OptionalSizeF& selfIdealSize, LayoutConstraintF& contentConstraint); 415 virtual int32_t LayoutALineForward( 416 LayoutWrapper* layoutWrapper, int32_t& currentIndex, float startPos, float& endPos); 417 virtual int32_t LayoutALineBackward( 418 LayoutWrapper* layoutWrapper, int32_t& currentIndex, float endPos, float& startPos); 419 virtual float CalculateLaneCrossOffset(float crossSize, float childCrossSize); CalculateLanes(const RefPtr<ListLayoutProperty> & layoutProperty,const LayoutConstraintF & layoutConstraint,std::optional<float> crossSizeOptional,Axis axis)420 virtual void CalculateLanes(const RefPtr<ListLayoutProperty>& layoutProperty, 421 const LayoutConstraintF& layoutConstraint, std::optional<float> crossSizeOptional, Axis axis) {}; GetLanesFloor(LayoutWrapper * layoutWrapper,int32_t index)422 virtual int32_t GetLanesFloor(LayoutWrapper* layoutWrapper, int32_t index) 423 { 424 return index; 425 } GetLanesCeil(LayoutWrapper * layoutWrapper,int32_t index)426 virtual int32_t GetLanesCeil(LayoutWrapper* layoutWrapper, int32_t index) 427 { 428 return index; 429 } 430 virtual void SetCacheCount(LayoutWrapper* layoutWrapper, int32_t cacheCount); 431 virtual void SetActiveChildRange(LayoutWrapper* layoutWrapper, int32_t cacheStart, int32_t cacheEnd); 432 433 void SetListItemGroupJumpIndex(const RefPtr<ListItemGroupLayoutAlgorithm>& itemGroup, 434 bool forwardLayout, int32_t index); 435 void SetListItemGroupParam(const RefPtr<LayoutWrapper>& layoutWrapper, int32_t index, float referencePos, 436 bool forwardLayout, const RefPtr<ListLayoutProperty>& layoutProperty, bool groupNeedAllLayout, 437 bool needAdjustRefPos = false); 438 static void SetListItemIndex(const RefPtr<LayoutWrapper>& layoutWrapper, int32_t index); 439 void ReMeasureListItemGroup(LayoutWrapper* layoutWrapper, bool forwardLayout); 440 void CheckListItemGroupRecycle( 441 LayoutWrapper* layoutWrapper, int32_t index, float referencePos, bool forwardLayout) const; 442 void AdjustPostionForListItemGroup(LayoutWrapper* layoutWrapper, Axis axis, int32_t index, bool forwardLayout); SetItemInfo(int32_t index,ListItemInfo && info)443 void SetItemInfo(int32_t index, ListItemInfo&& info) 444 { 445 itemPosition_[index] = info; 446 } 447 void LayoutItem(RefPtr<LayoutWrapper>& layoutWrapper, int32_t index, const ListItemInfo& pos, 448 int32_t& startIndex, float crossSize); 449 static void SyncGeometry(RefPtr<LayoutWrapper>& wrapper); 450 ListItemInfo GetListItemGroupPosition(const RefPtr<LayoutWrapper>& layoutWrapper, int32_t index); 451 bool CheckNeedMeasure(const RefPtr<LayoutWrapper>& layoutWrapper) const; 452 void ReviseSpace(const RefPtr<ListLayoutProperty>& listLayoutProperty); 453 std::pair<int32_t, int32_t> GetLayoutGroupCachedCount( 454 const RefPtr<LayoutWrapper>& wrapper, bool forward, int32_t cacheCount, bool outOfView); 455 void AdjustStartPosition(const RefPtr<LayoutWrapper>& layoutWrapper, float& startPos); 456 int32_t UpdateDefaultCachedCount(const int32_t oldCachedCount, const int32_t itemCount); 457 458 Axis axis_ = Axis::VERTICAL; 459 LayoutConstraintF childLayoutConstraint_; 460 RefPtr<ListChildrenMainSize> childrenSize_; 461 RefPtr<ListPositionMap> posMap_; 462 std::optional<std::pair<int32_t, ListItemInfo>> firstItemInfo_; 463 private: 464 void MeasureList(LayoutWrapper* layoutWrapper); 465 LayoutDirection LayoutDirectionForTargetIndex(LayoutWrapper* layoutWrapper, int startIndex); 466 void RecycleGroupItem(LayoutWrapper* layoutWrapper) const; 467 void CheckJumpToIndex(); 468 void CheckAndMeasureStartItem(LayoutWrapper* layoutWrapper, int32_t startIndex, 469 float& startPos, bool isGroup, bool forwardLayout); 470 471 std::pair<int32_t, float> RequestNewItemsForward(LayoutWrapper* layoutWrapper, 472 const LayoutConstraintF& layoutConstraint, int32_t startIndex, float startPos, Axis axis); 473 474 std::pair<int32_t, float> RequestNewItemsBackward(LayoutWrapper* layoutWrapper, 475 const LayoutConstraintF& layoutConstraint, int32_t startIndex, float startPos, Axis axis); 476 477 void OnSurfaceChanged(LayoutWrapper* layoutWrapper); 478 479 void FixPredictSnapOffset(const RefPtr<ListLayoutProperty>& listLayoutProperty); 480 void FixPredictSnapOffsetAlignStart(); 481 void FixPredictSnapOffsetAlignCenter(); 482 void FixPredictSnapOffsetAlignEnd(); 483 bool IsScrollSnapAlignCenter(LayoutWrapper* layoutWrapper); 484 bool LayoutCachedALine(LayoutWrapper* layoutWrapper, int32_t index, bool forward, float &currPos, float crossSize); 485 virtual std::list<int32_t> LayoutCachedItem(LayoutWrapper* layoutWrapper, int32_t cacheCount); 486 static void PostIdleTask(RefPtr<FrameNode> frameNode, const ListPredictLayoutParam& param); 487 static bool PredictBuildItem(RefPtr<LayoutWrapper> wrapper, const LayoutConstraintF& constraint); 488 489 void ProcessCacheCount(LayoutWrapper* layoutWrapper, int32_t cacheCount); 490 virtual int32_t LayoutCachedForward(LayoutWrapper* layoutWrapper, 491 int32_t cacheCount, int32_t cached, int32_t& currIndex); 492 virtual int32_t LayoutCachedBackward(LayoutWrapper* layoutWrapper, 493 int32_t cacheCount, int32_t cached, int32_t& currIndex); 494 std::list<PredictLayoutItem> LayoutCachedItemV2(LayoutWrapper* layoutWrapper, int32_t cacheCount); 495 static bool PredictBuildGroup(RefPtr<LayoutWrapper> wrapper, const LayoutConstraintF& constraint, int64_t deadline, 496 int32_t cached, const ListMainSizeValues& listMainSizeValues); 497 static void PostIdleTaskV2( 498 RefPtr<FrameNode> frameNode, const ListPredictLayoutParamV2& param, ListMainSizeValues listMainSizeValues); 499 static void PredictBuildV2(RefPtr<FrameNode> frameNode, int64_t deadline, ListMainSizeValues listMainSizeValues); 500 501 float GetStopOnScreenOffset(V2::ScrollSnapAlign scrollSnapAlign) const; 502 void FindPredictSnapIndexInItemPositionsStart(float predictEndPos, int32_t& endIndex, int32_t& currIndex) const; 503 void FindPredictSnapIndexInItemPositionsCenter(float predictEndPos, int32_t& endIndex, int32_t& currIndex) const; 504 void FindPredictSnapIndexInItemPositionsEnd(float predictEndPos, int32_t& endIndex, int32_t& currIndex) const; 505 int32_t FindPredictSnapEndIndexInItemPositions(float predictEndPos, V2::ScrollSnapAlign scrollSnapAlign); 506 bool IsUniformHeightProbably(); 507 float CalculatePredictSnapEndPositionByIndex(int32_t index, V2::ScrollSnapAlign scrollSnapAlign); 508 void UpdateSnapCenterContentOffset(LayoutWrapper* layoutWrapper); 509 std::optional<ListItemGroupLayoutInfo> GetListItemGroupLayoutInfo( 510 const RefPtr<LayoutWrapper>& wrapper) const; 511 int32_t GetListItemGroupItemCount(const RefPtr<LayoutWrapper>& wrapper) const; 512 513 std::optional<int32_t> jumpIndex_; 514 std::optional<int32_t> jumpIndexInGroup_; 515 std::optional<int32_t> targetIndex_; 516 std::optional<int32_t> targetIndexInGroup_; 517 std::optional<int32_t> targetIndexStaged_; 518 std::optional<float> predictSnapOffset_; 519 std::optional<float> predictSnapEndPos_; 520 float scrollSnapVelocity_; 521 ScrollAlign scrollAlign_ = ScrollAlign::START; 522 ScrollAutoType scrollAutoType_ = ScrollAutoType::NOT_CHANGE; 523 524 PositionMap itemPosition_; 525 PositionMap recycledItemPosition_; 526 int32_t preStartIndex_ = 0; 527 float currentOffset_ = 0.0f; 528 float adjustOffset_ = 0.0f; 529 float totalOffset_ = 0.0f; 530 float currentDelta_ = 0.0f; 531 float startMainPos_ = 0.0f; 532 float endMainPos_ = 0.0f; 533 std::optional<float> layoutEndMainPos_; 534 std::optional<float> layoutStartMainPos_; 535 float contentStartOffset_ = 0.0f; 536 float contentEndOffset_ = 0.0f; 537 float prevContentStartOffset_ = 0.0f; 538 float prevContentEndOffset_ = 0.0f; 539 float spaceWidth_ = 0.0f; 540 bool overScrollFeature_ = false; 541 bool canOverScroll_ = false; 542 bool isSpringEffect_ = false; 543 bool forwardFeature_ = false; 544 bool backwardFeature_ = false; 545 bool isNeedCheckOffset_ = false; 546 bool expandSafeArea_ = false; 547 548 int32_t totalItemCount_ = 0; 549 550 V2::ListItemAlign listItemAlign_ = V2::ListItemAlign::START; 551 552 bool needEstimateOffset_ = false; 553 554 bool mainSizeIsDefined_ = false; 555 bool crossMatchChild_ = false; 556 V2::ScrollSnapAlign scrollSnapAlign_ = V2::ScrollSnapAlign::NONE; 557 bool isReverse_ = false; 558 float contentMainSize_ = 0.0f; 559 float prevContentMainSize_ = 0.0f; 560 float paddingBeforeContent_ = 0.0f; 561 float paddingAfterContent_ = 0.0f; 562 float laneGutter_ = 0.0f; 563 OffsetF paddingOffset_; 564 565 V2::StickyStyle stickyStyle_ = V2::StickyStyle::NONE; 566 567 std::function<float(int32_t)> chainOffsetFunc_; 568 float chainInterval_ = 0.0f; 569 }; 570 } // namespace OHOS::Ace::NG 571 572 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_LIST_LIST_LAYOUT_ALGORITHM_H 573