MCPcopy Index your code
hub / github.com/apache/echarts / doCreateOrUpdateClipPath

Function doCreateOrUpdateClipPath

src/chart/custom/CustomView.ts:1141–1181  ·  view source on GitHub ↗
(
    el: Element,
    dataIndex: number,
    elOption: CustomElementOption,
    seriesModel: CustomSeriesModel,
    isInit: boolean
)

Source from the content-addressed store, hash-verified

1139}
1140
1141function doCreateOrUpdateClipPath(
1142 el: Element,
1143 dataIndex: number,
1144 elOption: CustomElementOption,
1145 seriesModel: CustomSeriesModel,
1146 isInit: boolean
1147): void {
1148 // Based on the "merge" principle, if no clipPath provided,
1149 // do nothing. The exists clip will be totally removed only if
1150 // `el.clipPath` is `false`. Otherwise it will be merged/replaced.
1151 const clipPathOpt = elOption.clipPath as CustomPathOption | false;
1152 if (clipPathOpt === false) {
1153 if (el && el.getClipPath()) {
1154 el.removeClipPath();
1155 }
1156 }
1157 else if (clipPathOpt) {
1158 let clipPath = el.getClipPath();
1159 if (clipPath && doesElNeedRecreate(
1160 clipPath,
1161 clipPathOpt,
1162 seriesModel
1163 )) {
1164 clipPath = null;
1165 }
1166 if (!clipPath) {
1167 clipPath = createEl(clipPathOpt) as graphicUtil.Path;
1168 if (__DEV__) {
1169 assert(
1170 isPath(clipPath),
1171 'Only any type of `path` can be used in `clipPath`, rather than ' + clipPath.type + '.'
1172 );
1173 }
1174 el.setClipPath(clipPath);
1175 }
1176 updateElNormal(
1177 null, clipPath, dataIndex, clipPathOpt, null, seriesModel, isInit
1178 );
1179 }
1180 // If not define `clipPath` in option, do nothing unnecessary.
1181}
1182
1183function doCreateOrUpdateAttachedTx(
1184 el: Element,

Callers 1

doCreateOrUpdateElFunction · 0.85

Calls 5

doesElNeedRecreateFunction · 0.85
updateElNormalFunction · 0.85
createElFunction · 0.70
isPathFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…