Skip to main content

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​

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​

Source: packages/core/src/draw/keys.ts:103