Browse Source

remove unused method

Aakansha Doshi 2 years ago
parent
commit
87b0c7a679
2 changed files with 3 additions and 13 deletions
  1. 1 1
      src/element/linearElementEditor.ts
  2. 2 12
      src/element/textMeasurements.ts

+ 1 - 1
src/element/linearElementEditor.ts

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

+ 2 - 12
src/element/textMeasurements.ts

@@ -9,18 +9,6 @@ import { normalizeText } from "./textElement";
 import { ExcalidrawTextElement, FontFamilyValues, FontString } from "./types";
 
 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;
 
@@ -37,9 +25,11 @@ const getLineWidth = (text: string, font: FontString) => {
   canvas2dContext.font = font;
   const width = canvas2dContext.measureText(text).width;
 
+  /* istanbul ignore else */
   if (isTestEnv()) {
     return width * DUMMY_CHAR_WIDTH;
   }
+  /* istanbul ignore next */
   return width;
 };