1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #14319 from calixteman/xfa_arc

XFA - Draw arcs correctly
This commit is contained in:
calixteman 2021-11-27 11:32:32 -08:00 committed by GitHub
commit bbd8b5ce9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View file

@ -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 = {