An Editor describes how features or shapes should be edited and created.

It creates handles that are used by the EditController to edit features and the CreateController to create new features.

Edit handles generally correspond to the shape of the feature being edited. For example, to edit a four-sided polygon, an Editor might create five handles: four to move each of the individual vertices of the polygon (see getEditHandles), and a fifth one to move the polygon as a whole (see createTranslateHandle).

For more information, check out the Customizing creation and editing guide.

Hierarchy

Constructors

  • Creates a new Editor instance

    Returns Editor

Methods

  • Indicates which features/shapes this editor can edit.

    The default implementation always returns false.

    Parameters

    Returns boolean

  • Creates the shape translation handle.

    This is a handle that allows translation (moving) of an entire shape / feature.

    Parameters

    • context: EditContext

      The context to retrieve the shape translate handle for

    Returns null | EditHandle

  • Returns a handle that is used to create the given object.

    Parameters

    Returns null | EditHandle

    an editing handle that is used to initialize the state of the object being created.

  • This method is called by EditController to retrieve the handles for editing.

    For example, point list translation/insertion/deletion handles, handles to modify a circles center and radius,... By default, all editors include a shape translation handle.

    This is also used for creation, when the "create-by-template" approach is used to create new shapes.

    Parameters

    • context: EditContext

      The context to retrieve the handles for.

    Returns EditHandle[]