rename to getLineHeight and use the same line height for regular text elements

This commit is contained in:
Aakansha Doshi 2023-03-01 13:38:03 +05:30
parent 91f6e87317
commit 0e54994187
5 changed files with 21 additions and 30 deletions

View file

@ -39,7 +39,7 @@ import {
} from "../constants";
import { getStroke, StrokeOptions } from "perfect-freehand";
import {
getApproxLineHeight,
getLineHeight,
getBoundTextElement,
getContainerElement,
} from "../element/textElement";
@ -276,7 +276,7 @@ const drawElementOnCanvas = (
// Canvas does not support multiline text by default
const lines = element.text.replace(/\r\n?/g, "\n").split("\n");
const lineHeight = element.containerId
? getApproxLineHeight(getFontString(element))
? getLineHeight(getFontString(element))
: element.height / lines.length;
const horizontalOffset =
element.textAlign === "center"