* The result will be set to `out`.
(out: TextStylePropsPart, richItem: Dictionary<any>)
| 131 | * The result will be set to `out`. |
| 132 | */ |
| 133 | function convertEC4CompatibleRichItem(out: TextStylePropsPart, richItem: Dictionary<any>): void { |
| 134 | if (!richItem) { |
| 135 | return; |
| 136 | } |
| 137 | // (1) For simplicity, make textXXX properties (deprecated since ec5) has |
| 138 | // higher priority. For example, consider in ec4 `borderColor: 5, textBorderColor: 10` |
| 139 | // on a rect means `borderColor: 4` on the rect and `borderColor: 10` on an attached |
| 140 | // richText in ec5. |
| 141 | // (2) `out === richItem` if and only if `out` is text el or rich item. |
| 142 | // So we can overwrite existing props in `out` since textXXX has higher priority. |
| 143 | richItem.font = richItem.textFont || richItem.font; |
| 144 | hasOwn(richItem, 'textStrokeWidth') && (out.lineWidth = richItem.textStrokeWidth); |
| 145 | hasOwn(richItem, 'textAlign') && (out.align = richItem.textAlign); |
| 146 | hasOwn(richItem, 'textVerticalAlign') && (out.verticalAlign = richItem.textVerticalAlign); |
| 147 | hasOwn(richItem, 'textLineHeight') && (out.lineHeight = richItem.textLineHeight); |
| 148 | hasOwn(richItem, 'textWidth') && (out.width = richItem.textWidth); |
| 149 | hasOwn(richItem, 'textHeight') && (out.height = richItem.textHeight); |
| 150 | hasOwn(richItem, 'textBackgroundColor') && (out.backgroundColor = richItem.textBackgroundColor); |
| 151 | hasOwn(richItem, 'textPadding') && (out.padding = richItem.textPadding); |
| 152 | hasOwn(richItem, 'textBorderColor') && (out.borderColor = richItem.textBorderColor); |
| 153 | hasOwn(richItem, 'textBorderWidth') && (out.borderWidth = richItem.textBorderWidth); |
| 154 | hasOwn(richItem, 'textBorderRadius') && (out.borderRadius = richItem.textBorderRadius); |
| 155 | hasOwn(richItem, 'textBoxShadowColor') && (out.shadowColor = richItem.textBoxShadowColor); |
| 156 | hasOwn(richItem, 'textBoxShadowBlur') && (out.shadowBlur = richItem.textBoxShadowBlur); |
| 157 | hasOwn(richItem, 'textBoxShadowOffsetX') && (out.shadowOffsetX = richItem.textBoxShadowOffsetX); |
| 158 | hasOwn(richItem, 'textBoxShadowOffsetY') && (out.shadowOffsetY = richItem.textBoxShadowOffsetY); |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * Convert to pure echarts4 format style. |
no test coverage detected
searching dependent graphs…