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:
Jonas Jenwald 2026-08-06 11:04:41 +02:00 committed by GitHub
commit 1f0659ef9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,6 +76,7 @@ import { createImage } from "./editor/pdf_images.js";
import { FileSpec } from "./file_spec.js";
import { getSoundFormat } from "./sound.js";
import { JpegStream } from "./jpeg_stream.js";
import { MathClamp } from "../shared/math_clamp.js";
import { ObjectLoader } from "./object_loader.js";
import { OperatorList } from "./operator_list.js";
import { parseMarkedContentProps } from "./evaluator_utils.js";
@ -4051,10 +4052,7 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
const minIndex = Math.min(...valueIndices);
const maxIndex = Math.max(...valueIndices);
firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1);
if (firstIndex > minIndex) {
firstIndex = minIndex;
}
firstIndex = MathClamp(maxIndex - numberOfVisibleLines + 1, 0, minIndex);
}
const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);