+ [task#129807] add the groupPositions function for think3c widget.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user