Prefer arrow functions and callbacks (#1210)

This commit is contained in:
Lipis
2020-05-20 16:21:37 +03:00
committed by GitHub
parent 33fe223b5d
commit c427aa3cce
64 changed files with 784 additions and 847 deletions

View File

@ -9,7 +9,7 @@ export const SCROLLBAR_MARGIN = 4;
export const SCROLLBAR_WIDTH = 6;
export const SCROLLBAR_COLOR = "rgba(0,0,0,0.3)";
export function getScrollBars(
export const getScrollBars = (
elements: readonly ExcalidrawElement[],
viewportWidth: number,
viewportHeight: number,
@ -22,7 +22,7 @@ export function getScrollBars(
scrollY: FlooredNumber;
zoom: number;
},
): ScrollBars {
): ScrollBars => {
// This is the bounding box of all the elements
const [
elementsMinX,
@ -100,9 +100,13 @@ export function getScrollBars(
Math.max(SCROLLBAR_MARGIN * 2, safeArea.top + safeArea.bottom),
},
};
}
};
export function isOverScrollBars(scrollBars: ScrollBars, x: number, y: number) {
export const isOverScrollBars = (
scrollBars: ScrollBars,
x: number,
y: number,
) => {
const [isOverHorizontalScrollBar, isOverVerticalScrollBar] = [
scrollBars.horizontal,
scrollBars.vertical,
@ -120,4 +124,4 @@ export function isOverScrollBars(scrollBars: ScrollBars, x: number, y: number) {
isOverHorizontalScrollBar,
isOverVerticalScrollBar,
};
}
};