-
Notifications
You must be signed in to change notification settings - Fork 0
/
state.ts
37 lines (27 loc) · 985 Bytes
/
state.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { state } from 'awai';
import {
Layer,
Line,
LineConfig,
Pencil,
PencilConfig,
Rectangle,
RectangleConfig,
} from '../types';
import {
DEFAULT_LINE_CONFIG,
DEFAULT_PENCIL_CONFIG,
DEFAULT_RECTANGLE_CONFIG,
EMPTY_LINE_LAYER,
EMPTY_PENCIL_LAYER,
EMPTY_RECTANGLE_LAYER,
} from './constants';
export const canvasElementState = state<HTMLCanvasElement | null>(null);
export const toolState = state<'line' | 'rectangle' | 'pencil'>('pencil');
export const lineConfigState = state<LineConfig>(DEFAULT_LINE_CONFIG);
export const pencilConfigState = state<PencilConfig>(DEFAULT_PENCIL_CONFIG);
export const rectangleConfigState = state<RectangleConfig>(DEFAULT_RECTANGLE_CONFIG);
export const layersState = state<Layer[]>([]);
export const currentLineLayerState = state<Line>(EMPTY_LINE_LAYER);
export const currentRectangleLayerState = state<Rectangle>(EMPTY_RECTANGLE_LAYER);
export const currentPencilLayerState = state<Pencil>(EMPTY_PENCIL_LAYER);