# 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

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

## Properties

### hasPin

```ts
readonly hasPin: boolean;
```

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

### resumeDraw

```ts
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

```ts
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

```ts
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

```ts
readonly sheetDetent: SheetDetent;
```

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

### sheetSection

```ts
readonly sheetSection: SheetSection | null;
```

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

### surface

```ts
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

- [`FocusTarget`](https://docs.mapcairn.com/api/core/FocusTarget.md)
- [`SheetDetent`](https://docs.mapcairn.com/api/core/SheetDetent.md)
- [`SheetSection`](https://docs.mapcairn.com/api/core/SheetSection.md)
- [`SurfaceKind`](https://docs.mapcairn.com/api/core/SurfaceKind.md)

Source: [packages/core/src/surface/surface.ts:53](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/surface/surface.ts#L53)
