code: function autocenter(options) {
      options = options || {};
      var needsCentering = false;
      var globe = null;
  
      var resize = function() {
        var width  = window.innerWidth + (options.extraWidth || 0);
        var height = window.innerHeight + (options.extraHeight || 0);
        globe.canvas.width = width;
        globe.canvas.height = height;
        globe.projection.translate([width / 2, height / 2]);
      };
  
      return function(planet) {
        globe = planet;
        planet.onInit(function() {
          needsCentering = true;
          d3.select(window).on('resize', function() {
            needsCentering = true;
          });
        });
  
        planet.onDraw(function() {
          if (needsCentering) { resize(); needsCentering = false; }
        });
      };
    }
docs: Plugin to resize the canvas to fill the window and to automatically center the planet when the window size changes