(
textStyle: TextStyleProps['rich'][string],
// FIXME: check/refactor for ellipsis handling of rich text.
textStyleModel: Model<TextCommonOption<TNuance> & Pick<LabelCommonOption, 'ellipsis'>>,
globalTextStyle: GlobalTextStyleOption,
plainTextModel: LabelCommonModel<TNuance>,
richInheritPlainLabel: boolean,
opt?: Pick<TextCommonParams, 'inheritColor' | 'defaultOpacity' | 'disableBox'>,
isNotNormal?: boolean,
isAttached?: boolean,
isBlock?: boolean,
inRich?: boolean
)
| 531 | ] as const; |
| 532 | |
| 533 | function setTokenTextStyle<TNuance extends TextCommonOptionNuanceBase>( |
| 534 | textStyle: TextStyleProps['rich'][string], |
| 535 | // FIXME: check/refactor for ellipsis handling of rich text. |
| 536 | textStyleModel: Model<TextCommonOption<TNuance> & Pick<LabelCommonOption, 'ellipsis'>>, |
| 537 | globalTextStyle: GlobalTextStyleOption, |
| 538 | plainTextModel: LabelCommonModel<TNuance>, |
| 539 | richInheritPlainLabel: boolean, |
| 540 | opt?: Pick<TextCommonParams, 'inheritColor' | 'defaultOpacity' | 'disableBox'>, |
| 541 | isNotNormal?: boolean, |
| 542 | isAttached?: boolean, |
| 543 | isBlock?: boolean, |
| 544 | inRich?: boolean |
| 545 | ) { |
| 546 | // In merge mode, default value should not be given. |
| 547 | globalTextStyle = !isNotNormal && globalTextStyle || EMPTY_OBJ; |
| 548 | const inheritColor = opt && opt.inheritColor; |
| 549 | let fillColor = textStyleModel.getShallow('color'); |
| 550 | let strokeColor = textStyleModel.getShallow('textBorderColor'); |
| 551 | let opacity = retrieve2(textStyleModel.getShallow('opacity'), globalTextStyle.opacity); |
| 552 | if (fillColor === 'inherit' || fillColor === 'auto') { |
| 553 | if (__DEV__) { |
| 554 | if (fillColor === 'auto') { |
| 555 | deprecateReplaceLog('color: \'auto\'', 'color: \'inherit\''); |
| 556 | } |
| 557 | } |
| 558 | if (inheritColor) { |
| 559 | fillColor = inheritColor; |
| 560 | } |
| 561 | else { |
| 562 | fillColor = null; |
| 563 | } |
| 564 | } |
| 565 | if (strokeColor === 'inherit' || (strokeColor === 'auto')) { |
| 566 | if (__DEV__) { |
| 567 | if (strokeColor === 'auto') { |
| 568 | deprecateReplaceLog('color: \'auto\'', 'color: \'inherit\''); |
| 569 | } |
| 570 | } |
| 571 | if (inheritColor) { |
| 572 | strokeColor = inheritColor; |
| 573 | } |
| 574 | else { |
| 575 | strokeColor = null; |
| 576 | } |
| 577 | } |
| 578 | if (!isAttached) { |
| 579 | // Only use default global textStyle.color if text is individual. |
| 580 | // Otherwise it will use the strategy of attached text color because text may be on a path. |
| 581 | fillColor = fillColor || globalTextStyle.color; |
| 582 | strokeColor = strokeColor || globalTextStyle.textBorderColor; |
| 583 | } |
| 584 | if (fillColor != null) { |
| 585 | // Might not be a string, e.g, it's a function in axisLabel case; but assume that it will |
| 586 | // be erased by a correct value outside. |
| 587 | textStyle.fill = fillColor as string; |
| 588 | } |
| 589 | if (strokeColor != null) { |
| 590 | textStyle.stroke = strokeColor; |
no test coverage detected
searching dependent graphs…