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

Function makeStyleCoord

src/component/tooltip/TooltipHTMLContent.ts:229–260  ·  view source on GitHub ↗
(
    out: number[],
    zr: ZRenderType,
    container: HTMLElement | null | undefined,
    zrX: number,
    zrY: number
)

Source from the content-addressed store, hash-verified

227
228// If not able to make, do not modify the input `out`.
229function makeStyleCoord(
230 out: number[],
231 zr: ZRenderType,
232 container: HTMLElement | null | undefined,
233 zrX: number,
234 zrY: number
235) {
236 const zrPainter = zr && zr.painter;
237
238 if (container) {
239 const zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
240 if (zrViewportRoot) {
241 // Some APPs might use scale on body, so we support CSS transform here.
242 transformLocalCoord(out, zrViewportRoot, container, zrX, zrY);
243 }
244 }
245 else {
246 out[0] = zrX;
247 out[1] = zrY;
248 // xy should be based on canvas root. But tooltipContent is
249 // the sibling of canvas root. So padding of ec container
250 // should be considered here.
251 const viewportRootOffset = zrPainter && (zrPainter as CanvasPainter | SVGPainter).getViewportRootOffset();
252 if (viewportRootOffset) {
253 out[0] += viewportRootOffset.offsetLeft;
254 out[1] += viewportRootOffset.offsetTop;
255 }
256 }
257
258 out[2] = out[0] / zr.getWidth();
259 out[3] = out[1] / zr.getHeight();
260}
261
262interface TooltipContentOption {
263 /**

Callers 2

constructorMethod · 0.70
moveToMethod · 0.70

Calls 2

getWidthMethod · 0.65
getHeightMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…