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
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
Parameter: overlay (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
For event object property descriptions, go to:MapsEvent