mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
better types, fix #1794
This commit is contained in:
parent
7b99aa9813
commit
e6cb27fc64
@ -116,19 +116,19 @@ type NodeEventMap = GlobalEventHandlersEventMap & {
|
||||
[index: string]: any;
|
||||
};
|
||||
|
||||
export interface KonvaEventObject<EventType> {
|
||||
export interface KonvaEventObject<EventType, This = Node> {
|
||||
type: string;
|
||||
target: Shape | Stage;
|
||||
evt: EventType;
|
||||
pointerId: number;
|
||||
currentTarget: Node;
|
||||
currentTarget: This;
|
||||
cancelBubble: boolean;
|
||||
child?: Node;
|
||||
}
|
||||
|
||||
export type KonvaEventListener<This, EventType> = (
|
||||
this: This,
|
||||
ev: KonvaEventObject<EventType>
|
||||
ev: KonvaEventObject<EventType, This>
|
||||
) => void;
|
||||
|
||||
/**
|
||||
@ -814,7 +814,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
||||
var targets = evt.target.findAncestors(selector, true, stopNode);
|
||||
for (var i = 0; i < targets.length; i++) {
|
||||
evt = Util.cloneObject(evt);
|
||||
evt.currentTarget = targets[i];
|
||||
evt.currentTarget = targets[i] as any;
|
||||
handler.call(targets[i], evt as any);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user