d3 / d3-zoom

Pan and zoom SVG, HTML or Canvas using mouse or touch input.
https://d3js.org/d3-zoom
ISC License
501 stars 144 forks source link

documentation for zoom.on does not provide sufficient information to understand its use #250

Closed christopherreay closed 2 years ago

christopherreay commented 2 years ago

The documentation seems to be assuming knowledge of many ideas.

I have read it, and dispatcher.on, and I have looked at the source code of the d3-zoom zoom.js

There is no information describing what actually needs to be done to listen to zoom events. There is a lot of information about zoom events, but it seems to be talking around the point and assuming that someone already knows some undetermined, implicit information

Registering a listener zoom().on("zoom", event => console.log(event) prints "undefined" into the console for every event. It appears that there are possibly events like "mousewheel.zoom" or something... But there is no documentation about this.

There is no example of a working event listener, which might help.

christopherreay commented 2 years ago

Hang on, maybe I am somehow mixing the documentation for d3fc-zoom and d3-zoom, and it is their documentation that is odd.

Fil commented 2 years ago

The documentation also has lots of links to examples.