+ [task#129807] add the groupPositions function for think3c widget.

This commit is contained in:
wangzemei
2024-10-13 18:14:10 +08:00
committed by 孙浩
parent 32315c2f3b
commit 0d000c6495
+19
View File
@@ -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.