mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-04 14:15:48 +02:00
Merge pull request #21047 from Snuffleupagus/AnnotationLayer-rm-floor-borderColor
Remove unnecessary "flooring" of the components when setting the Annotation `borderColor`
This commit is contained in:
commit
cae075e8d0
@ -465,11 +465,7 @@ class AnnotationElement {
|
|||||||
const borderColor = data.borderColor || null;
|
const borderColor = data.borderColor || null;
|
||||||
if (borderColor) {
|
if (borderColor) {
|
||||||
this.#hasBorder = true;
|
this.#hasBorder = true;
|
||||||
style.borderColor = Util.makeHexColor(
|
style.borderColor = Util.makeHexColor(...borderColor);
|
||||||
borderColor[0] | 0,
|
|
||||||
borderColor[1] | 0,
|
|
||||||
borderColor[2] | 0
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
// Transparent (invisible) border, so do not draw it at all.
|
// Transparent (invisible) border, so do not draw it at all.
|
||||||
style.borderWidth = 0;
|
style.borderWidth = 0;
|
||||||
@ -1374,9 +1370,7 @@ class WidgetAnnotationElement extends AnnotationElement {
|
|||||||
_setBackgroundColor(element) {
|
_setBackgroundColor(element) {
|
||||||
const color = this.data.backgroundColor || null;
|
const color = this.data.backgroundColor || null;
|
||||||
element.style.backgroundColor =
|
element.style.backgroundColor =
|
||||||
color === null
|
color === null ? "transparent" : Util.makeHexColor(...color);
|
||||||
? "transparent"
|
|
||||||
: Util.makeHexColor(color[0], color[1], color[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1427,7 +1421,7 @@ class WidgetAnnotationElement extends AnnotationElement {
|
|||||||
}
|
}
|
||||||
style.fontSize = `calc(${computedFontSize}px * var(--total-scale-factor))`;
|
style.fontSize = `calc(${computedFontSize}px * var(--total-scale-factor))`;
|
||||||
|
|
||||||
style.color = Util.makeHexColor(fontColor[0], fontColor[1], fontColor[2]);
|
style.color = Util.makeHexColor(...fontColor);
|
||||||
|
|
||||||
if (this.data.textAlignment !== null) {
|
if (this.data.textAlignment !== null) {
|
||||||
style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
|
style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user