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

Function assembleTransform

src/component/tooltip/TooltipHTMLContent.ts:126–143  ·  view source on GitHub ↗
(x: number, y: number, toString?: boolean)

Source from the content-addressed store, hash-verified

124}
125
126function assembleTransform(x: number, y: number, toString?: boolean) {
127 // If using float on style, the final width of the dom might
128 // keep changing slightly while mouse move. So `toFixed(0)` them.
129 const x0 = x.toFixed(0) + 'px';
130 const y0 = y.toFixed(0) + 'px';
131 // not support transform, use `left` and `top` instead.
132 if (!env.transformSupported) {
133 return toString
134 ? `top:${y0};left:${x0};`
135 : [['top', y0], ['left', x0]];
136 }
137 // support transform
138 const is3d = env.transform3dSupported;
139 const translate = `translate${is3d ? '3d' : ''}(${x0},${y0}${is3d ? ',0' : ''})`;
140 return toString
141 ? 'top:0;left:0;' + CSS_TRANSFORM_VENDOR + ':' + translate + ';'
142 : [['top', 0], ['left', 0], [TRANSFORM_VENDOR, translate]];
143}
144
145/**
146 * @param {Object} textStyle

Callers 2

showMethod · 0.85
moveToMethod · 0.85

Calls 1

toFixedMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…