remove unused method

This commit is contained in:
Aakansha Doshi 2023-03-22 15:13:09 +05:30
parent ee8fff8e8b
commit 87b0c7a679
2 changed files with 3 additions and 13 deletions

View File

@ -1290,7 +1290,7 @@ export class LinearElementEditor {
let midSegmentMidpoint = editorMidPointsCache.points[index]; let midSegmentMidpoint = editorMidPointsCache.points[index];
if (element.points.length === 2) { if (element.points.length === 2) {
midSegmentMidpoint = centerPoint(points[0], points[1]); midSegmentMidpoint = centerPoint(points[0], points[1]);
} }
if ( if (
!midSegmentMidpoint || !midSegmentMidpoint ||
editorMidPointsCache.version !== element.version editorMidPointsCache.version !== element.version

View File

@ -9,18 +9,6 @@ import { normalizeText } from "./textElement";
import { ExcalidrawTextElement, FontFamilyValues, FontString } from "./types"; import { ExcalidrawTextElement, FontFamilyValues, FontString } from "./types";
const DUMMY_TEXT = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase(); const DUMMY_TEXT = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toLocaleUpperCase();
const cacheLineHeight: { [key: FontString]: number } = {};
export const getLineHeight = (font: FontString) => {
if (cacheLineHeight[font]) {
return cacheLineHeight[font];
}
const fontSize = parseInt(font);
// Calculate line height relative to font size
cacheLineHeight[font] = fontSize * 1.2;
return cacheLineHeight[font];
};
let canvas: HTMLCanvasElement | undefined; let canvas: HTMLCanvasElement | undefined;
@ -37,9 +25,11 @@ const getLineWidth = (text: string, font: FontString) => {
canvas2dContext.font = font; canvas2dContext.font = font;
const width = canvas2dContext.measureText(text).width; const width = canvas2dContext.measureText(text).width;
/* istanbul ignore else */
if (isTestEnv()) { if (isTestEnv()) {
return width * DUMMY_CHAR_WIDTH; return width * DUMMY_CHAR_WIDTH;
} }
/* istanbul ignore next */
return width; return width;
}; };