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

Function confineTooltipPosition

src/component/tooltip/TooltipView.ts:1150–1166  ·  view source on GitHub ↗
(
    x: number, y: number,
    content: TooltipHTMLContent | TooltipRichContent,
    viewWidth: number,
    viewHeight: number
)

Source from the content-addressed store, hash-verified

1148}
1149
1150function confineTooltipPosition(
1151 x: number, y: number,
1152 content: TooltipHTMLContent | TooltipRichContent,
1153 viewWidth: number,
1154 viewHeight: number
1155): [number, number] {
1156 const size = content.getSize();
1157 const width = size[0];
1158 const height = size[1];
1159
1160 x = Math.min(x + width, viewWidth) - width;
1161 y = Math.min(y + height, viewHeight) - height;
1162 x = Math.max(x, 0);
1163 y = Math.max(y, 0);
1164
1165 return [x, y];
1166}
1167
1168function calcTooltipPosition(
1169 position: TooltipOption['position'],

Callers 1

_updatePositionMethod · 0.85

Calls 1

getSizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…