|
1 | 1 | import type { ActiveOutline, OutlineData } from './types'; |
2 | 2 |
|
3 | 3 | export const OUTLINE_ARRAY_SIZE = 7; |
4 | | -export const MONO_FONT = |
| 4 | +const MONO_FONT = |
5 | 5 | 'Menlo,Consolas,Monaco,Liberation Mono,Lucida Console,monospace'; |
6 | 6 |
|
7 | | -export const INTERPOLATION_SPEED = 0.1; |
8 | | -export const lerp = (start: number, end: number) => { |
| 7 | +const INTERPOLATION_SPEED = 0.1; |
| 8 | +const lerp = (start: number, end: number) => { |
9 | 9 | return Math.floor(start + (end - start) * INTERPOLATION_SPEED); |
10 | 10 | }; |
11 | 11 |
|
12 | | -export const MAX_PARTS_LENGTH = 4; |
13 | | -export const MAX_LABEL_LENGTH = 40; |
14 | | -export const TOTAL_FRAMES = 45; |
| 12 | +const MAX_PARTS_LENGTH = 4; |
| 13 | +const MAX_LABEL_LENGTH = 40; |
| 14 | +const TOTAL_FRAMES = 45; |
15 | 15 |
|
16 | | -export const primaryColor = '115,97,230'; |
17 | | -export const secondaryColor = '128,128,128'; |
| 16 | +const PRIMARY_COLOR = '115,97,230'; |
| 17 | +// const SECONDARY_COLOR = '128,128,128'; |
18 | 18 |
|
19 | 19 | function getLabelTextPart( |
20 | 20 | partsEntries: [number, string[]][], |
@@ -209,13 +209,13 @@ export const drawCanvas = ( |
209 | 209 | } |
210 | 210 |
|
211 | 211 | for (const { x, y, width, height, alpha } of rectMap.values()) { |
212 | | - ctx.strokeStyle = `rgba(${primaryColor},${alpha})`; |
| 212 | + ctx.strokeStyle = `rgba(${PRIMARY_COLOR},${alpha})`; |
213 | 213 | ctx.lineWidth = 1; |
214 | 214 |
|
215 | 215 | ctx.beginPath(); |
216 | 216 | ctx.rect(x, y, width, height); |
217 | 217 | ctx.stroke(); |
218 | | - ctx.fillStyle = `rgba(${primaryColor},${alpha * 0.1})`; |
| 218 | + ctx.fillStyle = `rgba(${PRIMARY_COLOR},${alpha * 0.1})`; |
219 | 219 | ctx.fill(); |
220 | 220 | } |
221 | 221 |
|
@@ -304,13 +304,13 @@ export const drawCanvas = ( |
304 | 304 | for (const label of labelMap.values()) { |
305 | 305 | const { x, y, alpha, width, height, text } = label; |
306 | 306 |
|
307 | | - let labelY: number = y - height - 4; |
| 307 | + let labelY = y - height - 4; |
308 | 308 |
|
309 | 309 | if (labelY < 0) { |
310 | 310 | labelY = 0; |
311 | 311 | } |
312 | 312 |
|
313 | | - ctx.fillStyle = `rgba(${primaryColor},${alpha})`; |
| 313 | + ctx.fillStyle = `rgba(${PRIMARY_COLOR},${alpha})`; |
314 | 314 | ctx.fillRect(x, labelY, width + 4, height + 4); |
315 | 315 |
|
316 | 316 | ctx.fillStyle = `rgba(255,255,255,${alpha})`; |
|
0 commit comments