bumbeishvili / org-chart

Highly customizable org chart. Integrations available for Angular, React, Vue
https://stackblitz.com/edit/web-platform-o5t1ha
MIT License
915 stars 324 forks source link

Question: Mouseup event #318

Open agtenr opened 1 year ago

agtenr commented 1 year ago

Hi,

Is there an option to expose the 'mouseup' event. currently I can see that the mousedown event is exposed on the zoomBehavior of the chart state. I would like to update the cursor based on the mousedown and mouseup event (grab and grabbing). Is this possible?

I tried registering my own mouseup event on the svg, but this seems to be prevented;

Any ideas?

bumbeishvili commented 1 year ago

Hi, I think you can receive it in zoomEnd handler, let me know if it works

https://github.com/bumbeishvili/org-chart/blob/61d458c028ffeb0e023dfe675f137b002a5209b2/src/d3-org-chart.js#L75

agtenr commented 1 year ago

Where can I access this. I'm using it in react/typescript, and the OrgChart does not have a onZoomEnd prop.

bumbeishvili commented 1 year ago

You can access it using

chart.onZoomEnd(event=>console.log('event'))

This was added from v3, so make sure you are using the latest version and have a look at breaking changes too

https://github.com/bumbeishvili/org-chart/pull/213

agtenr commented 1 year ago

Awesome, got it. Thank for the quick response