Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event handler callback switched parameter after dragging #22

Closed
ahmadsholehin opened this issue Jan 24, 2019 · 1 comment
Closed

Event handler callback switched parameter after dragging #22

ahmadsholehin opened this issue Jan 24, 2019 · 1 comment

Comments

@ahmadsholehin
Copy link

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
Copy link
Owner

susielu commented Jan 26, 2019

Thanks for flagging this. This should be fixed in v2.1.6 let me know if you have any issues.

@susielu susielu closed this as completed Jan 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants