【问题标题】:Google maps v2 control position谷歌地图v2控制位置
【发布时间】:2012-11-11 12:09:55
【问题描述】:

我正在使用带有默认 UI 的 Google maps api v2,因为设置为默认时控件看起来更好

<script type="text/javascript">
var map = null;
    function load() {
        map = new GMap2(document.getElementById('map'),
        {mapTypes:[G_PHYSICAL_MAP]});
        map.setCenter(new GLatLng(32.0000, 19.3000), 2);
        map.setUIToDefault();
    }
</script>

我想将所有控件(缩放和地图类型)放在右侧。我知道如何在 V3 中做到这一点,但在这里我迷路了。

【问题讨论】:

    标签: javascript google-maps google-maps-api-2


    【解决方案1】:

    查看positioning API

    var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT);
    map.addControl(mapTypeControl, topRight);
    

    【讨论】:

    • 这仅适用于普通控件,但在设置为默认值时无效
    猜你喜欢
    • 1970-01-01
    • 2012-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-09
    • 2013-04-16
    相关资源
    最近更新 更多