From c85315650fb5d936fcae016503b07e78295728d0 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Fri, 13 Mar 2020 15:10:44 +0100 Subject: [PATCH] fix calculating text width for indented text (#930) --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index e38146b8..52701899 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -63,7 +63,7 @@ export function measureText(text: string, font: string) { const line = document.createElement("div"); const body = document.body; line.style.position = "absolute"; - line.style.whiteSpace = "nowrap"; + line.style.whiteSpace = "pre"; line.style.font = font; body.appendChild(line); // Now we can measure width and height of the letter