mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Prefer arrow functions and callbacks (#1210)
This commit is contained in:
parent
33fe223b5d
commit
c427aa3cce
64 changed files with 784 additions and 847 deletions
|
@ -1,4 +1,7 @@
|
|||
export function getZoomOrigin(canvas: HTMLCanvasElement | null, scale: number) {
|
||||
export const getZoomOrigin = (
|
||||
canvas: HTMLCanvasElement | null,
|
||||
scale: number,
|
||||
) => {
|
||||
if (canvas === null) {
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
|
@ -14,10 +17,10 @@ export function getZoomOrigin(canvas: HTMLCanvasElement | null, scale: number) {
|
|||
x: normalizedCanvasWidth / 2,
|
||||
y: normalizedCanvasHeight / 2,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export function getNormalizedZoom(zoom: number): number {
|
||||
export const getNormalizedZoom = (zoom: number): number => {
|
||||
const normalizedZoom = parseFloat(zoom.toFixed(2));
|
||||
const clampedZoom = Math.max(0.1, Math.min(normalizedZoom, 2));
|
||||
return clampedZoom;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue