Skip to content

Commit

Permalink
Handle negative bounds (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
btecu committed Dec 6, 2020
1 parent 32ebd57 commit f2db93f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/text/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const computeFontSize = (
const height = font.heightAtSize(fontSize);
const lineHeight = height + height * 0.2;
const totalHeight = lines.length * lineHeight;
if (totalHeight > bounds.height) return fontSize - 1;
if (totalHeight > Math.abs(bounds.height)) return fontSize - 1;

fontSize += 1;
}
Expand Down

0 comments on commit f2db93f

Please sign in to comment.