MCPcopy
hub / github.com/baidu/amis / drawCells

Function drawCells

packages/office-viewer/src/excel/render/cell/drawCells.ts:12–60  ·  view source on GitHub ↗
(
  excelRender: ExcelRender,
  currentSheet: Sheet,
  excelRenderOptions: ExcelRenderOptions,
  canvas: SheetCanvas,
  displayData: DisplayData[],
  linkPositionCache: LinkPosition[]
)

Source from the content-addressed store, hash-verified

10 * 绘制所有单元格的主入口
11 */
12export function drawCells(
13 excelRender: ExcelRender,
14 currentSheet: Sheet,
15 excelRenderOptions: ExcelRenderOptions,
16 canvas: SheetCanvas,
17 displayData: DisplayData[],
18 linkPositionCache: LinkPosition[]
19) {
20 const cellInfoMap: Map<string, CellInfoWithSize> = new Map();
21 for (const data of displayData) {
22 const {row, col, width, height} = data;
23 if (width <= 0 || height <= 0) {
24 continue;
25 }
26 const cellInfo = currentSheet.getCellInfo(row, col);
27 if (cellInfo) {
28 cellInfoMap.set(`${row},${col}`, {
29 ...JSON.parse(JSON.stringify(cellInfo)),
30 width,
31 height
32 });
33 }
34 }
35
36 canvas.autoClip(cellInfoMap);
37
38 for (const data of displayData) {
39 const {row, col, x, y, width, height, needClear} = data;
40 if (width <= 0 || height <= 0) {
41 continue;
42 }
43 const key = `${row},${col}`;
44 if (cellInfoMap.has(key)) {
45 const cellInfo = cellInfoMap.get(key)!;
46 canvas.drawCell(
47 excelRender,
48 cellInfo,
49 x,
50 y,
51 width,
52 height,
53 excelRenderOptions.indentSize,
54 PADDING_SIZE,
55 needClear,
56 linkPositionCache
57 );
58 }
59 }
60}

Callers 4

drawMethod · 0.90
drawLeftFrozenFunction · 0.90
drawTopLeftFrozenFunction · 0.90
drawTopFrozenFunction · 0.90

Calls 7

autoClipMethod · 0.80
drawCellMethod · 0.80
getCellInfoMethod · 0.65
parseMethod · 0.65
setMethod · 0.45
hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected