mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Enable the no-lonely-if
ESLint rule
These changes were mostly done automatically, using `gulp lint --fix`, and only a few spots with comments needed manual tweaking; please see https://eslint.org/docs/latest/rules/no-lonely-if
This commit is contained in:
parent
abb24f82fb
commit
c018070e80
15 changed files with 108 additions and 147 deletions
|
@ -2698,24 +2698,22 @@ class TextWidgetAnnotation extends WidgetAnnotation {
|
|||
lastSpacePosInStringEnd = end;
|
||||
lastSpacePos = i;
|
||||
}
|
||||
} else {
|
||||
if (currentWidth + glyphWidth > width) {
|
||||
// We must break to the last white position (if available)
|
||||
if (lastSpacePosInStringStart !== -1) {
|
||||
chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
|
||||
startChunk = lastSpacePosInStringEnd;
|
||||
i = lastSpacePos + 1;
|
||||
lastSpacePosInStringStart = -1;
|
||||
currentWidth = 0;
|
||||
} else {
|
||||
// Just break in the middle of the word
|
||||
chunks.push(line.substring(startChunk, start));
|
||||
startChunk = start;
|
||||
currentWidth = glyphWidth;
|
||||
}
|
||||
} else if (currentWidth + glyphWidth > width) {
|
||||
// We must break to the last white position (if available)
|
||||
if (lastSpacePosInStringStart !== -1) {
|
||||
chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
|
||||
startChunk = lastSpacePosInStringEnd;
|
||||
i = lastSpacePos + 1;
|
||||
lastSpacePosInStringStart = -1;
|
||||
currentWidth = 0;
|
||||
} else {
|
||||
currentWidth += glyphWidth;
|
||||
// Just break in the middle of the word
|
||||
chunks.push(line.substring(startChunk, start));
|
||||
startChunk = start;
|
||||
currentWidth = glyphWidth;
|
||||
}
|
||||
} else {
|
||||
currentWidth += glyphWidth;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue