Skip to main content

MeasureToolbar

The measure toolbar: a Distance or Area switch, the running total, buttons to add a point at the map centre, undo and clear, and Done. It sits in a landmark named "Measurement", so it is inside a landmark wherever the host places it.

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

Signature​

import { MeasureToolbar } from "@mapcairn/map";

function MeasureToolbar(input: MeasureToolbarProps): JSX.Element;

Description​

On mount focus moves to its first button, because the person has just chosen Measure and the next thing to do is here. The bottom-centre slot it sits in is what the slots below it ride above.

Parameters​

  • { measure, onAddPointAtCentre, onDone, }
  • input (MeasureToolbarProps)

Returns​

JSX.Element

Remarks​

The total is plain text. It is read out by the announcer after the points settle (see useMeasure), not by a live region of its own. The controls are all reachable with Tab rather than a single roving tab stop, which keeps the mode switch's own arrow keys unambiguous. The published edge is getBoundingClientRect().top, in viewport pixels, which equals the chrome container's own coordinates when the container fills the viewport.

See also​

Source: packages/map/src/tools/MeasureToolbar/MeasureToolbar.tsx:43