From 1daaa85bc24a5d85b589ba5d109744d0aecca17f Mon Sep 17 00:00:00 2001 From: tomkl123 Date: Sat, 13 Sep 2025 18:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91Grid=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E9=AB=98=E5=BA=A6=E5=9C=BA=E6=99=AF=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E9=A2=91=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tomkl123 Change-Id: Ib31c4a306e4ed67a10a05b62143119d6601e550f --- .../grid/grid_scroll/grid_scroll_layout_algorithm.cpp | 6 ++++-- .../grid/irregular/grid_irregular_layout_algorithm.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frameworks/core/components_ng/pattern/grid/grid_scroll/grid_scroll_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/grid/grid_scroll/grid_scroll_layout_algorithm.cpp index e0a3928b14b..8d737455e79 100644 --- a/frameworks/core/components_ng/pattern/grid/grid_scroll/grid_scroll_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/grid/grid_scroll/grid_scroll_layout_algorithm.cpp @@ -246,8 +246,10 @@ void GridScrollLayoutAlgorithm::AdaptToChildMainSize(LayoutWrapper* layoutWrappe idealSize.SetMainSize(gridMainSize, axis_); AddPaddingToSize(gridLayoutProperty->CreatePaddingAndBorder(), idealSize); layoutWrapper->GetGeometryNode()->SetFrameSize(idealSize); - info_.lastMainSize_ = gridMainSize; - TAG_LOGI(AceLogTag::ACE_GRID, "gridMainSize:%{public}f", gridMainSize); + if (!NearEqual(info_.lastMainSize_, gridMainSize)) { + info_.lastMainSize_ = gridMainSize; + TAG_LOGI(AceLogTag::ACE_GRID, "gridMainSize:%{public}f", gridMainSize); + } } void GridScrollLayoutAlgorithm::UpdateOffsetOnHeightChangeDuringAnimation(LayoutWrapper* layoutWrapper, float mainSize) diff --git a/frameworks/core/components_ng/pattern/grid/irregular/grid_irregular_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/grid/irregular/grid_irregular_layout_algorithm.cpp index 55f306c2a6d..447916612b7 100644 --- a/frameworks/core/components_ng/pattern/grid/irregular/grid_irregular_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/grid/irregular/grid_irregular_layout_algorithm.cpp @@ -739,7 +739,9 @@ void GridIrregularLayoutAlgorithm::AdaptToChildMainSize( idealSize.SetMainSize(gridMainSize, info_.axis_); AddPaddingToSize(gridLayoutProperty->CreatePaddingAndBorder(), idealSize); wrapper_->GetGeometryNode()->SetFrameSize(idealSize); - info_.lastMainSize_ = gridMainSize; - TAG_LOGI(AceLogTag::ACE_GRID, "gridMainSize:%{public}f", gridMainSize); + if (!NearEqual(gridMainSize, info_.lastMainSize_)) { + info_.lastMainSize_ = gridMainSize; + TAG_LOGI(AceLogTag::ACE_GRID, "gridMainSize:%{public}f", gridMainSize); + } } } // namespace OHOS::Ace::NG -- Gitee