MCPcopy
hub / github.com/apache/echarts / createBodyAndCorner

Function createBodyAndCorner

src/component/matrix/MatrixView.ts:186–257  ·  view source on GitHub ↗
(
    group: Group,
    matrixModel: MatrixModel,
    xDim: MatrixDim,
    yDim: MatrixDim,
    ecModel: GlobalModel
)

Source from the content-addressed store, hash-verified

184}
185
186function createBodyAndCorner(
187 group: Group,
188 matrixModel: MatrixModel,
189 xDim: MatrixDim,
190 yDim: MatrixDim,
191 ecModel: GlobalModel
192): void {
193
194 createBodyOrCornerCells('body', matrixModel.getBody(), xDim, yDim);
195 if (xDim.shouldShow() && yDim.shouldShow()) {
196 createBodyOrCornerCells('corner', matrixModel.getCorner(), yDim, xDim);
197 }
198
199 function createBodyOrCornerCells<TBodyOrCornerKind extends MatrixBodyOrCornerKind>(
200 bodyCornerOptionRoot: TBodyOrCornerKind,
201 bodyOrCorner: MatrixBodyCorner<TBodyOrCornerKind>,
202 dimForCoordX: MatrixDim, // Can be `matrix.y` (transposed) for corners.
203 dimForCoordY: MatrixDim, // Can be `matrix.x` (trnasposed) for corners.
204 ): void {
205 // Prevent inheriting from ancestor.
206 const parentCellModel = new Model(matrixModel.getShallow(bodyCornerOptionRoot, true));
207 const parentItemStyleModel = parentCellModel.getModel('itemStyle');
208 const parentLabelModel = parentCellModel.getModel('label');
209
210 const itx = new ListIterator<MatrixCellLayoutInfo>();
211 const ity = new ListIterator<MatrixCellLayoutInfo>();
212 const xyLocator: number[] = [];
213 const tooltipOption = matrixModel.getShallow('tooltip', true);
214
215 for (dimForCoordY.resetLayoutIterator(ity, 1); ity.next();) {
216 for (dimForCoordX.resetLayoutIterator(itx, 0); itx.next();) {
217 const xLayout = itx.item;
218 const yLayout = ity.item;
219
220 vectorUtil.set(xyLocator, xLayout.id.x, yLayout.id.y);
221 const bodyCornerCell = bodyOrCorner.getCell(xyLocator);
222
223 // If in span of an other body or corner cell, never render it.
224 if (bodyCornerCell && bodyCornerCell.inSpanOf && bodyCornerCell.inSpanOf !== bodyCornerCell) {
225 continue;
226 }
227
228 const shape = {} as RectLike;
229 if (bodyCornerCell && bodyCornerCell.span) {
230 BoundingRect.copy(shape, bodyCornerCell.spanRect);
231 }
232 else {
233 xLayout.dim.getLayout(shape, 0, xyLocator[0]);
234 yLayout.dim.getLayout(shape, 1, xyLocator[1]);
235 }
236
237 const bodyCornerCellOption = bodyCornerCell ? bodyCornerCell.option : null;
238
239 createMatrixCell(
240 xyLocator,
241 matrixModel,
242 group,
243 ecModel,

Callers 1

renderMethod · 0.85

Calls 4

createBodyOrCornerCellsFunction · 0.85
getBodyMethod · 0.80
getCornerMethod · 0.80
shouldShowMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…