How to correctly position GWT google-map widget?

603 Views Asked by At

I am using GWT google maps v3. and I am having problems with map view. When I load the page I get the map half trimmed. Also when I set map center log lat and set the same parameters to a marker and add the marker to the map I don't get the marker in the center of the map. Any suggestions ?

here is my ui-binder

<g:HTMLPanel addStyleNames="{style.containser}">
   <g:HTMLPanel>
     <g:SimplePanel ui:field="mapWrapper">

     </g:SimplePanel>
   </g:HTMLPanel>

and this is where I initialize the map.

public AddressEditor() {
    HTMLPanel rootElement = ourUiBinder.createAndBindUi(this);
    mapOptions = new MapOptions();
    mapOptions.setZoom(15);
    mapOptions.setDraggable(true);
    mapOptions.setDisableDoubleClickZoom(false);
    mapOptions.setNavigationControl(true);
    mapOptions.setMapTypeControl(true);
    mapOptions.setKeyboardShortcuts(true);
    mapOptions.setMapTypeId(new MapTypeId().getRoadmap());
    mapWidget = new MapWidget(mapOptions);
    mapWidget.setSize("200px", "150px");

    mapWrapper.add(mapWidget);

    initWidget(rootElement);

  }
0

There are 0 best solutions below