Fix Path#arcTo() do not pass by through point (#1543)

Closes #1477
This commit is contained in:
Samuel Asensi 2018-10-13 15:33:21 +02:00 committed by Jürg Lehni
parent 3e19a96c46
commit 60f9d868a6
2 changed files with 11 additions and 1 deletions

View file

@ -2546,7 +2546,7 @@ new function() { // PostScript-style drawing commands
}
vector = from.subtract(center);
extent = vector.getDirectedAngle(to.subtract(center));
var centerSide = line.getSide(center);
var centerSide = line.getSide(center, true);
if (centerSide === 0) {
// If the center is lying on the line, we might have gotten
// the wrong sign for extent above. Use the sign of the side

View file

@ -628,3 +628,13 @@ test('Path#add() with a lot of segments (#1493)', function() {
path.clone();
expect(0);
});
test('Path#arcTo(through, to) is on through point side (#1477)', function() {
var p1 = new Point(16, 21.5);
var p2 = new Point(22.5, 15);
var p3 = new Point(16.000000000000004, 8.5);
var path = new Path();
path.add(p1);
path.arcTo(p2, p3);
equals(true, path.segments[1].point.x > p1.x);
});