Prefer arrow functions (#2344)

This commit is contained in:
Lipis 2020-11-06 22:06:39 +02:00 committed by GitHub
parent e05acd6fd9
commit a20f3240fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 304 additions and 336 deletions

View file

@ -82,7 +82,7 @@ export const newElement = (
_newElementBase<ExcalidrawGenericElement>(opts.type, opts);
/** computes element x/y offset based on textAlign/verticalAlign */
function getTextElementPositionOffsets(
const getTextElementPositionOffsets = (
opts: {
textAlign: ExcalidrawTextElement["textAlign"];
verticalAlign: ExcalidrawTextElement["verticalAlign"];
@ -91,7 +91,7 @@ function getTextElementPositionOffsets(
width: number;
height: number;
},
) {
) => {
return {
x:
opts.textAlign === "center"
@ -101,7 +101,7 @@ function getTextElementPositionOffsets(
: 0,
y: opts.verticalAlign === "middle" ? metrics.height / 2 : 0,
};
}
};
export const newTextElement = (
opts: {

View file

@ -46,7 +46,7 @@ export const textWysiwyg = ({
getViewportCoords: (x: number, y: number) => [number, number];
element: ExcalidrawElement;
}) => {
function updateWysiwygStyle() {
const updateWysiwygStyle = () => {
const updatedElement = Scene.getScene(element)?.getElement(id);
if (updatedElement && isTextElement(updatedElement)) {
const [viewportX, viewportY] = getViewportCoords(
@ -80,7 +80,7 @@ export const textWysiwyg = ({
filter: "var(--appearance-filter)",
});
}
}
};
const editable = document.createElement("textarea");