GWT Maps v3 resize problem in popup

485 views
Skip to first unread message

Jonas

unread,
Aug 21, 2012, 3:54:22 AM8/21/12
to google-we...@googlegroups.com
I'm using the GWT maps v3 javascript bindings developed by Brandon Donnelson. I have a problem that the map doesn't display correctly when I use it in a PopupPanel. It looks exactly as the picture in this thread on stack overflow:

http://stackoverflow.com/questions/11530334/second-call-of-google-maps-does-not-show-the-map-in-correct-size

I've figured out that the problem is that I need to trigger the resize event, but how can I do it?

Joseph Lust

unread,
Aug 21, 2012, 7:44:34 AM8/21/12
to google-we...@googlegroups.com
Jonas,

Using the GWT-V3-Maps-API it would be done as follows:

    /* Example of how to dynamically resize the map to fit the window - add your events */
    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            MapHandlerRegistration.trigger(mapWidget, MapEventType.RESIZE);
            GWT.log("Window has been resized!");            
        }
    });

    mapWidget.addResizeHandler(new ResizeMapHandler() {
        @Override
        public void onEvent(ResizeMapEvent event) {
            GWT.log("Map has been resized!");            
        }
    });

Sincerely,
Joseph
Reply all
Reply to author
Forward
0 new messages