mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Try to not omit some values when printing a choice list with several selected items
This commit is contained in:
parent
a2118f52b0
commit
0e610cab04
4 changed files with 24 additions and 10 deletions
|
@ -3334,15 +3334,15 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
|
|||
const vPadding = (lineHeight - fontSize) / 2;
|
||||
const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
|
||||
|
||||
let firstIndex;
|
||||
if (valueIndices.length === 1) {
|
||||
const valuePosition = valueIndices[0];
|
||||
const indexInPage = valuePosition % numberOfVisibleLines;
|
||||
firstIndex = valuePosition - indexInPage;
|
||||
} else {
|
||||
// If nothing is selected (valueIndice.length === 0), we render
|
||||
// from the first element.
|
||||
firstIndex = valueIndices.length ? valueIndices[0] : 0;
|
||||
let firstIndex = 0;
|
||||
if (valueIndices.length > 0) {
|
||||
const minIndex = Math.min(...valueIndices);
|
||||
const maxIndex = Math.max(...valueIndices);
|
||||
|
||||
firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1);
|
||||
if (firstIndex > minIndex) {
|
||||
firstIndex = minIndex;
|
||||
}
|
||||
}
|
||||
const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue