mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
floor line height and height when dom height increases than canvas height
This commit is contained in:
parent
7f1ef7562c
commit
8de6516823
1 changed files with 13 additions and 4 deletions
|
@ -36,6 +36,7 @@ import {
|
||||||
getMaxContainerWidth,
|
getMaxContainerWidth,
|
||||||
computeContainerDimensionForBoundText,
|
computeContainerDimensionForBoundText,
|
||||||
measureDOMHeight,
|
measureDOMHeight,
|
||||||
|
getLineHeightInPx,
|
||||||
splitIntoLines,
|
splitIntoLines,
|
||||||
} from "./textElement";
|
} from "./textElement";
|
||||||
import {
|
import {
|
||||||
|
@ -278,11 +279,19 @@ export const textWysiwyg = ({
|
||||||
getFontString(updatedTextElement),
|
getFontString(updatedTextElement),
|
||||||
updatedTextElement.lineHeight,
|
updatedTextElement.lineHeight,
|
||||||
);
|
);
|
||||||
|
|
||||||
let lineHeight = element.lineHeight;
|
let lineHeight = element.lineHeight;
|
||||||
if (isSafari && domHeight > textElementHeight) {
|
if (isSafari) {
|
||||||
lineHeight = (Math.floor(element.lineHeight * element.fontSize) /
|
const lineCount = splitIntoLines(element.text).length;
|
||||||
element.fontSize) as ExcalidrawTextElement["lineHeight"];
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure text editor height doesn't go beyond viewport
|
// Make sure text editor height doesn't go beyond viewport
|
||||||
|
|
Loading…
Add table
Reference in a new issue