Document Maps JavaScript API Reference Manual Map Controls Control

Control

AMap.Control

Base class for map controls, extensible to create custom map controls. Construct a map control object

new AMap.Control(opts: ControlConfig)

Parameter

opts (ControlConfig)Base class parameters for map controls

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

offset

[number, number]

The offset relative to the top-left corner of the map container, positive numbers represent shifting to the bottom-right.

Method

addTo(map)

Add controls to the map

Parametermap (Map) Map instance

Demo:

control.addTo(map);

remove()

Remove control from the map

Demo:

control.remove();

show()

Set control to visible

Demo:

control.show();

hide()

Set control to hidden

Demo:

control.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