Event handler callback switched parameter after dragging
Closed this issue · 1 comments
ahmadsholehin commented
I'm trying to capture the Event parameter when someone double clicks. Basically to know that a Note has been double clicked and not a Handle.
Realised that this will work, except after when you drag the Note around. The Event e (like the example code below), would be switched to become props instead. Something like the log below:
First try
{x: 150, y: 170, dx: 162, dy: 117, color: "#3ff", …}
null
Class {dispatchConfig: {…}, _targetInst: FiberNode, _dispatchListeners: Array(2), _dispatchInstances: Array(2), nativeEvent: MouseEvent, …}
After dragging the Note
{x: 150, y: 170, dx: 162, dy: 117, color: "#3ff", …}
null
{x: 150, y: 170, dx: 162, dy: 117, color: "#3ff", …}
<EditableAnnotation
x={150}
y={170}
dy={117}
dx={162}
color={"#9610ff"}
title={"Annotations :)"}
label={"Longer text to show text wrapping"}
events={ {
onDoubleClick: ( props, state, e ) => {
console.log( props, state, e ); // e will not become an event after dragging the Note
}
} }
>
<ConnectorLine />
<Note
align={"middle"}
orientation={"topBottom"}
bgPadding={20}
padding={15}
titleColor={"#59039c"} />
</EditableAnnotation>
```
susielu commented
Thanks for flagging this. This should be fixed in v2.1.6
let me know if you have any issues.