0

i am setting marker to place center of screen when it click event is trigger by user from google map. but the issue arrived that info window content is not fully visible within view port as u can see in picture below. How can i Auto-panning map by code so that info window is fully visible within view port. i disabled scrolling within content of info window.

I Half content is not showing within view port

Jd Akram
  • 47
  • 5
  • 1
    That's the default-behaviour, you don't need to do anything. Please show some code or provide a demo of the issue – Dr.Molle Oct 30 '15 at 10:46

1 Answers1

0

I found solution in StackOverFlow. By the way thanks Stackoverflow team.

google.maps.Map.prototype.panToWithOffset = function(latlng, offsetX, offsetY) {
    var map = this;
    var ov = new google.maps.OverlayView();
    ov.onAdd = function() {
        var proj = this.getProjection();
        var aPoint = proj.fromLatLngToContainerPixel(latlng);
        aPoint.x = aPoint.x+offsetX;
        aPoint.y = aPoint.y+offsetY;
        map.panTo(proj.fromContainerPixelToLatLng(aPoint));
    }; 
    ov.draw = function() {}; 
    ov.setMap(this); 
};

and called this function when marker is clicked.

Jd Akram
  • 47
  • 5
  • 1
    Does that mean this is a duplicate? Which question on StackOverflow is this from? You should reference the source. – geocodezip Oct 30 '15 at 13:14