-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
215 lines (199 loc) · 8.58 KB
/
index.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
<link href="img/favicon.ico" rel="shortcut icon" />
<link href="img/apple-touch-icon.png" rel="apple-touch-icon-precomposed" />
<title>Canvas</title>
</head>
<body>
<main id="app-root" class="hidden h-screen w-screen md:flex flex-col">
<dialog
id="load-canvas-modal"
class="backdrop-blur-sm shadow-lg ring-1 ring-slate-700/25 pt-2 pb-4 px-4 w-[450px] h-[400px] overflow-hidden rounded-sm top-1/4"
>
<div class="flex flex-col h-full">
<div
class="border-b pb-2 flex flex-row justify-between items-center m-0.5 mb-2"
>
<b class="text-gray-500">Load a drawing</b>
<form method="dialog">
<button
title="Close"
class="text-xl text-gray-500 h-5 w-5 flex justify-center items-center"
>
×
</button>
</form>
</div>
<ul
id="saved-list"
class="w-full grid grid-cols-1 items-start content-start overflow-scroll h-full"
>
<!-- `li` items go here -->
</ul>
</div>
</dialog>
<header
class="flex flex-row basis-14 w-full bg-neutral-50 border-b border-gray-300 items-center justify-between py-2 px-2"
>
<a
title="Source code"
class="h-8 flex items-center font-sans font-ultralight leading-none text-md hover:bg-gray-200 active:bg-gray-300 border rounded-sm transition-colors py-1 px-3 uppercase"
href="https://github.com/egilsster/canvas"
>Canvas</a
>
<div class="flex space-x-5 h-8 items-center">
<div class="flex h-full items-center">
<label for="penShape">Tool</label>
<select
id="penShape"
class="cursor-pointer rounded-sm p-1 h-full px-1 ml-2"
>
<option value="pencil">Pencil</option>
<option value="line">Line</option>
<option value="rectangle">Rectangle</option>
<option value="circle">Circle</option>
<option value="text">Text</option>
<option value="eraser">Erase</option>
</select>
</div>
<div class="flex h-full items-center">
<label for="penSize">Size</label>
<select
id="penSize"
class="cursor-pointer rounded-sm p-1 h-full px-1 ml-2"
>
<option value="4">Normal</option>
<option value="2">Thin</option>
<option value="8">Thick</option>
</select>
</div>
<div class="flex h-full items-center">
<div>Color</div>
<div
id="penColor"
class="w-8 h-full rounded-sm border border-black cursor-pointer ml-2"
></div>
</div>
</div>
<div id="action-buttons" class="text-white flex flex-row">
<div
class="grid grid-cols-5 divide-x-2 divide-white rounded-sm overflow-hidden h-8"
>
<button
class="transition-colors bg-red-600 hover:bg-red-500 active:bg-red-700 font-semibold p-1"
id="clear-canvas"
title="Clear canvas"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M3.49997 12.8995C2.71892 13.6805 2.71892 14.9468 3.49997 15.7279L7.35785 19.5858H4.08576C3.53347 19.5858 3.08576 20.0335 3.08576 20.5858C3.08576 21.1381 3.53347 21.5858 4.08576 21.5858H20.0858C20.638 21.5858 21.0858 21.1381 21.0858 20.5858C21.0858 20.0335 20.638 19.5858 20.0858 19.5858H10.9558L20.4705 10.071C21.2516 9.28999 21.2516 8.02366 20.4705 7.24261L16.2279 2.99997C15.4468 2.21892 14.1805 2.21892 13.3995 2.99997L3.49997 12.8995ZM7.82579 11.4021L4.91418 14.3137L9.15683 18.5563L12.0684 15.6447L7.82579 11.4021ZM9.24 9.98787L13.4826 14.2305L19.0563 8.65683L14.8137 4.41418L9.24 9.98787Z"
fill="currentColor"
/>
</svg>
</button>
<button
class="transition-colors bg-blue-600 hover:bg-blue-500 active:bg-blue-700 font-semibold p-1"
id="undo"
title="Undo last change"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10.6276 14.7219L9.21641 16.1391L2.83875 9.78892L9.18897 3.41125L10.6062 4.82242L6.82971 8.61526L17.1353 8.59304C19.3445 8.58828 21.1392 10.3753 21.144 12.5844L21.1612 20.5844L19.1612 20.5887L19.144 12.5887C19.1416 11.4841 18.2442 10.5907 17.1396 10.593L6.50391 10.616L10.6276 14.7219Z"
fill="currentColor"
/>
</svg>
</button>
<button
class="transition-colors bg-blue-600 hover:bg-blue-500 active:bg-blue-700 font-semibold p-1"
id="redo"
title="Redo last change"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M13.3724 14.7219L14.7835 16.1391L21.1612 9.78892L14.811 3.41125L13.3937 4.82242L17.1702 8.61526L6.86461 8.59304C4.65547 8.58828 2.86076 10.3753 2.85599 12.5844L2.83875 20.5844L4.83874 20.5887L4.85599 12.5887C4.85837 11.4841 5.75573 10.5907 6.8603 10.593L17.496 10.616L13.3724 14.7219Z"
fill="currentColor"
/>
</svg>
</button>
<button
class="transition-colors bg-sky-600 hover:bg-sky-500 active:bg-sky-700 font-semibold p-1"
id="save-canvas"
title="Save drawing"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10 18V16H8V14H10V12H12V14H14V16H12V18H10Z"
fill="currentColor"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M6 2C4.34315 2 3 3.34315 3 5V19C3 20.6569 4.34315 22 6 22H18C19.6569 22 21 20.6569 21 19V9C21 5.13401 17.866 2 14 2H6ZM6 4H13V9H19V19C19 19.5523 18.5523 20 18 20H6C5.44772 20 5 19.5523 5 19V5C5 4.44772 5.44772 4 6 4ZM15 4.10002C16.6113 4.4271 17.9413 5.52906 18.584 7H15V4.10002Z"
fill="currentColor"
/>
</svg>
</button>
<button
class="transition-colors bg-sky-600 hover:bg-sky-500 active:bg-sky-700 font-semibold p-1"
id="load-canvas"
title="Load saved drawings"
>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M4 1.5C2.89543 1.5 2 2.39543 2 3.5V4.5C2 4.55666 2.00236 4.61278 2.00698 4.66825C0.838141 5.07811 0 6.19118 0 7.5V19.5C0 21.1569 1.34315 22.5 3 22.5H21C22.6569 22.5 24 21.1569 24 19.5V7.5C24 5.84315 22.6569 4.5 21 4.5H11.874C11.4299 2.77477 9.86384 1.5 8 1.5H4ZM9.73244 4.5C9.38663 3.9022 8.74028 3.5 8 3.5H4V4.5H9.73244ZM3 6.5C2.44772 6.5 2 6.94772 2 7.5V19.5C2 20.0523 2.44772 20.5 3 20.5H21C21.5523 20.5 22 20.0523 22 19.5V7.5C22 6.94772 21.5523 6.5 21 6.5H3Z"
fill="currentColor"
/>
</svg>
</button>
</div>
</div>
</header>
<div
id="canvas-container"
class="bg-slate-200 h-full grow-[999] shrink-[999] basis-0 p-2"
>
<canvas id="my-canvas" class="bg-white cursor-crosshair"></canvas>
<div class="text-spawner"></div>
</div>
</main>
</body>
<script type="module" src="/src/index.ts"></script>
</html>