mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-06 14:27:23 +02:00
Merge pull request #21715 from Snuffleupagus/src-core-annotation-MathClamp
Use the `MathClamp` helper in the `src/core/annotation.js` file
This commit is contained in:
commit
1f0659ef9d
@ -76,6 +76,7 @@ import { createImage } from "./editor/pdf_images.js";
|
|||||||
import { FileSpec } from "./file_spec.js";
|
import { FileSpec } from "./file_spec.js";
|
||||||
import { getSoundFormat } from "./sound.js";
|
import { getSoundFormat } from "./sound.js";
|
||||||
import { JpegStream } from "./jpeg_stream.js";
|
import { JpegStream } from "./jpeg_stream.js";
|
||||||
|
import { MathClamp } from "../shared/math_clamp.js";
|
||||||
import { ObjectLoader } from "./object_loader.js";
|
import { ObjectLoader } from "./object_loader.js";
|
||||||
import { OperatorList } from "./operator_list.js";
|
import { OperatorList } from "./operator_list.js";
|
||||||
import { parseMarkedContentProps } from "./evaluator_utils.js";
|
import { parseMarkedContentProps } from "./evaluator_utils.js";
|
||||||
@ -4051,10 +4052,7 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
|
|||||||
const minIndex = Math.min(...valueIndices);
|
const minIndex = Math.min(...valueIndices);
|
||||||
const maxIndex = Math.max(...valueIndices);
|
const maxIndex = Math.max(...valueIndices);
|
||||||
|
|
||||||
firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1);
|
firstIndex = MathClamp(maxIndex - numberOfVisibleLines + 1, 0, minIndex);
|
||||||
if (firstIndex > minIndex) {
|
|
||||||
firstIndex = minIndex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
|
const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user