Document Maps JavaScript API Reference Manual Map Controls ToolBar

ToolBar

AMap.ToolBar

Map Operation Toolbar Control. Supports directional navigation, location positioning, view level zooming, view level selection, and other operations. Inherits from AMap.Control. Constructs a map operation toolbar object.

new AMap.ToolBar(opts: ControlConfig)

Parameter

opts (ControlConfig)Map Operation Toolbar Plugin Parameters

Attribute

Type

Description

position

string | object

Control docking position { top: "5px", left: "5px", right: "5px", bottom: "5px" } or 'LT': top-left, 'RT': top-right, 'LB': bottom-left, 'RB': bottom-right. Default 'RB': bottom-right.

offset

[number, number]

The offset relative to the position, a positive offset indicates an offset within the map, i.e., moving inward.

Demo

AMap.plugin(["AMap.ToolBar"], function () {
  //Load Toolbar
  var tool = new AMap.ToolBar();
  map.addControl(tool);
});

Method

addTo(map)

Add control to map

Parametermap (Map) Map instance

Demo:

tool.addTo(map);

remove()

Remove control from map

Demo:

tool.remove();

show()

Show control

Demo:

tool.show();

hide()

Hide control

Demo:

tool.hide();

Event

Event Name

Description

show

Trigger this event when displayed

hide

This event is triggered when hidden

For event object property descriptions, go to:MapsEvent