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

Function assembleCssText

src/component/tooltip/TooltipHTMLContent.ts:182–226  ·  view source on GitHub ↗
(
    tooltipModel: Model<TooltipOption>,
    enableTransition: boolean,
    onlyFadeTransition: boolean,
    enableDisplayTransition: boolean
)

Source from the content-addressed store, hash-verified

180}
181
182function assembleCssText(
183 tooltipModel: Model<TooltipOption>,
184 enableTransition: boolean,
185 onlyFadeTransition: boolean,
186 enableDisplayTransition: boolean
187) {
188 const cssText: string[] = [];
189 const transitionDuration = tooltipModel.get('transitionDuration');
190 const backgroundColor = tooltipModel.get('backgroundColor');
191 const shadowBlur = tooltipModel.get('shadowBlur');
192 const shadowColor = tooltipModel.get('shadowColor');
193 const shadowOffsetX = tooltipModel.get('shadowOffsetX');
194 const shadowOffsetY = tooltipModel.get('shadowOffsetY');
195 const textStyleModel = tooltipModel.getModel('textStyle');
196 const padding = getPaddingFromTooltipModel(tooltipModel, 'html');
197 const boxShadow = `${shadowOffsetX}px ${shadowOffsetY}px ${shadowBlur}px ${shadowColor}`;
198
199 cssText.push('box-shadow:' + boxShadow);
200 // Animation transition. Do not animate when transitionDuration <= 0.
201 enableTransition && transitionDuration > 0
202 && cssText.push(assembleTransition(transitionDuration, onlyFadeTransition, enableDisplayTransition));
203
204 if (backgroundColor) {
205 cssText.push('background-color:' + backgroundColor);
206 }
207
208 // Border style
209 each(['width', 'color', 'radius'] as const, function (name) {
210 const borderName = 'border-' + name;
211 const camelCase = toCamelCase(borderName) as 'borderWidth' | 'borderColor' | 'borderRadius';
212 const val = tooltipModel.get(camelCase);
213 val != null
214 && cssText.push(borderName + ':' + val + (name === 'color' ? '' : 'px'));
215 });
216
217 // Text style
218 cssText.push(assembleFont(textStyleModel));
219
220 // Padding
221 if (padding != null) {
222 cssText.push('padding:' + normalizeCssArray(padding).join('px ') + 'px');
223 }
224
225 return cssText.join(';') + ';';
226}
227
228// If not able to make, do not modify the input `out`.
229function makeStyleCoord(

Callers 1

showMethod · 0.85

Calls 7

toCamelCaseFunction · 0.90
assembleTransitionFunction · 0.85
assembleFontFunction · 0.85
eachFunction · 0.50
getMethod · 0.45
getModelMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…