apply offset only if in container

This commit is contained in:
zsviczian 2023-03-06 21:52:02 +01:00
parent 27c7e75761
commit da06e8ad27

View File

@ -270,13 +270,15 @@ export const textWysiwyg = ({
const lineHeight = updatedTextElement.containerId const lineHeight = updatedTextElement.containerId
? approxLineHeight ? approxLineHeight
: updatedTextElement.height / lines.length; : updatedTextElement.height / lines.length;
let magicOffset = 0;
if (!container) { if (!container) {
maxWidth = (appState.width - 8 - viewportX) / appState.zoom.value; maxWidth = (appState.width - 8 - viewportX) / appState.zoom.value;
textElementWidth = Math.min(textElementWidth, maxWidth); textElementWidth = Math.min(textElementWidth, maxWidth);
} } else {
const magicOffset = excalidrawContainer magicOffset = excalidrawContainer
? parseFloat(getComputedStyle(excalidrawContainer).fontSize) ? parseFloat(getComputedStyle(excalidrawContainer).fontSize)
: 16; : 16;
}
// Make sure text editor height doesn't go beyond viewport // Make sure text editor height doesn't go beyond viewport
const editorMaxHeight = const editorMaxHeight =
(appState.height - viewportY) / appState.zoom.value; (appState.height - viewportY) / appState.zoom.value;