MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / setTokenTextStyle

Function setTokenTextStyle

libs/echarts/echarts.simple.js:17733–17796  ·  view source on GitHub ↗
(textStyle, textStyleModel, globalTextStyle, opt, isEmphasis, isBlock)

Source from the content-addressed store, hash-verified

17731}
17732
17733function setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isEmphasis, isBlock) {
17734 // In merge mode, default value should not be given.
17735 globalTextStyle = !isEmphasis && globalTextStyle || EMPTY_OBJ;
17736
17737 textStyle.textFill = getAutoColor(textStyleModel.getShallow('color'), opt)
17738 || globalTextStyle.color;
17739 textStyle.textStroke = getAutoColor(textStyleModel.getShallow('textBorderColor'), opt)
17740 || globalTextStyle.textBorderColor;
17741 textStyle.textStrokeWidth = retrieve2(
17742 textStyleModel.getShallow('textBorderWidth'),
17743 globalTextStyle.textBorderWidth
17744 );
17745
17746 if (!isEmphasis) {
17747 if (isBlock) {
17748 textStyle.insideRollbackOpt = opt;
17749 applyDefaultTextStyle(textStyle);
17750 }
17751
17752 // Set default finally.
17753 if (textStyle.textFill == null) {
17754 textStyle.textFill = opt.autoColor;
17755 }
17756 }
17757
17758 // Do not use `getFont` here, because merge should be supported, where
17759 // part of these properties may be changed in emphasis style, and the
17760 // others should remain their original value got from normal style.
17761 textStyle.fontStyle = textStyleModel.getShallow('fontStyle') || globalTextStyle.fontStyle;
17762 textStyle.fontWeight = textStyleModel.getShallow('fontWeight') || globalTextStyle.fontWeight;
17763 textStyle.fontSize = textStyleModel.getShallow('fontSize') || globalTextStyle.fontSize;
17764 textStyle.fontFamily = textStyleModel.getShallow('fontFamily') || globalTextStyle.fontFamily;
17765
17766 textStyle.textAlign = textStyleModel.getShallow('align');
17767 textStyle.textVerticalAlign = textStyleModel.getShallow('verticalAlign')
17768 || textStyleModel.getShallow('baseline');
17769
17770 textStyle.textLineHeight = textStyleModel.getShallow('lineHeight');
17771 textStyle.textWidth = textStyleModel.getShallow('width');
17772 textStyle.textHeight = textStyleModel.getShallow('height');
17773 textStyle.textTag = textStyleModel.getShallow('tag');
17774
17775 if (!isBlock || !opt.disableBox) {
17776 textStyle.textBackgroundColor = getAutoColor(textStyleModel.getShallow('backgroundColor'), opt);
17777 textStyle.textPadding = textStyleModel.getShallow('padding');
17778 textStyle.textBorderColor = getAutoColor(textStyleModel.getShallow('borderColor'), opt);
17779 textStyle.textBorderWidth = textStyleModel.getShallow('borderWidth');
17780 textStyle.textBorderRadius = textStyleModel.getShallow('borderRadius');
17781
17782 textStyle.textBoxShadowColor = textStyleModel.getShallow('shadowColor');
17783 textStyle.textBoxShadowBlur = textStyleModel.getShallow('shadowBlur');
17784 textStyle.textBoxShadowOffsetX = textStyleModel.getShallow('shadowOffsetX');
17785 textStyle.textBoxShadowOffsetY = textStyleModel.getShallow('shadowOffsetY');
17786 }
17787
17788 textStyle.textShadowColor = textStyleModel.getShallow('textShadowColor')
17789 || globalTextStyle.textShadowColor;
17790 textStyle.textShadowBlur = textStyleModel.getShallow('textShadowBlur')

Callers 1

setTextStyleCommonFunction · 0.70

Calls 3

getAutoColorFunction · 0.70
retrieve2Function · 0.70
applyDefaultTextStyleFunction · 0.70

Tested by

no test coverage detected