我们正在从Google Map API v2更新到v3,到目前为止我已经能够实现所有必需的功能。至少在最新版本的IE,Firefox和Chrome方面。我们也有要求API必须在IE9上运行。可悲的是,它甚至没有出现在那里。
相关代码(简化,我注释了代码,然后跳转到另一个位置并为结果放置标记):
@UiField
SimplePanel mapWrapper;
[...]
MapOptions options = MapOptions.create();
options.setCenter(LatLng.create(46.81819, 8.22751));
options.setZoom(5);
options.setMapTypeId(MapTypeId.ROADMAP);
options.setDraggable(true);
options.setMapTypeControl(true);
options.setPanControl(true);
options.setScaleControl(true);
options.setScrollwheel(true);
options.setStreetViewControl(true);
mapWrapper.setSize("350px", "350px");
m_Map = GoogleMap.create(mapWrapper.getElement(), options);
m_Map.triggerCenterChanged();
m_Map.triggerResize();
虽然IE10包含
<div style="width: 350px; height: 350px; overflow: hidden; position: relative; background-color: rgb(229, 227, 223);">
<div style="left: 0px; top: 0px; width: 100%; height: 100%; overflow: hidden; position: absolute; z-index: 0;">
[...] // all the tags which make up the api and its content
</div>
</div>
IE9 只有
<div style="width: 350px; height: 350px;">
<div style="overflow: hidden;">
</div>
</div>
在同一位置。
(由
OP在问题编辑中回答。 转换为社区维基答案。请参阅没有答案的问题,但问题在评论中得到解决(或在聊天中扩展) )
OP写道:
确实存在一个JS错误,指出API被多次加载。
在 -.gwt.xml 文件中删除以下第一行后,IE9 能够加载 API 并按预期工作。
<script src="http://maps.google.com/maps/api/js?sensor=false" />
<script src="http://maps.google.com/maps/api/js?sensor=false&v=3&libraries=geometry" />
令我感到困惑的是,其他浏览器都没有问题。