Set Trailing Cmma to (#525)

This commit is contained in:
Lipis
2020-01-24 12:04:54 +02:00
committed by GitHub
parent 25202aec11
commit ee68af0fd3
53 changed files with 352 additions and 350 deletions

View File

@ -3,20 +3,20 @@ import { getElementAbsoluteCoords } from "../element";
export function getElementsWithinSelection(
elements: readonly ExcalidrawElement[],
selection: ExcalidrawElement
selection: ExcalidrawElement,
) {
const [
selectionX1,
selectionY1,
selectionX2,
selectionY2
selectionY2,
] = getElementAbsoluteCoords(selection);
return elements.filter(element => {
const [
elementX1,
elementY1,
elementX2,
elementY2
elementY2,
] = getElementAbsoluteCoords(element);
return (
@ -62,14 +62,14 @@ export const someElementIsSelected = (elements: readonly ExcalidrawElement[]) =>
*/
export function getCommonAttributeOfSelectedElements<T>(
elements: readonly ExcalidrawElement[],
getAttribute: (element: ExcalidrawElement) => T
getAttribute: (element: ExcalidrawElement) => T,
): T | null {
const attributes = Array.from(
new Set(
elements
.filter(element => element.isSelected)
.map(element => getAttribute(element))
)
.map(element => getAttribute(element)),
),
);
return attributes.length === 1 ? attributes[0] : null;
}