mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
parent
4ba406bfe3
commit
3177c7ac46
3 changed files with 51 additions and 39 deletions
|
@ -13,6 +13,7 @@
|
||||||
- Do not ignore `Group#clipItem.matrix` in `Group#internalBounds` (#1427).
|
- Do not ignore `Group#clipItem.matrix` in `Group#internalBounds` (#1427).
|
||||||
- Correctly calculate bounds with nested empty items (#1467).
|
- Correctly calculate bounds with nested empty items (#1467).
|
||||||
- Fix color change propagation on groups (#1152).
|
- Fix color change propagation on groups (#1152).
|
||||||
|
- Fix `Path#arcTo()` where `from` and `to` points are equal (#1613).
|
||||||
- SVG Export: Fix error when `Item#matrix` is not invertible (#1580).
|
- SVG Export: Fix error when `Item#matrix` is not invertible (#1580).
|
||||||
- SVG Export: Include missing viewBox attribute (#1576).
|
- SVG Export: Include missing viewBox attribute (#1576).
|
||||||
- SVG Import: Use correct default values for gradients (#1632, #1661).
|
- SVG Import: Use correct default values for gradients (#1632, #1661).
|
||||||
|
|
|
@ -2467,9 +2467,10 @@ new function() { // PostScript-style drawing commands
|
||||||
// #2: arcTo(through, to)
|
// #2: arcTo(through, to)
|
||||||
through = to;
|
through = to;
|
||||||
to = Point.read(arguments);
|
to = Point.read(arguments);
|
||||||
} else {
|
} else if (!from.equals(to)) {
|
||||||
// #3: arcTo(to, radius, rotation, clockwise, large)
|
// #3: arcTo(to, radius, rotation, clockwise, large)
|
||||||
// Drawing arcs in SVG style:
|
// Draw arc in SVG style, but only if `from` and `to` are not
|
||||||
|
// equal (#1613).
|
||||||
var radius = Size.read(arguments),
|
var radius = Size.read(arguments),
|
||||||
isZero = Numerical.isZero;
|
isZero = Numerical.isZero;
|
||||||
// If rx = 0 or ry = 0 then this arc is treated as a
|
// If rx = 0 or ry = 0 then this arc is treated as a
|
||||||
|
@ -2565,11 +2566,12 @@ new function() { // PostScript-style drawing commands
|
||||||
extent += extent < 0 ? 360 : -360;
|
extent += extent < 0 ? 360 : -360;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (extent) {
|
||||||
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
|
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
|
||||||
ext = abs(extent),
|
ext = abs(extent),
|
||||||
// Calculate the amount of segments required to approximate over
|
// Calculate amount of segments required to approximate over
|
||||||
// `extend` degrees (extend / 90), but prevent ceil() from
|
// `extend` degrees (extend / 90), but prevent ceil() from
|
||||||
// rounding up small imprecisions by subtracting epsilon first.
|
// rounding up small imprecisions by subtracting epsilon.
|
||||||
count = ext >= 360 ? 4 : Math.ceil((ext - epsilon) / 90),
|
count = ext >= 360 ? 4 : Math.ceil((ext - epsilon) / 90),
|
||||||
inc = extent / count,
|
inc = extent / count,
|
||||||
half = inc * Math.PI / 360,
|
half = inc * Math.PI / 360,
|
||||||
|
@ -2606,6 +2608,7 @@ new function() { // PostScript-style drawing commands
|
||||||
}
|
}
|
||||||
// Add all segments at once at the end for higher performance
|
// Add all segments at once at the end for higher performance
|
||||||
this._add(segments);
|
this._add(segments);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
lineBy: function(/* to */) {
|
lineBy: function(/* to */) {
|
||||||
|
|
|
@ -645,3 +645,11 @@ test('Path#arcTo(through, to) is on through point side (#1477)', function() {
|
||||||
path.arcTo(p2, p3);
|
path.arcTo(p2, p3);
|
||||||
equals(true, path.segments[1].point.x > p1.x);
|
equals(true, path.segments[1].point.x > p1.x);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Path#arcTo(to, radius, rotation, clockwise, large) when from and to are equal (#1613)', function(){
|
||||||
|
var point = new Point(10,10);
|
||||||
|
var path = new Path();
|
||||||
|
path.moveTo(point);
|
||||||
|
path.arcTo(point, new Size(10), 0, true, true);
|
||||||
|
expect(0);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue