Merge pull request #19393 from Snuffleupagus/fewer-hasFieldFlag

Use fewer `hasFieldFlag` calls in the `src/core/annotation.js` file
This commit is contained in:
Jonas Jenwald 2025-01-30 15:10:14 +01:00 committed by GitHub
commit 31deee26b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2774,8 +2774,8 @@ class TextWidgetAnnotation extends WidgetAnnotation {
this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE); this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
this.data.comb = this.data.comb =
this.hasFieldFlag(AnnotationFieldFlag.COMB) && this.hasFieldFlag(AnnotationFieldFlag.COMB) &&
!this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.data.multiLine &&
!this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.data.password &&
!this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) &&
this.data.maxLen !== 0; this.data.maxLen !== 0;
this.data.doNotScroll = this.hasFieldFlag(AnnotationFieldFlag.DONOTSCROLL); this.data.doNotScroll = this.hasFieldFlag(AnnotationFieldFlag.DONOTSCROLL);
@ -2986,13 +2986,12 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
this.checkedAppearance = null; this.checkedAppearance = null;
this.uncheckedAppearance = null; this.uncheckedAppearance = null;
this.data.checkBox = const isRadio = this.hasFieldFlag(AnnotationFieldFlag.RADIO),
!this.hasFieldFlag(AnnotationFieldFlag.RADIO) && isPushButton = this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
!this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
this.data.radioButton = this.data.checkBox = !isRadio && !isPushButton;
this.hasFieldFlag(AnnotationFieldFlag.RADIO) && this.data.radioButton = isRadio && !isPushButton;
!this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON); this.data.pushButton = isPushButton;
this.data.pushButton = this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
this.data.isTooltipOnly = false; this.data.isTooltipOnly = false;
if (this.data.checkBox) { if (this.data.checkBox) {