Reputation: 353
d3 has zoom and pan rolled into the zoom behavior. Is there a way to disable zoom on scrollwheel but retain the ability to pan, i.e. move the map when dragging?
Upvotes: 4
Views: 2993
Reputation: 109242
The zoom behaviour really only provides the framework for what you need for zoom, the handling of the generated events is entirely up to you. You are free to ignore parts of the events, or all of them. In this case, you could simply not use the zoom, e.g. like this.
function zoomed() {
svg.attr("transform", "translate(" + d3.event.translate + ")");
// d3.event.scale is ignored
}
Upvotes: 4
Reputation: 2874
You can simply constrain the zoom with zoom.scaleExtent([extent])
and the documentation is here
Upvotes: 2