MCPcopy
hub / github.com/apache/echarts / handler

Method handler

src/core/echarts.ts:1291–1368  ·  view source on GitHub ↗
(e: ElementEvent)

Source from the content-addressed store, hash-verified

1289 private _initEvents(): void {
1290 each(MOUSE_EVENT_NAMES, (eveName) => {
1291 const handler = (e: ElementEvent) => {
1292 const ecModel = this.getModel();
1293 const el = e.target;
1294 let params: ECElementEvent;
1295 const isGlobalOut = eveName === 'globalout';
1296 // no e.target when 'globalout'.
1297 if (isGlobalOut) {
1298 params = {} as ECElementEvent;
1299 }
1300 else {
1301 el && findEventDispatcher(el, (parent) => {
1302 const ecData = getECData(parent);
1303 if (ecData && ecData.dataIndex != null) {
1304 const dataModel = ecData.dataModel || ecModel.getSeriesByIndex(ecData.seriesIndex);
1305 params = (
1306 dataModel && dataModel.getDataParams(ecData.dataIndex, ecData.dataType, el) || {}
1307 ) as ECElementEvent;
1308 return true;
1309 }
1310 // If element has custom eventData of components
1311 else if (ecData.eventData) {
1312 params = extend({}, ecData.eventData) as ECElementEvent;
1313 return true;
1314 }
1315 }, true);
1316 }
1317
1318 // Contract: if params prepared in mouse event,
1319 // these properties must be specified:
1320 // {
1321 // componentType: string (component main type)
1322 // componentIndex: number
1323 // }
1324 // Otherwise event query can not work.
1325
1326 if (params) {
1327 let componentType = params.componentType;
1328 let componentIndex = params.componentIndex;
1329 // Special handling for historic reason: when trigger by
1330 // markLine/markPoint/markArea, the componentType is
1331 // 'markLine'/'markPoint'/'markArea', but we should better
1332 // enable them to be queried by seriesIndex, since their
1333 // option is set in each series.
1334 if (componentType === 'markLine'
1335 || componentType === 'markPoint'
1336 || componentType === 'markArea'
1337 ) {
1338 componentType = 'series';
1339 componentIndex = params.seriesIndex;
1340 }
1341 const model = componentType && componentIndex != null
1342 && ecModel.getComponent(componentType, componentIndex);
1343 const view = model && this[
1344 model.mainType === 'series' ? '_chartsMap' : '_componentsMap'
1345 ][model.__viewId];
1346
1347 if (__DEV__) {
1348 // `event.componentType` and `event[componentTpype + 'Index']` must not

Callers 2

onLeaveFunction · 0.80
doEnterFunction · 0.80

Calls 7

getModelMethod · 0.95
findEventDispatcherFunction · 0.90
warnFunction · 0.90
extendFunction · 0.85
getSeriesByIndexMethod · 0.80
getComponentMethod · 0.80
getDataParamsMethod · 0.65

Tested by

no test coverage detected