4

I have a google map with a custom control over it, covering 35% of the right area:

  var myControl = document.getElementById('tireshopsPickerList');
  map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(myControl);

When the user enter an address in an input box above the map I geocode it and build a list of shops nearby; I place markers and then I currently use fitbounds to secure the first 5 shops are visible on the map:

      var fullBounds = new google.maps.LatLngBounds();
      _.each(
        _.first(shops, 5),
        function (s) {
          var point = new google.maps.LatLng(
            parseFloat(s.shop.latitude),
            parseFloat(s.shop.longitude)
            );

          fullBounds.extend(point);
        });
      map.fitBounds(fullBounds);

The problem is some of the markers lay behind the custom control and are not visible. I was wondering if there's a way of telling the map to make the 5 shops visible not just on the whole map, but a specific area of the map. Is that possible?

Max Favilli
  • 6,161
  • 3
  • 42
  • 62

0 Answers0