Browse Source

fix calculating text width for indented text (#930)

David Luzar 5 years ago
parent
commit
c85315650f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/utils.ts

+ 1 - 1
src/utils.ts

@@ -63,7 +63,7 @@ export function measureText(text: string, font: string) {
   const line = document.createElement("div");
   const line = document.createElement("div");
   const body = document.body;
   const body = document.body;
   line.style.position = "absolute";
   line.style.position = "absolute";
-  line.style.whiteSpace = "nowrap";
+  line.style.whiteSpace = "pre";
   line.style.font = font;
   line.style.font = font;
   body.appendChild(line);
   body.appendChild(line);
   // Now we can measure width and height of the letter
   // Now we can measure width and height of the letter