Skip to main content

editHandlesFor

The handles the person can drag on the selected shape: a vertex at each position, a midpoint on each edge of a finished line or polygon (pressing one adds a vertex there), and for a circle a radius handle due east of its centre. Only the selected shape has handles, so a map full of shapes is not full of targets.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { editHandlesFor } from "@mapcairn/core";

function editHandlesFor(shapes: readonly DrawShape[], selection: DrawSelection | null, projection?: MapProjection): MapEditHandle[];

Parameters​

  • shapes (readonly DrawShape[])
  • selection (DrawSelection | null)
  • projection? (MapProjection)

Returns​

MapEditHandle[]

Remarks​

Ids are <shape>:v:<index>, <shape>:m:<index> (the vertex that would be inserted at that index) and <shape>:r; read them with parseHandleId. A midpoint sits on its edge as the overlay draws it for the map's projection (flat, the default, or globe).

See also​

Source: packages/core/src/draw/handles.ts:66