mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-25 09:35:48 +02:00
Simplify the Annotation.prototype.setAppearance method a tiny bit
It's not necessary to check if the /AS entry exists first, and it can just be fetched directly, since in that case the existing "is stream"-check won't be true anyway. Also, move the `appearance` field definition to the top of the class instead.
This commit is contained in:
parent
f07a106529
commit
8a2c112c20
@ -687,6 +687,8 @@ function getTransformMatrix(rect, bbox, matrix) {
|
||||
}
|
||||
|
||||
class Annotation {
|
||||
appearance = null;
|
||||
|
||||
_oc = undefined;
|
||||
|
||||
constructor(params) {
|
||||
@ -1175,8 +1177,6 @@ class Annotation {
|
||||
* @param {Dict} dict - The annotation's data dictionary
|
||||
*/
|
||||
setAppearance(dict) {
|
||||
this.appearance = null;
|
||||
|
||||
const appearanceStates = dict.get("AP");
|
||||
if (!(appearanceStates instanceof Dict)) {
|
||||
return;
|
||||
@ -1195,7 +1195,7 @@ class Annotation {
|
||||
// In case the normal appearance is a dictionary, the `AS` entry provides
|
||||
// the key of the stream in this dictionary.
|
||||
const as = dict.get("AS");
|
||||
if (!(as instanceof Name) || !normalAppearanceState.has(as.name)) {
|
||||
if (!(as instanceof Name)) {
|
||||
return;
|
||||
}
|
||||
const appearance = normalAppearanceState.get(as.name);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user