GWT MAP 3.8 (Google API) - Related onResize() problem ?

156 views
Skip to first unread message

regnoult axel

unread,
Aug 21, 2012, 10:52:27 PM8/21/12
to google-we...@googlegroups.com
Hello,

Problem:

 - I display a map inside a popup and I have unloaded tiles (grey background).
 - If I zoom out or in, then the map will fill the entire space (no grey background anymore).

My solution:

I think I should call onResize(), isn t it ? ... and I unsuccessfully tried to :
 - use a LayoutPanel
 - call the javascript function : 

private final native void resizeMap(GoogleMap map) /*-{
$wnd.google.maps.event.trigger(map, 'resize');
}-*/;

I am using the javaxLoaderAPI and have the following code: 

        GoogleMap map;
      
        @UiField LayoutPanel gmap;

public void AjaxLoader_MAP() {

AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();

options.setOtherParms("key=********&sensor=false&language=es");
Runnable callback = new Runnable() {
public void run() {
gmap.onResize(); // Should I call onResize() here  ? 
map = GoogleMap.create(gmap.getElement());
}
};
                AjaxLoader.loadApi("maps", "3", callback, options);
     }


#1 - Have you any idea about my problem ?  
#2 - I do not know if I should call onResize() inside the Runnable callback or not ?

Thanks you,












Ulas

unread,
Jan 24, 2013, 5:57:59 PM1/24/13
to google-we...@googlegroups.com
Hi,

Have you tried

MapHandlerRegistration.trigger(mapWidgetInstance, MapEventType.RESIZE);

Where mapWidgetInstance is, as the name implies, your MapWidget object. MapHandlerRegistration class can be found in the com.google.gwt.maps.client.events package.

/Ulas
Reply all
Reply to author
Forward
0 new messages