g1mahadik
g1mahadik

Reputation: 1

e.relatedTarget is undefined in onMouseOver event on react-konva node

I've written onMouseOver event for a shape/node - '' in React-Konva. Here I'm able to access e.target . But I'm getting 'undefined' for e.relatedTarget . Can anyone please explain how to get that value? Thanks. Below is my code....

<Stage width={window.innerWidth} height={window.innerHeight}>
    <Layer>
        <Rect x={50} y={50} onMouseOver={onMouseOverRect}/>
    </Layer>
</Stage>

const onMouseOverRect = (e) => {
const trgt = e.target;
const relTrgt = e.relatedTarget;
console.log(trgt, "target");
console.log(relTrgt, "related Target");  
};

I tried OnMouseEnter also. Same result. I tried googling it. But I couldn't find anywhere it is used in React Konva Canvas.

Upvotes: 0

Views: 90

Answers (1)

lavrton
lavrton

Reputation: 20373

There is no relatedTarget in Konva events. There is:

  1. e.target - initial target of event, usually shape
  2. e.currentTarget - the node where you attach a listener

Upvotes: 0

Related Questions