Skip to content

Commit

Permalink
Merge pull request svg#752 from JoshyPHP/ticket-708
Browse files Browse the repository at this point in the history
Fix arcto sweep flag when a transformation matrix is applied
  • Loading branch information
GreLI authored Sep 14, 2017
2 parents a1c7210 + 40bcb7f commit dc8042a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/_transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ exports.transformArc = function(arc, transform) {
arc[2] = ((major ? term2 < 0 : term1 > 0) ? -1 : 1) *
Math.acos((major ? term1 : term2) / Math.sqrt(term1 * term1 + term2 * term2)) * 180 / Math.PI;
}

if ((transform[0] < 0) !== (transform[3] < 0)) {
// Flip the sweep flag if coordinates are being flipped horizontally XOR vertically
arc[4] = 1 - arc[4];
}

return arc;

};
Expand Down
9 changes: 9 additions & 0 deletions test/plugins/convertPathData.18.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dc8042a

Please sign in to comment.