code: function visibilityCheck() {
      var graphBound = g.node().getBoundingClientRect(),
          containerBound = container[0].getBoundingClientRect();
  
      if(graphBound.right < containerBound.left ||
        graphBound.bottom < containerBound.top ||
        graphBound.left > containerBound.right ||
        graphBound.top > containerBound.bottom) {
          panX = PADDING;
          panY = PADDING;
          scale = 1;
          transform(true);
      }
    }
docs: Check if the item have moved out of the visible area, and reset if required