mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
add comment
This commit is contained in:
parent
97929c07d6
commit
fd379c2897
1 changed files with 4 additions and 0 deletions
|
@ -300,6 +300,10 @@ export const measureText = (
|
|||
const fontSize = parseFloat(font);
|
||||
const height = getTextHeight(text, fontSize, lineHeight);
|
||||
let width = getTextWidth(text, font);
|
||||
// Since we now preserve trailing whitespaces so if the text has
|
||||
// trailing whitespaces, it will be considered in the width and thus width
|
||||
// computed might be much higher than the allowed max width
|
||||
// by the container hence making sure the width never goes beyond the max width.
|
||||
if (maxWidth) {
|
||||
width = Math.min(width, maxWidth);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue