Skip to main content

mapKeyAction

Maps a key press on the map region to an action.

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

Signature​

import { mapKeyAction } from "@mapcairn/core";

function mapKeyAction(event: MapKeyEvent): MapKeyAction | null;

Parameters​

  • event (MapKeyEvent)

Returns​

MapKeyAction | null: The action, or null when the key is not a map shortcut. Any ctrl, meta or alt modifier gives null so browser and system shortcuts keep working. Shift is otherwise ignored for the character keys, because "+" and "_" need it on many keyboards.

Remarks​

For pan, dx and dy are screen pixels with y pointing down, and the map view moves the way the arrow points: ArrowRight shows more of the map to the right. Shift with left or right rotates; Shift with up or down pans further.

See also​

Source: packages/core/src/keyboard/keyboard.ts:58