This is an example of pan limiting, trapping for zoom.translate() by passing an array, which is determined by a simple boolean network for each of x and y of the translation to ensure that dragging is constrained within the panExtent.
It is a fork of Pan+Zoom demonstrating an example of d3.behavior.zoom applied using x- and y-scales.
Requirements
-
create an object variable
var panExtent = {x: [0,600], y: [-200,Infinity] };
to set the limits of the pan -
when setting the domain test for compliance with the panExtent (the domain should be no bigger than panExtent)