From 0a41335b50dc27aa4edd26fee45e055fc0248189 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Tue, 24 Sep 2024 17:29:35 +0800 Subject: [PATCH] + [task#128767] calculate area row width for calculateCardPosition function. --- lib/zin/wg/think3c/js/v1.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/zin/wg/think3c/js/v1.js b/lib/zin/wg/think3c/js/v1.js index d6edcd4cc1..de90489c0b 100644 --- a/lib/zin/wg/think3c/js/v1.js +++ b/lib/zin/wg/think3c/js/v1.js @@ -100,6 +100,23 @@ function calculateCardPosition(region) const d = 10; // 间距 const rows = flattenData(region.rows); const rowsCount = rows.length; + + let r = 0; + while (r < rowsCount) + { + let totalWidth = 0; + let validStartRow = -1; + + for(let i = r; i < r + h && i < rowsCount; i++) + { + if(rows[i]?.right) totalWidth += rows[i].right - rows[i].left; + if(totalWidth >= minW) + { + validStartRow = r; + break; + } + } + } } /**