From 0d000c6495722dbe6d3f9df3886220e7fd08e6ad Mon Sep 17 00:00:00 2001 From: wangzemei Date: Sat, 12 Oct 2024 17:30:39 +0800 Subject: [PATCH] + [task#129807] add the groupPositions function for think3c widget. --- lib/zin/wg/think3c/js/v1.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/zin/wg/think3c/js/v1.js b/lib/zin/wg/think3c/js/v1.js index 110e12e75c..c2e89011ad 100644 --- a/lib/zin/wg/think3c/js/v1.js +++ b/lib/zin/wg/think3c/js/v1.js @@ -215,6 +215,25 @@ function isSameLine(currentItem, nextItem, offset) return currentItem[1] == nextItem[1] || Math.abs(currentItem[1] - nextItem[1]) < offset; } +function groupPositions(data, offset) +{ + const groupedData = new Map(); + + /* 分组数据 */ + /* Group data. */ + data.forEach(item => { + const key = item[2]; + if (!groupedData.has(key)) groupedData.set(key, []); + groupedData.get(key).push(item); + }); + + /* 合并临近的行 */ + /* Merge adjacent rows. */ + const mergedGroups = []; + + return mergedGroups; +} + /** * 使用偏移量计算位置。 * Calculate positions with offset.