# drawKeyCommand

Maps a key press on the map region (or in the draw toolbar) to a command.

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

## Signature

```ts
import { drawKeyCommand } from "@mapcairn/core";
 
function drawKeyCommand(state: DrawState, event: DrawKeyEvent): DrawKeyCommand | null;
```

## Parameters

- `state` (`DrawState`)
- `event` (`DrawKeyEvent`)

## Returns

`DrawKeyCommand | null`: Null when the key is not a draw shortcut in the current state, so
 the map's own keys (arrows pan, Shift with left or right rotates) keep
 working. Arrows nudge only while a vertex is selected. Escape is only a
 command while there is something to step back from. Control or Command
 with Z, Shift for redo, and Y undo and redo; every other Control, Command
 or Alt combination is left to the browser.

## See also

- [`DrawState`](https://docs.mapcairn.com/api/core/DrawState.md)
- [`DrawKeyEvent`](https://docs.mapcairn.com/api/core/DrawKeyEvent.md)
- [`DrawKeyCommand`](https://docs.mapcairn.com/api/core/DrawKeyCommand-typealias.md)

Source: [packages/core/src/draw/keys.ts:103](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/draw/keys.ts#L103)
