简体   繁体   中英

How to pan a map to a floatPane overlay in Google Maps API V3?

I have a class based on google.maps.OverlayView which implements a custom replacement for a standard InfoWindow.

You can see my custom overlays in action at http://www.qype.co.uk/uki/explore/category/883-eating-and-drinking

I need to be able to pan a map when the overlay doesn't fit completely in the visible area (standard behaviour for InfoWindows) and I can't figure out a way to do that.

I've tried something like this.map.panTo(this.getProjection().fromDivPixelToLatLng(this.getProjection().center)) but it didn't work the way I expected, so I'm somewhat lost.

i used this example ones, in that there is a method panMap which probably exactly does what you need.

http://gmaps-samples-v3.googlecode.com/svn/trunk/infowindow_custom/infowindow-custom.html

Hope it helps. The example looks very similar to your info window.

cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM