Revert "floor line height and height when dom height increases than canvas height"

This reverts commit 8de6516823.
This commit is contained in:
Aakansha Doshi 2023-04-05 20:41:41 +05:30
parent 8de6516823
commit 038714e715

View file

@ -36,7 +36,6 @@ import {
getMaxContainerWidth,
computeContainerDimensionForBoundText,
measureDOMHeight,
getLineHeightInPx,
splitIntoLines,
} from "./textElement";
import {
@ -279,19 +278,11 @@ export const textWysiwyg = ({
getFontString(updatedTextElement),
updatedTextElement.lineHeight,
);
let lineHeight = element.lineHeight;
if (isSafari) {
const lineCount = splitIntoLines(element.text).length;
if (domHeight > textElementHeight) {
lineHeight = (Math.floor(element.lineHeight * element.fontSize) /
element.fontSize) as ExcalidrawTextElement["lineHeight"];
textElementHeight =
getLineHeightInPx(element.fontSize, lineHeight) * lineCount;
mutateElement(updatedTextElement, {
lineHeight,
height: textElementHeight,
});
}
if (isSafari && domHeight > textElementHeight) {
lineHeight = (Math.floor(element.lineHeight * element.fontSize) /
element.fontSize) as ExcalidrawTextElement["lineHeight"];
}
// Make sure text editor height doesn't go beyond viewport