mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Annotation - Use border and background colors from MK dictionary
- it aims to fix #13003; - set the bg and fg colors as they're in the pdf; - put a transparent overlay to help to see the fields.
This commit is contained in:
parent
3b1d547738
commit
0776cd9b90
5 changed files with 68 additions and 21 deletions
|
@ -244,7 +244,8 @@ class AnnotationElement {
|
|||
break;
|
||||
}
|
||||
|
||||
if (data.color) {
|
||||
const borderColor = data.borderColor || data.color || null;
|
||||
if (borderColor) {
|
||||
container.style.borderColor = Util.makeHexColor(
|
||||
data.color[0] | 0,
|
||||
data.color[1] | 0,
|
||||
|
@ -645,6 +646,14 @@ class WidgetAnnotationElement extends AnnotationElement {
|
|||
}
|
||||
}
|
||||
|
||||
_setBackgroundColor(element) {
|
||||
const color = this.data.backgroundColor || null;
|
||||
element.style.backgroundColor =
|
||||
color === null
|
||||
? "transparent"
|
||||
: Util.makeHexColor(color[0], color[1], color[2]);
|
||||
}
|
||||
|
||||
_dispatchEventFromSandbox(actions, jsEvent) {
|
||||
const setColor = (jsName, styleName, event) => {
|
||||
const color = event.detail[jsName];
|
||||
|
@ -971,6 +980,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
}
|
||||
|
||||
this._setTextStyle(element);
|
||||
this._setBackgroundColor(element);
|
||||
|
||||
this.container.appendChild(element);
|
||||
return this.container;
|
||||
|
@ -1074,6 +1084,8 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
);
|
||||
}
|
||||
|
||||
this._setBackgroundColor(element);
|
||||
|
||||
this.container.appendChild(element);
|
||||
return this.container;
|
||||
}
|
||||
|
@ -1151,6 +1163,8 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
);
|
||||
}
|
||||
|
||||
this._setBackgroundColor(element);
|
||||
|
||||
this.container.appendChild(element);
|
||||
return this.container;
|
||||
}
|
||||
|
@ -1382,6 +1396,8 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
});
|
||||
}
|
||||
|
||||
this._setBackgroundColor(selectElement);
|
||||
|
||||
this.container.appendChild(selectElement);
|
||||
return this.container;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue