Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix calculating text width for indented text (#930)

David Luzarc85315650fb5
diff --git a/src/utils.ts b/src/utils.ts
index e38146b873..52701899ed 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