title: Google Maps JavaScript API - fitbounds together with setCenter
body: <p>I've been looking around for a solution to this problem, but i can't seem to find somthing that solves this. The closest i get is <a href="https://stackoverflow.com/questions/8969742/javascript-google-map-api-v3-fitbounds-with-center-location">this thread</a>. But this doesn't work.</p>
  
  <p>What i'm trying to do is to run fitbounds based on a set of markers which works fine. But i would also like to center the map based on the users location (the bouncing marker in the plunk) and still keep all markers within the map view.
  If i try to setCenter after fitBounds, some markers are outside of the map view.
  Is there some nifty way of combining these two functions?
  <a href="http://plnkr.co/edit/Wvbh9a?p=preview" rel="nofollow noreferrer">Here's the plunk illustrating the issue</a>.</p>
  
  <pre><code>function initialize() {
    var userCenter = new google.maps.LatLng(51.508742, -0.120850);
  
    var userCenterMarker = new google.maps.Marker({
    position: userCenter
  });
  
   userCenterMarker.setAnimation(google.maps.Animation.BOUNCE);
  
  var mapProp = {
    center: userCenter,
    zoom: 12,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  var map = new google.maps.Map(document.getElementById("googleMap"),   mapProp);
  
  var bounds = new google.maps.LatLngBounds();
  var markers = getMarkers();
  
  $(markers).each(function() {
    bounds.extend(this.position);
    this.setMap(map);
  });
  
  userCenterMarker.setMap(map);
  
  map.fitBounds(bounds);
  
  setTimeout(function() {
    map.setCenter(userCenter);
  }, 1500);
  }
  </code></pre>
  
  <p>Thanks!</p>