谷歌地图的第二个电话不会显示正确大小的地图 [英] second call of google maps does not show the map in correct size
问题描述
使用gwt-maps-3.8.0我在gwt弹出窗口中显示路由。有一次调用但第二次调用不起作用。
我应该怎么做...一些建议刷新mapWidget?
在文档中:
$ b
当div更改大小时,开发人员应在地图上触发此事件:
google.maps.event.trigger map,'resize')
它出现在GWT中执行此操作的方式是
Event.trigger(mapWidget.getMap(),resize);
目前,就API而言,地图的大小为零,所以它只是显示(0,0)处单个像素周围的瓦片缓冲区。触发 resize
事件会导致API从浏览器中获取正确的大小,因此正确的图块将被提取以供显示。
using gwt-maps-3.8.0 i display a route in a gwt popup. Works when called once but does not work on second call.
What should i do ... some advice to refresh the mapWidget?
When you display the map, trigger its resize
event.
From the documentation:
Developers should trigger this event on the map when the div changes size:
google.maps.event.trigger(map, 'resize')
It appears the way to do this in GWT is
Event.trigger(mapWidget.getMap(), "resize");
At the moment, the map has zero size as far as the API is concerned, so it's just displaying the buffer of tiles around the single pixel at (0,0). Triggering the resize
event causes the API to get the correct size from the browser so the right tiles are fetched for display.
这篇关于谷歌地图的第二个电话不会显示正确大小的地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!