MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / singleEnterEmphasis

Function singleEnterEmphasis

libs/echarts/echarts-en.simple.js:17137–17201  ·  view source on GitHub ↗
(el)

Source from the content-addressed store, hash-verified

17135}
17136
17137function singleEnterEmphasis(el) {
17138 var hoverStl = el.__hoverStl;
17139
17140 if (!hoverStl || el.__highlighted) {
17141 return;
17142 }
17143
17144 var zr = el.__zr;
17145
17146 var useHoverLayer = el.useHoverLayer && zr && zr.painter.type === 'canvas';
17147 el.__highlighted = useHoverLayer ? 'layer' : 'plain';
17148
17149 if (el.isGroup || (!zr && el.useHoverLayer)) {
17150 return;
17151 }
17152
17153 var elTarget = el;
17154 var targetStyle = el.style;
17155
17156 if (useHoverLayer) {
17157 elTarget = zr.addHover(el);
17158 targetStyle = elTarget.style;
17159 }
17160
17161 rollbackDefaultTextStyle(targetStyle);
17162
17163 if (!useHoverLayer) {
17164 cacheElementStl(elTarget);
17165 }
17166
17167 // styles can be:
17168 // {
17169 // label: {
17170 // show: false,
17171 // position: 'outside',
17172 // fontSize: 18
17173 // },
17174 // emphasis: {
17175 // label: {
17176 // show: true
17177 // }
17178 // }
17179 // },
17180 // where properties of `emphasis` may not appear in `normal`. We previously use
17181 // module:echarts/util/model#defaultEmphasis to merge `normal` to `emphasis`.
17182 // But consider rich text and setOption in merge mode, it is impossible to cover
17183 // all properties in merge. So we use merge mode when setting style here.
17184 // But we choose the merge strategy that only properties that is not `null/undefined`.
17185 // Because when making a textStyle (espacially rich text), it is not easy to distinguish
17186 // `hasOwnProperty` and `null/undefined` in code, so we trade them as the same for simplicity.
17187 // But this strategy brings a trouble that `null/undefined` can not be used to remove
17188 // style any more in `emphasis`. Users can both set properties directly on normal and
17189 // emphasis to avoid this issue, or we might support `'none'` for this case if required.
17190 targetStyle.extendFrom(hoverStl);
17191
17192 setDefaultHoverFillStroke(targetStyle, hoverStl, 'fill');
17193 setDefaultHoverFillStroke(targetStyle, hoverStl, 'stroke');
17194

Callers 1

setElementHoverStyleFunction · 0.70

Calls 5

addHoverMethod · 0.80
rollbackDefaultTextStyleFunction · 0.70
cacheElementStlFunction · 0.70
applyDefaultTextStyleFunction · 0.70

Tested by

no test coverage detected