refactor: don't pass array to handleBindTextResize (#4826)

This commit is contained in:
Aakansha Doshi 2022-02-21 17:15:29 +05:30 committed by GitHub
parent f224e4d596
commit e203203993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 55 deletions

View File

@ -602,7 +602,7 @@ export const resizeSingleElement = (
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
handleBindTextResize([element], transformHandleDirection);
handleBindTextResize(element, transformHandleDirection);
}
};
@ -742,7 +742,7 @@ const resizeMultipleElements = (
fontSize: updates[index].fontSize,
baseline: updates[index].baseline,
});
handleBindTextResize([element], transformHandleType);
handleBindTextResize(element, transformHandleType);
}
});
}

View File

@ -92,10 +92,9 @@ export const bindTextToShapeAfterDuplication = (
};
export const handleBindTextResize = (
elements: readonly NonDeletedExcalidrawElement[],
element: NonDeletedExcalidrawElement,
transformHandleType: MaybeTransformHandleType,
) => {
elements.forEach((element) => {
const boundTextElementId = getBoundTextElementId(element);
if (boundTextElementId) {
const textElement = Scene.getScene(element)!.getElement(
@ -156,7 +155,6 @@ export const handleBindTextResize = (
});
}
}
});
};
// https://github.com/grassator/canvas-text-editor/blob/master/lib/FontMetrics.js