---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/geometryEditor.Polygon.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt

# geometryEditor.Polygon

Extends [IGeometryEditor](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometryEditor.md).

The "Polygon" geometry editor.

[Constructor](#constructor-summary) | [Fields](#properties-summary) | [Events](#events-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
geometryEditor.Polygon(geometry[, options])
```

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`geometry`](#param-geometry)[*](*star) | — | Type: [IPolygonGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IPolygonGeometry.md)

The "Polygon" geometry. ||
|| [`options`](#param-options) | — | Type: Object

Options for the geometry editor. ||
|| [`options.dblClickHandler`](#param-options.dblClickHandler) | — | Type: Function

Handler for double-clicking a vertex. Accepts a reference to a model of the vertex being edited. By default, the handler is defined by the function that removes the corresponding vertex. ||
|| [`options.drawingCursor`](#param-options.drawingCursor) | "arrow" | Type: Boolean

The mouse cursor in the mode for adding new vertexes. ||
|| [`options.drawOver`](#param-options.drawOver) | true | Type: Boolean

Allows to put points on top of map objects in the mode for adding new vertexes. ||
|| [`options.edgeInteractiveOptions`](#param-options.edgeInteractiveOptions) | true | Type: Boolean

Allows the intermediate vertices placemarks to use options with postfixes linked to the current state of the placemark. The following postfixes are available: 
- Drag - Options with this given postfix are used when the user drags a placemark.
- Hover - Options with this given postfix are used when the user hovers over a placemark with the mouse pointer.
Examples of such options: edgeLayoutHover, edgeIconImageSizeActive, edgeIconImageShapeHover, etc. If you do not want to change the options of intermediate vertices placemarks depending on their state, then you will need to disable this option. ||
|| [`options.edgeLayout`](#param-options.edgeLayout) | — | Type: Function

Class of the layout for interim placemarks. ||
|| [`options.maxPoints`](#param-options.maxPoints) | Infinity | Type: Number

The maximum allowable number of vertexes on a polygon. ||
|| [`options.menuManager`](#param-options.menuManager) | — | Type: Function

Context menu dispatcher for the menu that opens when clicking on a vertex. Accepts two arguments: 
- An array of objects describing the context menu items for this vertex.
- A reference to a model of the vertex being edited.
The dispatcher can change data in the passed array. Must return an array of objects that describe context menu items. ||
|| [`options.minPoints`](#param-options.minPoints) | 0 | Type: Number

The minimum allowable number of vertexes on a polygon. ||
|| [`options.useAutoPanInDrawing`](#param-options.useAutoPanInDrawing) | true | Type: Boolean

Enables autopan of the map when dragging a vertex on the boundary. ||
|| [`options.useMapMarginInDrawing`](#param-options.useMapMarginInDrawing) | true | Type: Boolean

Whether to use map margins in drawing mode. ||
|| [`options.vertexInteractiveOptions`](#param-options.vertexInteractiveOptions) | true | Type: Boolean

Allows the vertices placemarks to use options with postfixes linked to the current state of the vertex. The following postfixes are available: 
- Hover - Options with this given postfix are used when the user hovers over a vertex with the mouse pointer.
- Drag - Options with this given postfix are used when the user drags a vertex.
- Active - Options with this given postfix are used when the context menu is opened for the vertex.
Examples of such options: vertexLayoutHover, vertexIconImageSizeActive, vertexIconImageShapeHover, etc. If you do not want to change the options of vertices placemarks depending on their state, then you will need to disable this option. ||
|| [`options.vertexLayout`](#param-options.vertexLayout) | — | Type: Function

Class of the layout for placemarks on polygon vertexes. ||
|#

\* Mandatory parameter/option.

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events) | [IEventManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md)| Event manager.

Inherited from [IEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events). ||
|| [geometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometryEditor.md#geometry) | [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md)| The geometry being edited.

Inherited from [IGeometryEditor](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometryEditor.md#geometry). ||
|| [options](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options) | [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md)| Options manager.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options). ||
|| [state](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#state) | [IDataManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDataManager.md)| Manager for the state of the geometry editor.

Data fields that are available via the "get" and "set" methods:

- editing - Checks whether editing mode is enabled. Type - Boolean. Default value - false.
- drawing - Checks whether vertex drawing mode is enabled. Type - Boolean. Default value - false.
- drawingFrom - Checks how new points are added in drawing mode. Accepts one of two string values: "begin" - points are added at the beginning of the polygon; "end" - points are added at the end.
- drawingFromIndex - The index of the polygon vertex after which new points will be added in drawing mode. This field is available only during editing, because saving changes rearranges the order of vertexes in the polygon 	so that the point with the specified index becomes the last one. Type - integer.
- drawingPath - The index of the polygon contour where new points are added in drawing mode. Type - integer. Default value - 0. ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [beforeedgedrag](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-beforeedgedrag)| Event preceding the "edgedrag" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelOffset - Array of two numbers that describe the pixel offset at this step.
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates.
Names of methods that are accessible via [Event.callMethod](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#callMethod): 
- setPixelOffset - This method is for correcting the value of the pixel offset that will 	actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, a subsequent "edgedrag" event will be canceled. ||
|| [beforeedgedragstart](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-beforeedgedragstart)| Event preceding the "edgedragstart" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- domEvent - Source DOM event (as a [DomEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/DomEvent.md) object), if there is one.
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates.
If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, any subsequent dragging, as well as the "edgedragstart" event, will be canceled. ||
|| [beforevertexadd](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-beforevertexadd)| Event preceding the "vertexadd" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- parentModel - Reference to the parent data model for the vertex being added.
- vertexIndex - Index of the vertex being added.
- globalPixels - Coordinates of the vertex being added, in global pixel coordinates.
Names of methods that are accessible via [Event.callMethod](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#callMethod): 
- setGlobalPixels - Use this method to correct the coordinate values of the added vertex. It takes an argument with the new global pixel coordinates of the vertex as an array of two numbers.
If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, a subsequent "vertexadd" event will be canceled. ||
|| [beforevertexdrag](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-beforevertexdrag)| Event preceding the "vertexdrag" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelOffset - Array of two numbers that describe the pixel offset at this step.
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates.
Names of methods that are accessible via [Event.callMethod](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#callMethod): 
- setPixelOffset - This method is for correcting the value of the pixel offset that will 	actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, a subsequent "vertexdrag" event will be canceled. ||
|| [beforevertexdragstart](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-beforevertexdragstart)| Event preceding the "vertexdragstart" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- domEvent - Source DOM event (as a [DomEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/DomEvent.md) object), if there is one.
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates.
If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, any subsequent dragging, as well as the"vertexdragstart" event, will be canceled. ||
|| [beforevertexdraw](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-beforevertexdraw)| Event preceding the "vertexdraw" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- parentModel - Reference to the parent data model for the vertex being added.
- vertexIndex - Index of the vertex being added.
- globalPixels - Coordinates of the vertex being added, in global pixel coordinates.
Names of methods that are accessible via [Event.callMethod](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#callMethod): 
- setGlobalPixels - Use this method to correct the coordinate values of the added vertex. It takes an argument with the new global pixel coordinates of the vertex as an array of two numbers.
If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, a subsequent "vertexdraw" event will be canceled. ||
|| [drawingstart](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-drawingstart)| Enabling the mode for adding new vertexes. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [drawingstop](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-drawingstop)| Disabling the mode for adding new vertexes. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [edgedrag](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-edgedrag)| Dragging an interim placemark. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelOffset - Array of two numbers that describe the pixel offset at this step.
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates. ||
|| [edgedragend](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-edgedragend)| End of dragging an interim placemark. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates. ||
|| [edgedragstart](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-edgedragstart)| Start of dragging an interim placemark. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- domEvent - Source DOM event (as a [DomEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/DomEvent.md) object), if there is one.
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates. ||
|| [editingstart](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-editingstart)| Enabling the mode for editing vertexes. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [editingstop](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-editingstop)| Disabling the mode for editing vertexes. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [framingstart](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-framingstart)| Enabling the zoom mode. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [framingstop](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-framingstop)| Disabling the zoom mode. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [optionschange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange)| Change to the object options.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange). ||
|| [statechange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometryEditor.md#event-statechange)| Change to the geometry editor state. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

Inherited from [IGeometryEditor](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometryEditor.md#event-statechange). ||
|| [vertexadd](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-vertexadd)| Adding a new vertex. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- parentModel - Reference to the parent data model for the vertex that was added.
- vertexIndex - Index of the vertex that was added.
- globalPixels - Coordinates of the vertex that was added, in global pixel coordinates. ||
|| [vertexdrag](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-vertexdrag)| Dragging a vertex. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelOffset - Array of two numbers that describe the pixel offset at this step.
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates. ||
|| [vertexdragend](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-vertexdragend)| End of vertex dragging. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates. ||
|| [vertexdragstart](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-vertexdragstart)| Start of vertex dragging. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- domEvent - Source DOM event (as a [DomEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/DomEvent.md) object), if there is one.
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates. ||
|| [vertexdraw](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#event-vertexdraw)| Drawing a new vertex. This event usually precedes the add vertex event, and occurs when the mouse moves and the mode for adding new vertexes is enabled. Based on data passed in this event, guide lines are displayed in vertex drawing mode. Instance of the Event class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- parentModel - Reference to the parent data model for the vertex being added.
- vertexIndex - Index of the vertex being added.
- globalPixels - Coordinates of the vertex being added, in global pixel coordinates. ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [getModel](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#getModel)() | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md)
| Returns the promise object, which is confirmed by the model object at the time it is actually created, or is rejected with one of the following error messages: 
- Canceled - Editing mode is disabled until the model is actually 	created.
- Editor wasn't started - Editing mode is not enabled. ||
|| [getModelSync](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#getModelSync)() | [geometryEditor.model.RootPolygon](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.model.RootPolygon.md)\|null
| Returns the editor's model, or null if it is missing at the time of the call. ||
|| [getView](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#getView)() | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md)
| Returns the promise object, which is confirmed by the representation object at the time it is actually created, or is rejected with one of the following error messages: 
- Canceled - Editing mode is disabled until the representation is actually created.
- Editor wasn't started - Editing mode is not enabled. ||
|| [getViewSync](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#getViewSync)() | [geometryEditor.view.MultiPath](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.view.MultiPath.md)\|null
| Returns the editor's representation, or null if it is missing at the time of the call. ||
|| [startDrawing](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#startDrawing)() | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md)
| Enables drawing mode (for adding new vertexes to a polygon). Enabling occurs asynchronously. ||
|| [startEditing](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#startEditing)() | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md)
| Enables edit mode (for adding new vertexes to a polygon). Enabling occurs asynchronously. ||
|| [startFraming](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#startFraming)() | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md)
| Enables the zoom mode for a polygon. Enabling occurs asynchronously. ||
|| [stopDrawing](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#stopDrawing)() | | Disables drawing mode (for adding new vertexes to a polygon). ||
|| [stopEditing](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#stopEditing)() | | Disables edit mode. ||
|| [stopFraming](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geometryEditor.Polygon.md#stopFraming)() | | Disables the zoom mode. ||
|#

## Fields details {#field_detail}

### state {#state}

```javascript
{IDataManager} state
```

Manager for the state of the geometry editor.

Data fields that are available via the "get" and "set" methods:

- editing - Checks whether editing mode is enabled. Type - Boolean. Default value - false.
- drawing - Checks whether vertex drawing mode is enabled. Type - Boolean. Default value - false.
- drawingFrom - Checks how new points are added in drawing mode. Accepts one of two string values: "begin" - points are added at the beginning of the polygon; "end" - points are added at the end.
- drawingFromIndex - The index of the polygon vertex after which new points will be added in drawing mode. This field is available only during editing, because saving changes rearranges the order of vertexes in the polygon 	so that the point with the specified index becomes the last one. Type - integer.
- drawingPath - The index of the polygon contour where new points are added in drawing mode. Type - integer. Default value - 0.

## Events details {#event_detail}

### beforeedgedrag {#beforeedgedrag}

Event preceding the "edgedrag" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelOffset - Array of two numbers that describe the pixel offset at this step.
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates.
Names of methods that are accessible via [Event.callMethod](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#callMethod): 
- setPixelOffset - This method is for correcting the value of the pixel offset that will 	actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, a subsequent "edgedrag" event will be canceled.

### beforeedgedragstart {#beforeedgedragstart}

Event preceding the "edgedragstart" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- domEvent - Source DOM event (as a [DomEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/DomEvent.md) object), if there is one.
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates.
 If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, any subsequent dragging, as well as the "edgedragstart" event, will be canceled.

### beforevertexadd {#beforevertexadd}

Event preceding the "vertexadd" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- parentModel - Reference to the parent data model for the vertex being added.
- vertexIndex - Index of the vertex being added.
- globalPixels - Coordinates of the vertex being added, in global pixel coordinates.
 Names of methods that are accessible via [Event.callMethod](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#callMethod): 
- setGlobalPixels - Use this method to correct the coordinate values of the added vertex. It takes an argument with the new global pixel coordinates of the vertex as an array of two numbers.
 If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, a subsequent "vertexadd" event will be canceled.

**Examples:**

**1.**

```javascript
// Prohibiting adding new vertexes further than 100 pixels from the map center.
polygon.editor.events.add("beforevertexadd", function (event) {
    var mapGlobalPixelCenter = geoMap.getGlobalPixelCenter();
    var globalPixels = event.get("globalPixels");
    var vector = [mapGlobalPixelCenter[0] - globalPixels[0], mapGlobalPixelCenter[1] - globalPixels[1]];
    var vectorLength = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
    if (dist > 100) {
        event.preventDefault();
    }
});
```

**2.**

```javascript
// Adjusting coordinates of the add vertex events so they fall inside a square 
// with 100-pixel sides that is centered at the map center.
polygon.editor.events.add(["beforevertexdraw", "beforevertexadd"], function (event) {
    var mapGlobalPixelCenter = geoMap.getGlobalPixelCenter();
    var globalPixels = event.get("globalPixels");
    var pixelBounds = [
        [mapGlobalPixelCenter[0] - 100, mapGlobalPixelCenter[1] - 100],
        [mapGlobalPixelCenter[0] + 100, mapGlobalPixelCenter[1] + 100]
    ];
    event.callMethod("setGlobalPixels", [
        Math.max(Math.min(globalPixels[0], pixelBounds[1][0]), pixelBounds[0][0]),
        Math.max(Math.min(globalPixels[1], pixelBounds[1][1]), pixelBounds[0][1])
    ]);
});
```

### beforevertexdrag {#beforevertexdrag}

Event preceding the "vertexdrag" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelOffset - Array of two numbers that describe the pixel offset at this step.
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates.
 Names of methods that are accessible via [Event.callMethod](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#callMethod): 
- setPixelOffset - This method is for correcting the value of the pixel offset that will 	actually be applied. It takes an argument with the new pixel offset in the form of an array of two numbers.
 If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, a subsequent "vertexdrag" event will be canceled.

### beforevertexdragstart {#beforevertexdragstart}

Event preceding the "vertexdragstart" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- domEvent - Source DOM event (as a [DomEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/DomEvent.md) object), if there is one.
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates.
 If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, any subsequent dragging, as well as the"vertexdragstart" event, will be canceled.

**Example:**

```javascript
// Prohibiting dragging vertexes with the index 0 in a contour with the same index.
polygon.editor.events.add("beforevertexdragstart", function (event) {
    var vertexModel = event.get("vertexModel");
    var pathModel = vertexModel.getParent();
    if (pathModel.getIndex() == 0 && vertexModel.getIndex() == 0) {
        event.preventDefault();
    }
});
```

### beforevertexdraw {#beforevertexdraw}

Event preceding the "vertexdraw" event. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- parentModel - Reference to the parent data model for the vertex being added.
- vertexIndex - Index of the vertex being added.
- globalPixels - Coordinates of the vertex being added, in global pixel coordinates.
 Names of methods that are accessible via [Event.callMethod](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#callMethod): 
- setGlobalPixels - Use this method to correct the coordinate values of the added vertex. It takes an argument with the new global pixel coordinates of the vertex as an array of two numbers.
 If the [Event.preventDefault](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#preventDefault) method is called for this event, a subsequent "vertexdraw" event will be canceled.

### drawingstart {#drawingstart}

Enabling the mode for adding new vertexes. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

### drawingstop {#drawingstop}

Disabling the mode for adding new vertexes. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

### edgedrag {#edgedrag}

Dragging an interim placemark. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelOffset - Array of two numbers that describe the pixel offset at this step.
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates.

### edgedragend  {#edgedragend}

End of dragging an interim placemark. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates.

### edgedragstart {#edgedragstart}

Start of dragging an interim placemark. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- domEvent - Source DOM event (as a [DomEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/DomEvent.md) object), if there is one.
- edgeModel - Reference to the model of the draggable placemark.
- globalPixels - Coordinates of the draggable placemark, in global pixel coordinates.

### editingstart {#editingstart}

Enabling the mode for editing vertexes. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

### editingstop {#editingstop}

Disabling the mode for editing vertexes. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

### framingstart {#framingstart}

Enabling the zoom mode. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

### framingstop {#framingstop}

Disabling the zoom mode. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

### vertexadd {#vertexadd}

Adding a new vertex. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- parentModel - Reference to the parent data model for the vertex that was added.
- vertexIndex - Index of the vertex that was added.
- globalPixels - Coordinates of the vertex that was added, in global pixel coordinates.

### vertexdrag {#vertexdrag}

Dragging a vertex. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- pixelOffset - Array of two numbers that describe the pixel offset at this step.
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates.

### vertexdragend {#vertexdragend}

End of vertex dragging. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates.

### vertexdragstart {#vertexdragstart}

Start of vertex dragging. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- domEvent - Source DOM event (as a [DomEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/DomEvent.md) object), if there is one.
- vertexModel - Reference to the model of the draggable vertex.
- globalPixels - Coordinates of the draggable vertex, in global pixel coordinates.

### vertexdraw {#vertexdraw}

Drawing a new vertex. This event usually precedes the add vertex event, and occurs when the mouse moves and the mode for adding new vertexes is enabled. Based on data passed in this event, guide lines are displayed in vertex drawing mode. Instance of the Event class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- parentModel - Reference to the parent data model for the vertex being added.
- vertexIndex - Index of the vertex being added.
- globalPixels - Coordinates of the vertex being added, in global pixel coordinates.

## Methods details {#method_detail}

### getModel {#getModel}

```javascript
{vow.Promise} getModel()
```

**Returns** the promise object, which is confirmed by the model object at the time it is actually created, or is rejected with one of the following error messages: 
- Canceled - Editing mode is disabled until the model is actually 	created.
- Editor wasn't started - Editing mode is not enabled.

### getModelSync {#getModelSync}

```javascript
{geometryEditor.model.RootPolygon|null} getModelSync()
```

**Returns** the editor's model, or null if it is missing at the time of the call.

### getView {#getView}

```javascript
{vow.Promise} getView()
```

**Returns** the promise object, which is confirmed by the representation object at the time it is actually created, or is rejected with one of the following error messages: 
- Canceled - Editing mode is disabled until the representation is actually created.
- Editor wasn't started - Editing mode is not enabled.

### getViewSync {#getViewSync}

```javascript
{geometryEditor.view.MultiPath|null} getViewSync()
```

**Returns** the editor's representation, or null if it is missing at the time of the call.

### startDrawing {#startDrawing}

```javascript
{vow.Promise} startDrawing()
```

Enables drawing mode (for adding new vertexes to a polygon). Enabling occurs asynchronously.

**Returns** the promise object, which is confirmed when drawing mode has actually started, or is rejected with one of the following error messages: 
- Canceled - Drawing mode is disabled until it is actually 	started.

### startEditing {#startEditing}

```javascript
{vow.Promise} startEditing()
```

Enables edit mode (for adding new vertexes to a polygon). Enabling occurs asynchronously.

**Returns** the promise object, which is confirmed when editing mode has actually started, or is rejected with one of the following error messages: 
- Canceled - Editing mode is disabled until it is actually started.

### startFraming {#startFraming}

```javascript
{vow.Promise} startFraming()
```

Enables the zoom mode for a polygon. Enabling occurs asynchronously.

**Returns** the promise object that is confirmed when zoom mode actually starts.

### stopDrawing {#stopDrawing}

```javascript
{} stopDrawing()
```

Disables drawing mode (for adding new vertexes to a polygon).

### stopEditing {#stopEditing}

```javascript
{} stopEditing()
```

Disables edit mode.

### stopFraming {#stopFraming}

```javascript
{} stopFraming()
```

Disables the zoom mode.

[*star]: Mandatory parameter/option.