Document Maps JavaScript API Reference Manual Tool Category CircleEditor

CircleEditor

AMap.CircleEditor

Circle editing plugin. Used to edit AMap.Circle objects, features include changing the radius of the circle with the mouse, dragging the center of the circle to change its position. Construct a circle editing plugin object

new AMap.CircleEditor(map: Map, circle: Circle?, opts: Object?)

Parameter

map (Map) Map instance

circle (Circle?) AMap.Circle instance

opts (Object?) Set parameters

Attribute

Type

Description

createOptions

Object?

Newly created object style

editOptions

Object?

Edit style

movePoint

Object?

Move point style MarkerOptions

resizePoint

Object?

Resize point style MarkerOptions

Demo

//Introduce the circle editor plugin
map.plugin(["AMap.CircleEditor"], function () {
  //Instantiate the circle editor, passing in the map instance and the circle instance to be edited
  var circleEditor = new AMap.CircleEditor(map, circle);
  //Enable Edit Mode
  circleEditor.open();
});

Method

setTarget(overlay?)

Set Edit Object

Parameteroverlay (Circle?) Edit Object

Demo:

//Create Circle Instance
var circle = new AMap.Circle({
  center: new AMap.LngLat(116.433322, 39.900255), //Center of Circle
  radius: 1000, 
});
map.add(circle);
//Instantiate the circular editor, passing in the map instance and the circular instance to be edited
var circleEditor = new AMap.CircleEditor(map);
//Set circle as the circular instance to be edited
circleEditor.setTarget(circle);
circleEditor.open();

getTarget()

Get editing object

return value:  (Circle | undefined) Currently editing object

Demo:

circleEditor.getTarget();

open()

Start editing object

Demo:

circleEditor.open();

close()

Stop editing the object

Demo:

circleEditor.close();

Event

Event Name

Description

adjust

This event is triggered when resizing the circle

move

This event is triggered when moving the overlay

add

This event is triggered after creating an overlay, and the target is the created object. When the editor's editing object is empty, calling the open interface and clicking the screen once will create a new overlay object

end

This event is triggered after calling close, and the target is the edited overlay object

For event object property descriptions, go to:MapsEvent