silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
183 stars 18 forks source link

Improve hook to register events on canvas #1481

Closed axelboc closed 1 year ago

axelboc commented 1 year ago

I'm rethinking useCanvasEvents a bit. The hook is now called useCanvasEvent (singular) and allows registering only one event listener at a time. This brings the API closer to that of useEventListener from react-hookz and avoids registering event listeners that are not actually used.

Additional benefits of the new implementation: