Skip to main content

SurfaceState

Everything the chrome needs to know about which surface is open.

This is an interface exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import type { SurfaceState } from "@mapcairn/core";

interface SurfaceState

Properties​

hasPin​

readonly hasPin: boolean;

Whether a pin is on the map, whether or not its card is open.

resumeDraw​

readonly resumeDraw: boolean;

True while the sheet is open over a drawing that was under way: closing the sheet then goes back to the draw tool, with focus on its Shapes button, rather than to nothing.

resumeMeasure​

readonly resumeMeasure: boolean;

True while the sheet is open over a measurement that was under way: closing the sheet then goes back to the measure tool, with its points kept and focus on the Measure button, rather than to nothing.

returnFocusTo​

readonly returnFocusTo: FocusTarget | null;

Where focus should go when the surface closes. null means the map region. The value is kept after the surface closes so the effect that restores focus can read it; the next surface to open replaces it.

sheetDetent​

readonly sheetDetent: SheetDetent;

The sheet's detent. Meaningful only while surface is "sheet".

sheetSection​

readonly sheetSection: SheetSection | null;

The open sheet section, or null when the sheet is closed.

surface​

readonly surface: SurfaceKind;

Which surface is open: none, the sheet, search, or the measure, draw, pin or directions tool.

Remarks​

Exactly one surface is active at a time. hasPin is separate because a dropped pin is data on the map, not a surface: it can exist while the pin card is closed, or while another surface (measure, for example) is active.

See also​

Source: packages/core/src/surface/surface.ts:53