(
style: ZRStyleProps & LegacyStyleProps,
elType: string,
hasOwnTextContentOption: boolean,
hasOwnTextConfig: boolean
)
| 34 | * Whether need to call `convertEC4CompatibleStyle`. |
| 35 | */ |
| 36 | export 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. |
no test coverage detected
searching dependent graphs…