mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Use max of width and actualBoundingBox to get text width (#24085)
This commit is contained in:
parent
172d6c3079
commit
bd74d39dd8
@ -23,6 +23,9 @@ export function measureTextWidth(
|
||||
context.font = `${fontSize}px ${fontFamily}`;
|
||||
const textMetrics = context.measureText(text);
|
||||
return Math.ceil(
|
||||
textMetrics.actualBoundingBoxRight + textMetrics.actualBoundingBoxLeft
|
||||
Math.max(
|
||||
textMetrics.actualBoundingBoxRight + textMetrics.actualBoundingBoxLeft,
|
||||
textMetrics.width
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user