On Mon, Dec 21, 2009 at 6:19 AM, Andrew Winter <[email protected]> wrote:
> Hi,
>
> I have the exact same problem as Jeff. One difference between Jeff's
> case and Eric's case is that in Jeff's case, the dimensions of the map
> are not known; in Eric's case the map is 400px by 500px. It seems this
> problem occurs when the dimensions of the map are not known at build-
> time.
>
> I want my map to occupy the bottom-right corner of my UI (like Google
> Maps). When I use setSize("100%,"100%"), the MapWidget is given the
> correct size (the Google logo etc appear in the right place) but the
> tiles don't cover the whole of the widget.

The trick I used to schedule checkResizeAndCenter() in a timer
callback solved that issue for me

> When I provide an explicit
> size, or resize the browser, the tiles are displayed correctly.
>
> I don't really want to provide dimensions in pixels if I don't have
> to. Is this the only way?

In the past I've always recommended dimensions in pixels for best
results.  You could hack around this by hooking into the resize event
listener.

>
> Thanks
>
> Andrew.
>
> On Dec 17, 6:44 pm, Eric Ayers <[email protected]> wrote:
>> Hi Jeff,
>>
>> I played around with this and got it to work with these panels:
>>
>> private MapWidget map;
>>
>> // GWT module entry point method.
>>  public void onModuleLoad() {
>> Maps.loadMapsApi(null, null, false, new Runnable() {
>>  public void run() {
>> LatLng cawkerCity = LatLng.newInstance(39.509, -98.434);
>>  // Open a map centered on Cawker City, KS USA
>>
>> map = new MapWidget(cawkerCity, 2);
>>  map.setSize("100%", "100%");
>> map.setUIToDefault();
>>
>> DockLayoutPanel dock = new DockLayoutPanel(Unit.PX);
>> dock.setHeight("600px");
>>  dock.setWidth("400px");
>> SplitLayoutPanel split = new SplitLayoutPanel();
>>  dock.add(split);
>> split.addNorth(map, 500);
>> split.setWidth("100%");
>>  split.setHeight("100%");
>> // Add the map to the HTML host page
>>  RootPanel.get().add(dock);
>> new Timer() {
>> public void run() {
>>  map.checkResizeAndCenter();
>>
>>
>>
>> }
>> }.schedule(1);
>>  }
>> });
>> }
>> On Sat, Dec 12, 2009 at 3:51 AM, Jeff Schnitzer <[email protected]> wrote:
>> > Does anyone have the GWT Google maps working inside the new Layout
>> > panels?
>>
>> > My page is basically a DockLayoutPanel whose main element is a
>> > SplitLayoutPanel whose main element is a MapWidget.  The MapWidget is
>> > set to 100% size.
>>
>> > On startup, the map tiles are sized to a very small part of the area,
>> > although the grey background does seem to cover the entire space:
>>
>> >http://www.infohazard.org/~jeff/mapnolayout.png
>>
>> > If I resize the browser window, the map quickly covers the whole area
>> > and starts to work normally.
>>
>> > I've tried calling MapWidget.checkResize() and the LayoutPanel's
>> > forceLayout() methods but neither have an effect.  Any idea what I'm
>> > doing wrong?
>>
>> > The code is super-simple:
>>
>> >        SplitLayoutPanel split = new SplitLayoutPanel();
>> >        this.add(split);  // to the DockLayoutPanel
>>
>> >        split.addWest(new HTML("<p>blah</p>"), 200);
>>
>> >        LatLng cawkerCity = LatLng.newInstance(39.509, -98.434);
>> >        MapWidget map = new MapWidget(cawkerCity, 4);
>> >        map.setSize("100%", "100%");
>> >        split.add(map);
>>
>> > Thanks,
>> > Jeff
>>
>> > --
>>
>> > You received this message because you are subscribed to the Google Groups
>> > "Google Web Toolkit" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected]<google-web-toolkit%[email protected]>
>> > .
>> > For more options, visit this group at
>> >http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>> --
>> Eric Z. Ayers
>> Google Web Toolkit, Atlanta, GA USA
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>



-- 
Eric Z. Ayers
Google Web Toolkit, Atlanta, GA USA

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to