XFA - Draw arcs correctly
- it aims to fix #14315; - take into account the startAngle to compute the coordinates of the final point.
This commit is contained in:
parent
e439f4d620
commit
31e13515f5
@ -475,7 +475,7 @@ class Arc extends XFAObject {
|
||||
},
|
||||
};
|
||||
|
||||
if (this.startAngle === 0 && this.sweepAngle === 360) {
|
||||
if (this.sweepAngle === 360) {
|
||||
arc = {
|
||||
name: "ellipse",
|
||||
attributes: {
|
||||
@ -490,12 +490,12 @@ class Arc extends XFAObject {
|
||||
} else {
|
||||
const startAngle = (this.startAngle * Math.PI) / 180;
|
||||
const sweepAngle = (this.sweepAngle * Math.PI) / 180;
|
||||
const largeArc = this.sweepAngle - this.startAngle > 180 ? 1 : 0;
|
||||
const largeArc = this.sweepAngle > 180 ? 1 : 0;
|
||||
const [x1, y1, x2, y2] = [
|
||||
50 * (1 + Math.cos(startAngle)),
|
||||
50 * (1 - Math.sin(startAngle)),
|
||||
50 * (1 + Math.cos(sweepAngle)),
|
||||
50 * (1 - Math.sin(sweepAngle)),
|
||||
50 * (1 + Math.cos(startAngle + sweepAngle)),
|
||||
50 * (1 - Math.sin(startAngle + sweepAngle)),
|
||||
];
|
||||
|
||||
arc = {
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -489,3 +489,4 @@
|
||||
!issue14267.pdf
|
||||
!PDFBOX-4352-0.pdf
|
||||
!REDHAT-1531897-0.pdf
|
||||
!xfa_issue14315.pdf
|
||||
|
BIN
test/pdfs/xfa_issue14315.pdf
Normal file
BIN
test/pdfs/xfa_issue14315.pdf
Normal file
Binary file not shown.
@ -1037,6 +1037,13 @@
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "xfa_issue14315",
|
||||
"file": "pdfs/xfa_issue14315.pdf",
|
||||
"md5": "e239710875f9dea72fd94c20672a29e1",
|
||||
"rounds": 1,
|
||||
"enableXfa": true,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "xfa_issue14071",
|
||||
"file": "pdfs/xfa_issue14071.pdf",
|
||||
"md5": "7ef09705091602668ce22086c83a90f3",
|
||||
|
Loading…
Reference in New Issue
Block a user