From 4c815ebfe7dab616d02b3e8d34749dc198887fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Or=C5=82=C3=B3w?= <adrian.orlow@fishbrain.com> Date: Tue, 21 Nov 2023 11:21:04 +0100 Subject: [PATCH] fix: rename getCanvas with createCanvas --- .../Map/MapViewer/utils/config/getCanvasIcon.test.ts | 4 ++-- src/components/Map/MapViewer/utils/config/getCanvasIcon.ts | 4 ++-- src/utils/canvas/getCanvas.test.ts | 4 ++-- src/utils/canvas/getCanvas.ts | 2 +- src/utils/canvas/getFontSizeToFit.test.ts | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Map/MapViewer/utils/config/getCanvasIcon.test.ts b/src/components/Map/MapViewer/utils/config/getCanvasIcon.test.ts index 2915ff79..aa5b8640 100644 --- a/src/components/Map/MapViewer/utils/config/getCanvasIcon.test.ts +++ b/src/components/Map/MapViewer/utils/config/getCanvasIcon.test.ts @@ -1,6 +1,6 @@ /* eslint-disable no-magic-numbers */ import { DEFAULT_FONT_FAMILY } from '@/constants/font'; -import { getCanvas } from '@/utils/canvas/getCanvas'; +import { createCanvas } from '@/utils/canvas/getCanvas'; import { drawNumberOnCanvas, drawPinOnCanvas, @@ -9,7 +9,7 @@ import { } from './getCanvasIcon'; const getContext = (): CanvasRenderingContext2D => { - const canvas = getCanvas({ width: 100, height: 100 }); + const canvas = createCanvas({ width: 100, height: 100 }); return canvas.getContext('2d') as CanvasRenderingContext2D; }; diff --git a/src/components/Map/MapViewer/utils/config/getCanvasIcon.ts b/src/components/Map/MapViewer/utils/config/getCanvasIcon.ts index 7df1b0b0..c377b0ef 100644 --- a/src/components/Map/MapViewer/utils/config/getCanvasIcon.ts +++ b/src/components/Map/MapViewer/utils/config/getCanvasIcon.ts @@ -2,7 +2,7 @@ import { PIN_PATH2D, PIN_SIZE } from '@/constants/canvas'; import { HALF, ONE_AND_HALF, QUARTER, THIRD, TWO_AND_HALF } from '@/constants/dividers'; import { DEFAULT_FONT_FAMILY } from '@/constants/font'; import { Point } from '@/types/map'; -import { getCanvas } from '@/utils/canvas/getCanvas'; +import { createCanvas } from '@/utils/canvas/getCanvas'; import { getFontSizeToFit } from '@/utils/canvas/getFontSizeToFit'; const SMALL_TEXT_VALUE = 1; @@ -60,7 +60,7 @@ export const drawNumberOnCanvas = ( }; export const getCanvasIcon = (args: Args): HTMLCanvasElement => { - const canvas = getCanvas(PIN_SIZE); + const canvas = createCanvas(PIN_SIZE); const ctx = canvas.getContext('2d'); if (!ctx) { return canvas; diff --git a/src/utils/canvas/getCanvas.test.ts b/src/utils/canvas/getCanvas.test.ts index fec95f0b..a0f6f1ad 100644 --- a/src/utils/canvas/getCanvas.test.ts +++ b/src/utils/canvas/getCanvas.test.ts @@ -1,9 +1,9 @@ /* eslint-disable no-magic-numbers */ -import { getCanvas } from './getCanvas'; +import { createCanvas } from './getCanvas'; describe('getCanvas', () => { it('should return HTMLCanvasElement with valid size on positive params', () => { - const result = getCanvas({ + const result = createCanvas({ width: 800, height: 600, }); diff --git a/src/utils/canvas/getCanvas.ts b/src/utils/canvas/getCanvas.ts index 390bba04..d380a465 100644 --- a/src/utils/canvas/getCanvas.ts +++ b/src/utils/canvas/getCanvas.ts @@ -1,4 +1,4 @@ -export const getCanvas = ({ +export const createCanvas = ({ width, height, }: { diff --git a/src/utils/canvas/getFontSizeToFit.test.ts b/src/utils/canvas/getFontSizeToFit.test.ts index 3f5dea7b..ce53c089 100644 --- a/src/utils/canvas/getFontSizeToFit.test.ts +++ b/src/utils/canvas/getFontSizeToFit.test.ts @@ -1,9 +1,9 @@ /* eslint-disable no-magic-numbers */ -import { getCanvas } from './getCanvas'; +import { createCanvas } from './getCanvas'; import { getFontSizeToFit } from './getFontSizeToFit'; const getContext = (): CanvasRenderingContext2D => { - const canvas = getCanvas({ width: 100, height: 100 }); + const canvas = createCanvas({ width: 100, height: 100 }); return canvas.getContext('2d') as CanvasRenderingContext2D; }; -- GitLab