Skip to content
Snippets Groups Projects
Commit a152f842 authored by Miłosz Grocholewski's avatar Miłosz Grocholewski
Browse files

Merge branch 'bugfix/MIN-158-label-complex-too-big' into 'development'

fix(complex-text): set correct units for font to calculate fontSize

Closes MIN-158

See merge request !431
parents 05cd37d4 f2807878
No related branches found
No related tags found
1 merge request!431fix(complex-text): set correct units for font to calculate fontSize
Pipeline #102886 passed
......@@ -14,7 +14,7 @@ describe('getWrappedTextWithFontSize', () => {
});
expect(wrappedText.trim()).toEqual('Wrapped text\nwith font size\ntest');
expect(fontSize).toEqual(12);
expect(fontSize).toEqual(14);
});
it('should return a wrapped text and font size for this text when maxWidth is unlimited and maxHeight is limited', () => {
......
......@@ -4,7 +4,7 @@ export default function getWrappedTextWithFontSize({
maxWidth,
maxHeight,
minFontSize = 1,
maxFontSize = 12,
maxFontSize = 14,
}: {
text: string;
maxWidth: number;
......@@ -25,7 +25,7 @@ export default function getWrappedTextWithFontSize({
let resultFontSize = maxFontSize;
let resultText = text;
for (let testFontSize = maxFontSize; testFontSize >= minFontSize; testFontSize -= 1) {
context.font = `${testFontSize}px Arial`;
context.font = `${testFontSize}pt Arial`;
let currentLine = '';
let splittedText = '';
resultFontSize = testFontSize;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment