mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: add 1px width to the container to calculate more accurately (#6174)
* fix: add 1px width to the container to calculate accurately * fix tests
This commit is contained in:
parent
5ae39c9292
commit
3a141ca77a
5 changed files with 9 additions and 8 deletions
|
@ -292,7 +292,8 @@ export const measureText = (
|
|||
container.appendChild(span);
|
||||
// Baseline is important for positioning text on canvas
|
||||
const baseline = span.offsetTop + span.offsetHeight;
|
||||
const width = container.offsetWidth;
|
||||
// since we are adding a span of width 1px
|
||||
const width = container.offsetWidth + 1;
|
||||
const height = container.offsetHeight;
|
||||
document.body.removeChild(container);
|
||||
if (isTestEnv()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue