Skip to content
Snippets Groups Projects
Commit 116a5cb5 authored by Andrea Gottsponer's avatar Andrea Gottsponer
Browse files

- fix text word wrap (final)

parent f1a635b5
No related branches found
No related tags found
No related merge requests found
...@@ -95,14 +95,14 @@ export class CaretElement extends BaseContainer { ...@@ -95,14 +95,14 @@ export class CaretElement extends BaseContainer {
let startIndex: number = 0; let startIndex: number = 0;
let wordWrapRows: number = 0; let wordWrapRows: number = 0;
for (let i = 1; i <= text.length; i++) { for (let i = 1; i <= text.length; i++) {
const tmpText = text.substr(startIndex, i); const tmpText = text.substring(startIndex, i);
// @ts-ignore // @ts-ignore
const tmpWidth = this._targetInteraction.targetElement._textElement.context.measureText(tmpText).width; const tmpWidth = this._targetInteraction.targetElement._textElement.context.measureText(tmpText).width;
if (tmpWidth > style.wordWrapWidth) { if (tmpWidth > style.wordWrapWidth) {
wordWrapRows++; wordWrapRows++;
startIndex += i - wordWrapRows; startIndex = (i - 1);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment