fix: event fix

This commit is contained in:
多牧 2021-06-08 17:26:38 +08:00 committed by Yanyan Wang
parent 5d4665cd39
commit 77b0d62e56

View File

@ -1,16 +1,11 @@
import { IShape } from '@antv/g-base';
import {
IG6GraphEvent,
INode,
IAbstractGraph as Graph,
} from '@antv/g6-core/lib';
import { IAbstractGraph } from '@antv/g6-pc';
import { IAbstractGraph, IG6GraphEvent, Item } from '@antv/g6-pc';
export type ShapeEventListner = (
event: IG6GraphEvent,
node: INode | null,
node: Item | null,
shape: IShape,
graph: Graph,
graph: IAbstractGraph,
) => void;
export interface EventAttrs {
@ -61,7 +56,7 @@ export function appenAutoShapeListener(graph: IAbstractGraph) {
const graph = evt.currentTarget as IAbstractGraph;
const func = shape?.get(propName) as ShapeEventListner;
if (func) {
if (func && item) {
func(evt, item, shape, graph);
}
});