NavigationControl

此类表示地图的平移缩放控件。

构造函数

  • 创建平移缩放控件

    参数类型说明
    opts 可选NavigationControlOptions可选参数
    属性类型说明
    anchorControlAnchor控件的停靠位置
    enableGeolocationboolean控件是否集成定位功能
    offsetSize控件的水平偏移值
    showZoomInfoboolean是否显示级别提示信息
    typeNavigationControlType平移缩放控件的类型

    返回值 NavigationControl

    示例代码1

    const navigationControl = new BMap.NavigationControl({
    anchor: BMAP_ANCHOR_TOP_LEFT,
    type: BMAP_NAVIGATION_CONTROL_LARGE,
    showZoomInfo: true,
    });
    map.addControl(navigationControl);

方法

  • 设置平移缩放控件的类型

    参数类型说明
    typeNavigationControlType控件类型

    返回值 void

    示例代码1

    navigationControl.setType(BMAP_NAVIGATION_CONTROL_SMALL);