# drawReducer

Applies an action to the drawing. Pure: an action that changes nothing
returns the same state object, so React can skip re-rendering. Shapes are
named in English; see [`createDrawReducer`](https://docs.mapcairn.com/api/core/createDrawReducer.md) for another language.

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

## Signature

```ts
import { drawReducer } from "@mapcairn/core";
 
drawReducer: (state: DrawState, action: DrawAction) => DrawState
```

## Parameters

- `state` (`DrawState`)
- `action` (`DrawAction`)

## Returns

`DrawState`

## Remarks

Every edit goes on the undo stack as the shapes and selection
 before it (at most `DRAW_HISTORY_LIMIT` steps), except an edit that
 passes the same `coalesceKey` as the one just before it, which joins that
 step. Selecting, stepping and changing mode with nothing drawn are not
 edits. A refused action leaves the shapes alone and sets a `rejected`
 event naming why.

## See also

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

Source: [packages/core/src/draw/reducer.ts:777](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/draw/reducer.ts#L777)
