A handle used to translate (move) a Shape.

The user can move the shape by dragging its fill or stroke. This works for both mouse and touch events.

Typically, this is the type of handle that Editor.createTranslateHandle returns.

For PointTranslateHandle instead. PointTranslateHandle adds point snapping capabilities.

Since

2022.1

Hierarchy

Constructors

Accessors

  • get active(): boolean
  • Indicates whether the handle is active.

    Returns boolean

  • set active(active): void
  • Parameters

    • active: boolean

    Returns void

  • get endPoint(): null | Point
  • The (current) end point of the translation, or null if the handle is not active.

    Returns null | Point

  • set endPoint(p): void
  • Parameters

    Returns void

  • get shape(): Shape
  • The shape that's translated by this handle

    Returns Shape

  • get startPoint(): null | Point
  • The start point of the translation, or null if the handle is not active.

    Returns null | Point

  • set startPoint(p): void
  • Parameters

    Returns void

Methods

  • Populates a context menu with entries.

    For example, a handle for a point in a polyline might add a "Delete point" context menu entry.

    Parameters

    • event: GestureEvent

      the input event that triggered opening the context menu.

    • context: EditContext

      the edit context

    • contextMenu: ContextMenu

      the context menu to add entries to.

    • onDone: (() => void)

      a callback that needs to be called when a menu action is performed. Call this at the end of the ContextMenuItem.action implementation.

        • (): void
        • Returns void

    Returns void

  • This method allows the handle to draw shapes on the map.

    For example, a point handle draws an icon at its point using EditHandleStyles.handleIconStyle.

    A handle can also draw "helper" shapes. These are shapes that are not interactive, but help the user while editing. For example, the base shape of an extruded shape, draped over terrain. Or lines showing how a point can move.

    For consistency with built-in handles, it's recommended to draw helper shapes using EditHandleStyles.handleIconStyle.

    The default implementation draws nothing.

    Parameters

    Returns void

  • This method allows the handle to draw labels on the map.

    For example, you can use this to show coordinates of points, or the current radius of a circle on top of an edit handle.

    The default implementation draws nothing.

    Parameters

    Returns void

  • Called when the shape should be translated (moved).

    The default implementation calls Shape.translate2D.

    Parameters

    Returns void

  • Called when (another) handle changes the feature or shape, as indicated by the "EditShape" event.

    This handle can update its own state, based on the changed shape.

    For example, a PointListInsertHandle just inserted a point in a polyline. The PointListTranslateHandle uses the update to recalculate new sub-handles, based on the new polyline (with the extra point).

    The default implementation does nothing.

    Returns void

Events

"EditShape" event

  • on("EditShape", callback: ((event) => void)) : Handle
  • An event that is emitted whenever this handle changes the shape of a feature.

    EditShape

    Parameters

    • event: "EditShape"
    • callback: ((event) => void)

    Returns Handle