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

Function isEC4CompatibleStyle

src/util/styleCompat.ts:36–62  ·  view source on GitHub ↗
(
    style: ZRStyleProps & LegacyStyleProps,
    elType: string,
    hasOwnTextContentOption: boolean,
    hasOwnTextConfig: boolean
)

Source from the content-addressed store, hash-verified

34 * Whether need to call `convertEC4CompatibleStyle`.
35 */
36export function isEC4CompatibleStyle(
37 style: ZRStyleProps & LegacyStyleProps,
38 elType: string,
39 hasOwnTextContentOption: boolean,
40 hasOwnTextConfig: boolean
41): boolean {
42 // Since echarts5, `RectText` is separated from its host element and style.text
43 // does not exist any more. The compat work brings some extra burden on performance.
44 // So we provide:
45 // `legacy: true` force make compat.
46 // `legacy: false`, force do not compat.
47 // `legacy` not set: auto detect whether legacy.
48 // But in this case we do not compat (difficult to detect and rare case):
49 // Because custom series and graphic component support "merge", users may firstly
50 // only set `textStrokeWidth` style or secondly only set `text`.
51 return style && (
52 style.legacy
53 || (
54 style.legacy !== false
55 && !hasOwnTextContentOption
56 && !hasOwnTextConfig
57 && elType !== 'tspan'
58 // Difficult to detect whether legacy for a "text" el.
59 && (elType === 'text' || hasOwn(style, 'text'))
60 )
61 );
62}
63
64/**
65 * `EC4CompatibleStyle` is style that might be in echarts4 format or echarts5 format.

Callers 2

processTxInfoFunction · 0.90
_updateElementsMethod · 0.90

Calls 1

hasOwnFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…