code: function () {
      var offset = this.model.get("offset");
  
      if (!this.model.get("autoPan") || this.isHidden()) { return; }
  
      var
      x               = this.$el.position().left,
      y               = this.$el.position().top,
      containerHeight = this.$el.outerHeight(true) + 15, // Adding some more space
      containerWidth  = this.$el.width(),
      pos             = this.mapView.latLonToPixel(this.model.get("latlng")),
      adjustOffset    = {x: 0, y: 0};
      size            = this.mapView.getSize()
      wait_callback   = 0;
  
      if (pos.x - offset[0] < 0) {
        adjustOffset.x = pos.x - offset[0] - 10;
      }
  
      if (pos.x - offset[0] + containerWidth > size.x) {
        adjustOffset.x = pos.x + containerWidth - size.x - offset[0] + 10;
      }
  
      if (pos.y - containerHeight < 0) {
        adjustOffset.y = pos.y - containerHeight - 10;
      }
  
      if (pos.y - containerHeight > size.y) {
        adjustOffset.y = pos.y + containerHeight - size.y;
      }
  
      if (adjustOffset.x || adjustOffset.y) {
        this.mapView.panBy(adjustOffset);
        wait_callback = 300;
      }
  
      return wait_callback;
    }
docs: Adjust pan to show correctly the infowindow