A handle for a Point.

This is a base class for point handles, such as PointDragHandle and the "single point" handles used in pointlists (SinglePointInsertHandle, SinglePointTranslateHandle and SinglePointDeleteHandle).

It provides implementations for drawing point handle icons, snapping and point interaction.

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 snapPoint(): null | Point
  • The point to snap to.

    This is used to paint a snap icon.

    Typically, this is set by subclasses, for example in PointDragHandle.drag.

    Returns null | Point

  • set snapPoint(p): void
  • Parameters

    Returns void

Methods

  • Returns the cursor for this point handle.

    • if the handle is active, this returns "grab".
    • if the handle is inactive, but the mouse interacts with the point, this returns "pointer".
    • otherwise, null is returned.

    Parameters

    Returns null | string

  • Returns the default handle icon style.

    This is the handle icon style that is used if no handleIconStyle was passed into the constructor.

    Parameters

    Returns null | IconStyle

    The context's handle icon style.

  • Returns the drape target for this point handle.

    This will make sure point handles with z=0 are correctly draped or not, and on the correct DrapeTarget (terrain or a 3D Tiles mesh). Icons for handles at an altitude are never draped.

    In detail, this uses the following heuristics to determine a DrapeTarget: By default, this uses the drapeTarget of getHandleIconStyle. If that is not defined, this looks at the DrapeTarget.NOT_DRAPED. If it is zero, this looks for a 3D Tiles mesh layer on the map that has isDrapeTarget set. If a 3D tiles mesh layer is found, this returns DrapeTarget.ALL so the handles are draped on the mesh (and terrain, in case the data lies outside the mesh). If no mesh layer is found, this returns DrapeTarget.NOT_DRAPED.

    Parameters

    Returns DrapeTarget

  • Returns the handle icon style, to be used for visualizing point handles in onDraw.

    This returns the handle icon style that was passed into the constructor. If no handle icon style was passed into the constructor, this returns the context's handle icon style.

    Parameters

    Returns null | IconStyle

  • Returns the point, in model coordinates, that this handle represents.

    Returns Point

  • Checks whether the given input event interacts with the point handle.

    By default, this returns true if the mouse or finger is within a certain distance of the point. A larger distance is used for touch events than for mouse events.

    Parameters

    Returns boolean

  • 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 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 (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