Implement rendering polyline/polygon annotations without appearance stream
This commit is contained in:
parent
ca668587c6
commit
60ab15427f
@ -2507,6 +2507,31 @@ class PolylineAnnotation extends MarkupAnnotation {
|
|||||||
y: rawVertices[i + 1],
|
y: rawVertices[i + 1],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.appearance) {
|
||||||
|
// The default stroke color is black.
|
||||||
|
const strokeColor = this.color
|
||||||
|
? Array.from(this.color).map(c => c / 255)
|
||||||
|
: [0, 0, 0];
|
||||||
|
|
||||||
|
const borderWidth = this.borderStyle.width || 1;
|
||||||
|
|
||||||
|
this._setDefaultAppearance({
|
||||||
|
xref: parameters.xref,
|
||||||
|
extra: `${borderWidth} w`,
|
||||||
|
strokeColor,
|
||||||
|
pointsCallback: (buffer, points) => {
|
||||||
|
const vertices = this.data.vertices;
|
||||||
|
for (let i = 0, ii = vertices.length; i < ii; i++) {
|
||||||
|
buffer.push(
|
||||||
|
`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
buffer.push("S");
|
||||||
|
return [points[0].x, points[1].x, points[3].y, points[1].y];
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -412,6 +412,7 @@
|
|||||||
!annotation-choice-widget.pdf
|
!annotation-choice-widget.pdf
|
||||||
!annotation-button-widget.pdf
|
!annotation-button-widget.pdf
|
||||||
!annotation-polyline-polygon.pdf
|
!annotation-polyline-polygon.pdf
|
||||||
|
!annotation-polyline-polygon-without-appearance.pdf
|
||||||
!zero_descent.pdf
|
!zero_descent.pdf
|
||||||
!operator-in-TJ-array.pdf
|
!operator-in-TJ-array.pdf
|
||||||
!issue7878.pdf
|
!issue7878.pdf
|
||||||
|
BIN
test/pdfs/annotation-polyline-polygon-without-appearance.pdf
Normal file
BIN
test/pdfs/annotation-polyline-polygon-without-appearance.pdf
Normal file
Binary file not shown.
@ -4989,6 +4989,13 @@
|
|||||||
"type": "eq",
|
"type": "eq",
|
||||||
"annotations": true
|
"annotations": true
|
||||||
},
|
},
|
||||||
|
{ "id": "annotation-polyline-polygon-without-appearance",
|
||||||
|
"file": "pdfs/annotation-polyline-polygon-without-appearance.pdf",
|
||||||
|
"md5": "b776937148e9f7c4de6bea552e23b92f",
|
||||||
|
"rounds": 1,
|
||||||
|
"annotations": true,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue4872",
|
{ "id": "issue4872",
|
||||||
"file": "pdfs/issue4872.pdf",
|
"file": "pdfs/issue4872.pdf",
|
||||||
"md5": "21c6cbc682140d6f6017bbeb45892053",
|
"md5": "21c6cbc682140d6f6017bbeb45892053",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user